private void btnDelEmp_Click(object sender, EventArgs e) { int rowIdx = 0; if (this.dgvEmp.CurrentCell != null) { rowIdx = this.dgvEmp.CurrentCell.RowIndex; } if (rowIdx < 0) { this.ShowMessage("请选择要移除的员工记录行!"); return; } if (_roleID <= 0) { this.ShowMessage("请先选择角色!"); return; } if (MessageBox.Show("确定是否删除当前记录?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } int?[] arrEmpIds = new int?[] { this.dgvEmp["col_EmpID", rowIdx].Value.ToInt32() }; Sys_EmpDataRightLogic logic = new Sys_EmpDataRightLogic(this); WCFAddUpdateResult rst = logic.DelRoleEmpIDs(new Sys_EmpDataRightParam() { RoleID = _roleID.ToString(), EmpIDs = arrEmpIds }); if (rst.Key > 0) { LoadEmpList(); } }
private void btnAddEmps_Click(object sender, EventArgs e) { if (_roleID <= 0) { this.ShowMessage("请先选择角色!"); return; } frmSelectEmp frm = new frmSelectEmp(true); frm.ShowDialog(); List <HR_EmployeeResult> slcList = frm.GetSelectList <HR_EmployeeResult>(); if (slcList.Count > 0) { int?[] arrEmpIds = slcList.Select(a => (int?)a.EmpID).ToArray(); Sys_EmpDataRightLogic logic = new Sys_EmpDataRightLogic(this); WCFAddUpdateResult rst = logic.AddRoleEmpIDs(new Sys_EmpDataRightParam() { RoleID = _roleID.ToString(), RoleName = _roleName, EmpIDs = arrEmpIds }); if (rst.Key > 0) { LoadEmpList(); } } }
public frmSysEmpDataRight() { InitializeComponent(); roleLogic = new Sys_RoleLogic(this); empDataRightLogic = new Sys_EmpDataRightLogic(this); orgLogic = new HR_OrgLogic(this); deptLogic = new HR_DepartmentLogic(this); empLogic = new HR_EmployeeLogic(this); }
void LoadEmpList() { Sys_EmpDataRightLogic logic = new Sys_EmpDataRightLogic(this); List <HR_EmployeeResult> empList = logic.GetRoleEmpList(new Sys_EmpDataRightParam() { RoleID = _roleID.ToString() }); this.dgvEmp.DataSource = empList; }