private void btnDirector_Click(object sender, EventArgs e) { FormSelectPersonnel form = new FormSelectPersonnel("员工"); if (cmbPrincipal.Tag != null) { form.SelectedUser = (cmbDirector.Tag as List <View_SelectPersonnel>); } if (form.ShowDialog() == DialogResult.OK) { if (!cbIsPermission.Checked) { if (MessageDialog.ShowEnquiryMessage("设置的主管没有审批权限吗?有,请退出后先勾选审批权再选择主管;没有请点击【确定】") == DialogResult.No) { return; } } cmbDirector.Items.Clear(); m_personnerServer.DeleteDeptDirector(txtCode.Text, "0"); if (form.SelectedUser != null && form.SelectedUser.Count > 0) { cmbDirector.Items.AddRange((from r in form.SelectedUser select r.员工姓名).ToArray()); cmbDirector.Tag = form.SelectedUser; cmbDirector.SelectedIndex = 0; if (!m_personnerServer.AddDeptDirector(txtCode.Text, form.SelectedUser, "0", cbIsPermission.Checked, out m_error)) { MessageDialog.ShowErrorMessage(m_error); } } } }
private void btnLeader_Click(object sender, EventArgs e) { FormSelectPersonnel form = new FormSelectPersonnel("员工"); if (cmbPrincipal.Tag != null) { form.SelectedUser = (cmbLeader.Tag as List <View_SelectPersonnel>); } if (form.ShowDialog() == DialogResult.OK) { cmbLeader.Items.Clear(); m_personnerServer.DeleteDeptDirector(txtCode.Text, "2"); if (form.SelectedUser != null && form.SelectedUser.Count > 0) { cmbLeader.Items.AddRange((from r in form.SelectedUser select r.员工姓名).ToArray()); cmbLeader.Tag = form.SelectedUser; cmbLeader.SelectedIndex = 0; if (!m_personnerServer.AddDeptDirector(txtCode.Text, form.SelectedUser, "2", true, out m_error)) { MessageDialog.ShowErrorMessage(m_error); } } } }
/// <summary> /// 选择部门 /// </summary> private void btnFindPrincipal_Click(object sender, EventArgs e) { FormSelectPersonnel form = new FormSelectPersonnel("部门"); if (cmbApplicableDeptCode.Tag != null) { form.SelectedDept = (cmbApplicableDeptCode.Tag as List <View_HR_Dept>); } if (form.ShowDialog() == DialogResult.OK) { cmbApplicableDeptCode.Items.Clear(); if (form.SelectedDept != null && form.SelectedDept.Count > 0) { if (form.Count == "全部") { cmbApplicableDeptCode.Items.Add("全部"); cmbApplicableDeptCode.SelectedIndex = 0; } else { deptName = ""; cmbApplicableDeptCode.Items.AddRange((from r in form.SelectedDept select r.部门名称).ToArray()); cmbApplicableDeptCode.Tag = form.SelectedDept; cmbApplicableDeptCode.SelectedIndex = 0; for (int i = 0; i < cmbApplicableDeptCode.Items.Count; i++) { deptName += cmbApplicableDeptCode.Items[i].ToString() + ";"; } } } } }
private void btnFindCode_Click(object sender, EventArgs e) { FormSelectPersonnel form = new FormSelectPersonnel("员工"); txtCultivateLecturer.Text = ""; if (form.ShowDialog() == DialogResult.OK) { for (int i = 0; i < form.SelectedUser.Count; i++) { txtCultivateLecturer.Text += form.SelectedUser[i].员工姓名 + ";"; } txtCultivateLecturer.Text = txtCultivateLecturer.Text.Substring(0, txtCultivateLecturer.Text.Length - 1); } }
private void btnPerson_Click(object sender, EventArgs e) { if (txtDept.Text.Trim() == "") { MessageDialog.ShowPromptMessage("请先选择参与部门!"); return; } FormSelectPersonnel form = new FormSelectPersonnel("员工"); form.DeptCode = m_deptCode; if (txtPerson.Text.Trim() != "") { string[] person = txtPerson.Text.Split(','); List <View_SelectPersonnel> list = new List <View_SelectPersonnel>(); for (int i = 0; i < person.Length; i++) { if (person[i] != "") { View_SelectPersonnel personnel = new View_SelectPersonnel(); personnel.员工编号 = UniversalFunction.GetPersonnelCode(person[i]); list.Add(personnel); } } form.SelectedUser = list; } if (form.ShowDialog() == DialogResult.OK) { txtPerson.Text = ""; m_lstPerson = form.SelectedUser; for (int i = 0; i < form.SelectedUser.Count; i++) { txtPerson.Text += form.SelectedUser[i].员工姓名 + ";"; } txtPerson.Text = txtPerson.Text.Substring(0, txtPerson.Text.Length - 1); } }
private void btnDept_Click(object sender, EventArgs e) { FormSelectPersonnel form = new FormSelectPersonnel("部门"); if (form.ShowDialog() == DialogResult.OK) { txtDept.Text = ""; m_deptCode = ""; for (int i = 0; i < form.SelectedDept.Count; i++) { txtDept.Text += form.SelectedDept[i].部门名称 + ";"; m_deptCode += form.SelectedDept[i].部门代码 + ";"; } txtDept.Text = txtDept.Text.Substring(0, txtDept.Text.Length - 1); btnPerson_Click(sender, e); } }
///// <summary> ///// 初始化控件 ///// </summary> //void ClearControl() //{ // txtErrand.Text = ""; // txtApplicant.Text = BasicInfo.LoginName; // txtApplicant.Tag = BasicInfo.LoginID; // txtNumOfPersonnel.Text = "0"; // cmbCompensateMode.Text = ""; // cbAuthorize.Checked = false; // numHours.Value = 2; // txtRealHours.Text = "0"; // cmbCompensateMode.Enabled = true; // m_billNo = ""; // if (dataGridView2.Rows.Count > 0) // { // dataGridView2.Rows.Clear(); // } //} private void 添加人员ToolStripMenuItem_Click(object sender, EventArgs e) { if (cmbCompensateMode.SelectedIndex == -1) { MessageDialog.ShowPromptMessage("请先选择“补偿方式”!"); return; } FormSelectPersonnel form = new FormSelectPersonnel("员工"); form.DeptCode = BasicInfo.DeptCode; if (dataGridView2.Rows.Count > 0) { List <View_SelectPersonnel> list = new List <View_SelectPersonnel>(); for (int i = 0; i < dataGridView2.Rows.Count; i++) { View_SelectPersonnel person = new View_SelectPersonnel(); person.员工编号 = dataGridView2.Rows[i].Cells["员工编号"].Value.ToString(); list.Add(person); } form.SelectedUser = list; } if (form.ShowDialog() == DialogResult.OK) { dataGridView2.DataSource = form.SelectedUser; } txtNumOfPersonnel.Text = dataGridView2.Rows.Count.ToString(); for (int i = 0; i < dataGridView2.Rows.Count; i++) { View_SelectPersonnel person = new View_SelectPersonnel(); person.员工编号 = dataGridView2.Rows[i].Cells["员工编号"].Value.ToString(); #region 2013-08-23 邱瑶 人力重新定义了加班,以前所有选择加班补偿方式的约束代码都取消,任何时间,任何员工都可以选择 //if (m_personnerServer.GetPersonnelInfo(person.员工编号).WorkPost.ToString() == "393" // || m_personnerServer.GetPersonnelInfo(person.员工编号).WorkPost.ToString() == "385") //{ // cmbCompensateMode.SelectedIndex = 0; // cmbCompensateMode.Enabled = true; //} //else //{ // bool b = m_overTimeServer.IsChooseDoubleRest(m_personnerServer.GetPersonnelInfo(person.员工编号).WorkPost.ToString(), // m_personnerServer.GetPersonnelInfo(person.员工编号).Dept.ToString(), person.员工编号); // if (b) // { // cmbCompensateMode.SelectedIndex = 0; // cmbCompensateMode.Enabled = false; // } //} #endregion } }