//维修人员
 private void txtcServiceman_ChooserClick(object sender, EventArgs e)
 {
     frmPersonnelSelector frmSelector = new frmPersonnelSelector();
     frmSelector.isMoreCheck = false;
     DialogResult result = frmSelector.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtcServiceman.Text = frmSelector.strPersonName;
     }
 }
 /// <summary>
 /// 领料人选择器
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtFetchOpid_ChooserClick(object sender, EventArgs e)
 {
     try
     {
         frmPersonnelSelector frmPInfo = new frmPersonnelSelector();
         DialogResult result = frmPInfo.ShowDialog();
         if (result == DialogResult.OK)
         {
             txtFetchOpid.Text = frmPInfo.strPersonName;
             txtFetchOpid.Tag = frmPInfo.strUserId;
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void editUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (strProjectSattus != "3" && strProjectSattus != "5")
         {
             if (!IsChooserProject())
             {
                 return;
             }
             int intUserIndex = dgvUserData.CurrentRow.Index;//当前行索引
             if (intUserIndex >= 0)
             {
                 string strRescuerNo = CommonCtrl.IsNullToString(dgvUserData.Rows[intUserIndex].Cells["dispatch_no"].Value);
                 string strItemId = CommonCtrl.IsNullToString(dgvUserData.Rows[intUserIndex].Cells["dispatch_id"].Value);
                 if (!string.IsNullOrEmpty(strRescuerNo))
                 {
                     frmPersonnelSelector person = new frmPersonnelSelector();
                     DialogResult result = person.ShowDialog();
                     if (result == DialogResult.OK)
                     {
                         if (!string.IsNullOrEmpty(strItemId))
                         {
                             List<SQLObj> listSql = new List<SQLObj>();
                             SQLObj obj = new SQLObj();
                             obj.cmdType = CommandType.Text;
                             Dictionary<string, ParamObj> dicParam = new Dictionary<string, ParamObj>();
                             dicParam.Add("dispatch_id", new ParamObj("dispatch_id", strItemId, SysDbType.VarChar, 40));
                             obj.sqlString = @"delete from tb_maintain_dispatch_worker where dispatch_id=@dispatch_id";
                             obj.Param = dicParam;
                             listSql.Add(obj);
                             DBHelper.BatchExeSQLMultiByTrans("删除分配工时人员", listSql);
                         }
                         listUser.Remove(strRescuerNo);
                         BindUserInfo(person.strUserId, intUserIndex);                               
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void addUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (strProjectSattus != "3" && strProjectSattus != "5")
         {
             if (!IsChooserProject())
             {
                 return;
             }
             int intUrows = dgvUserData.CurrentRow.Index;//当前行索引
             frmPersonnelSelector person = new frmPersonnelSelector();
             DialogResult result = person.ShowDialog();
             if (result == DialogResult.OK)
             {
                 for (int i = 0; i <= intUrows; i++)
                 {
                     if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvUserData.Rows[i].Cells["dispatch_no"].Value)))
                     {
                         BindUserInfo(person.strUserId, i);
                         dgvUserData.Rows.Add(1);
                         break;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void dgvUserData_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (strProjectSattus != "3" && strProjectSattus != "6")
     {
         if (!IsChooserProject())
         {
             return;
         }
         frmPersonnelSelector person = new frmPersonnelSelector();
         DialogResult result = person.ShowDialog();
         if (result == DialogResult.OK)
         {
             BindUserInfo(person.strUserId, e.RowIndex);
             dgvUserData.Rows.Add(1);
         }
     }
 }
 private void txtAdvisor_ChooserClick(object sender, EventArgs e)
 {
     frmPersonnelSelector perSelector = new frmPersonnelSelector();
     DialogResult result = perSelector.ShowDialog();
       if (result == DialogResult.OK)
       {
           txtAdvisor.Text = perSelector.strPersonName;
       }
 }
        private void btnPerson_Click(object sender, EventArgs e)
        {
            frmPersonnelSelector frmSelector = new frmPersonnelSelector();
            frmSelector.isMoreCheck = true;
            DialogResult result = frmSelector.ShowDialog();
            if (result == DialogResult.OK)
            {


                string[] HumanList = frmSelector.strPersonName.Substring(0, frmSelector.strPersonName.Length - 1).Split(',');
                if (!string.IsNullOrEmpty(rtbPerson.Text))
                {
                    string[] OriginalHumanList = rtbPerson.Text.Split(',');
                    var ExceptList = HumanList.Except<string>(OriginalHumanList);
                    rtbPerson.AppendText(",");
                    rtbPerson.AppendText(string.Join(",", ExceptList));
                }
                else
                {
                    rtbPerson.AppendText(string.Join(",", HumanList));
                }




                string[] HumanIDArray = frmSelector.strUserId.Substring(0, frmSelector.strUserId.Length - 1).Split(',');
                if (rtbPerson.Tag!=null)
                {
                    string[] OriginalHumanIDArray = rtbPerson.Tag.ToString().Split(',');
                    var ExceptList = HumanIDArray.Except<string>(OriginalHumanIDArray);
                    rtbPerson.Tag += ",";
                    rtbPerson.Tag +=(string.Join(",", ExceptList));
                }
                else
                {
                    rtbPerson.Tag = (string.Join(",", HumanIDArray));
                }
            }
        }
 private void dgvRescuePerson_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     frmPersonnelSelector frmSelector = new frmPersonnelSelector();
     DialogResult result = frmSelector.ShowDialog();
     if (result == DialogResult.OK)
     {
         dgvRescuePerson.Rows[e.RowIndex].Cells["rescuer_no"].Value = frmSelector.strPersonCode;
         dgvRescuePerson.Rows[e.RowIndex].Cells["rescuer_name"].Value = frmSelector.strPersonName;
         dgvRescuePerson.Rows[e.RowIndex].Cells["org_name"].Value = frmSelector.strDepartment;
         dgvRescuePerson.Rows[e.RowIndex].Cells["team_name"].Value = frmSelector.strDiName;
         dgvRescuePerson.Rows[e.RowIndex].Cells["RPremarks"].Value = frmSelector.strRemark;
     }
 }
        private void labelUser_YYDZ_DoubleClick(object sender, EventArgs e)
        {
            Label label = sender as Label;

            frmPersonnelSelector frmSelector = new frmPersonnelSelector();
            frmSelector.isMoreCheck = true;
            DialogResult result = frmSelector.ShowDialog();
            if (result == DialogResult.OK)
            {
                if (frmSelector.strPersonName.Length > 0)
                {
                    label.Text = frmSelector.strPersonName.Substring(0, frmSelector.strPersonName.Length - 1);
                    label.Tag = frmSelector.strUserId.Substring(0, frmSelector.strUserId.Length - 1);
                }
            }
        }
 private void editUser_Click(object sender, EventArgs e)
 {
     try
     {
         int intUserIndex = dgvRescuePerson.CurrentRow.Index;
         if (intUserIndex >= 0)
         {
             string strRescuerNo = CommonCtrl.IsNullToString(dgvRescuePerson.Rows[intUserIndex].Cells["rescuer_no"].Value);
             if (!string.IsNullOrEmpty(strRescuerNo))
             {
                 frmPersonnelSelector frmSelector = new frmPersonnelSelector();
                 DialogResult result = frmSelector.ShowDialog();
                 if (result == DialogResult.OK)
                 {
                     if (listUser.Contains(frmSelector.strPersonCode))
                     {
                         MessageBoxEx.Show("此人员信息已存在,请选择其他人员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         return;
                     }
                     dgvRescuePerson.Rows[intUserIndex].Cells["rescuer_no"].Value = frmSelector.strPersonCode;
                     dgvRescuePerson.Rows[intUserIndex].Cells["rescuer_name"].Value = frmSelector.strPersonName;
                     dgvRescuePerson.Rows[intUserIndex].Cells["org_name"].Value = frmSelector.strDepartment;
                     dgvRescuePerson.Rows[intUserIndex].Cells["team_name"].Value = "";
                     dgvRescuePerson.Rows[intUserIndex].Cells["RPremarks"].Value = frmSelector.strRemark;
                     dgvRescuePerson.Rows[intUserIndex].Cells["man_hour"].ReadOnly = false;
                     dgvRescuePerson.Rows[intUserIndex].Cells["RPsum_money"].ReadOnly = false;
                     listUser.Remove(strRescuerNo);
                     foreach (DataGridViewRow dgvr in dgvRescuePerson.Rows)
                     {
                         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["rescuer_no"].Value);
                         if (!string.IsNullOrEmpty(strPCode) && !listUser.Contains(strPCode))
                         {
                             listUser.Add(strPCode);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void dgvRescuePerson_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int intUrows = e.RowIndex;//当前行索引
         frmPersonnelSelector frmSelector = new frmPersonnelSelector();
         DialogResult result = frmSelector.ShowDialog();
         if (result == DialogResult.OK)
         {
             if (listUser.Contains(frmSelector.strPersonCode))
             {
                 MessageBoxEx.Show("此人员信息已存在,请选择其他人员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             for (int i = 0; i <= intUrows; i++)
             {
                 if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dgvRescuePerson.Rows[i].Cells["rescuer_no"].Value)))
                 {
                     dgvRescuePerson.Rows[i].Cells["rescuer_no"].Value = frmSelector.strPersonCode;
                     dgvRescuePerson.Rows[i].Cells["rescuer_name"].Value = frmSelector.strPersonName;
                     dgvRescuePerson.Rows[i].Cells["org_name"].Value = frmSelector.strDepartment;
                     dgvRescuePerson.Rows[i].Cells["team_name"].Value = "";
                     dgvRescuePerson.Rows[i].Cells["RPremarks"].Value = frmSelector.strRemark;
                     dgvRescuePerson.Rows[i].Cells["man_hour"].ReadOnly = false;
                     dgvRescuePerson.Rows[i].Cells["RPsum_money"].ReadOnly = false;
                     dgvRescuePerson.Rows.Add(1);
                     break;
                 }
             }
         }
         foreach (DataGridViewRow dgvr in dgvRescuePerson.Rows)
         {
             string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["rescuer_no"].Value);
             if (!string.IsNullOrEmpty(strPCode) && !listUser.Contains(strPCode))
             {
                 listUser.Add(strPCode);
             }
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
 private void txtRepairWorker_ChooserClick(object sender, EventArgs e)
 {
     frmPersonnelSelector frmSelector = new frmPersonnelSelector();
     frmSelector.isMoreCheck = true;
     DialogResult result = frmSelector.ShowDialog();
     if (result == DialogResult.OK)
     {      
         txtRepairWorker.Text = frmSelector.strPersonName.Contains(",")? frmSelector.strPersonName.Substring(0,frmSelector.strPersonName.Length-1):frmSelector.strPersonName;
         txtRepairWorker.Tag = frmSelector.strUserId.Substring(0,frmSelector.strUserId.Length-1);
     }
 }
 /// <summary>
 /// 领料人选择器
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtFetchOpid_ChooserClick(object sender, EventArgs e)
 {
     frmPersonnelSelector frmPInfo = new frmPersonnelSelector();
     DialogResult result = frmPInfo.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtFetchOpid.Text = frmPInfo.strPersonName;
         txtFetchOpid.Tag = frmPInfo.strUserId;
     }
 }
        private void txtAdvisor_ChooserClick(object sender, EventArgs e)
        {
            try
            {
                frmPersonnelSelector perSelector = new frmPersonnelSelector();
                DialogResult result = perSelector.ShowDialog();
                if (result == DialogResult.OK)
                {
                    txtAdvisor.Text = perSelector.strPersonName;
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);

            }
        }
 private void btnPerson_Click(object sender, EventArgs e)
 {
     frmPersonnelSelector frmSelector = new frmPersonnelSelector();
     frmSelector.isMoreCheck = true;
     DialogResult result = frmSelector.ShowDialog();
     if (result == DialogResult.OK)
     {
         rtbPerson.Text = frmSelector.strPersonName.Substring(0, frmSelector.strPersonName.Length - 1);
         rtbPerson.Tag = frmSelector.strUserId.Substring(0, frmSelector.strUserId.Length - 1);
     }
 }
 private void addUser_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow dgvr in dgvRescuePerson.Rows)
     {
         string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["rescuer_no"].Value);
         if (!string.IsNullOrEmpty(strPCode))
         {
             listUser.Add(strPCode);
         }
     }
     frmPersonnelSelector frmSelector = new frmPersonnelSelector();
     DialogResult result = frmSelector.ShowDialog();
     if (result == DialogResult.OK)
     {
         if (listUser.Contains(frmSelector.strPersonCode))
         {
             MessageBoxEx.Show("此人员信息已存在,请选择其他人员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         dgvRescuePerson.CurrentRow.Cells["rescuer_no"].Value = frmSelector.strPersonCode;
         dgvRescuePerson.CurrentRow.Cells["rescuer_name"].Value = frmSelector.strPersonName;
         dgvRescuePerson.CurrentRow.Cells["org_name"].Value = frmSelector.strDepartment;
         dgvRescuePerson.CurrentRow.Cells["team_name"].Value = frmSelector.strDiName;
         dgvRescuePerson.CurrentRow.Cells["RPremarks"].Value = frmSelector.strRemark;
         dgvRescuePerson.Rows.Add(1);
     }
 }