FrmResponsiblePersonDetails.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.StatisticalInquiry
  10. {
  11. public partial class FrmResponsiblePersonDetails : LYFZ.Software.UI.StatisticalInquiry.FrmResponsiblePersonDetails
  12. {
  13. public string employeeId = "";
  14. public string startTime = "";
  15. public string endTime = "";
  16. LYFZ.BLL.BLL_ErpOrderRetakeRecord retakeRecordBll = new BLL.BLL_ErpOrderRetakeRecord();
  17. public FrmResponsiblePersonDetails()
  18. {
  19. this.Shown += FrmResponsiblePersonDetails_Shown;
  20. this.cbxBoot.Click += cbxBoot_Click;
  21. this.cbxBootAssist.Click += cbxBoot_Click;
  22. this.cbxMakeup.Click += cbxBoot_Click;
  23. this.cbxMakeupAssist.Click += cbxBoot_Click;
  24. this.cbxPhotograph.Click += cbxBoot_Click;
  25. this.cbxPhotographAssist.Click += cbxBoot_Click;
  26. }
  27. void cbxBoot_Click(object sender, EventArgs e)
  28. {
  29. BindResponsiblePersonDetailsData();
  30. }
  31. void FrmResponsiblePersonDetails_Shown(object sender, EventArgs e)
  32. {
  33. BindResponsiblePersonDetailsData();
  34. }
  35. void BindResponsiblePersonDetailsData()
  36. {
  37. DataTable dt = retakeRecordBll.GetOrderRetakeRecordTable(startTime, endTime, employeeId);
  38. Dictionary<string, string> dicUserNameList = new Dictionary<string, string>();
  39. foreach(DataRow dr in dt.Rows)
  40. {
  41. string txtEmployeeId = dr["Ordrr_Person1"].ToString();
  42. if(!string.IsNullOrEmpty(txtEmployeeId))
  43. {
  44. if(!dicUserNameList.ContainsKey(txtEmployeeId))
  45. {
  46. dicUserNameList.Add(dr["Ordrr_Person1"].ToString(), "");
  47. }
  48. }
  49. txtEmployeeId = dr["Ordrr_Person2"].ToString();
  50. if (!string.IsNullOrEmpty(txtEmployeeId))
  51. {
  52. if (!dicUserNameList.ContainsKey(txtEmployeeId))
  53. {
  54. dicUserNameList.Add(dr["Ordrr_Person2"].ToString(), "");
  55. }
  56. }
  57. txtEmployeeId = dr["Ordrr_Person3"].ToString();
  58. if (!string.IsNullOrEmpty(txtEmployeeId))
  59. {
  60. if (!dicUserNameList.ContainsKey(txtEmployeeId))
  61. {
  62. dicUserNameList.Add(dr["Ordrr_Person3"].ToString(), "");
  63. }
  64. }
  65. txtEmployeeId = dr["Ordrr_Person4"].ToString();
  66. if (!string.IsNullOrEmpty(txtEmployeeId))
  67. {
  68. if (!dicUserNameList.ContainsKey(txtEmployeeId))
  69. {
  70. dicUserNameList.Add(dr["Ordrr_Person4"].ToString(), "");
  71. }
  72. }
  73. txtEmployeeId = dr["Ordrr_Person5"].ToString();
  74. if (!string.IsNullOrEmpty(txtEmployeeId))
  75. {
  76. if (!dicUserNameList.ContainsKey(txtEmployeeId))
  77. {
  78. dicUserNameList.Add(dr["Ordrr_Person5"].ToString(), "");
  79. }
  80. }
  81. txtEmployeeId = dr["Ordrr_Person6"].ToString();
  82. if (!string.IsNullOrEmpty(txtEmployeeId))
  83. {
  84. if (!dicUserNameList.ContainsKey(txtEmployeeId))
  85. {
  86. dicUserNameList.Add(dr["Ordrr_Person6"].ToString(), "");
  87. }
  88. }
  89. }
  90. DataTable userDt = new LYFZ.BLL.BLL_ErpUser().GetList(" User_EmployeeID in ('" + string.Join("','", dicUserNameList.Keys) + "') ").Tables[0];
  91. foreach (DataRow dr in userDt.Rows)
  92. {
  93. dicUserNameList[dr["User_EmployeeID"].ToString()] = dr["User_Name"].ToString();
  94. }
  95. List<DataRow> drList = new List<DataRow>();
  96. if(this.cbxPhotograph.Checked)
  97. {
  98. DataRow[] drs = dt.Select(" Ordrr_Person1 = '" + employeeId + "' ");
  99. drList.AddRange(drs);
  100. }
  101. if (this.cbxPhotographAssist.Checked)
  102. {
  103. DataRow[] drs = dt.Select(" Ordrr_Person2 = '" + employeeId + "' ");
  104. drList.AddRange(drs);
  105. }
  106. if (this.cbxMakeup.Checked)
  107. {
  108. DataRow[] drs = dt.Select(" Ordrr_Person3 = '" + employeeId + "' ");
  109. drList.AddRange(drs);
  110. }
  111. if (this.cbxMakeupAssist.Checked)
  112. {
  113. DataRow[] drs = dt.Select(" Ordrr_Person4 = '" + employeeId + "' ");
  114. drList.AddRange(drs);
  115. }
  116. if (this.cbxBoot.Checked)
  117. {
  118. DataRow[] drs = dt.Select(" Ordrr_Person5 = '" + employeeId + "' ");
  119. drList.AddRange(drs);
  120. }
  121. if (this.cbxBootAssist.Checked)
  122. {
  123. DataRow[] drs = dt.Select(" Ordrr_Person6 = '" + employeeId + "' ");
  124. drList.AddRange(drs);
  125. }
  126. lab_dutyName.Text = dicUserNameList[employeeId];
  127. foreach (DataRow dr in drList)
  128. {
  129. int rowIndex = this.dgvDetail.Rows.Add();
  130. this.dgvDetail.Rows[rowIndex].Cells["订单号"].Value = dr["Ordrr_OrdNumber"];
  131. this.dgvDetail.Rows[rowIndex].Cells["客户姓名"].Value = dr["Cus_Name"];
  132. this.dgvDetail.Rows[rowIndex].Cells["客户性别"].Value = dr["Cus_Sex_cs"];
  133. this.dgvDetail.Rows[rowIndex].Cells["客户电话"].Value = dr["Cus_Telephone"];
  134. this.dgvDetail.Rows[rowIndex].Cells["订单类型"].Value = Enum.GetName(typeof(EnumPublic.OrderType) ,dr["GP_CustomerType"]);
  135. this.dgvDetail.Rows[rowIndex].Cells["摄影师"].Value = GetEmployeeName(dr["Ordrr_Person1"].ToString(), dicUserNameList);
  136. this.dgvDetail.Rows[rowIndex].Cells["摄影师助理"].Value = GetEmployeeName(dr["Ordrr_Person2"].ToString(), dicUserNameList);
  137. this.dgvDetail.Rows[rowIndex].Cells["化妆师"].Value = GetEmployeeName(dr["Ordrr_Person3"].ToString(), dicUserNameList);
  138. this.dgvDetail.Rows[rowIndex].Cells["化妆师助理"].Value = GetEmployeeName(dr["Ordrr_Person4"].ToString(), dicUserNameList);
  139. this.dgvDetail.Rows[rowIndex].Cells["引导师"].Value = GetEmployeeName(dr["Ordrr_Person5"].ToString(), dicUserNameList);
  140. this.dgvDetail.Rows[rowIndex].Cells["引导师助理"].Value = GetEmployeeName(dr["Ordrr_Person6"].ToString(), dicUserNameList);
  141. this.dgvDetail.Rows[rowIndex].Cells["重拍责任人"].Value = GetEmployeeName(dr["Ordrr_RetakePerson"].ToString(), dicUserNameList);
  142. this.dgvDetail.Rows[rowIndex].Cells["责任描述"].Value = dr["Ordrr_Remark"].ToString();
  143. }
  144. }
  145. string GetEmployeeName(string employeeId ,Dictionary<string, string> dicUserNameList)
  146. {
  147. string[] employeeList = employeeId.Split(',');
  148. string employeeData = "";
  149. foreach (string tempEmployee in employeeList)
  150. {
  151. if (!string.IsNullOrEmpty(tempEmployee))
  152. {
  153. if (dicUserNameList.ContainsKey(tempEmployee))
  154. {
  155. if (employeeData!="")
  156. {
  157. employeeData += ",";
  158. }
  159. employeeData += dicUserNameList[tempEmployee];
  160. }
  161. }
  162. }
  163. return employeeData;
  164. }
  165. }
  166. }