AddClientServiceExecTaskSuperSmallForm.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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.CameraControlBook.SuperSmallForm
  10. {
  11. public partial class AddClientServiceExecTaskSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.AddClientServiceExecTaskSuperSmallForm
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpCustomersTrackRecord ctrbll = new BLL.BLL_ErpCustomersTrackRecord();
  15. public AddClientServiceExecTaskSuperSmallForm()
  16. {
  17. this.Load += AddClientServiceExecTaskSuperSmallForm_Load;
  18. this.Shown += AddClientServiceExecTaskSuperSmallForm_Shown;
  19. this.btnSaveed.Click += btnSaveed_Click;
  20. this.btnCancel.Click += btnCancel_Click;
  21. this.btnSet.Click += btnSet_Click;
  22. this.cmbtreevClientName.ComboBoxTree_NodeMouseClick += cmbtreevClientName_ComboBoxTree_NodeMouseClick;
  23. this.txtLength.KeyPress += txtLength_KeyPress;
  24. }
  25. /// <summary>
  26. /// 任务类型
  27. /// </summary>
  28. public string StrTaskType = "";
  29. /// <summary>
  30. /// 任务项目
  31. /// </summary>
  32. public string StrTaskItem = "";
  33. /// <summary>
  34. /// 任务编号
  35. /// </summary>
  36. public string StrTaskNumber = "";
  37. /// <summary>
  38. /// 客户组编号
  39. /// </summary>
  40. public string StrClientGroupNumber = "";
  41. /// <summary>
  42. /// 客户编号
  43. /// </summary>
  44. public string StrClientNumber = "";
  45. /// <summary>
  46. /// 医院编号
  47. /// </summary>
  48. public string StrHospitalNumber = "";
  49. /// <summary>
  50. /// 任务完成时间
  51. /// </summary>
  52. public string StrClientServiceDateTime = "";
  53. /// <summary>
  54. /// 任务完成说明
  55. /// </summary>
  56. public string StrCompletionRemark = "";
  57. /// <summary>
  58. /// 是否保存
  59. /// </summary>
  60. public bool IsSaveed = false;
  61. /// <summary>
  62. /// 当前登录者的ID
  63. /// </summary>
  64. string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  65. /// <summary>
  66. /// 窗体加载事件
  67. /// </summary>
  68. /// <param name="sender"></param>
  69. /// <param name="e"></param>
  70. void AddClientServiceExecTaskSuperSmallForm_Load(object sender, EventArgs e)
  71. {
  72. this.dtDateTime.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
  73. #region 获取客户数据
  74. DataTable tbl = new DataTable();
  75. if (!string.IsNullOrEmpty(this.StrClientGroupNumber))
  76. { tbl = orbll.GetView_Custom("tb_ErpCustomerGroupMembers left join tb_ErpCustomer on Cus_CustomerNumber=GM_CustomerID", StrWhere: "GM_CustomerGroupID='" + this.StrClientGroupNumber + "'", ShowColumnName: "Cus_Name,Cus_CustomerNumber,Cus_Telephone,GM_Master,GM_ProtagonistCustomer,GM_Relation").Tables[0]; }
  77. else if (!string.IsNullOrEmpty(this.StrClientNumber))
  78. { tbl = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_CustomerNumber='" + this.StrClientNumber + "'", ShowColumnName: "Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0]; }
  79. else if (!string.IsNullOrEmpty(this.StrHospitalNumber))
  80. {
  81. DataTable dt = orbll.GetView_Custom("tb_ErpHospitalClient", StrWhere: "Hct_Oddnumber = '" + this.StrHospitalNumber + "'", ShowColumnName: "*").Tables[0];
  82. if (dt.Rows.Count > 0)
  83. {
  84. System.Windows.Forms.TreeNode root = new System.Windows.Forms.TreeNode();
  85. root.Text = dt.Rows[0]["Hct_CustomerName"].ToString().Trim();
  86. root.Tag = dt.Rows[0]["Hct_CustomerName"].ToString().Trim();
  87. root.Name = dt.Rows[0]["Hct_MyselfMobile"].ToString().Trim();
  88. this.cmbtreevClientName.Nodes.Add(root);
  89. this.cmbtreevClientName.TagFindText(dt.Rows[0]["Hct_CustomerName"].ToString().Trim());
  90. this.txtClientTelephone.Text = dt.Rows[0]["Hct_MyselfMobile"].ToString().Trim();
  91. this.cmbtreevClientName.Enabled = false;
  92. this.txtClientTelephone.Enabled = false;
  93. }
  94. }
  95. if (tbl.Rows.Count > 0)
  96. {
  97. System.Windows.Forms.TreeNode root = null;
  98. if (StrClientGroupNumber != "")
  99. {
  100. string StrCurrentClientNumber = "";
  101. for (int i = 0; i < tbl.Rows.Count; i++)
  102. {
  103. if (tbl.Rows[i]["GM_Master"].ToString().Trim() == "0" && tbl.Rows[i]["GM_ProtagonistCustomer"].ToString() == "1" && tbl.Rows[i]["GM_Relation"].ToString() == "本人")
  104. { continue; }
  105. if (StrCurrentClientNumber == "")
  106. { StrCurrentClientNumber = tbl.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); }
  107. root = new System.Windows.Forms.TreeNode();
  108. root.Text = tbl.Rows[i]["Cus_Name"].ToString();
  109. root.Tag = tbl.Rows[i]["Cus_CustomerNumber"].ToString();
  110. root.Name = tbl.Rows[i]["Cus_Telephone"].ToString();
  111. this.cmbtreevClientName.Nodes.Add(root);
  112. }
  113. this.cmbtreevClientName.TagFindText(StrCurrentClientNumber);
  114. }
  115. else
  116. {
  117. root = new System.Windows.Forms.TreeNode();
  118. root.Text = tbl.Rows[0]["Cus_Name"].ToString();
  119. root.Tag = tbl.Rows[0]["Cus_CustomerNumber"].ToString();
  120. root.Name = tbl.Rows[0]["Cus_Telephone"].ToString();
  121. this.cmbtreevClientName.Nodes.Add(root);
  122. this.cmbtreevClientName.TagFindText(this.StrClientNumber);
  123. }
  124. this.txtClientTelephone.Text = this.cmbtreevClientName.StrGetName;
  125. }
  126. #endregion
  127. }
  128. /// <summary>
  129. /// 窗体加载事件
  130. /// </summary>
  131. /// <param name="sender"></param>
  132. /// <param name="e"></param>
  133. void AddClientServiceExecTaskSuperSmallForm_Shown(object sender, EventArgs e)
  134. {
  135. this.txtTaskType.Text = this.StrTaskType;
  136. this.txtTaskItem.Text = this.StrTaskItem;
  137. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cmbtreevCommunicateMode);
  138. }
  139. /// <summary>
  140. /// 保存
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. void btnSaveed_Click(object sender, EventArgs e)
  145. {
  146. if (string.IsNullOrEmpty(this.cmbtreevClientName.Text.Trim()))
  147. { MessageBoxCustom.Show("客户姓名不能为空!"); return; }
  148. if (string.IsNullOrEmpty(this.dtDateTime.DateValue.Trim()))
  149. { MessageBoxCustom.Show("沟通时间不能为空!"); return; }
  150. if (string.IsNullOrEmpty(this.cmbtreevCommunicateMode.Text.Trim()))
  151. { MessageBoxCustom.Show("沟通方式不能为空!"); return; }
  152. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  153. DateTime StrTime = SDateTime.Now;
  154. LYFZ.Model.Model_ErpCustomersTrackRecord model = new Model.Model_ErpCustomersTrackRecord();
  155. model.TR_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  156. if (!string.IsNullOrEmpty(this.StrClientGroupNumber))
  157. { model.TR_CustomerGroupID = this.StrClientGroupNumber; }
  158. else if (!string.IsNullOrEmpty(this.StrClientNumber))
  159. { model.TR_CustomerGroupID = this.StrClientNumber; }
  160. else if (!string.IsNullOrEmpty(this.StrHospitalNumber))
  161. { model.TR_CustomerGroupID = this.StrHospitalNumber; }
  162. model.TR_CustomerID = this.cmbtreevClientName.Tag.ToString();
  163. model.TR_TracePersonID = StrUserID;
  164. model.TR_TraceDateTime = Convert.ToDateTime(this.dtDateTime.DateValue.Trim());
  165. model.TR_TraceWay = this.cmbtreevCommunicateMode.Text.Trim().ToString();
  166. if (this.txtLength.Text.Trim() != "")
  167. { model.TR_TraceTimeLength = Convert.ToInt32(this.txtLength.Text.Trim()); }
  168. else
  169. { model.TR_TraceTimeLength = 0; }
  170. model.TR_Communicationstatus = "已沟通";
  171. model.TR_Remark = this.txtRemark.Text.Trim().ToString();
  172. model.TR_NextRemindTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
  173. model.TR_TraceType = this.txtTaskType.Text.Trim();
  174. model.TR_SpecificMatters = this.txtTaskItem.Text.Trim();
  175. model.TR_TraceInputTypes = Convert.ToInt32(Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskItem), this.StrTaskItem));
  176. model.TR_CreateDateTime = StrTime;
  177. model.TR_UpdateDateName = this.StrUserID;
  178. model.TR_TaskNumber = this.StrTaskNumber;
  179. clist.Add(ctrbll.GetAddCommandInfo(model));
  180. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  181. {
  182. this.IsSaveed = true;
  183. this.StrCompletionRemark = this.txtRemark.Text.Trim();
  184. this.StrClientServiceDateTime = this.dtDateTime.DateValue.Trim();
  185. this.Close();
  186. }
  187. else
  188. { MessageBoxCustom.Show("保存失败"); }
  189. }
  190. /// <summary>
  191. /// 关闭
  192. /// </summary>
  193. /// <param name="sender"></param>
  194. /// <param name="e"></param>
  195. void btnCancel_Click(object sender, EventArgs e)
  196. {
  197. this.Close();
  198. }
  199. /// <summary>
  200. /// 设置
  201. /// </summary>
  202. /// <param name="sender"></param>
  203. /// <param name="e"></param>
  204. void btnSet_Click(object sender, EventArgs e)
  205. {
  206. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  207. frm.TypeName = "AAAAAAE";
  208. frm.Version = "Version";
  209. if (frm.ShowDialog() == DialogResult.OK)
  210. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cmbtreevCommunicateMode); }
  211. }
  212. /// <summary>
  213. /// 选择客户给客户电话赋值
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="e"></param>
  217. void cmbtreevClientName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  218. {
  219. this.txtClientTelephone.Text = e.Node.Name;
  220. }
  221. /// <summary>
  222. /// 沟通时长
  223. /// </summary>
  224. /// <param name="sender"></param>
  225. /// <param name="e"></param>
  226. void txtLength_KeyPress(object sender, KeyPressEventArgs e)
  227. {
  228. if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
  229. { e.Handled = true; }
  230. }
  231. }
  232. }