OrderClientParentsControlsEx.cs 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using LYFZ.ComponentLibrary;
  10. using LYFZ.Model.API;
  11. namespace LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls
  12. {
  13. public partial class OrderClientParentsControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer();
  17. LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
  18. bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
  19. public OrderClientParentsControlsEx()
  20. {
  21. if (this.IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator())
  22. {
  23. this.txtCusTelephone.PasswordChar = '*';
  24. this.txtCusFixedPhone.PassChar = '*';
  25. }
  26. this.PictEdit.Click += PictEdit_Click;
  27. this.PictReset.Click += PictReset_Click;
  28. this.PictDelete.Click += PictDelete_Click;
  29. this.btnTips.Click += btnTips_Click;
  30. this.btnDial.Click += btnDial_Click;
  31. this.btnQQCall.Click += btnQQCall_Click;
  32. this.btnSet.Click += btnSet_Click;
  33. this.btnSetRegion.Click += btnSetRegion_Click;
  34. this.txtCusName.EventTextBoxEx_TextChanged += txtCusName_EventTextBoxEx_TextChanged;
  35. this.txtCusName.KeyDown += txtCusName_KeyDown;
  36. this.txtCusTelephone.TextChanged += txtCusTelephone_TextChanged;
  37. this.txtCusTelephone.Leave += txtCusTelephone_Leave;
  38. this.txtCusTelephone.KeyDown += txtCusTelephone_KeyDown;
  39. this.txtCusAddress.KeyPress += txtCusAddress_KeyPress;
  40. this.txtCusFixedPhone.KeyPress += txtCusFixedPhone_KeyPress;
  41. this.txtCusName.KeyPress += txtCusName_KeyPress;
  42. this.txtCusQQ.KeyPress += txtCusQQ_KeyPress;
  43. this.txtCusWorkUnit.KeyPress += txtCusWorkUnit_KeyPress;
  44. // 权限
  45. this.btnSetRegion.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClientRegionSet);
  46. this.btnSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClientRelationSet);
  47. this.panelIDNumber.Visible = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber;
  48. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("BFABDBAJBJCEBDJCJ", this.cmbtreevCusRelation);
  49. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("AAAAAAC", this.cmbtreevCusRegion, true);
  50. }
  51. /// <summary>
  52. /// 是否是修改订单(从订单报表、保存后这里都会为true)
  53. /// </summary>
  54. public bool IsUpdateOrderLoad = false;
  55. public delegate void OrderClientParents_PictDeleteClick(LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx senderEx);
  56. /// <summary>
  57. /// 用event 关键字声明事件对象
  58. /// </summary>
  59. [Category("控件扩展事件"), Description("删除客户")]
  60. public event OrderClientParents_PictDeleteClick DeleteClick;
  61. /// <summary>
  62. /// 删除事件
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void PictDelete_Click(object sender, EventArgs e)
  67. {
  68. if (this.DeleteClick != null)
  69. {
  70. if (MessageBoxCustom.Show("你确定要删除吗!", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  71. { return; }
  72. this.DeleteClick(this);
  73. this.Parent.Controls.Remove(this);
  74. }
  75. }
  76. /// <summary>
  77. /// 重置
  78. /// </summary>
  79. /// <param name="sender"></param>
  80. /// <param name="e"></param>
  81. private void PictReset_Click(object sender, EventArgs e)
  82. {
  83. if (MessageBoxCustom.Show("重置后数据将会清空,您确定要重置吗?", "温馨提示", MessageBoxButtons.YesNo) != DialogResult.No)
  84. {
  85. this.SetClientValue(null);
  86. this.IsPictEditShow = false;
  87. this.IsPictResetShow = false;
  88. }
  89. }
  90. /// <summary>
  91. /// 编辑
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. private void PictEdit_Click(object sender, EventArgs e)
  96. {
  97. this.SetClientEdit(this.IsUpdateOrderLoad);
  98. }
  99. public delegate string OrderClientParents_IsExistClient(string StrControlsName, string StrClientNumber);
  100. /// <summary>
  101. /// 用event 关键字声明事件对象
  102. /// </summary>
  103. [Category("控件扩展事件"), Description("提示详情")]
  104. public event OrderClientParents_IsExistClient IsExistClient;
  105. /// <summary>
  106. /// 提示详情
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. void btnTips_Click(object sender, EventArgs e)
  111. {
  112. string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  113. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrderHistoryCustomerSuperSmallForm frm = new SuperSmallForm.OrderHistoryCustomerSuperSmallForm();
  114. if (this.txtCusName.Text.Trim().Length > 0 && StrPhone.Length > 0)
  115. { frm.StrWhere = "Cus_Telephone Like '" + StrPhone.Trim() + "%' And Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
  116. else if (this.txtCusName.Text.Trim().Length > 0 && StrPhone.Length <= 0)
  117. { frm.StrWhere = "Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
  118. else if (this.txtCusName.Text.Trim().Length <= 0 && StrPhone.Length > 0)
  119. { frm.StrWhere = "Cus_Telephone Like '" + StrPhone.Trim() + "%'"; }
  120. //if (!Convert.ToBoolean(this.btnTips.Tag))
  121. //{
  122. // string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  123. // frm.StrWhere = "Cus_Telephone Like '" + StrPhone.Trim() + "%'";
  124. //}
  125. //else
  126. //{ frm.StrWhere = " Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
  127. frm.ShowDialog();
  128. if (frm.IsSaveed)
  129. {
  130. if (this.IsExistClient != null && !string.IsNullOrEmpty(frm.model.Cus_CustomerNumber.Trim()))
  131. {
  132. //判断是否有相同客户存在
  133. string StrTitleName = this.IsExistClient(this.Name.Trim(), frm.model.Cus_CustomerNumber);
  134. if (!string.IsNullOrEmpty(StrTitleName))
  135. {
  136. this.panelTips.Visible = false;
  137. this.txtTips.Text = "";
  138. MessageBoxCustom.Show("你选择的客户在" + StrTitleName + "已存在,一个订单不能同时存在两个相同的客户");
  139. return;
  140. }
  141. }
  142. //获取选择的客户是否存在意向订单
  143. DataTable tbl = orbll.GetView_Custom("View_CustomerGroupAndCustomerGroupMembersAndErpCustomer", StrWhere: "GP_GroupType = '2' and Cus_CustomerNumber = '" + frm.model.Cus_CustomerNumber + "'", ShowColumnName: "GP_CustomerGroupID", GroupBy: "GP_CustomerGroupID,GP_OrderNumber").Tables[0];
  144. if (tbl.Rows.Count > 0)
  145. {
  146. //如果只存在一个意向订单,那么就直接提示是否要获取
  147. if (tbl.Rows.Count == 1)
  148. {
  149. DataTable tblOrderNumber = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_CustomerGroupID = '" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim() + "'", ShowColumnName: "GP_OrderNumber").Tables[0];
  150. if (tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim() != "")
  151. {
  152. if (MessageBoxCustom.Show("根据你选择的客户:'" + frm.model.Cus_Name.Trim() + "' 电话:'" + frm.model.Cus_Telephone + "' 系统查找到'" + frm.model.Cus_Name.Trim() + "'有一个未完成的意向订单,您是否要对意向订单进行完成订单?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  153. {
  154. if (this.UpdateOrderGroup != null)
  155. { this.UpdateOrderGroup("OrderNumber|" + tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim()); }
  156. }
  157. }
  158. else
  159. {
  160. if (!lblClientName.Text.Contains("其他联系人"))
  161. {
  162. if (MessageBoxCustom.Show("根据你选择的客户:'" + frm.model.Cus_Name.Trim() + "' 电话:'" + frm.model.Cus_Telephone + "' 系统查找到'" + frm.model.Cus_Name.Trim() + "'有一个未完成的意向客户组,您是否要对意向客户组进行完成订单?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  163. {
  164. if (this.UpdateOrderGroup != null)
  165. {
  166. this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim());
  167. }
  168. }
  169. }
  170. }
  171. }
  172. else
  173. {
  174. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.SelectIntentClientSuperSmallForm frmIntent = new SuperSmallForm.SelectIntentClientSuperSmallForm();
  175. frmIntent.StrInputClientName = frm.model.Cus_Name.Trim();
  176. frmIntent.tblOrderGroup = tbl;
  177. frmIntent.ShowDialog();
  178. if (!frmIntent.IsSaveed)
  179. { return; }
  180. if (!string.IsNullOrEmpty(frmIntent.SelectOrderNumber))
  181. { this.UpdateOrderGroup("IntentClient|" + tbl.Rows[0]["GP_OrderNumber"].ToString().Trim() + "," + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim()); }
  182. else
  183. {
  184. if (this.UpdateOrderGroup != null)
  185. {
  186. if (!lblClientName.Text.Contains("其他联系人"))
  187. {
  188. this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim());
  189. }
  190. }
  191. }
  192. }
  193. }
  194. this.SetClientValue(frm.model, true);
  195. this.IsPictResetShow = true;
  196. this.IsPictEditShow = true;
  197. }
  198. }
  199. /// <summary>
  200. /// 拨打电话
  201. /// </summary>
  202. /// <param name="sender"></param>
  203. /// <param name="e"></param>
  204. void btnDial_Click(object sender, EventArgs e)
  205. {
  206. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(this.txtCusTelephone);
  207. }
  208. /// <summary>
  209. /// QQ呼叫
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. void btnQQCall_Click(object sender, EventArgs e)
  214. {
  215. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.QQCall(this.txtCusQQ.Text.Trim());
  216. }
  217. public delegate void OrderClientParents_RelationSet(object obj);
  218. /// <summary>
  219. /// 用event 关键字声明事件对象
  220. /// </summary>
  221. [Category("控件扩展事件"), Description("关系设置")]
  222. public event OrderClientParents_RelationSet RelationSet;
  223. /// <summary>
  224. /// 设置
  225. /// </summary>
  226. /// <param name="sender"></param>
  227. /// <param name="e"></param>
  228. void btnSet_Click(object sender, EventArgs e)
  229. {
  230. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  231. frm.TypeName = "BFABDBAJBJCEBDJCJ";
  232. frm.Version = "Version";
  233. if (frm.ShowDialog() == DialogResult.OK)
  234. {
  235. if (this.RelationSet != null)
  236. { this.RelationSet(this.cmbtreevCusRelation); }
  237. else
  238. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("BFABDBAJBJCEBDJCJ", this.cmbtreevCusRelation); }
  239. }
  240. }
  241. public delegate void OrderClientParents_RegionSet(object obj);
  242. /// <summary>
  243. /// 用event 关键字声明事件对象
  244. /// </summary>
  245. [Category("控件扩展事件"), Description("地区设置")]
  246. public event OrderClientParents_RegionSet RegionSet;
  247. /// <summary>
  248. /// 地区设置
  249. /// </summary>
  250. /// <param name="sender"></param>
  251. /// <param name="e"></param>
  252. void btnSetRegion_Click(object sender, EventArgs e)
  253. {
  254. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  255. frm.TypeName = "AAAAAAC";
  256. frm.Version = "Version";
  257. if (frm.ShowDialog() == DialogResult.OK)
  258. {
  259. if (this.RegionSet != null)
  260. { this.RegionSet(this.cmbtreevCusRegion); }
  261. else
  262. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("AAAAAAC", this.cmbtreevCusRegion, true); }
  263. }
  264. }
  265. /// <summary>
  266. /// 姓名输入事件——模糊查询
  267. /// </summary>
  268. /// <param name="sender"></param>
  269. /// <param name="e"></param>
  270. void txtCusName_EventTextBoxEx_TextChanged(object sender, EventArgs e)
  271. {
  272. if (this.IsTextChanged)
  273. {
  274. this.txtCusName.Tag = "";
  275. this.txtTips.Text = "";
  276. this.panelTips.Visible = false;
  277. if (this.txtCusName.Text.Trim() != "")
  278. {
  279. string StrWhere = "";
  280. string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  281. if (StrPhone.Length > 0)
  282. { StrWhere = " And Cus_Telephone Like '" + StrPhone.Trim() + "%'"; }
  283. DataTable tbl = ctbll.GetListCustomer("Cus_Name", "Cus_Name like '" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'" + StrWhere).Tables[0];
  284. if (tbl.Rows.Count > 0)
  285. {
  286. this.btnTips.Tag = true;
  287. this.panelTips.Visible = true;
  288. this.txtTips.Text = "找到类似客户:" + tbl.Rows.Count + " (根据名字和电话查找)";
  289. }
  290. }
  291. }
  292. }
  293. /// <summary>
  294. /// 姓名输入后回车
  295. /// </summary>
  296. /// <param name="sender"></param>
  297. /// <param name="e"></param>
  298. void txtCusName_KeyDown(object sender, KeyEventArgs e)
  299. {
  300. if (e.KeyCode == Keys.Enter)
  301. {
  302. if (this.btnTips.Visible)
  303. { this.btnTips_Click(this, null); }
  304. }
  305. }
  306. public delegate void OrderClientParents_UpdateOrderGroup(object obj);
  307. /// <summary>
  308. /// 用event 关键字声明事件对象
  309. /// </summary>
  310. [Category("控件扩展事件"), Description("地区设置")]
  311. public event OrderClientParents_UpdateOrderGroup UpdateOrderGroup;
  312. /// <summary>
  313. /// 电话输入事件——模糊查询
  314. /// </summary>
  315. /// <param name="sender"></param>
  316. /// <param name="e"></param>
  317. void txtCusTelephone_TextChanged(object sender, EventArgs e)
  318. {
  319. if (this.IsTextChanged)
  320. {
  321. this.panelTips.Visible = false;
  322. this.txtTips.Text = "";
  323. string CusTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  324. if (CusTelephone != "" && CusTelephone.Trim().Length > 6)
  325. {
  326. if (CusTelephone.Length == 11)
  327. {
  328. DataTable dtRow = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_Telephone Like '" + CusTelephone + "%'", ShowColumnName: "ID, Cus_CustomerNumber, Cus_Telephone, Cus_Name").Tables[0];
  329. if (dtRow.Rows.Count > 0)
  330. {
  331. DataTable tbl = orbll.GetView_Custom("View_CustomerGroupAndCustomerGroupMembersAndErpCustomer", StrWhere: "GP_GroupType = '2' and Cus_CustomerNumber = '" + dtRow.Rows[0]["Cus_CustomerNumber"].ToString().Trim() + "'", ShowColumnName: "GP_CustomerGroupID", GroupBy: "GP_CustomerGroupID").Tables[0];
  332. if (tbl.Rows.Count > 0)
  333. {
  334. DataTable tblOrderNumber = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_CustomerGroupID = '" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim() + "'", ShowColumnName: "GP_OrderNumber").Tables[0];
  335. if (tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim() != "")
  336. {
  337. DialogResult dirst = MessageBoxCustom.Show("根据你选择的客户:'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "' 电话:'" + dtRow.Rows[0]["Cus_Telephone"].ToString().Trim() + "' 系统查找到'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "'有一个未完成的意向订单,您是否要对意向订单进行完成订单?", "温馨提示", MessageBoxButtons.YesNoCancel);
  338. if (dirst == DialogResult.Yes)
  339. {
  340. this.IsPictResetShow = true;
  341. this.IsPictEditShow = true;
  342. if (this.UpdateOrderGroup != null)
  343. { this.UpdateOrderGroup("OrderNumber|" + tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim()); }
  344. }
  345. else if (dirst == DialogResult.No)
  346. {
  347. LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
  348. this.SetClientValue(modelClientModel);
  349. this.SetClientEdit(false);
  350. }
  351. else
  352. {
  353. txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
  354. txtCusTelephone.ForCharMaskedTextBox();
  355. }
  356. }
  357. else
  358. {
  359. if (!lblClientName.Text.Contains("其他联系人"))
  360. {
  361. DialogResult dirst = MessageBoxCustom.Show("根据你选择的客户:'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "' 电话:'" + dtRow.Rows[0]["Cus_Telephone"].ToString().Trim() + "' 系统查找到'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "'有一个未完成的意向客户组,您是否要对意向客户组进行完成订单?", "温馨提示", MessageBoxButtons.YesNoCancel);
  362. if (dirst == DialogResult.Yes)
  363. {
  364. LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
  365. this.SetClientValue(modelClientModel, true);
  366. this.IsPictResetShow = true;
  367. this.IsPictEditShow = true;
  368. if (this.UpdateOrderGroup != null)
  369. { this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim()); }
  370. }
  371. else if (dirst == DialogResult.No)
  372. {
  373. LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
  374. this.SetClientValue(modelClientModel);
  375. this.SetClientEdit(false);
  376. }
  377. else
  378. {
  379. txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
  380. txtCusTelephone.ForCharMaskedTextBox();
  381. }
  382. }
  383. }
  384. }
  385. else
  386. {
  387. if (MessageBoxCustom.Show("根据电话<" + CusTelephone + ">查找到1位相同客户,是否要加载此客户资料?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  388. {
  389. txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
  390. txtCusTelephone.ForCharMaskedTextBox();
  391. }
  392. else
  393. {
  394. LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
  395. this.SetClientValue(modelClientModel);
  396. this.PictEdit.Tag = true;
  397. this.SetClientEdit(false);
  398. this.IsPictResetShow = true;
  399. this.IsPictEditShow = true;
  400. }
  401. }
  402. }
  403. }
  404. else
  405. {
  406. string StrWhere = "";
  407. if (this.txtCusName.Text.Trim().Length > 0)
  408. { StrWhere = " And Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
  409. DataTable dt = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_Telephone Like '" + CusTelephone + "%'" + StrWhere, ShowColumnName: "Count(ID) AS CountID").Tables[0];
  410. if (Convert.ToInt32(dt.Rows[0]["CountID"]) > 0)
  411. {
  412. this.btnTips.Tag = true;
  413. this.panelTips.Visible = true;
  414. this.txtTips.Text = "找到类似客户:" + dt.Rows[0]["CountID"].ToString().Trim() + " (根据电话查找)";
  415. }
  416. }
  417. }
  418. }
  419. }
  420. public delegate void OrderClientParents_PhoneLeave(object objForm);
  421. /// <summary>
  422. /// 用event 关键字声明事件对象
  423. /// </summary>
  424. [Category("控件扩展事件"), Description("地区设置")]
  425. public event OrderClientParents_PhoneLeave PhoneLeave;
  426. /// <summary>
  427. /// 电话号码离开事件
  428. /// </summary>
  429. /// <param name="sender"></param>
  430. /// <param name="e"></param>
  431. void txtCusTelephone_Leave(object sender, EventArgs e)
  432. {
  433. if (this.PhoneLeave != null)
  434. { this.PhoneLeave(this); }
  435. }
  436. /// <summary>
  437. /// 电话输入后回车
  438. /// </summary>
  439. /// <param name="sender"></param>
  440. /// <param name="e"></param>
  441. void txtCusTelephone_KeyDown(object sender, KeyEventArgs e)
  442. {
  443. if (e.KeyCode == Keys.Enter)
  444. {
  445. if (this.btnTips.Visible)
  446. { this.btnTips_Click(this, null); }
  447. }
  448. }
  449. #region 输入限制
  450. /// <summary>
  451. /// 地址输入限制
  452. /// </summary>
  453. /// <param name="sender"></param>
  454. /// <param name="e"></param>
  455. void txtCusAddress_KeyPress(object sender, KeyPressEventArgs e)
  456. {
  457. if (Convert.ToString(e.KeyChar) == "-")
  458. { }
  459. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar))
  460. { e.Handled = true; }
  461. }
  462. /// <summary>
  463. /// 固定输入限制
  464. /// </summary>
  465. /// <param name="sender"></param>
  466. /// <param name="e"></param>
  467. void txtCusFixedPhone_KeyPress(object sender, KeyPressEventArgs e)
  468. {
  469. if (Convert.ToString(e.KeyChar) == "-")
  470. { }
  471. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  472. { e.Handled = true; }
  473. }
  474. /// <summary>
  475. /// 姓名输入限制
  476. /// </summary>
  477. /// <param name="sender"></param>
  478. /// <param name="e"></param>
  479. void txtCusName_KeyPress(object sender, KeyPressEventArgs e)
  480. {
  481. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar) && e.KeyChar != '_' && e.KeyChar != ' ')
  482. { e.Handled = true; }
  483. }
  484. /// <summary>
  485. /// QQ输入限制
  486. /// </summary>
  487. /// <param name="sender"></param>
  488. /// <param name="e"></param>
  489. void txtCusQQ_KeyPress(object sender, KeyPressEventArgs e)
  490. {
  491. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  492. { e.Handled = true; }
  493. }
  494. /// <summary>
  495. /// 工作单位输入限制
  496. /// </summary>
  497. /// <param name="sender"></param>
  498. /// <param name="e"></param>
  499. void txtCusWorkUnit_KeyPress(object sender, KeyPressEventArgs e)
  500. {
  501. if (Convert.ToString(e.KeyChar) == "-")
  502. { }
  503. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar))
  504. { e.Handled = true; }
  505. }
  506. #endregion
  507. #region 属性
  508. /// <summary>
  509. /// 电话号码和姓名值变化是否进入
  510. /// </summary>
  511. private bool IsTextChanged = true;
  512. private string _strClientAttribute;
  513. /// <summary>
  514. /// 客户属性
  515. /// </summary>
  516. public string StrClientAttribute
  517. {
  518. get { return _strClientAttribute; }
  519. set { _strClientAttribute = value; }
  520. }
  521. private string _lblClientName;
  522. /// <summary>
  523. /// 标题
  524. /// </summary>
  525. public string LblClientName
  526. {
  527. get { return _lblClientName; }
  528. set
  529. {
  530. _lblClientName = value;
  531. this.lblClientName.Text = this._lblClientName;
  532. }
  533. }
  534. private bool _isPictDeleteShow;
  535. /// <summary>
  536. /// 是否显示移除客户控件
  537. /// </summary>
  538. public bool IsPictDeleteShow
  539. {
  540. get { return _isPictDeleteShow; }
  541. set
  542. {
  543. _isPictDeleteShow = value;
  544. this.PictDelete.Visible = _isPictDeleteShow;
  545. }
  546. }
  547. private bool _isPictEdit;
  548. /// <summary>
  549. /// 是否显示编辑
  550. /// </summary>
  551. public bool IsPictEditShow
  552. {
  553. get { return _isPictEdit; }
  554. set
  555. {
  556. _isPictEdit = value;
  557. this.PictEdit.Visible = _isPictEdit;
  558. }
  559. }
  560. private bool _isPictResetShow;
  561. /// <summary>
  562. /// 重置
  563. /// </summary>
  564. public bool IsPictResetShow
  565. {
  566. get { return _isPictResetShow; }
  567. set
  568. {
  569. _isPictResetShow = value;
  570. this.PictReset.Visible = _isPictResetShow;
  571. }
  572. }
  573. private bool _isShowRelation;
  574. /// <summary>
  575. /// 是否显示关系
  576. /// </summary>
  577. public bool IsShowRelation
  578. {
  579. get { return _isShowRelation; }
  580. set
  581. {
  582. _isShowRelation = value;
  583. if (_isShowRelation)
  584. { this.panelRelation.Visible = true; }
  585. else
  586. { this.panelRelation.Visible = false; }
  587. }
  588. }
  589. private string _lblRelationText;
  590. /// <summary>
  591. /// 关系的名称
  592. /// </summary>
  593. public string LblRelationText
  594. {
  595. get { return _lblRelationText; }
  596. set
  597. {
  598. _lblRelationText = value;
  599. this.lblClientRelation.Text = this._lblRelationText;
  600. }
  601. }
  602. private LYFZ.Model.Model_ErpCustomer _modelCilent;
  603. /// <summary>
  604. /// 当前的选择的客户资料
  605. /// </summary>
  606. public LYFZ.Model.Model_ErpCustomer modelCilent
  607. {
  608. get { return _modelCilent; }
  609. set { _modelCilent = value; }
  610. }
  611. /// <summary>
  612. /// 电话号码符号
  613. /// </summary>
  614. /// <returns></returns>
  615. public void isShowPhoneSymbol(bool IsValue)
  616. { this.labelEx13.Visible = IsValue; }
  617. private string _strClientPhone;
  618. /// <summary>
  619. /// 客户电话
  620. /// </summary>
  621. public string StrClientPhone
  622. {
  623. get
  624. {
  625. _strClientPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  626. return _strClientPhone;
  627. }
  628. set
  629. {
  630. _strClientPhone = value;
  631. this.txtCusTelephone.Text = _strClientPhone;
  632. this.modelCilent = null;
  633. }
  634. }
  635. private ComboBoxTreeViewEx _cmbtreevRelation;
  636. /// <summary>
  637. /// 客户关系
  638. /// </summary>
  639. public ComboBoxTreeViewEx CmbtreevRelation
  640. {
  641. get
  642. {
  643. _cmbtreevRelation = this.cmbtreevCusRelation;
  644. return _cmbtreevRelation;
  645. }
  646. set
  647. {
  648. _cmbtreevRelation = value;
  649. this.cmbtreevCusRelation = _cmbtreevRelation;
  650. }
  651. }
  652. private ComboBoxTreeViewEx _cmbtreevRegion;
  653. /// <summary>
  654. /// 客户地区
  655. /// </summary>
  656. public ComboBoxTreeViewEx CmbtreevRegion
  657. {
  658. get
  659. {
  660. _cmbtreevRegion = this.cmbtreevCusRegion;
  661. return _cmbtreevRegion;
  662. }
  663. set
  664. {
  665. _cmbtreevRegion = value;
  666. this.cmbtreevCusRegion = _cmbtreevRegion;
  667. }
  668. }
  669. #endregion
  670. /// <summary>
  671. /// 绑定客户信息
  672. /// </summary>
  673. /// <param name="erpModel"></param>
  674. /// <param name="MainClientRelation"></param>
  675. public void GetClientValueData(Api_ErpOrderModel erpModel, ref string MainClientRelation)
  676. {
  677. string StrTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  678. if (erpModel.customerData == null)
  679. {
  680. erpModel.customerData = new List<Api_CustomerModel>();
  681. }
  682. Api_CustomerModel apiModel = new Api_CustomerModel()
  683. {
  684. cusAttr = this.StrClientAttribute,
  685. ClientModel = new API_ClientDataModel(),
  686. cus_Type = "成人"
  687. };
  688. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel model = new ClientModel();
  689. if (this.modelCilent != null)
  690. {
  691. model.ID = this.modelCilent.ID;
  692. }
  693. else
  694. {
  695. model.ID = -1;
  696. }
  697. //if (this.panelRelation.Visible)
  698. //{
  699. // if (this.cmbtreevCusRelation.Text.Trim() == "")
  700. // { MessageBoxCustom.Show(this.lblClientName.Text + this.lblClientRelation.Text.Trim() + "不能为空!"); return null; }
  701. // model.CusRelations = this.cmbtreevCusRelation.Text.Trim();
  702. //}
  703. //else
  704. //{ model.CusRelations = ""; }
  705. apiModel.ClientModel.ID = model.ID;
  706. apiModel.ClientModel.CusRelations = this.cmbtreevCusRelation.Text.Trim();
  707. apiModel.ClientModel.CusAddress = this.txtCusAddress.Text.Trim();
  708. apiModel.ClientModel.Cus_Birthday = this.maskBirthday.StrValue.Trim();
  709. apiModel.ClientModel.Cus_BirthdayLunar ="";
  710. apiModel.ClientModel.Cus_Zodiac = "";
  711. if (apiModel.ClientModel.Cus_Birthday != "")
  712. {
  713. apiModel.ClientModel.Cus_BirthdayLunar = this.chkBirthday.Checked ? "1" : "0";
  714. apiModel.ClientModel.Cus_Zodiac = LYFZ.Command.Command_CalendarTurnLunar.GetZodiac(model.CusBirthday, this.chkBirthday.Checked);
  715. }
  716. apiModel.ClientModel.CusIDNumber = "";
  717. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  718. { apiModel.ClientModel.CusIDNumber = this.maskedIDNumber.StrValue; }
  719. apiModel.ClientModel.Cus_Name = LYFZ.BLL.OtherCommonModel.ClearSpecialCharacter(this.txtCusName.Text.Trim());
  720. model.CusName = apiModel.ClientModel.Cus_Name;
  721. apiModel.ClientModel.Cus_NamePinyin = LYFZ.Command.Command_ChineseToPinyin.GetChineseSpellPinyin(model.CusName.Trim()).ToLower();
  722. apiModel.ClientModel.CusQQ = this.txtCusQQ.Text.Trim();
  723. apiModel.ClientModel.CusRegion = this.cmbtreevCusRegion.Text.Trim();
  724. apiModel.ClientModel.Cus_Sex = this.rdoCusSex1.Checked ? false : true;
  725. apiModel.ClientModel.CusTelephone = StrTelephone;
  726. apiModel.ClientModel.CusMicroSignal = this.txtMicroSignal.Text.Trim();
  727. apiModel.ClientModel.CusWorkUnit = this.txtCusWorkUnit.Text.Trim();
  728. apiModel.ClientModel.CusFixedPhone = this.txtCusFixedPhone.Text.Trim();
  729. /*if (MainClientRelation == "")
  730. { MainClientRelation = this.cmbtreevCusRelation.Text.Trim(); }*/
  731. if (MainClientRelation == "" && this.IsShowRelation)
  732. {
  733. MainClientRelation = this.cmbtreevCusRelation.Text.Trim();
  734. if (string.IsNullOrEmpty(MainClientRelation))
  735. {
  736. if (cmbtreevCusRelation.Nodes.Count>0)
  737. {
  738. MainClientRelation = cmbtreevCusRelation.Nodes[0].Text;
  739. }
  740. else
  741. {
  742. MainClientRelation = "未知";
  743. //ExMessageBoxCustom.Show("客户关系无数据,不可保存,请添加客户关系!!");
  744. }
  745. }
  746. }
  747. if (this.IsShowRelation)
  748. {
  749. apiModel.userRelation = string.IsNullOrEmpty(this.cmbtreevCusRelation.Text.Trim()) ? "未知" : this.cmbtreevCusRelation.Text.Trim();
  750. apiModel.ClientModel.CusRelations = string.IsNullOrEmpty(this.cmbtreevCusRelation.Text.Trim()) ? "未知" : this.cmbtreevCusRelation.Text.Trim() ;
  751. }
  752. erpModel.customerData.Add(apiModel);
  753. }
  754. /// <summary>
  755. /// 获取客户资料
  756. /// </summary>
  757. public LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel GetClientValue(ref string MainClientRelation)
  758. {
  759. int intMasse = this.maskBirthday.CheckDateValue(this.maskBirthday, this.chkBirthday);
  760. if (intMasse == 1) { MessageBoxCustom.Show(this.lblClientName.Text + "生日日期格式输入错误!"); return null; }
  761. else if (intMasse == 2)
  762. { MessageBoxCustom.Show(this.lblClientName.Text + "生日:" + this.maskBirthday.StrValue.Trim() + "不是公历日期,若要保存请勾上农历!"); return null; }
  763. if (this.txtCusName.Text.Trim() == "")
  764. { MessageBoxCustom.Show(this.lblClientName.Text + "姓名不能为空!"); return null; }
  765. string StrTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
  766. if (StrTelephone == this.txtCusFixedPhone.Text.Trim())
  767. {
  768. if (!string.IsNullOrEmpty(this.txtCusFixedPhone.Text.Trim()) && !string.IsNullOrEmpty(StrTelephone))
  769. { MessageBoxCustom.Show(this.lblClientName.Text + "手机号与固定电话不能一样!"); this.txtCusTelephone.Text = ""; return null; }
  770. }
  771. if (this.StrClientAttribute == "Man_")
  772. {
  773. if (string.IsNullOrEmpty(StrTelephone))
  774. { MessageBoxCustom.Show(this.lblClientName.Text + "手机号不能为空!"); return null; }
  775. else
  776. {
  777. if (StrTelephone.Length != 11)
  778. { MessageBoxCustom.Show(this.lblClientName.Text + "手机号长度不足11位!"); return null; }
  779. }
  780. }
  781. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel model = new ClientModel();
  782. if (this.modelCilent != null)
  783. { model.ID = this.modelCilent.ID; }
  784. else
  785. { model.ID = -1; }
  786. //if (this.panelRelation.Visible)
  787. //{
  788. // if (this.cmbtreevCusRelation.Text.Trim() == "")
  789. // { MessageBoxCustom.Show(this.lblClientName.Text + this.lblClientRelation.Text.Trim() + "不能为空!"); return null; }
  790. // model.CusRelations = this.cmbtreevCusRelation.Text.Trim();
  791. //}
  792. //else
  793. //{ model.CusRelations = ""; }
  794. model.CusRelations = this.cmbtreevCusRelation.Text.Trim();
  795. model.CusAddress = this.txtCusAddress.Text.Trim();
  796. model.CusBirthday = this.maskBirthday.StrValue.Trim();
  797. model.CusBirthdayLunar = "";
  798. model.CusZodiac = "";
  799. if (model.CusBirthday != "")
  800. {
  801. model.CusBirthdayLunar = this.chkBirthday.Checked ? "1" : "0";
  802. model.CusZodiac = LYFZ.Command.Command_CalendarTurnLunar.GetZodiac(model.CusBirthday, this.chkBirthday.Checked);
  803. }
  804. model.CusIDNumber = "";
  805. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  806. { model.CusIDNumber = this.maskedIDNumber.StrValue; }
  807. model.CusName = LYFZ.BLL.OtherCommonModel.ClearSpecialCharacter(this.txtCusName.Text.Trim());
  808. model.CusNamePinyin = LYFZ.Command.Command_ChineseToPinyin.GetChineseSpellPinyin(model.CusName.Trim()).ToLower();
  809. model.CusQQ = this.txtCusQQ.Text.Trim();
  810. model.CusRegion = this.cmbtreevCusRegion.Text.Trim();
  811. model.CusSex = this.rdoCusSex1.Checked ? false : true;
  812. model.CusTelephone = StrTelephone;
  813. model.CusMicroSignal = this.txtMicroSignal.Text.Trim();
  814. model.CusWorkUnit = this.txtCusWorkUnit.Text.Trim();
  815. model.CusFixedPhone = this.txtCusFixedPhone.Text.Trim();
  816. if (MainClientRelation == "")
  817. { MainClientRelation = this.cmbtreevCusRelation.Text.Trim(); }
  818. return model;
  819. }
  820. /// <summary>
  821. /// 设置客户资料
  822. /// </summary>
  823. /// <param name="model"></param>
  824. public void SetClientValue(LYFZ.Model.Model_ErpCustomer model, bool IsReadOnly = false, string MainClientRelation = "")
  825. {
  826. this.IsTextChanged = false;
  827. if (model == null)
  828. {
  829. this.txtCusAddress.Text = "";
  830. this.maskBirthday.StrValue = "";
  831. this.chkBirthday.Checked = false;
  832. this.txtCusName.Text = "";
  833. this.txtCusQQ.Text = "";
  834. this.cmbtreevCusRegion.Text = "";
  835. this.rdoCusSex2.Checked = true;
  836. this.txtCusTelephone.Text = "";
  837. this.txtMicroSignal.Text = "";
  838. this.txtCusWorkUnit.Text = "";
  839. this.txtCusFixedPhone.Text = "";
  840. this.cmbtreevCusRelation.Text = "";
  841. this.maskedIDNumber.Text = "";
  842. }
  843. else
  844. {
  845. this.txtCusAddress.Text = model.Cus_Address;
  846. this.maskBirthday.StrValue = model.Cus_Birthday;
  847. this.chkBirthday.Checked = model.Cus_BirthdayLunar == "1" ? true : false;
  848. this.txtCusName.Text = model.Cus_Name;
  849. this.txtCusQQ.Text = model.Cus_QQ;
  850. this.cmbtreevCusRegion.Text = model.Cus_Region;
  851. if (model.Cus_Sex)
  852. { this.rdoCusSex2.Checked = true; }
  853. else
  854. { this.rdoCusSex1.Checked = true; }
  855. this.txtCusTelephone.Text = model.Cus_Telephone;
  856. this.txtMicroSignal.Text = model.Cus_MicroSignal;
  857. this.txtCusWorkUnit.Text = model.Cus_WorkUnit;
  858. this.txtCusFixedPhone.Text = model.Cus_FixedPhone;
  859. this.cmbtreevCusRelation.Text = "";
  860. this.cmbtreevCusRelation.Tag = "";
  861. this.maskedIDNumber.Text = model.Cus_IDNumber;
  862. }
  863. this.cmbtreevCusRelation.TextFindTag(MainClientRelation);
  864. this.modelCilent = model;
  865. if (IsReadOnly)
  866. {
  867. this.txtCusAddress.ReadOnly = true;
  868. this.maskBirthday.ReadOnly = true;
  869. this.chkBirthday.Enabled = false;
  870. this.txtCusName.ReadOnly = true;
  871. this.txtCusQQ.ReadOnly = true;
  872. this.cmbtreevCusRegion.Enabled = false;
  873. this.rdoCusSex1.Enabled = false;
  874. this.rdoCusSex2.Enabled = false;
  875. this.txtCusTelephone.ReadOnly = true;
  876. this.txtMicroSignal.ReadOnly = true;
  877. this.txtCusWorkUnit.ReadOnly = true;
  878. this.txtCusFixedPhone.ReadOnly = true;
  879. this.cmbtreevCusRelation.Enabled = false;
  880. this.maskedIDNumber.ReadOnly = true;
  881. }
  882. else
  883. {
  884. this.txtCusAddress.ReadOnly = false;
  885. this.maskBirthday.ReadOnly = false;
  886. this.chkBirthday.Enabled = true;
  887. this.txtCusName.ReadOnly = false;
  888. this.txtCusQQ.ReadOnly = false;
  889. this.cmbtreevCusRegion.Enabled = true;
  890. this.rdoCusSex1.Enabled = true;
  891. this.rdoCusSex2.Enabled = true;
  892. this.txtCusTelephone.ReadOnly = false;
  893. this.txtMicroSignal.ReadOnly = false;
  894. this.txtCusWorkUnit.ReadOnly = false;
  895. this.txtCusFixedPhone.ReadOnly = false;
  896. this.cmbtreevCusRelation.Enabled = true;
  897. this.maskedIDNumber.ReadOnly = false;
  898. }
  899. this.panelTips.Visible = false;
  900. this.panelTips.Tag = null;
  901. this.IsTextChanged = true;
  902. }
  903. /// <summary>
  904. /// 设置客户资料
  905. /// </summary>
  906. /// <param name="model"></param>
  907. public void setHospitalClientValue(LYFZ.Model.Model_ErpHospitalClient model)
  908. {
  909. if (model == null)
  910. {
  911. this.txtCusAddress.Text = "";
  912. this.maskBirthday.StrValue = "";
  913. this.chkBirthday.Checked = false;
  914. this.txtCusName.Text = "";
  915. this.txtCusQQ.Text = "";
  916. this.cmbtreevCusRegion.Text = "";
  917. this.rdoCusSex1.Checked = true;
  918. this.txtCusTelephone.Text = "";
  919. this.txtMicroSignal.Text = "";
  920. this.txtCusWorkUnit.Text = "";
  921. this.txtCusFixedPhone.Text = "";
  922. this.cmbtreevCusRelation.Text = "";
  923. this.maskedIDNumber.Text = "";
  924. }
  925. else
  926. {
  927. this.txtCusAddress.Text = model.Hct_HomeAddress;
  928. this.maskBirthday.StrValue = "";// LYFZ.Command.Command_Validate.DateTimeToString(model.Hct_BabyBirthday);
  929. this.chkBirthday.Checked = false;// model.Hct_AreLunar;
  930. this.txtCusName.Text = model.Hct_CustomerName;
  931. this.txtCusQQ.Text = model.Hct_QQ;
  932. this.cmbtreevCusRegion.Text = model.Hct_CustomerRegions;
  933. this.rdoCusSex2.Checked = true;
  934. this.txtCusTelephone.Text = model.Hct_MyselfMobile;
  935. this.txtMicroSignal.Text = "";
  936. this.txtCusWorkUnit.Text = "";
  937. this.txtCusFixedPhone.Text = model.Hct_FamilyPhone;
  938. this.cmbtreevCusRelation.Text = "";
  939. this.cmbtreevCusRelation.Tag = "";
  940. this.maskedIDNumber.Text = "";
  941. }
  942. }
  943. /// <summary>
  944. /// 编辑客户
  945. /// </summary>
  946. public void SetClientEdit(bool IsUpdateName = false)
  947. {
  948. Image img = null;
  949. if (Convert.ToBoolean(this.PictEdit.Tag))
  950. {
  951. this.txtCusAddress.ReadOnly = true;
  952. this.maskBirthday.ReadOnly = true;
  953. this.chkBirthday.Enabled = false;
  954. this.txtCusQQ.ReadOnly = true;
  955. this.cmbtreevCusRegion.Enabled = false;
  956. this.rdoCusSex1.Enabled = false;
  957. this.rdoCusSex2.Enabled = false;
  958. this.txtCusTelephone.ReadOnly = true;
  959. this.txtMicroSignal.ReadOnly = true;
  960. this.txtCusWorkUnit.ReadOnly = true;
  961. this.txtCusFixedPhone.ReadOnly = true;
  962. this.txtCusName.ReadOnly = true;
  963. this.cmbtreevCusRelation.Enabled = false;
  964. this.maskedIDNumber.ReadOnly = true;
  965. this.PictEdit.Tag = false;
  966. img = LYFZ.ComponentLibrary.Properties.Resources.pitEdit;
  967. this.toolTip1.SetToolTip(this.PictEdit, "进入编辑");
  968. }
  969. else
  970. {
  971. this.txtCusAddress.ReadOnly = false;
  972. this.maskBirthday.ReadOnly = false;
  973. this.chkBirthday.Enabled = true;
  974. this.txtCusQQ.ReadOnly = false;
  975. this.cmbtreevCusRegion.Enabled = true;
  976. this.rdoCusSex1.Enabled = true;
  977. this.rdoCusSex2.Enabled = true;
  978. this.txtCusTelephone.ReadOnly = false;
  979. this.txtMicroSignal.ReadOnly = false;
  980. this.txtCusWorkUnit.ReadOnly = false;
  981. this.txtCusFixedPhone.ReadOnly = false;
  982. //this.txtCusName.ReadOnly = true;
  983. if (IsUpdateName)
  984. { this.txtCusName.ReadOnly = false; }
  985. else
  986. { this.txtCusName.ReadOnly = true; }
  987. this.cmbtreevCusRelation.Enabled = true;
  988. this.maskedIDNumber.ReadOnly = false;
  989. this.PictEdit.Tag = true;
  990. img = LYFZ.ComponentLibrary.Properties.Resources.pitEditOk;
  991. this.toolTip1.SetToolTip(this.PictEdit, "编辑OK");
  992. }
  993. this.PictEdit.Image = img;
  994. }
  995. }
  996. public class ClientModel
  997. {
  998. #region Model
  999. private int _id;
  1000. private string _cus_name;
  1001. private string _cus_namepinyin;
  1002. private bool _cus_sex;
  1003. private string _cus_birthday;
  1004. private string _cus_birthdaylunar;
  1005. private string _cus_IDNumber;
  1006. private string _cus_relations;
  1007. private string _cus_qq;
  1008. private string _cus_microsignal;
  1009. private string _cus_telephone;
  1010. private string _cus_fixedphone;
  1011. private string _cus_region;
  1012. private string _cus_address;
  1013. private string _cus_workunit;
  1014. private string _cus_zodiac;
  1015. /// <summary>
  1016. /// ID
  1017. /// </summary>
  1018. public int ID
  1019. {
  1020. set { _id = value; }
  1021. get { return _id; }
  1022. }
  1023. /// <summary>
  1024. /// 客户姓名
  1025. /// </summary>
  1026. public string CusName
  1027. {
  1028. set { _cus_name = value; }
  1029. get { return _cus_name; }
  1030. }
  1031. /// <summary>
  1032. /// 客户姓名拼音
  1033. /// </summary>
  1034. public string CusNamePinyin
  1035. {
  1036. get { return _cus_namepinyin; }
  1037. set { _cus_namepinyin = value; }
  1038. }
  1039. /// <summary>
  1040. /// 客户性别 0(false):男,1(true):女
  1041. /// </summary>
  1042. public bool CusSex
  1043. {
  1044. set { _cus_sex = value; }
  1045. get { return _cus_sex; }
  1046. }
  1047. /// <summary>
  1048. /// 客户生日
  1049. /// </summary>
  1050. public string CusBirthday
  1051. {
  1052. set { _cus_birthday = value; }
  1053. get { return _cus_birthday; }
  1054. }
  1055. /// <summary>
  1056. /// 生日历类 0:公历 1:农历 2:农历润月
  1057. /// </summary>
  1058. public string CusBirthdayLunar
  1059. {
  1060. set { _cus_birthdaylunar = value; }
  1061. get { return _cus_birthdaylunar; }
  1062. }
  1063. /// <summary>
  1064. /// 称呼、关系、与宝贝关系
  1065. /// </summary>
  1066. public string CusRelations
  1067. {
  1068. set { _cus_relations = value; }
  1069. get { return _cus_relations; }
  1070. }
  1071. /// <summary>
  1072. /// 客户QQ
  1073. /// </summary>
  1074. public string CusQQ
  1075. {
  1076. set { _cus_qq = value; }
  1077. get { return _cus_qq; }
  1078. }
  1079. /// <summary>
  1080. /// 微信号
  1081. /// </summary>
  1082. public string CusMicroSignal
  1083. {
  1084. set { _cus_microsignal = value; }
  1085. get { return _cus_microsignal; }
  1086. }
  1087. /// <summary>
  1088. /// 客户电话
  1089. /// </summary>
  1090. public string CusTelephone
  1091. {
  1092. set { _cus_telephone = value; }
  1093. get { return _cus_telephone; }
  1094. }
  1095. /// <summary>
  1096. /// 客户固定电话
  1097. /// </summary>
  1098. public string CusFixedPhone
  1099. {
  1100. set { _cus_fixedphone = value; }
  1101. get { return _cus_fixedphone; }
  1102. }
  1103. /// <summary>
  1104. /// 客户所在地区
  1105. /// </summary>
  1106. public string CusRegion
  1107. {
  1108. set { _cus_region = value; }
  1109. get { return _cus_region; }
  1110. }
  1111. /// <summary>
  1112. /// 客户地址
  1113. /// </summary>
  1114. public string CusAddress
  1115. {
  1116. set { _cus_address = value; }
  1117. get { return _cus_address; }
  1118. }
  1119. /// <summary>
  1120. /// 客户工作单位
  1121. /// </summary>
  1122. public string CusWorkUnit
  1123. {
  1124. set { _cus_workunit = value; }
  1125. get { return _cus_workunit; }
  1126. }
  1127. /// <summary>
  1128. /// 生肖
  1129. /// </summary>
  1130. public string CusZodiac
  1131. {
  1132. set { _cus_zodiac = value; }
  1133. get { return _cus_zodiac; }
  1134. }
  1135. /// <summary>
  1136. /// 客户身份证号
  1137. /// </summary>
  1138. public string CusIDNumber
  1139. {
  1140. get { return _cus_IDNumber; }
  1141. set { _cus_IDNumber = value; }
  1142. }
  1143. #endregion Model
  1144. }
  1145. }