using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Project.Dialog
{
    public partial class fSelectDept : FCOMMON.fBase
    {
        public string deptName { get; set; }
        public fSelectDept()
        {
            InitializeComponent();
            deptName = string.Empty;
            this.fpSpread1.KeyDown += (s1, e1) => { SelectData(); };
            this.fpSpread1.CellDoubleClick += (s1, e1) => { SelectData(); };
        }

        private void fSelectDept_Load(object sender, EventArgs e)
        {
            EnsureVisibleAndUsableSize();
            this.ta.Fill(this.dsMSSQL.UserGroup);
            var ta = new dsMSSQLTableAdapters.UserGroupTableAdapter();
            
        }
        void SelectData()
        {
            var drv = this.bs.Current as DataRowView;
            if (drv == null) return;
            var dr = drv.Row as dsMSSQL.UserGroupRow;
            this.deptName = dr.dept;
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
