123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.StatisticalInquiry
- {
- public partial class FrmResponsiblePersonDetails : LYFZ.Software.UI.StatisticalInquiry.FrmResponsiblePersonDetails
- {
- public string employeeId = "";
- public string startTime = "";
- public string endTime = "";
- LYFZ.BLL.BLL_ErpOrderRetakeRecord retakeRecordBll = new BLL.BLL_ErpOrderRetakeRecord();
- public FrmResponsiblePersonDetails()
- {
- this.Shown += FrmResponsiblePersonDetails_Shown;
- this.cbxBoot.Click += cbxBoot_Click;
- this.cbxBootAssist.Click += cbxBoot_Click;
- this.cbxMakeup.Click += cbxBoot_Click;
- this.cbxMakeupAssist.Click += cbxBoot_Click;
- this.cbxPhotograph.Click += cbxBoot_Click;
- this.cbxPhotographAssist.Click += cbxBoot_Click;
- }
- void cbxBoot_Click(object sender, EventArgs e)
- {
- BindResponsiblePersonDetailsData();
- }
- void FrmResponsiblePersonDetails_Shown(object sender, EventArgs e)
- {
- BindResponsiblePersonDetailsData();
- }
- void BindResponsiblePersonDetailsData()
- {
- DataTable dt = retakeRecordBll.GetOrderRetakeRecordTable(startTime, endTime, employeeId);
- Dictionary<string, string> dicUserNameList = new Dictionary<string, string>();
- foreach(DataRow dr in dt.Rows)
- {
- string txtEmployeeId = dr["Ordrr_Person1"].ToString();
- if(!string.IsNullOrEmpty(txtEmployeeId))
- {
- if(!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person1"].ToString(), "");
- }
- }
- txtEmployeeId = dr["Ordrr_Person2"].ToString();
- if (!string.IsNullOrEmpty(txtEmployeeId))
- {
- if (!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person2"].ToString(), "");
- }
- }
- txtEmployeeId = dr["Ordrr_Person3"].ToString();
- if (!string.IsNullOrEmpty(txtEmployeeId))
- {
- if (!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person3"].ToString(), "");
- }
- }
- txtEmployeeId = dr["Ordrr_Person4"].ToString();
- if (!string.IsNullOrEmpty(txtEmployeeId))
- {
- if (!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person4"].ToString(), "");
- }
- }
- txtEmployeeId = dr["Ordrr_Person5"].ToString();
- if (!string.IsNullOrEmpty(txtEmployeeId))
- {
- if (!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person5"].ToString(), "");
- }
- }
- txtEmployeeId = dr["Ordrr_Person6"].ToString();
- if (!string.IsNullOrEmpty(txtEmployeeId))
- {
- if (!dicUserNameList.ContainsKey(txtEmployeeId))
- {
- dicUserNameList.Add(dr["Ordrr_Person6"].ToString(), "");
- }
- }
- }
- DataTable userDt = new LYFZ.BLL.BLL_ErpUser().GetList(" User_EmployeeID in ('" + string.Join("','", dicUserNameList.Keys) + "') ").Tables[0];
- foreach (DataRow dr in userDt.Rows)
- {
- dicUserNameList[dr["User_EmployeeID"].ToString()] = dr["User_Name"].ToString();
- }
- List<DataRow> drList = new List<DataRow>();
- if(this.cbxPhotograph.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person1 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- if (this.cbxPhotographAssist.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person2 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- if (this.cbxMakeup.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person3 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- if (this.cbxMakeupAssist.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person4 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- if (this.cbxBoot.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person5 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- if (this.cbxBootAssist.Checked)
- {
- DataRow[] drs = dt.Select(" Ordrr_Person6 = '" + employeeId + "' ");
- drList.AddRange(drs);
- }
- lab_dutyName.Text = dicUserNameList[employeeId];
- foreach (DataRow dr in drList)
- {
- int rowIndex = this.dgvDetail.Rows.Add();
- this.dgvDetail.Rows[rowIndex].Cells["订单号"].Value = dr["Ordrr_OrdNumber"];
- this.dgvDetail.Rows[rowIndex].Cells["客户姓名"].Value = dr["Cus_Name"];
- this.dgvDetail.Rows[rowIndex].Cells["客户性别"].Value = dr["Cus_Sex_cs"];
- this.dgvDetail.Rows[rowIndex].Cells["客户电话"].Value = dr["Cus_Telephone"];
- this.dgvDetail.Rows[rowIndex].Cells["订单类型"].Value = Enum.GetName(typeof(EnumPublic.OrderType) ,dr["GP_CustomerType"]);
- this.dgvDetail.Rows[rowIndex].Cells["摄影师"].Value = GetEmployeeName(dr["Ordrr_Person1"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["摄影师助理"].Value = GetEmployeeName(dr["Ordrr_Person2"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["化妆师"].Value = GetEmployeeName(dr["Ordrr_Person3"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["化妆师助理"].Value = GetEmployeeName(dr["Ordrr_Person4"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["引导师"].Value = GetEmployeeName(dr["Ordrr_Person5"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["引导师助理"].Value = GetEmployeeName(dr["Ordrr_Person6"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["重拍责任人"].Value = GetEmployeeName(dr["Ordrr_RetakePerson"].ToString(), dicUserNameList);
- this.dgvDetail.Rows[rowIndex].Cells["责任描述"].Value = dr["Ordrr_Remark"].ToString();
- }
- }
- string GetEmployeeName(string employeeId ,Dictionary<string, string> dicUserNameList)
- {
- string[] employeeList = employeeId.Split(',');
- string employeeData = "";
- foreach (string tempEmployee in employeeList)
- {
- if (!string.IsNullOrEmpty(tempEmployee))
- {
- if (dicUserNameList.ContainsKey(tempEmployee))
- {
- if (employeeData!="")
- {
- employeeData += ",";
- }
- employeeData += dicUserNameList[tempEmployee];
- }
-
- }
-
- }
- return employeeData;
- }
- }
- }
|