예제 #1
0
        private void RoleLevelSettingsForm_Load(object sender, System.EventArgs e)
        {
            roleList = Role.GetAll();
            gridControl1.DataSource = roleList;

            //初始化公司列表
            companyList             = CompanyInfo.GetAll();
            gridControl2.DataSource = companyList;
        }
        private void Init()
        {
            //初始化公司列表
            repositoryItemCompany.Items.Clear();
            foreach (CompanyInfo c in CompanyInfo.GetAll())
            {
                ImageComboBoxItem item = new ImageComboBoxItem(c.公司简称, c.公司编码);
                repositoryItemCompany.Items.Add(item);
            }
            //初始化职务等级列表
            repositoryItemGrade.Items.Clear();
            repositoryItemGrade.Items.Add(new ImageComboBoxItem("管培生", "管培生"));
            repositoryItemGrade.Items.Add(new ImageComboBoxItem("副总经理以上", "副总经理以上"));
            List <职务等级> lvlList = new List <职务等级>();

            foreach (DictionaryEntry entry in PsHelper.GetSupvLvls())
            {
                职务等级 lvl = new 职务等级 {
                    编码 = (string)entry.Value, 称 = (string)entry.Key
                };
                lvlList.Add(lvl);
            }
            lvlList = lvlList.OrderBy(a => a.编码).ToList();
            foreach (职务等级 lvl in lvlList)
            {
                ImageComboBoxItem item = new ImageComboBoxItem(lvl.称, lvl.编码);
                repositoryItemGrade.Items.Add(item);
            }
            //初始化角色列表
            List <Role> allRoles = Role.GetAll();

            foreach (Role role in allRoles)
            {
                repositoryItemRole.Items.Add(role.Name);
            }
            //只显示当前薪等表里的权限,历史记录隐藏
            impowerList.Clear();
            foreach (RoleLevel rg in RoleLevel.GetAll())
            {
                impowerList.Add(rg);
            }
            gridControl1.DataSource = impowerList;
        }