private void InitListBox() { if (this.CurrentRole != null) { if (checkedListBoxControl1.Items.Count == 0) { //初始化职务等级列表 职务等级 管培生, 副总经理以上; 管培生.编码 = "管培生"; 管培生.称 = "管培生"; 副总经理以上.编码 = "副总经理以上"; 副总经理以上.称 = "副总经理以上"; List <职务等级> lvlList = new List <职务等级>(); lvlList.Add(管培生); lvlList.Add(副总经理以上); 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) { CheckedListBoxItem item = new CheckedListBoxItem(lvl, false); checkedListBoxControl1.Items.Add(item); } } checkedListBoxControl1.BeginUpdate(); if (CurrentCompany != null) { List <RoleLevel> groups = RoleLevel.GetRoleLevels(this.CurrentRole.Name).FindAll(a => a.公司编码 == CurrentCompany.公司编码); foreach (CheckedListBoxItem item in checkedListBoxControl1.Items) { 职务等级 grade = (职务等级)item.Value; bool isChecked = groups.Find(a => a.职务等级 == grade.编码) != null; item.CheckState = isChecked ? CheckState.Checked : CheckState.Unchecked; } } checkedListBoxControl1.EndUpdate(); } }
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; }
public static void Reset() { List <LevelInfo> oldList = GetAll(); List <LevelInfo> newList = new List <LevelInfo>(); //新增的 foreach (DictionaryEntry entry in PsHelper.GetSupvLvls()) { LevelInfo level = LevelInfo.AddLevelInfo((string)entry.Value, (string)entry.Key); newList.Add(level); } //清理被删除的级别 foreach (LevelInfo lv in oldList) { LevelInfo find = newList.Find(a => a.编码 == lv.编码); if (find == null) { lv.Delete(); } } }
private void Init() { //初始化职务等级列表 repositoryItemImageComboBox.Items.Clear(); 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.编码); repositoryItemImageComboBox.Items.Add(item); } LoadData(); }
private void EditEmployeeQueryPowerForm_Load(object sender, EventArgs e) { this.Text = "查询权限录入 - " + (this.是验证录入 ? "验证录入" : "初次录入"); repositoryItemImageComboBox1.Items.Clear(); foreach (DictionaryEntry entry in PsHelper.GetCompanyTable()) { ImageComboBoxItem item = new ImageComboBoxItem(); item.Description = (string)entry.Key; item.Value = (string)entry.Value; repositoryItemImageComboBox1.Items.Add(item); } repositoryItemImageComboBox2.Items.Clear(); foreach (DictionaryEntry entry in PsHelper.GetSupvLvls()) { ImageComboBoxItem item = new ImageComboBoxItem(); item.Description = (string)entry.Key; item.Value = (string)entry.Value; repositoryItemImageComboBox2.Items.Add(item); } LoadData(); }