public void InitializeModuleSection() { TreeListNode node = treeList.FocusedNode; if (node != null) { ADUserGroupSectionsController objUserGroupSectionsController = new ADUserGroupSectionsController(); ADUserGroupSectionsInfo objADUserGroupSectionsInfo = (ADUserGroupSectionsInfo)objUserGroupSectionsController.GetObjectByID(Convert.ToInt32(node.Tag)); if (objADUserGroupSectionsInfo != null) { STModuleToUserGroupSectionsController objModuleToUserGroupSectionsController = new STModuleToUserGroupSectionsController(); DataSet ds = objModuleToUserGroupSectionsController.GetAllModuleToUserGroupSectionByUserGroupSectionID(objADUserGroupSectionsInfo.ADUserGroupSectionID); if (ds != null) { foreach (DataRow row in ds.Tables[0].Rows) { STModuleToUserGroupSectionsInfo objSTModuleToUserGroupSectionsInfo = (STModuleToUserGroupSectionsInfo) new STModuleToUserGroupSectionsController().GetObjectFromDataRow(row); if (objADUserGroupSectionsInfo != null) { STModulesInfo objSTModulesInfo = (STModulesInfo) new STModulesController().GetObjectByID(objSTModuleToUserGroupSectionsInfo.FK_STModuleID); if (objSTModulesInfo != null) { lstModule.Add(objSTModulesInfo); } } } } } } fld_dgcModuleActivesGridControl.DataSource = lstModule; fld_dgcModuleActivesGridControl.RefreshDataSource(); }
public void ModuleParentScreen_Init() { STModulesController objModulesController = new STModulesController(); STModulesInfo objModulesInfo = objModulesController.GetObjectByID(Module.CurrentModuleID) as STModulesInfo; if (objModulesInfo != null) { this.Text = objModulesInfo.STModuleDesc; } else { this.Text = Module.CurrentModuleName; } InitDisplayToolbar(); }
private void fld_btnBackward_Click(object sender, EventArgs e) { int iRowHandle = fld_dgvActiveModulesGridView.FocusedRowHandle; if (iRowHandle >= 0) { STModulesInfo objSTModulesInfo = (STModulesInfo)fld_dgvActiveModulesGridView.GetRow(iRowHandle); if (objSTModulesInfo != null) { int iIndex = lstModule.IndexOf(objSTModulesInfo); lstModule.RemoveAt(iIndex); } } fld_dgcModuleActivesGridControl.DataSource = lstModule; fld_dgcModuleActivesGridControl.RefreshDataSource(); }
public static void InitMenuOfMainForm() { //for (int i = 2; i < VinaApp.MainScreen.MainMenu.ItemLinks.Count - 2; i++) //{ // VinaApp.MainScreen.MainMenu.ItemLinks.RemoveAt(i); // i--; //} STModulesController moduleController = new STModulesController(); List <STModulesInfo> modules = moduleController.GetAllModulesByUserName(VinaApp.CurrentUserName); if (modules.Count() == 0) { return; } Dictionary <string, List <STModulesInfo> > dictionary = new Dictionary <string, List <STModulesInfo> >(); string key; foreach (STModulesInfo module in modules) { key = module.ADUserGroupSectionID + "&&" + module.ADUserGroupSectionName; if (!dictionary.ContainsKey(key)) { dictionary.Add(key, new List <STModulesInfo>()); } dictionary[key].Add(module); } int imdex = 0; foreach (string groupSection in dictionary.Keys) { if (dictionary[groupSection] != null && dictionary[groupSection].Count != 0) { STModulesInfo firstItem = dictionary[groupSection][0]; DevExpress.XtraBars.BarSubItem item = new DevExpress.XtraBars.BarSubItem(); item.Caption = firstItem.ADUserGroupSectionName; VinaApp.MainScreen.MainMenu.InsertItem(VinaApp.MainScreen.MainMenu.ItemLinks[2 + imdex], item); item = AddSubMenuToMenuItem(item, dictionary[groupSection]); imdex++; } } }
public void InitializeModuleNonSection() { STModulesController objModulesController = new STModulesController(); DataSet ds = objModulesController.GetAllObjects(); if (ds.Tables.Count > 0) { List <STModulesInfo> lstModules = new List <STModulesInfo>(); foreach (DataRow row in ds.Tables[0].Rows) { STModulesInfo objModulesInfo = (STModulesInfo)objModulesController.GetObjectFromDataRow(row); if (objModulesInfo.AAStatus != "Delete") { lstModules.Add(objModulesInfo); } } fld_dgcModuleNoneActiveGridControl.DataSource = lstModules; fld_dgcModuleNoneActiveGridControl.RefreshDataSource(); } }
private void fld_btnForward_Click(object sender, EventArgs e) { int iRowHandle = fld_dgvCurrentModuleGridView.FocusedRowHandle; if (iRowHandle >= 0) { STModulesInfo objSTModulesInfo = (STModulesInfo)fld_dgvCurrentModuleGridView.GetRow(iRowHandle); if (objSTModulesInfo != null) { if (lstModule.Exists("STModuleName", objSTModulesInfo.STModuleName)) { MessageBox.Show("Module đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } lstModule.Add(objSTModulesInfo); } } fld_dgcModuleActivesGridControl.DataSource = lstModule; fld_dgcModuleActivesGridControl.RefreshDataSource(); }
private void AddModuleNode(TreeList fld_trlstUserGroup, int iUserGroupSectionID, TreeListNode parentNode) { STModuleToUserGroupSectionsController objSTModuleToUserGroupSectionsController = new STModuleToUserGroupSectionsController(); DataSet dsModuleUserGroupSections = objSTModuleToUserGroupSectionsController.GetAllModuleToUserGroupSectionByUserGroupSectionID(iUserGroupSectionID); if (dsModuleUserGroupSections != null) { foreach (DataRow row in dsModuleUserGroupSections.Tables[0].Rows) { STModuleToUserGroupSectionsInfo objSTModuleToUserGroupSectionsInfo = (STModuleToUserGroupSectionsInfo)objSTModuleToUserGroupSectionsController.GetObjectFromDataRow(row); if (objSTModuleToUserGroupSectionsInfo != null) { STModulesInfo objSTModulesInfo = (STModulesInfo) new STModulesController().GetObjectByID(objSTModuleToUserGroupSectionsInfo.FK_STModuleID); if (objSTModulesInfo != null) { TreeListNode treeListModuleNode = fld_trlstUserGroup.AppendNode(new object[] { objSTModulesInfo.STModuleDesc, parentNode.Level + 1 }, parentNode); treeListModuleNode.Tag = objSTModulesInfo.STModuleID; } } } } }
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); }