示例#1
0
        private void txtCountry_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                WindowsFormLogic logic = new WindowsFormLogic();
                this.dt = logic.GetAll("Country");

                this.GridForm.dgv.DataSource = dt;
                if (this.GridForm.dgv.Rows.Count > 0)
                {
                    this.GridForm.dgv.Columns[0].Visible = false;
                }
                this.GridForm.ShowDialog();

                txtCountry.Text = GridForm.dgv.CurrentRow.Cells[0].Value.ToString();
            }
        }
        protected override void CheckActiveMode()
        {
            DataTable        chk   = new DataTable();
            WindowsFormLogic logic = new WindowsFormLogic();

            chk = logic.GetID(this.Tbl, Convert.ToString(IDField), CountryData.ID);

            if (chk.Rows.Count == 1)
            {
                ActiveMode = EnumActiveMode.EditMode;
            }
            if (chk.Rows.Count == 0)
            {
                ActiveMode = EnumActiveMode.AddMode;
            }

            base.CheckActiveMode();
        }