public Dictionary <STFieldsInfo, List <BusinessObject> > GetFieldInfo(int id) { STFieldsInfo objField = (STFieldsInfo) new STFieldsController().GetObjectByID(id); Dictionary <STFieldsInfo, List <BusinessObject> > dicFields = new Dictionary <STFieldsInfo, List <BusinessObject> >(); STGridColumnsController STGridColumnCtrl = new STGridColumnsController(); if (objField != null) { DataSet dsInfo = STGridColumnCtrl.GetAllDataByGridColumnAndUserIDOrderByTabIndex(objField.STFieldID, AuthConfig.CurrenUserInfo.ADUserID); dicFields.Add(objField, STGridColumnCtrl.GetListFromDataset(dsInfo)); } return(dicFields); }
public Dictionary <List <STGridColumnsInfo>, DataSet> GetScreenEmployeeOffWork(string sModuleName, int iObjectID) { DataSet dsScreen = GetScreenByModuleNameAndUserGroupName(sModuleName, "ADMIN"); if (dsScreen == null || dsScreen.Tables.Count == 0 && dsScreen.Tables[0].Rows.Count == 0) { return(null); } STScreensInfo objScreen = new STScreensController().GetObjectFromDataRow(dsScreen.Tables[0].Rows[0]) as STScreensInfo; List <DataRow> dr = GetLocalDataSet("*", "STFields", string.Format(@"STScreenID = {0} AND STFieldType = 'GMCGridControl' AND STFieldGroup <> 'HiddenWeb'", objScreen.STScreenID)); if (dr.Count == 0) { return(null); } STFieldsInfo objField = (STFieldsInfo) new STFieldsController().GetObjectFromDataRow(dr[0]); if (objField == null) { return(null); } BaseBusinessController itemCtrl = BusinessControllerFactory.GetBusinessController(objField.STFieldDataSource + "Controller"); DataSet ds = new DataSet(); if (itemCtrl != null) { ds = itemCtrl.GetDataSetByID(iObjectID); } List <STGridColumnsInfo> lstGridColumns = new List <STGridColumnsInfo>(); dr = GetLocalDataSet("*", "STGridColumns", string.Format("FK_STFieldID = {0}", objField.STFieldID)); STGridColumnsController GridColCtrl = new STGridColumnsController(); dr.Distinct().ToList().ForEach(x => { STGridColumnsInfo colInfo = (STGridColumnsInfo)GridColCtrl.GetObjectFromDataRow(x); lstGridColumns.Add(colInfo); }); return(new Dictionary <List <STGridColumnsInfo>, DataSet>() { { lstGridColumns, ds } }); }
public IEnumerable GetScreenByModuleID(int iModuleID) { STModulesInfo objModule = (STModulesInfo) new STModulesController().GetObjectByID(iModuleID); List <STScreensInfo> lstScreens = new List <STScreensInfo>(); STScreensController ScreenCtrl = new STScreensController(); STFieldsController STFieldsCtrl = new STFieldsController(); STGridColumnsController STGridColumnCtrl = new STGridColumnsController(); STFieldColumnsController STFieldColumnCtrl = new STFieldColumnsController(); DataSet ds = GetScreenByModuleNameAndUserGroupName(objModule.STModuleName, AuthConfig.CurrenUserGroupInfo.ADUserGroupName); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 0) { ds = GetScreenByModuleNameAndUserGroupName(objModule.STModuleName, "ADMIN"); } Dictionary <STScreensInfo, Dictionary <STFieldsInfo, List <BusinessObject> > > dicControls = new Dictionary <STScreensInfo, Dictionary <STFieldsInfo, List <BusinessObject> > >(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { STScreensInfo objScreen = (STScreensInfo)ScreenCtrl.GetObjectFromDataRow(dr); lstScreens.Add(objScreen); } lstScreens.Sort((st1, st2) => st1.STScreenSortOrder.CompareTo(st2.STScreenSortOrder)); foreach (STScreensInfo item in lstScreens) { if (item.STScreenSortOrder >= 0) { ds = STFieldsCtrl.GetActiveFieldsByScreenIDAndUserGroupID(item.STScreenID, AuthConfig.CurrenUserGroupInfo.ADUserGroupID); Dictionary <STFieldsInfo, List <BusinessObject> > dicFields = new Dictionary <STFieldsInfo, List <BusinessObject> >(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { STFieldsInfo objField = (STFieldsInfo)STFieldsCtrl.GetObjectFromDataRow(dr); if (objField.STFieldType.EndsWith("GridControl")) { DataSet dsInfo = STGridColumnCtrl.GetAllDataByGridColumnAndUserIDOrderByTabIndex(objField.STFieldID, AuthConfig.CurrenUserInfo.ADUserID); if (!dicFields.ContainsKey(objField)) { dicFields.Add(objField, STGridColumnCtrl.GetListFromDataset(dsInfo)); } } else if (objField.STFieldType.EndsWith("LookupEdit")) { DataSet dsInfo = STFieldColumnCtrl.GetAllDataByForeignColumn("STFieldID", objField.STFieldID); if (!dicFields.ContainsKey(objField)) { dicFields.Add(objField, STFieldColumnCtrl.GetListFromDataset(dsInfo)); } } else if (!dicFields.ContainsKey(objField)) { dicFields.Add(objField, new List <BusinessObject>()); } } } if (!dicControls.ContainsKey(item)) { dicControls.Add(item, dicFields); } } } return(dicControls); } return(null); }
public Dictionary <List <STGridColumnsInfo>, DataSet> ShowModuleByJournal(String strSourceLeger, String strDocumentNo, ADInboxItemsInfo objInbox, STFieldsInfo objOldField) { STModulesController ModuleCtrl = new STModulesController(); STModuleTablesController ModuleTableCtrl = new STModuleTablesController(); int iMainObjectID = -1; String strTable = String.Empty; String strTablePrefix = String.Empty; String strPrimaryKey = String.Empty; Object MainObj = null; int iModuleID = 0; List <DataRow> dr = GetLocalDataSet("STModuleID,STModuleName", "STModules", string.Format("STModuleName = '{0}'", strSourceLeger)); if (dr.Count > 0) { iModuleID = Convert.ToInt32(dr.First()["STModuleID"]); } dr = GetLocalDataSet("STModuleTableID,STModuleTableName,STModuleID,STModuleTableLevelIndex", "STModuleTables", string.Format("STModuleID = {0} AND STModuleTableLevelIndex = 0", iModuleID)); if (dr.Count > 0) { strTable = dr.First()["STModuleTableName"].ToString(); } if (String.IsNullOrEmpty(strTable) == false) { strTablePrefix = strTable.Substring(0, strTable.Length - 1); strPrimaryKey = strTablePrefix + "ID"; } BaseBusinessController Ctrl = BusinessControllerFactory.GetBusinessController(strTable + "Controller"); if (Ctrl != null) { MainObj = Ctrl.GetObjectByNo(strDocumentNo); } if (MainObj != null) { iMainObjectID = Convert.ToInt32(GMCDbUtil.GetPropertyValue(MainObj, strPrimaryKey)); if (GMCDbUtil.GetPropertyValue(MainObj, "FK_HREmployeeID") != null) { int iEmployeeID = Convert.ToInt32(GMCDbUtil.GetPropertyValue(MainObj, "FK_HREmployeeID")); objInbox.FK_HRFromEmployeeID = iEmployeeID; } if (GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc") != null) { //TextEdit txtRemark = (TextEdit)GetControlByName("fld_medADInboxItemRemark1"); //if (txtRemark != null) //{ // txtRemark.EditValue = GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc"); //} objInbox.ADInboxItemMessage = Convert.ToString(GMCDbUtil.GetPropertyValue(MainObj, strTable.TrimEnd('s') + "Desc")); } } //ShowModuleByJournal(strSourceLeger, iMainObjectID, false); //Thang - edit 26/4/2016 hiển thị chi tiêt chứng từ ADUserGroupsInfo objUserGroup = AuthConfig.CurrenUserGroupInfo; dr = GetLocalDataSet("STScreenID,STScreenNumber,STModuleID,STUserGroupID,STScreenSortOrder", "STScreens", string.Format(@"STModuleID = {0} AND STUserGroupID = {1} AND STScreenNumber like 'DM%' AND STScreenSortOrder > 0 AND STScreenSortOrder <= 1", iModuleID, objUserGroup.ADUserGroupID)); int iScreenID = 0; if (dr.Count > 0) { iScreenID = Convert.ToInt32(dr.First()["STScreenID"]); } //Thang edit - 8/2/2017 Chỉnh sửa nếu 1 user group không có giao diện riêng thì sẽ lấy mặc định giao diện admin if (iScreenID == 0) { int iUserGroupDefaultID = new ADUserGroupsController().GetObjectIDByName("ADMIN"); dr = GetLocalDataSet("STScreenID,STScreenNumber,STModuleID,STUserGroupID,STScreenSortOrder", "STScreens", string.Format(@"STModuleID = {0} AND STUserGroupID = {1} AND STScreenNumber like 'DM%' AND STScreenSortOrder > 0 AND STScreenSortOrder <= 1", iModuleID, iUserGroupDefaultID)); if (dr.Count > 0) { iScreenID = Convert.ToInt32(dr.First()["STScreenID"]); } } dr = GetLocalDataSet("*", "STFields", string.Format(@"STScreenID = {0} AND STFieldType = 'GMCGridControl' AND(STFieldDataSource like '%Items' OR STFieldDataSource like '%Details') AND STFieldGroup <> ''", iScreenID)); if (dr.Count == 0) { return(null); } STFieldsInfo objField = (STFieldsInfo) new STFieldsController().GetObjectFromDataRow(dr[0]); if (objField == null) { return(null); } BaseBusinessController itemCtrl = BusinessControllerFactory.GetBusinessController(objField.STFieldDataSource + "Controller"); DataSet ds = new DataSet(); if (itemCtrl != null) { ds = itemCtrl.GetAllDataByForeignColumn("FK_" + strPrimaryKey, iMainObjectID); } List <STGridColumnsInfo> lstGridColumns = new List <STGridColumnsInfo>(); if (objOldField == null || !objOldField.STFieldID.Equals(objField.STFieldID)) { objOldField = objField; dr = GetLocalDataSet("*", "STGridColumns", string.Format("FK_STFieldID = {0}", objField.STFieldID)); STGridColumnsController GridColCtrl = new STGridColumnsController(); dr.Distinct().ToList().ForEach(x => { STGridColumnsInfo colInfo = (STGridColumnsInfo)GridColCtrl.GetObjectFromDataRow(x); lstGridColumns.Add(colInfo); }); } return(new Dictionary <List <STGridColumnsInfo>, DataSet>() { { lstGridColumns, ds } }); }