FrmOldCustomerRecord.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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. using System.Globalization;
  10. using LYFZ.ComponentLibrary;
  11. using LYFZ.BLL;
  12. using LYFZ.Software.UI.Customers.OldCustomer;
  13. using LYFZ.Model;
  14. using LYFZ.DAL;
  15. namespace LYFZ.Software.MainBusiness.Customers
  16. {
  17. public partial class FrmOldCustomerRecord : LYFZ.Software.UI.Customers.FrmOldCustomerRecord
  18. {
  19. /// <summary>
  20. /// 订单号
  21. /// </summary>
  22. public string Theorderno;
  23. /// <summary>
  24. /// 客户组编号
  25. /// </summary>
  26. string Customergroup;
  27. /// <summary>
  28. /// 主联系人ID
  29. /// </summary>
  30. int masterID;
  31. /// <summary>
  32. /// 是否有修改过
  33. /// </summary>
  34. public bool IsSaved = false;
  35. public FrmOldCustomerRecord()
  36. {
  37. this.btnUnbind.Click += btnUnbind_Click;
  38. this.dgv2.CellDoubleClick += dgv2_CellDoubleClick;
  39. this.chkLKH.Click += chkLKH_Click;
  40. this.chkPYJS.Click += chkPYJS_Click;
  41. this.chkQT.Click += chkQT_Click;
  42. this.btnQQCall.Click += btnQQCall_Click;
  43. this.btnDial.Click += btnDial_Click;
  44. this.txtCus_FixedPhone.KeyPress += txtCus_FixedPhone_KeyPress;
  45. }
  46. LYFZ.BLL.BLL_ErpOrder orbll = new BLL_ErpOrder();
  47. LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL_ErpCustomer();
  48. LYFZ.BLL.BLL_ErpCustomerGroup cgbll = new BLL_ErpCustomerGroup();
  49. /// <summary>
  50. /// 窗体加载事件
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="e"></param>
  54. protected override void FrmOldCustomerRecord_Load(object sender, EventArgs e)
  55. {
  56. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtCus_Telephone);
  57. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtCus_FixedPhone);
  58. this.btnUnbind.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.MicroInfo, CustomAttributes.OperatingAuthority.MicroInfo_Unbind);
  59. this.btnUpdate.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OrdersCustomerCompetence, CustomAttributes.OperatingAuthority.Update);
  60. this.Text = "编辑";
  61. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAC", this.cmbCus_Region, strHideFiled: "");
  62. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAF", this.cmbCus_CustomerSource, strHideFiled: "BFACBABGBGBJGDHIE,BFAFBCBADBDCABFDD");
  63. DataTable dt2 = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_OrderNumber = '" + Theorderno + "'", ShowColumnName: "GP_CustomerSource,GP_CustomerGroupID,GP_CustomerType").Tables[0];
  64. if (dt2.Rows.Count > 0)
  65. {
  66. this.Text = "编辑" + type(dt2.Rows[0]["GP_CustomerType"].ToString()) + "客户";
  67. switch (dt2.Rows[0]["GP_CustomerSource"].ToString().Trim())
  68. {
  69. case "老客户":
  70. this.chkLKH.Checked = true;
  71. this.chkLKH_Click(null, null);
  72. break;
  73. case "朋友介绍":
  74. this.chkPYJS.Checked = true;
  75. this.chkPYJS_Click(null, null);
  76. break;
  77. default:
  78. this.chkQT.Checked = true;
  79. this.chkQT_Click(null, null);
  80. this.cmbCus_CustomerSource.Text = dt2.Rows[0]["GP_CustomerSource"].ToString().Trim();
  81. break;
  82. }
  83. Customergroup = dt2.Rows[0]["GP_CustomerGroupID"].ToString();
  84. DataTable dt = orbll.GetView_Custom("tb_ErpCustomerGroupMembers Left Join tb_ErpCustomer on GM_CustomerID = Cus_CustomerNumber", StrWhere: "GM_CustomerGroupID = '" + Customergroup + "'", ShowColumnName: "tb_ErpCustomer.ID,Cus_Name,Cus_Sex,Cus_Birthday,Cus_BirthdayLunar,Cus_QQ,Cus_MicroSignal,Cus_Zodiac,Cus_DayForMarriage,Cus_DayForMarriageLunar,Cus_Telephone,Cus_FixedPhone,Cus_Region,Cus_Address,Cus_WorkUnit,Cus_CustomerNumber,Cus_Grade,Cus_Type,Cus_OpenID,GM_CustomerGroupID,GM_CustomerID,GM_RelatedPersonID,GM_Relation,tb_ErpCustomerGroupMembers.ID as GMID", filedOrder: "tb_ErpCustomer.ID").Tables[0];
  85. for (int t = 0; t < dt.Rows.Count; t++)
  86. {
  87. if (dt.Rows[t]["GM_Relation"].ToString().Trim() != "本人")
  88. {
  89. DataGridViewRow dgvr = new DataGridViewRow();
  90. DataGridViewCell cell = null;
  91. //姓名 0
  92. cell = new DataGridViewTextBoxCell();
  93. cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim();
  94. dgvr.Cells.Add(cell);
  95. //性别 1
  96. cell = new DataGridViewTextBoxCell();
  97. cell.Value = Convert.ToBoolean(dt.Rows[t]["Cus_Sex"]) == false ? "男" : "女";
  98. dgvr.Cells.Add(cell);
  99. //生日 2
  100. cell = new DataGridViewTextBoxCell();
  101. cell.Value = dt.Rows[t]["Cus_Birthday"].ToString().Trim();
  102. dgvr.Cells.Add(cell);
  103. //生日历类 3
  104. cell = new DataGridViewTextBoxCell();
  105. cell.Value = Lunar(dt.Rows[t]["Cus_BirthdayLunar"].ToString().Trim());
  106. dgvr.Cells.Add(cell);
  107. //QQ 4
  108. cell = new DataGridViewTextBoxCell();
  109. cell.Value = dt.Rows[t]["Cus_QQ"].ToString().Trim();
  110. dgvr.Cells.Add(cell);
  111. //微信 5
  112. cell = new DataGridViewTextBoxCell();
  113. cell.Value = dt.Rows[t]["Cus_MicroSignal"].ToString().Trim();
  114. dgvr.Cells.Add(cell);
  115. //手机 6
  116. cell = new DataGridViewTextBoxCell();
  117. cell.Value = dt.Rows[t]["Cus_Telephone"].ToString().Trim();
  118. dgvr.Cells.Add(cell);
  119. //固定电话 7
  120. cell = new DataGridViewTextBoxCell();
  121. cell.Value = dt.Rows[t]["Cus_FixedPhone"].ToString().Trim();
  122. dgvr.Cells.Add(cell);
  123. //地区 8
  124. cell = new DataGridViewTextBoxCell();
  125. cell.Value = dt.Rows[t]["Cus_Region"].ToString().Trim();
  126. dgvr.Cells.Add(cell);
  127. //地址 9
  128. cell = new DataGridViewTextBoxCell();
  129. cell.Value = dt.Rows[t]["Cus_Address"].ToString().Trim();
  130. dgvr.Cells.Add(cell);
  131. //工作单位 10
  132. cell = new DataGridViewTextBoxCell();
  133. cell.Value = dt.Rows[t]["Cus_WorkUnit"].ToString().Trim();
  134. dgvr.Cells.Add(cell);
  135. //ID 11
  136. cell = new DataGridViewTextBoxCell();
  137. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  138. dgvr.Cells.Add(cell);
  139. //联系人 12
  140. cell = new DataGridViewTextBoxCell();
  141. cell.Value = dt.Rows[t]["GM_Relation"].ToString().Trim();
  142. dgvr.Cells.Add(cell);
  143. //客户编号 14
  144. cell = new DataGridViewTextBoxCell();
  145. cell.Value = dt.Rows[t]["Cus_CustomerNumber"].ToString().Trim();
  146. dgvr.Cells.Add(cell);
  147. // //GM客户组表ID 13
  148. cell = new DataGridViewTextBoxCell();
  149. cell.Value = dt.Rows[t]["GMID"].ToString().Trim();
  150. dgvr.Cells.Add(cell);
  151. dgv2.Rows.Add(dgvr);
  152. }
  153. else
  154. {
  155. #region 赋值
  156. string Cus_BirthdayLunar = dt.Rows[t]["Cus_BirthdayLunar"].ToString();
  157. if (Cus_BirthdayLunar.ToString() == "1")
  158. { this.chkCus_Lunar.Checked = true; }
  159. //姓名
  160. txtCus_Name.Text = dt.Rows[t]["Cus_Name"].ToString();
  161. //生日
  162. txtCus_Birthday.Text = dt.Rows[t]["Cus_Birthday"].ToString();
  163. //QQ
  164. txtCus_QQ.Text = dt.Rows[t]["Cus_QQ"].ToString();
  165. //微信
  166. txtCus_MicroSignal.Text = dt.Rows[t]["Cus_MicroSignal"].ToString();
  167. //手机
  168. txtCus_Telephone.Text = dt.Rows[t]["Cus_Telephone"].ToString();
  169. //固定电话
  170. txtCus_FixedPhone.Text = dt.Rows[t]["Cus_FixedPhone"].ToString();
  171. //区域
  172. cmbCus_Region.Text = dt.Rows[t]["Cus_Region"].ToString();
  173. //地址
  174. txtCus_Address.Text = dt.Rows[t]["Cus_Address"].ToString();
  175. //单位
  176. txtCus_WorkUnit.Text = dt.Rows[t]["Cus_WorkUnit"].ToString();
  177. //来源
  178. // cmbCus_CustomerSource.Text = dt.Rows[t]["Cus_Name"].ToString();
  179. //性别
  180. if (!Convert.ToBoolean(dt.Rows[t]["Cus_Sex"]))
  181. { this.radCus_Nan.Checked = true; }
  182. else
  183. { this.radCus_Nv.Checked = true; }
  184. /*if (!string.IsNullOrEmpty(dt.Rows[t]["Cus_OpenID"].ToString().Trim()))
  185. { this.txtMicroID.Text = "已绑定"; }
  186. else
  187. { this.txtMicroID.Text = "未绑定"; }*/
  188. BindMicroData(dt.Rows[t]["Cus_CustomerNumber"].ToString());
  189. masterID = Convert.ToInt32(dt.Rows[t]["ID"]);
  190. #endregion
  191. }
  192. }
  193. }
  194. else
  195. { MessageBoxCustom.Show("此订单没有用户"); }
  196. }
  197. /// <summary>
  198. /// 客户微信绑定
  199. /// </summary>
  200. void BindMicroData(string customerID)
  201. {
  202. BLL_CustomerAndWxOpen bllWxOpen = new BLL_CustomerAndWxOpen();
  203. DataTable dt = bllWxOpen.GetCustomerDataByCustomerID(customerID);
  204. BLL.BLL_ErpMicroInterface bllInterface = new BLL.BLL_ErpMicroInterface();
  205. LYFZ.Model.Model_ErpMicroInterface modInterFace = new Model.Model_ErpMicroInterface();
  206. modInterFace = bllInterface.GetModelMicroInterface(LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID);
  207. if (string.IsNullOrEmpty(modInterFace.AppID))
  208. {
  209. modInterFace.AppID = "";
  210. }
  211. DataRow[] drList = dt.Select(" APPID = '" + modInterFace.AppID + "' ");
  212. if (drList.Length > 0)
  213. { this.txtMicroID.Text = "已绑定"; }
  214. else
  215. { this.txtMicroID.Text = "未绑定"; }
  216. }
  217. /// <summary>
  218. /// 解除客户微信绑定
  219. /// </summary>
  220. /// <param name="customerID"></param>
  221. bool UnBindMicroData(string customerID)
  222. {
  223. BLL_CustomerAndWxOpen bllWxOpen = new BLL_CustomerAndWxOpen();
  224. DataTable dt = bllWxOpen.GetCustomerDataByCustomerID(customerID);
  225. BLL.BLL_ErpMicroInterface bllInterface = new BLL.BLL_ErpMicroInterface();
  226. LYFZ.Model.Model_ErpMicroInterface modInterFace = new Model.Model_ErpMicroInterface();
  227. modInterFace = bllInterface.GetModelMicroInterface(LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID);
  228. if(string.IsNullOrEmpty( modInterFace.AppID))
  229. {
  230. modInterFace.AppID = "";
  231. }
  232. DataRow[] drList = dt.Select(" APPID = '" + modInterFace.AppID + "' ");
  233. if (drList.Length > 0)
  234. {
  235. bllWxOpen.Delete(drList[0]["ID"]);
  236. dt = bllWxOpen.GetCustomerDataByCustomerID(customerID);
  237. string strOpenID = "";
  238. for (int i = 0; i < dt.Rows.Count; i++)
  239. {
  240. if (!string.IsNullOrEmpty(strOpenID))
  241. {
  242. strOpenID += "/";
  243. }
  244. strOpenID += dt.Rows[i]["APPID"] + ":" + dt.Rows[i]["WxOpenId"];
  245. }
  246. Model_ErpCustomer model = ctbll.GetModel(Convert.ToInt32(this.masterID));
  247. model.Cus_OpenID = strOpenID;
  248. ctbll.Update(model);
  249. return true;
  250. //this.txtMicroID.Text = "已绑定";
  251. }
  252. else
  253. {
  254. return false;
  255. }
  256. }
  257. /// <summary>
  258. /// 修改客户资料
  259. /// </summary>
  260. /// <param name="sender"></param>
  261. /// <param name="e"></param>
  262. protected override void btnUpdate_Click(object sender, EventArgs e)
  263. {
  264. Model_ErpCustomer model = ctbll.GetModel(masterID);
  265. Model_ErpCustomerGroup gpmodel = cgbll.GetModel("GP_OrderNumber", Theorderno);
  266. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  267. try
  268. {
  269. #region 验证输入框不能为空
  270. if (string.IsNullOrEmpty(txtCus_Name.Text))
  271. { MessageBoxCustom.Show("客户姓名不能为空!"); return; }
  272. if (string.IsNullOrEmpty(txtCus_Telephone.Text))
  273. { MessageBoxCustom.Show("客户手机不能为空!"); return; }
  274. string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCus_Telephone);
  275. if (!string.IsNullOrEmpty(StrPhone))
  276. {
  277. if (StrPhone.Length != 11)
  278. { MessageBoxCustom.Show("手机号码必须为11位数!"); return; }
  279. DataTable tblClient = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_Telephone = '" + StrPhone + "' and ID != '" + masterID + "'", ShowColumnName: "ID").Tables[0];
  280. if (tblClient.Rows.Count > 0)
  281. { MessageBoxCustom.Show("手机号已存在"); return; }
  282. }
  283. int intMasse = this.txtCus_Birthday.CheckDateValue(this.txtCus_Birthday, this.chkCus_Lunar);
  284. if (intMasse == 1) { MessageBoxCustom.Show("客户生日日期格式输入错误!"); return; }
  285. else if (intMasse == 2)
  286. { MessageBoxCustom.Show("客户生日:" + this.txtCus_Birthday.StrValue.Trim() + "不是公历日期,若要保存请勾上农历!"); return; }
  287. if (chkLKH.Checked == false && chkQT.Checked == false && chkPYJS.Checked == false)
  288. { MessageBoxCustom.Show("请选择客户来源"); return; }
  289. #endregion
  290. model.Cus_Name = LYFZ.BLL.OtherCommonModel.ClearSpecialCharacter(this.txtCus_Name.Text);
  291. model.Cus_NamePinyin = LYFZ.Command.Command_ChineseToPinyin.GetChineseSpellPinyin(model.Cus_Name).ToLower();
  292. if (this.radCus_Nan.Checked == true)
  293. { model.Cus_Sex = false; }
  294. else
  295. { model.Cus_Sex = true; }
  296. model.Cus_Birthday = "";
  297. model.Cus_BirthdayLunar = "";
  298. model.Cus_Zodiac = "";
  299. if (txtCus_Birthday.StrValue.Trim() != "")
  300. {
  301. model.Cus_Birthday = txtCus_Birthday.StrValue.Trim();
  302. model.Cus_Zodiac = LYFZ.Command.Command_CalendarTurnLunar.GetZodiac(this.txtCus_Birthday.StrValue.Trim(), this.chkCus_Lunar.Checked);
  303. if (chkCus_Lunar.Checked == true)
  304. { model.Cus_BirthdayLunar = "1"; }
  305. else
  306. { model.Cus_BirthdayLunar = "0"; }
  307. }
  308. model.Cus_QQ = this.txtCus_QQ.Text;
  309. model.Cus_MicroSignal = this.txtCus_MicroSignal.Text;
  310. model.Cus_Telephone = StrPhone;
  311. model.Cus_FixedPhone = this.txtCus_FixedPhone.Text;
  312. model.Cus_Region = this.cmbCus_Region.Text;
  313. model.Cus_Address = this.txtCus_Address.Text;
  314. model.Cus_WorkUnit = this.txtCus_WorkUnit.Text;
  315. model.Cus_CustomerSource = cmbCus_CustomerSource.Text;
  316. model.Cus_UpdateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  317. model.Cus_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  318. clist.Add(ctbll.GetUpdateCommandInfo(model));
  319. if (this.chkLKH.Checked == true)
  320. {
  321. gpmodel.GP_CustomerSource = "老客户";
  322. gpmodel.GP_IntroducerCustomerID = "";
  323. }
  324. if (this.chkPYJS.Checked == true)
  325. { gpmodel.GP_CustomerSource = "朋友介绍"; }
  326. if (chkQT.Checked == true)
  327. {
  328. gpmodel.GP_CustomerSource = cmbCus_CustomerSource.Text.Trim();
  329. gpmodel.GP_IntroducerCustomerID = "";
  330. }
  331. clist.Add(cgbll.GetUpdateCommandInfo(gpmodel));
  332. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) >= 0)
  333. {
  334. DAL_ErpCustomer.UpdateAggregationCustomer(Theorderno);
  335. this.IsSaved = true;
  336. //日志
  337. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.修改客户资料, "联系人:" + model.Cus_Name + ",修改联系人资料的客户组:" + gpmodel.GP_CustomerGroupID + ",时间:" + SDateTime.Now, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  338. MessageBoxCustom.Show("保存成功");
  339. }
  340. else
  341. { MessageBoxCustom.Show("保存失败"); }
  342. }
  343. catch (Exception ex)
  344. { MessageBoxCustom.Show(ex.Message); }
  345. }
  346. /// <summary>
  347. /// 解绑
  348. /// </summary>
  349. /// <param name="sender"></param>
  350. /// <param name="e"></param>
  351. void btnUnbind_Click(object sender, EventArgs e)
  352. {
  353. if (this.txtMicroID.Text.Trim() == "已绑定")
  354. {
  355. if (MessageBoxCustom.Show("是否要解除绑定?", "温馨提示!", MessageBoxButtons.YesNo) == DialogResult.No)
  356. { return; }
  357. LYFZ.Model.Model_ErpCustomer model = ctbll.GetModel(Convert.ToInt32(this.masterID));
  358. model.Cus_OpenID = "";
  359. model.Cus_UpdateDateTime = SDateTime.Now;
  360. model.Cus_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  361. ctbll.Update(model);
  362. if (UnBindMicroData(model.Cus_CustomerNumber))
  363. {
  364. MessageBoxCustom.Show("解绑成功!");
  365. this.txtMicroID.Text = "未绑定";
  366. }
  367. else
  368. { MessageBoxCustom.Show("解绑失败"); }
  369. }
  370. }
  371. /// <summary>
  372. /// 获取客户资料做修改
  373. /// </summary>
  374. /// <param name="sender"></param>
  375. /// <param name="e"></param>
  376. void dgv2_CellDoubleClick(object sender, EventArgs e)
  377. {
  378. try
  379. {
  380. if (dgv2.Rows.Count > 0)
  381. {
  382. bool IsUpdate = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OrdersCustomerCompetence, CustomAttributes.OperatingAuthority.Update);
  383. LYFZ.Software.MainBusiness.Customers.OldCustomer.FrmAddContacts frm = new OldCustomer.FrmAddContacts();
  384. frm.btnSave.Enabled = IsUpdate;
  385. frm.Zhuangtai = "编辑";
  386. frm.GP = Customergroup.Trim();
  387. frm.YouID = dgv2.CurrentRow.Cells["ID"].Value.ToString().Trim();
  388. frm.GMID = dgv2.CurrentRow.Cells["GMID"].Value.ToString().Trim();
  389. if (frm.ShowDialog() == DialogResult.OK)
  390. {
  391. this.IsSaved = true;
  392. this.dgv2.Rows.Clear();
  393. this.FrmOldCustomerRecord_Load(null, null);
  394. }
  395. }
  396. }
  397. catch (Exception ex)
  398. { MessageBoxCustom.Show(ex.Message); }
  399. }
  400. /// <summary>
  401. /// 设置客户来源
  402. /// </summary>
  403. /// <param name="sender"></param>
  404. /// <param name="e"></param>
  405. protected override void btnCustomerSource_Click(object sender, EventArgs e)
  406. {
  407. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
  408. set.TypeName = "AAAAAAF";
  409. set.Version = "Version";
  410. if (set.ShowDialog() == DialogResult.OK)
  411. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAF", this.cmbCus_CustomerSource, strHideFiled: "BFACBABGBGBJGDHIE,BFAFBCBADBDCABFDD"); }
  412. }
  413. /// <summary>
  414. /// 设置客户区域
  415. /// </summary>
  416. /// <param name="sender"></param>
  417. /// <param name="e"></param>
  418. protected override void btnRegion_Click(object sender, EventArgs e)
  419. {
  420. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet set = new InitialSet.FrmSystemSet();
  421. set.TypeName = "AAAAAAC";
  422. set.Version = "Version";
  423. if (set.ShowDialog() == DialogResult.OK)
  424. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAC", this.cmbCus_Region, strHideFiled: ""); }
  425. }
  426. /// <summary>
  427. /// 打电话
  428. /// </summary>
  429. /// <param name="sender"></param>
  430. /// <param name="e"></param>
  431. void btnDial_Click(object sender, EventArgs e)
  432. {
  433. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(this.txtCus_Telephone);
  434. }
  435. /// <summary>
  436. /// QQ呼叫
  437. /// </summary>
  438. /// <param name="sender"></param>
  439. /// <param name="e"></param>
  440. void btnQQCall_Click(object sender, EventArgs e)
  441. {
  442. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.QQCall(txtCus_QQ.Text.Trim());
  443. }
  444. /// <summary>
  445. /// 关闭
  446. /// </summary>
  447. /// <param name="sender"></param>
  448. /// <param name="e"></param>
  449. protected override void btnClose_Click(object sender, EventArgs e)
  450. {
  451. this.Close();
  452. }
  453. #region 文本框输入
  454. void txtCus_FixedPhone_KeyPress(object sender, KeyPressEventArgs e)
  455. {
  456. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  457. {
  458. e.Handled = true;
  459. }
  460. }
  461. protected override void txtCus_Telephone_KeyPress(object sender, KeyPressEventArgs e)
  462. {
  463. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  464. {
  465. e.Handled = true;
  466. }
  467. }
  468. protected override void txtCus_QQ_KeyPress(object sender, KeyPressEventArgs e)
  469. {
  470. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  471. {
  472. e.Handled = true;
  473. }
  474. }
  475. #endregion
  476. #region 单选框事件
  477. void chkQT_Click(object sender, EventArgs e)
  478. {
  479. try
  480. {
  481. chkLKH.Checked = false;
  482. chkPYJS.Checked = false;
  483. cmbCus_CustomerSource.Enabled = true;
  484. }
  485. catch (Exception ex)
  486. { MessageBoxCustom.Show(ex.Message); }
  487. }
  488. void chkPYJS_Click(object sender, EventArgs e)
  489. {
  490. try
  491. {
  492. cmbCus_CustomerSource.Enabled = false;
  493. chkLKH.Checked = false;
  494. chkQT.Checked = false;
  495. }
  496. catch (Exception ex)
  497. { MessageBoxCustom.Show(ex.Message); }
  498. }
  499. void chkLKH_Click(object sender, EventArgs e)
  500. {
  501. try
  502. {
  503. chkPYJS.Checked = false;
  504. chkQT.Checked = false;
  505. cmbCus_CustomerSource.Enabled = false;
  506. }
  507. catch (Exception ex)
  508. { MessageBoxCustom.Show(ex.Message); }
  509. }
  510. #endregion
  511. /// <summary>
  512. /// 返回日历类别
  513. /// </summary>
  514. /// <param name="lun"></param>
  515. /// <returns></returns>
  516. string Lunar(string lun)
  517. {
  518. string luns = "";
  519. switch (lun)
  520. {
  521. case "0": luns = "公历"; break;
  522. case "1": luns = "农历"; break;
  523. case "2": luns = "农历润月"; break;
  524. }
  525. return luns;
  526. }
  527. /// <summary>
  528. /// 返回类型的中文
  529. /// </summary>
  530. /// <param name="py"></param>
  531. /// <returns></returns>
  532. string type(string py)
  533. {
  534. string pyE = "";
  535. switch (py)
  536. {
  537. case "3": pyE = "服务"; break;
  538. case "0": pyE = "婚纱"; break;
  539. case "1": pyE = "儿童"; break;
  540. case "2": pyE = "写真"; break;
  541. }
  542. return pyE;
  543. }
  544. }
  545. }