예제 #1
0
        void txtMa_Tg_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_Tg.Text.Trim();
            bool   bRequire = false;

            frmDmTg frmLookup = new frmDmTg();
            DataRow drLookup  = Lookup.ShowLookup(frmLookup, "ASTG", "Ma_Tg", strValue, bRequire, "");

            if (bRequire && drLookup == null)
            {
                e.Cancel = true;
            }

            if (drLookup == null)
            {
                lbtTen_Tg.Text = string.Empty;
                lbtTen_Tg.Text = string.Empty;
            }
            else
            {
                txtMa_Tg.Text  = ((string)drLookup["Ma_Tg"]).Trim();
                lbtTen_Tg.Text = ((string)drLookup["Ten_Tg"]).Trim();
            }

            dicName.SetValue(lbtTen_Tg.Name, lbtTen_Tg.Text);

            if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible)
            {
                ((txtTextLookup)sender).AutoFilter.Visible = false;
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
            }
        }
예제 #2
0
        void txtMa_Giam_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_Giam_Ts.Text.Trim();
            bool   bRequire = true;

            frmDmTg frmLookup = new frmDmTg();
            DataRow drLookup  = Lookup.ShowLookup(frmLookup, "ASTG", "Ma_Tg", strValue, bRequire, " Ma_Tg LIKE 'G%'");

            if (bRequire && drLookup == null)
            {
                e.Cancel = true;
            }

            if (drLookup == null)
            {
                lbtTen_Tg.Text = string.Empty;
                lbtTen_Tg.Text = string.Empty;
            }
            else
            {
                txtMa_Giam_Ts.Text = ((string)drLookup["Ma_Tg"]).Trim();
                lbtTen_Tg.Text     = ((string)drLookup["Ten_Tg"]).Trim();
            }

            dicName.SetValue(lbtTen_Tg.Name, lbtTen_Tg.Text);
        }