private void InitListBox()
        {
            if (this.CurrentRole != null)
            {
                if (checkedListBoxControl1.Items.Count == 0)
                {
                    foreach (PayGroup pg in PayGroup.薪资组集合)
                    {
                        checkedListBoxControl1.Items.Add(pg, false);
                    }
                }

                checkedListBoxControl1.BeginUpdate();

                List <RolePayGroup> groups = RolePayGroup.GetPayGroups(this.CurrentRole.Name);
                foreach (CheckedListBoxItem item in checkedListBoxControl1.Items)
                {
                    PayGroup paygroup  = (PayGroup)item.Value;
                    bool     isChecked = groups.Find(a => a.薪资组 == paygroup.英文名) != null;
                    item.CheckState = isChecked ? CheckState.Checked : CheckState.Unchecked;
                }

                checkedListBoxControl1.EndUpdate();
            }
        }
Example #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            RolePayGroup imp = new RolePayGroup();

            imp.标识 = Guid.NewGuid();
            impowerList.Add(imp);
            gridControl1.RefreshDataSource();
            gridView1.FocusedRowHandle = gridView1.RowCount - 1;
        }
Example #3
0
        private void ManagePayGroupImpowers_Load(object sender, System.EventArgs e)
        {
            //初始化
            repositoryItemLookUpEdit1.DataSource = PayGroup.薪资组集合;
            List <Role> allRoles = Role.GetAll();

            foreach (Role role in allRoles)
            {
                repositoryItemComboBox1.Items.Add(role.Name);
            }
            impowerList             = RolePayGroup.GetAll();
            gridControl1.DataSource = impowerList;
        }
Example #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            ColumnView colView = (ColumnView)gridControl1.MainView;

            if (colView != null)
            {
                if (MessageBox.Show("确实删除当前记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                {
                    RolePayGroup currentRolePayGroup = (RolePayGroup)colView.GetFocusedRow();
                    if (currentRolePayGroup != null)
                    {
                        impowerList.Remove(currentRolePayGroup);
                        currentRolePayGroup.Delete();
                        gridControl1.RefreshDataSource();
                        MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
        private void checkedListBoxControl1_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
        {
            CheckedListBoxItem currItem = (CheckedListBoxItem)checkedListBoxControl1.GetItem(e.Index);
            PayGroup           paygroup = (PayGroup)currItem.Value;
            string             rolename = this.CurrentRole.Name;

            //如果选中
            if (e.State == CheckState.Checked)
            {
                RolePayGroup rpg = new RolePayGroup();
                rpg.角色  = rolename;
                rpg.薪资组 = paygroup.英文名;
                rpg.Save();
            }
            //如果没有选中
            if (e.State == CheckState.Unchecked)
            {
                RolePayGroup rpg = RolePayGroup.GetRolePayGroup(paygroup.英文名, rolename);
                if (rpg != null)
                {
                    rpg.Del();
                }
            }
        }