void txtMa_Nh_Ts_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Nh_Ts.Text.Trim(); bool bRequire = false; frmQuickLookup frmLookup = new frmQuickLookup("ASTSNH", "DMNHTS"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "ASTSNH", "Ma_Nh_Ts", strValue, bRequire, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Nh_Ts.Text = string.Empty; lblMa_Nh_Ts.Text = string.Empty; } else { txtMa_Nh_Ts.Text = drLookup["Ma_Nh_Ts"].ToString(); lblMa_Nh_Ts.Text = drLookup["Ten_Nh_Ts"].ToString(); } }
void txtMa_Ct_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Ct.Text.Trim(); bool bRequire = true; string strKey = "(Table_Ct = '" + (string)drDmCt["Table_Ct"] + "')"; frmQuickLookup frmLookup = new frmQuickLookup("SYSDMCT", "DMCT"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSDMCT", "Ma_Ct", strValue, bRequire, strKey); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Ct.Text = string.Empty; } else { txtMa_Ct.Text = drLookup["Ma_Ct"].ToString(); dicName.SetValue("Ten_Ct", drLookup["Ten_Ct"].ToString()); } //Tính lại Số chứng từ trong truờng hợp chọn lại Ma_Ct khác if (this.enuNew_Edit != enuEdit.Edit && txtMa_Ct.bTextChange) { } }
void txtSo_Ct_Bg_Validating(object sender, CancelEventArgs e) { string strValue = txtSo_Ct_Bg.Text.Trim(); bool bRequire = false; frmQuickLookup frmLookup = new frmQuickLookup("VW_BAOGIA", "BAOGIA"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "VW_BAOGIA", "So_Ct_Bg", strValue, bRequire, null); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtSo_Ct_Bg.Text = string.Empty; } else { txtSo_Ct_Bg.Text = drLookup["So_Ct_Bg"].ToString(); //Lay Ma_Dt if (bSo_Ct_Bg_Changed) { txtMa_Dt.Text = drLookup["Ma_Dt"].ToString(); } dicName.SetValue("Dien_Giai", drLookup["Dien_Giai"].ToString()); } }
void txtMa_CbNv_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_CbNv.Text.Trim(); bool bRequire = false; frmQuickLookup frmLookup = new frmQuickLookup(); DataRow drLookup = Lookup.ShowLookup("Ma_CbNv", strValue, bRequire, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_CbNv.Text = string.Empty; txtTen_CbNv.Text = string.Empty; } else { txtMa_CbNv.Text = drLookup["Ma_CbNv"].ToString(); txtTen_CbNv.Text = drLookup["Ten_CbNv"].ToString(); } if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible) { ((txtTextLookup)sender).AutoFilter.Visible = false; this.SelectNextControl(this.ActiveControl, true, true, true, true); } }
void txtMa_Moi_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Moi.Text.Trim(); bool bRequire = true; if (DataTool.SQLCheckExist(strTableName, strColumn_Type, strValue)) { lbtTen_Ma_Moi.Text = DataTool.SQLGetNameByCode(strTableName, strColumn_Type, strColumnName, strValue); return; } frmQuickLookup frm = new frmQuickLookup(strTableName, strZone); frm.Load(); DataRow drLookup = frm.drLookup; if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Moi.Text = string.Empty; lbtTen_Ma_Moi.Text = string.Empty; } else { txtMa_Moi.Text = ((string)drLookup[strColumn_Type]).Trim(); lbtTen_Ma_Moi.Text = ((string)drLookup[strColumnName]).Trim(); } }
void txtMa_Ct_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Ct.Text.Trim(); bool bRequire = true; string strKey = "(Table_Ct = '" + (string)drDmCt["Table_Ct"] + "')"; frmQuickLookup frmLookup = new frmQuickLookup("SYSDMCT", "DMCT"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSDMCT", "Ma_Ct", strValue, bRequire, strKey); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Ct.Text = string.Empty; } else { txtMa_Ct.Text = drLookup["Ma_Ct"].ToString(); dicName.SetValue("Ten_Ct", drLookup["Ten_Ct"].ToString()); } }
void txtObject_ID_Validating(object sender, CancelEventArgs e) { string strValue = txtObject_ID.Text.Trim(); bool bRequire = true; string strKey = "(Object_Type = '" + (string)drEdit["Object_Type"] + "')"; if (enuNew_Edit == enuEdit.New) { strKey += " AND Object_ID NOT IN (SELECT Object_ID FROM SYSPermission " + " WHERE Member_ID = '" + (string)drEdit["Member_ID"] + "') "; } frmQuickLookup frmLookup = new frmQuickLookup("SYSObject", "OBJECT"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSObject", "Object_ID", strValue, bRequire, strKey, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtObject_ID.Text = string.Empty; lbtObject_Name.Text = string.Empty; } else { txtObject_ID.Text = ((string)drLookup["Object_ID"]).Trim(); lbtObject_Name.Text = ((string)drLookup["Object_Name"]).Trim(); } dicName[lbtObject_Name.Name] = lbtObject_Name.Text; }
private void txtMa_DvCs_Default_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_DvCs_Default.Text.Trim(); bool bRequire = true; string strFilter = "Ma_Data LIKE '%'"; frmQuickLookup frmLookup = new frmQuickLookup(); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSDMDVCS", "Ma_DvCs", strValue, bRequire, strFilter); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_DvCs_Default.Text = string.Empty; lbtTen_DvCs_Default.Text = string.Empty; } else { txtMa_DvCs_Default.Text = drLookup["Ma_DvCs"].ToString(); lbtTen_DvCs_Default.Text = drLookup["Ten_DvCs"].ToString(); } }
void txtMa_DvCs_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_DvCs.Text.Trim(); bool bRequire = true; string strKey = "(1 = 1)"; //if (enuNew_Edit == enuEdit.New) // strKey += " AND Ma_DvCs NOT IN (SELECT Ma_DvCs FROM SYSPermissionDvCs " + // " WHERE Member_ID = '" + (string)drEdit["Member_ID"] + "') "; frmQuickLookup frmLookup = new frmQuickLookup("SYSDMDVCS", "Ma_DvCs"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSDMDVCS", "Ma_DvCs", strValue, bRequire, "", ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_DvCs.Text = string.Empty; lbtTen_DvCs.Text = string.Empty; } else { txtMa_DvCs.Text = ((string)drLookup["Ma_DvCs"]).Trim(); lbtTen_DvCs.Text = ((string)drLookup["Ten_DvCs"]).Trim(); } }
void txtMa_Ct_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Ct.Text.Trim(); bool bRequire = true; frmQuickLookup frmLookup = new frmQuickLookup("SYSDMCT", "DMCT"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSDMCT", "Ma_Ct", strValue, bRequire, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Ct.Text = string.Empty; lbtMa_Ct.Text = string.Empty; } else { txtMa_Ct.Text = drLookup["Ma_Ct"].ToString(); lbtMa_Ct.Text = drLookup["Ten_Ct"].ToString(); dicName.SetValue(lbtMa_Ct.Name, lbtMa_Ct.Text); } }
void txtTk_Validating(object sender, CancelEventArgs e) { string strValue = txtTk.Text.Trim(); bool bRequire = true; string strKey = "(1 = 1)"; if (enuNew_Edit == enuEdit.New) { strKey += " AND Tk NOT IN (SELECT Tk FROM SYSPermissionTk " + " WHERE Member_ID = '" + (string)drEdit["Member_ID"] + "') "; } frmQuickLookup frmLookup = new frmQuickLookup("LITAIKHOAN", "Tk"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "LITAIKHOAN", "Tk", strValue, bRequire, strKey, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtTk.Text = string.Empty; lbtTen_Tk.Text = string.Empty; } else { txtTk.Text = ((string)drLookup["Tk"]).Trim(); lbtTen_Tk.Text = ((string)drLookup["Ten_Tk"]).Trim(); } }
void txtObject_ID_Validating(object sender, CancelEventArgs e) { //Lookup User string strValue = txtObject_ID.Text; bool bRequire = true; frmQuickLookup frmLookup = new frmQuickLookup("SYSObject", "OBJECT"); Lookup.ShowLookup(frmLookup, "SYSObject", "Object_ID", strValue, bRequire, ""); if (!frmLookup.bIsEnter) { return; } if (frmLookup.drLookup != null) { txtObject_ID.Text = (string)frmLookup.drLookup["Object_ID"]; lbtObject_Name.Text = (string)frmLookup.drLookup["Object_Name"]; } dicName.SetValue(lbtObject_Name.Name, lbtObject_Name.Text); if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible) { ((txtTextLookup)sender).AutoFilter.Visible = false; this.SelectNextControl(this.ActiveControl, true, true, true, true); } }
public override void Edit(enuEdit enuNew_Edit) { if (enuNew_Edit == enuEdit.Edit) { return; } int iModule_Id = (int)(((DataRowView)bdsModule.Current).Row["Module_Id"]); //Copy hang hien tai if (bdsModule_Menu.Position >= 0) { Common.CopyDataRow(((DataRowView)bdsModule_Menu.Current).Row, ref drCurrent); } else { drCurrent = dtModule_Menu.NewRow(); } string strValue = string.Empty; bool bRequire = true; frmQuickLookup frmLookup = new frmQuickLookup("SYSMENU", "MENU"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSMENU", "MENU_ID", strValue, bRequire, ""); if (bRequire && drLookup == null) { dtModule_Menu.RejectChanges(); return; } if (drLookup != null) { drCurrent["Module_Id"] = iModule_Id; drCurrent["Menu_ID"] = drLookup["Menu_ID"]; drCurrent["Menu_Name"] = drLookup["Menu_Name"]; drCurrent["Menu_Parent"] = drLookup["Menu_Parent"]; if (DataTool.SQLUpdate(enuNew_Edit, "SYSMODULEME", ref drCurrent)) { if (bdsModule_Menu.Position >= 0) { dtModule_Menu.ImportRow(drCurrent); } else { dtModule_Menu.Rows.Add(drCurrent); } dtModule_Menu.AcceptChanges(); } else { dtModule_Menu.RejectChanges(); } } }
public override void Edit(enuEdit enuNew_Edit) { int iMenu_ID = (int)(((DataRowView)bdsMenu.Current).Row["Menu_ID"]); //Copy hang hien tai if (bdsMenu_Report.Position >= 0) { Common.CopyDataRow(((DataRowView)bdsMenu_Report.Current).Row, ref drCurrent); } else { drCurrent = dtMenu_Report.NewRow(); } string strValue = string.Empty; bool bRequire = true; frmQuickLookup frmLookup = new frmQuickLookup("SYSREPORT", "REPORT", false); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSREPORT", "REPORT_ID", strValue, bRequire, ""); //DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSREPORT", "REPORT_ID", strValue, bRequire, "","","Stt"); if (bRequire && drLookup == null) { dtMenu_Report.RejectChanges(); return; } if (drLookup != null) { drCurrent["Menu_ID"] = iMenu_ID; drCurrent["Report_ID"] = drLookup["Report_ID"]; drCurrent["Report_Name"] = drLookup["Report_Name"]; drCurrent["Report_Parent"] = drLookup["Report_Parent"]; if (DataTool.SQLUpdate(enuEdit.New, "SYSMENURP", ref drCurrent)) { if (bdsMenu_Report.Position >= 0) { dtMenu_Report.ImportRow(drCurrent); } else { dtMenu_Report.Rows.Add(drCurrent); } dtMenu_Report.AcceptChanges(); } else { dtMenu_Report.RejectChanges(); } } }
public static DataRow ShowMultiLookup(string strLookupColumn, string strLookupValue, bool bLookupRequire, string strLookupKeyFilter, string strLookupKeyValid) { strLookupValue = (strLookupValue == null) ? string.Empty : strLookupValue; strLookupValue = strLookupValue.ToUpper(); DataRow row = DataTool.SQLGetDataRowByID("SYSLookup", "ColumnID", strLookupColumn); frmQuickLookup lookup = new frmQuickLookup(); lookup.bMuiltiLookup = true; lookup.isLookup = true; lookup.strLookupColumn = row["ColumnID_Lookup"].ToString(); lookup.strLookupValue = strLookupValue; lookup.strLookupKeyFilter = strLookupKeyFilter; lookup.strLookupKeyValid = strLookupKeyValid; lookup.LoadLookup(); return(lookup.drLookup); }
public static DataRow ShowQuickLookup(string strLookupColumn, string strLookupValue, bool bLookupRequire, string strLookupKeyFilter, string strLookupKeyValid) { strLookupValue = (strLookupValue == null) ? string.Empty : strLookupValue; strLookupValue = strLookupValue.ToUpper(); DataRow row = DataTool.SQLGetDataRowByID("SYSLookup", "ColumnID", strLookupColumn); if (row == null) { EpointMessage.MsgCancel("Chưa khai báo Lookup cho [" + strLookupColumn + "]"); return(null); } if (!(bLookupRequire || !(strLookupValue == string.Empty))) { return(null); } string strKey = string.Concat(new object[] { "( ", row["ColumnID_Lookup"], " = N'", strLookupValue, "' )" }); if ((strLookupKeyFilter != null) && (strLookupKeyFilter != string.Empty)) { strKey = strKey + " AND (" + strLookupKeyFilter + ")"; } if ((strLookupKeyValid != null) && (strLookupKeyValid != string.Empty)) { strKey = strKey + " AND (" + strLookupKeyValid + ")"; } DataTable table = DataTool.SQLGetDataTable(row["Table_Lookup"].ToString(), null, strKey, null); if (table.Rows.Count == 1) { return(table.Rows[0]); } frmQuickLookup lookup = new frmQuickLookup(); lookup.bMuiltiLookup = false; lookup.isLookup = true; lookup.strLookupColumn = row["ColumnID_Lookup"].ToString(); lookup.strLookupValue = strLookupValue; lookup.strLookupKeyFilter = strLookupKeyFilter; lookup.strLookupKeyValid = strLookupKeyValid; lookup.LoadLookup(); return(lookup.drLookup); }
private void Add_Group_Member() { string strGroup_ID = tvGroup.SelectedNode.Name; drMemberGroup = dtMemberGroup.NewRow(); //Lookup User string strValue = ""; bool bRequire = true; frmQuickLookup frmLookup = new frmQuickLookup("SYSMEMBER", "USER"); Lookup.ShowLookup(frmLookup, "SYSMEMBER", "Member_ID", strValue, bRequire, "Member_Type = 'U'"); if (!frmLookup.bIsEnter) { return; } if (frmLookup.drLookup != null) { drMemberGroup["Member_Group_ID"] = strGroup_ID; drMemberGroup["Member_ID"] = frmLookup.drLookup["Member_ID"]; //Luu du lieu xuong CSDL if (DataTool.SQLUpdate(enuEdit.New, "SYSMEMBERNH", ref drMemberGroup)) { dtMemberGroup.Rows.Add(drMemberGroup); dtMemberGroup.AcceptChanges(); FillGroupUser(strGroup_ID); } else { dtMemberGroup.RejectChanges(); } } }
void txtMember_ID_Validating(object sender, CancelEventArgs e) { string strValue = txtMember_ID.Text; bool bRequire = false; frmQuickLookup frmLookup = new frmQuickLookup("SYSMEMBER", "USER"); DataRow drLookup = Lookup.ShowLookup(frmLookup, "SYSMEMBER", "Member_ID", strValue, bRequire, "Member_Type = 'U'"); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMember_ID.Text = string.Empty; } else { txtMember_ID.Text = drLookup["Member_ID"].ToString(); //lbtTen_Member.Text = drLookup["Member_Name"].ToString(); } }