Пример #1
0
        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();
        }
Пример #2
0
        public virtual void InitializeModule()
        {
            STModulesController objModulesController = new STModulesController();

            CurrentModuleID = objModulesController.GetObjectIDByName(CurrentModuleName);

            CurrentModuleEntity.InitModuleEntity();

            InitModuleToolbarEvents();

            InitializeScreens();

            CurrentModuleEntity.InitGridControlInVinaList();

            MainTableName = VinaUtil.GetTableNameFromBusinessObject(CurrentModuleEntity.MainObject);

            MainTablePrefix = MainTableName.Substring(0, MainTableName.Length - 1);
        }
Пример #3
0
        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++;
                }
            }
        }
Пример #4
0
        public void SaveFieldPermission(TreeListNode treeListNode)
        {
            UserManagementEntities entity = (UserManagementEntities)CurrentModuleEntity;

            if (treeListNode.Level != 3)
            {
                return;
            }

            TreeListNode           userGroupNode           = treeListNode.ParentNode.ParentNode;
            ADUserGroupsController objUserGroupsController = new ADUserGroupsController();
            int userGroupID = Convert.ToInt32(userGroupNode.Tag);
            STModulesController objSTModulesController = new STModulesController();
            int    moduleID   = Convert.ToInt32(treeListNode.Tag);
            string moduleName = objSTModulesController.GetObjectNameByID(moduleID);

            //STFieldPermissionsController objFieldPermissionsController = new STFieldPermissionsController();
            //guiConfigureToolbar guiConfigToolbar = new guiConfigureToolbar();
            //entity.STToolbarsTreeList.InvalidateTreeList(moduleID, true);
            //List<STFieldPermissionsInfo> fieldPermissions = objFieldPermissionsController.GetFieldPermissionList(userGroupID, moduleName, null, null, null);
            //foreach (STFieldPermissionsInfo objFieldPermissionsInfo in fieldPermissions)
            //{
            //    STToolbarsInfo objToolbarsInfo = (STToolbarsInfo)entity.STToolbarsTreeList.GetObjectByPropertyNameAndValue("STToolbarName", objFieldPermissionsInfo.STToolbarName);
            //    if (objToolbarsInfo != null)
            //    {
            //        if (objFieldPermissionsInfo.STFieldPermissionType.Equals((int)FieldPermissionType.None))
            //        {
            //            objToolbarsInfo.Selected = true;
            //        }
            //        else
            //        {
            //            objToolbarsInfo.Selected = false;
            //        }
            //    }
            //}
            //guiConfigToolbar.Module = this;
            //guiConfigToolbar.InitializeControls();
            //if (guiConfigToolbar.ShowDialog() == DialogResult.OK)
            //{
            //    entity.SaveFieldPermission(userGroupID, moduleName);
            //    MessageBox.Show(UserManagementLocalizedResources.SaveSuccessfulMessage, CommonLocalizedResources.MessageBoxDefaultCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            //}
        }
Пример #5
0
        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();
            }
        }
Пример #6
0
        public IEnumerable GetScreenByModuleID(string strModuleName)
        {
            int iModuleID = new STModulesController().GetObjectIDByName(strModuleName);

            return(GetScreenByModuleID(iModuleID));
        }
Пример #7
0
        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 }
            });
        }