void txtMa_Bp_Cha_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Nh_Ts_Cha.Text.Trim(); bool bRequire = false; frmDmNhTs frmLookup = new frmDmNhTs(); DataRow drLookup = Lookup.ShowLookup(frmLookup, "ASTSNH", "Ma_Nh_Ts", strValue, bRequire, "Nh_Cuoi = '0'"); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Nh_Ts_Cha.Text = string.Empty; lbtMa_Nh_Ts_Cha.Text = string.Empty; } else { txtMa_Nh_Ts_Cha.Text = ((string)drLookup["Ma_Nh_Ts"]).Trim(); lbtMa_Nh_Ts_Cha.Text = ((string)drLookup["Ten_Nh_Ts"]).Trim(); } dicName.SetValue(lbtMa_Nh_Ts_Cha.Name, lbtMa_Nh_Ts_Cha.Text); }
void txtMa_Nh_Ts_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Nh_Ts.Text.Trim(); bool bRequire = true; frmDmNhTs frmLookup = new frmDmNhTs(); DataRow drLookup = Lookup.ShowLookup(frmLookup, "ASTSNH", "Ma_Nh_Ts", strValue, bRequire, "", "Nh_Cuoi = 1"); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { lbtTen_Nh_Ts.Text = string.Empty; lbtTen_Nh_Ts.Text = string.Empty; } else { txtMa_Nh_Ts.Text = ((string)drLookup["Ma_Nh_Ts"]).Trim(); lbtTen_Nh_Ts.Text = ((string)drLookup["Ten_Nh_Ts"]).Trim(); } dicName.SetValue(lbtTen_Nh_Ts.Name, lbtTen_Nh_Ts.Text); if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible) { ((txtTextLookup)sender).AutoFilter.Visible = false; this.SelectNextControl(this.ActiveControl, true, true, true, true); } }
private void LoadLookupByGroup() { //Lookup danh muc doi tuong theo nhom string strValue = this.strLookupValue; bool bRequire = this.bLookupRequire; string strKeyFilter = this.strLookupKeyFilter; frmDmNhTs frm = new frmDmNhTs(); frm.bEnterFinish = false; Lookup.ShowLookup(frm, "ASTSNH", "Ma_Nh_Ts", strValue, bRequire, strKeyFilter, "Nh_Cuoi = '1'"); this.bIsEnter = frm.bIsEnter; this.drLookup = frm.drLookup; this.Close(); }