frmAddSMSTemplate.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace LYFZ.Software.MainBusiness.SMSManagement
  6. {
  7. public class frmAddSMSTemplate:LYFZ.Software.UI.SMSManagement.frmAddSMSTemplate
  8. {
  9. public frmAddSMSTemplate() {
  10. this.Load += frmAddSMSTemplate_Load;
  11. this.cboxEvent.SelectedIndexChanged += cboxEvent_SelectedIndexChanged;
  12. this.number.Value = 1;
  13. this.btnSave.Click += btnSave_Click;
  14. this.Shown += frmAddSMSTemplate_Shown;
  15. this.linkSelectSms.Click += linkSelectSms_Click;
  16. this.txtSmsInfo.EventTextBoxEx_TextChanged += txtSmsInfo_EventTextBoxEx_TextChanged;
  17. this.lbWordCount.Text = SmsSend.FrmSendSms.GetlblNameTextString(0, 0);
  18. }
  19. void txtSmsInfo_EventTextBoxEx_TextChanged(object sender, EventArgs e)
  20. {
  21. string SmsInfo = txtSmsInfo.Text;
  22. this.lbWordCount.Text = SmsSend.FrmSendSms.GetlblNameTextString(SmsInfo.Length, SmsSend.FrmSendSms.GetSmsSizeCount(SmsInfo.ToString(), SmsSend.FrmSendSms.Works64));
  23. }
  24. /// <summary>
  25. /// 当前短信类别
  26. /// </summary>
  27. EnumPublic.SmsCategory sCategory = EnumPublic.SmsCategory.公共短信;
  28. /// <summary>
  29. /// 当前短信类别
  30. /// </summary>
  31. public EnumPublic.SmsCategory SCategory
  32. {
  33. get { return sCategory; }
  34. set { sCategory = value; }
  35. }
  36. void linkSelectSms_Click(object sender, EventArgs e)
  37. {
  38. frmSelectSmsInfo selectInfo = new frmSelectSmsInfo();
  39. if (selectInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
  40. if (selectInfo.SmsModel.ID > 0)
  41. {
  42. this.txtSmsInfo.Text = selectInfo.SmsModel.ST_SMSContent;
  43. }
  44. }
  45. }
  46. void frmAddSMSTemplate_Shown(object sender, EventArgs e)
  47. {
  48. if (this.SmsModel.ID > 0)
  49. {
  50. this.cboxEvent.SelectedItem = ((EnumPublic.SmsSendEvent)this.SmsModel.ST_SendEvent).ToString();
  51. this.SCategory = (EnumPublic.SmsCategory)SmsModel.ST_Category;
  52. }
  53. this.Text = "添加" + this.SCategory.ToString() + "事件设置";
  54. }
  55. LYFZ.DAL.DAL_SMSTemplates smsDal = new DAL.DAL_SMSTemplates();
  56. LYFZ.Model.Model_SMSTemplates smsModel = new Model.Model_SMSTemplates();
  57. /// <summary>
  58. /// 短信对象
  59. /// </summary>
  60. public LYFZ.Model.Model_SMSTemplates SmsModel
  61. {
  62. get { return smsModel; }
  63. set { smsModel = value; }
  64. }
  65. void btnSave_Click(object sender, EventArgs e)
  66. {
  67. if (this.cboxEvent.Text.Length <= 0)
  68. {
  69. MessageBoxCustom.Show("请选择短信发送事件");
  70. return;
  71. }
  72. if (this.txtSmsInfo.Text.Length <= 0)
  73. {
  74. MessageBoxCustom.Show("请输入短信内容");
  75. return;
  76. }
  77. if (this.txtReceiver.Text.Length <= 0)
  78. {
  79. MessageBoxCustom.Show("请输入短信接收手机号");
  80. return;
  81. }
  82. int sumSmsCount = 0;
  83. try
  84. {
  85. sumSmsCount = smsDal.GetRecordCount("ST_Type=1 and ST_DividedShop='" + LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID.Trim() + "'");
  86. }
  87. catch { }
  88. smsModel.ST_Type = (int)EnumPublic.SmsTemplateType.事件短信;
  89. smsModel.ST_Title = "";
  90. smsModel.ST_Category=(int)this.SCategory;
  91. smsModel.ST_SendChannel = 0;
  92. smsModel.ST_ReceiveObjects = this.txtReceiver.Text.Trim();
  93. smsModel.ST_SendEvent = (int)((EnumPublic.SmsSendEvent)Enum.Parse(typeof(EnumPublic.SmsSendEvent), this.cboxEvent.Text));
  94. smsModel.ST_SMSContent = this.txtSmsInfo.Text;
  95. smsModel.ST_IsEnabled = this.checkBoxEx1.Checked;
  96. smsModel.ST_CreateDatetime = SDateTime.Now;
  97. smsModel.ST_UpdateDatetime = SDateTime.Now;
  98. smsModel.ST_DividedShop = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID;
  99. if (smsModel.ST_ReceiveObjects.Split(',').Length > 100)
  100. {
  101. MessageBoxCustom.Show("最多只能输入100个手机号!");
  102. return;
  103. }
  104. switch (this.CurrentEvent)
  105. {
  106. case EnumPublic.SmsSendEvent.每天X时X分发送财务短信到X手机:
  107. string retMsg = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(this.txtReceiver.Text.Trim());
  108. if (retMsg.Trim().Length > 0)
  109. {
  110. MessageBoxCustom.Show("手机号输入错误:" + retMsg);
  111. return;
  112. }
  113. this.smsModel.ST_SendEventValue = Convert.ToInt32(this.number.Value).ToString() + ":" + Convert.ToInt32(this.number2.Value).ToString();
  114. break;
  115. case EnumPublic.SmsSendEvent.宝宝生日前X天且X岁以下:
  116. case EnumPublic.SmsSendEvent.宝宝X岁前X天成长跟踪短信:
  117. this.smsModel.ST_SendEventValue = Convert.ToInt32(this.number.Value).ToString() + ":" + Convert.ToInt32(this.number2.Value).ToString();
  118. break;
  119. case EnumPublic.SmsSendEvent.客户来电挂机后X分钟:
  120. case EnumPublic.SmsSendEvent.未知来电挂机后X分钟:
  121. case EnumPublic.SmsSendEvent.员工来电挂机后X分钟:
  122. this.smsModel.ST_SendEventValue = Convert.ToInt32(this.number.Value).ToString() + ":" + ((ItemValue)comBox.SelectedItem).Value.ToString();
  123. break;
  124. case EnumPublic.SmsSendEvent.客户云选片完成后发通知短信:
  125. case EnumPublic.SmsSendEvent.客户云看样完成后发通知短信:
  126. string retMsg2 = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(this.txtReceiver.Text.Trim());
  127. if (retMsg2.Trim().Length > 0)
  128. {
  129. MessageBoxCustom.Show("手机号输入错误:" + retMsg2);
  130. return;
  131. }
  132. this.smsModel.ST_SendEventValue = "0";
  133. break;
  134. default:
  135. this.smsModel.ST_SendEventValue = Convert.ToInt32(this.number.Value).ToString();
  136. break;
  137. }
  138. bool ret = false;
  139. if (smsModel.ID > 0)
  140. {
  141. ret = smsDal.Update(smsModel);
  142. }
  143. else
  144. {
  145. if (sumSmsCount > 1000)
  146. {
  147. MessageBoxCustom.Show("对不起,短信设置多只能添加1000条记录,请删除无用短信设置记录后重试。");
  148. return;
  149. }
  150. try
  151. {
  152. sumSmsCount = smsDal.GetRecordCount(String.Format("ST_Type=1 and ST_DividedShop='{0}' and ST_Category={3} and ST_SendEvent={1} and ST_SendEventValue='{2}'", LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID.Trim(), smsModel.ST_SendEvent, this.smsModel.ST_SendEventValue, this.smsModel.ST_Category));
  153. }
  154. catch { }
  155. if (sumSmsCount > 0)
  156. {
  157. MessageBoxCustom.Show("对不起,相同类型事件的短信模板已以存在,请不要重复添加。");
  158. return;
  159. }
  160. ret = smsDal.Add(smsModel);
  161. }
  162. if (ret)
  163. {
  164. MessageBoxCustom.Show("保存成功");
  165. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  166. }
  167. else
  168. {
  169. MessageBoxCustom.Show("保存失败,请检查网络环境或关闭后重试。");
  170. }
  171. }
  172. LYFZ.EnumPublic.SmsSendEvent currentEvent = EnumPublic.SmsSendEvent.客人生日前X天;
  173. /// <summary>
  174. /// 当前事件
  175. /// </summary>
  176. public LYFZ.EnumPublic.SmsSendEvent CurrentEvent
  177. {
  178. get { return currentEvent; }
  179. set { currentEvent = value; }
  180. }
  181. LYFZ.ComponentLibrary.NumericUpDownEx number = new ComponentLibrary.NumericUpDownEx();
  182. LYFZ.ComponentLibrary.NumericUpDownEx number2 = new ComponentLibrary.NumericUpDownEx();
  183. LYFZ.ComponentLibrary.LabelEx labTxt = new ComponentLibrary.LabelEx();
  184. LYFZ.ComponentLibrary.LabelEx labTxt2 = new ComponentLibrary.LabelEx();
  185. LYFZ.ComponentLibrary.ComboBoxEx comBox = new ComponentLibrary.ComboBoxEx();
  186. void cboxEvent_SelectedIndexChanged(object sender, EventArgs e)
  187. {
  188. try
  189. {
  190. this.CurrentEvent = (EnumPublic.SmsSendEvent)Enum.Parse(typeof(EnumPublic.SmsSendEvent), this.cboxEvent.Text);
  191. }
  192. catch { }
  193. // LYFZ.ComponentLibrary.TextBoxEx textBox = new ComponentLibrary.TextBoxEx();
  194. this.plEventValue.Controls.Clear();
  195. number.Maximum=999999;
  196. number.Minimum=0;
  197. number.TextAlign= System.Windows.Forms.HorizontalAlignment.Center;
  198. number.Width = 90;
  199. number.Font = this.cboxEvent.Font;
  200. number.Location = new System.Drawing.Point(10, 4);
  201. labTxt.Text = "分钟";
  202. labTxt.Width = 60;
  203. labTxt.Font = this.cboxEvent.Font;
  204. labTxt.Location = new System.Drawing.Point(number.Location.X + number.Width+5,6);
  205. comBox.Items.Clear();
  206. comBox.ReadOnly = true;
  207. comBox.Width = 90;
  208. comBox.Font= this.cboxEvent.Font;
  209. comBox.Location = new System.Drawing.Point(labTxt.Location.X + labTxt.Width, 4);
  210. comBox.Items.Add(new ItemValue("y","一年内一次"));
  211. comBox.Items.Add(new ItemValue("m", "一月内一次"));
  212. comBox.Items.Add(new ItemValue("d", "一天内一次"));
  213. // comBox.Items.Add(new ItemValue("a", "实时发送"));
  214. comBox.SelectedIndex = 0;
  215. number2.Maximum = 59;
  216. number2.Minimum = 0;
  217. number2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
  218. number2.Width = 90;
  219. number2.Font = this.cboxEvent.Font;
  220. number2.Location = new System.Drawing.Point(labTxt.Location.X + labTxt.Width, 4);
  221. labTxt2.Text = "分";
  222. labTxt2.Font = this.cboxEvent.Font;
  223. labTxt2.Location = new System.Drawing.Point(number2.Location.X + number2.Width + 5, 6);
  224. this.plEventValue.Controls.Add(number);
  225. this.plEventValue.Controls.Add(labTxt);
  226. labTxt.Text = "分钟";
  227. this.lbTips.Text = GetControlPropertyAttribute(this.CurrentEvent);
  228. this.txtSmsInfo.ReadOnly = false;
  229. this.linkSelectSms.Enabled = true;
  230. this.txtReceiver.ReadOnly = true;
  231. this.txtReceiver.Text = "相关客户";
  232. if (smsModel.ID > 0)
  233. {
  234. this.txtReceiver.Text = SmsModel.ST_ReceiveObjects;
  235. this.txtSmsInfo.Text = SmsModel.ST_SMSContent;
  236. SetSendEventValue(SmsModel.ST_SendEventValue);
  237. this.checkBoxEx1.Checked = this.SmsModel.ST_IsEnabled;
  238. }
  239. if (this.CurrentEvent != EnumPublic.SmsSendEvent.每天X时X分发送财务短信到X手机)
  240. {
  241. if (this.txtSmsInfo.Text.Trim() == "系统自动生成")
  242. {
  243. this.txtSmsInfo.Text = "";
  244. }
  245. }
  246. switch (this.CurrentEvent)
  247. {
  248. case EnumPublic.SmsSendEvent.客人订单后X分钟:
  249. case EnumPublic.SmsSendEvent.订单件齐后X分钟发送取件通知:
  250. case EnumPublic.SmsSendEvent.拍照预约后X分钟:
  251. case EnumPublic.SmsSendEvent.拍照完成后X分钟:
  252. case EnumPublic.SmsSendEvent.服务预约后X分钟:
  253. case EnumPublic.SmsSendEvent.服务完成后X分钟:
  254. case EnumPublic.SmsSendEvent.客人预约选片后X分钟:
  255. case EnumPublic.SmsSendEvent.客人选片完成后X分钟:
  256. case EnumPublic.SmsSendEvent.客人预约看样后X分钟:
  257. case EnumPublic.SmsSendEvent.客人看样后X分钟:
  258. case EnumPublic.SmsSendEvent.客人取件后X分钟:
  259. case EnumPublic.SmsSendEvent.转介绍后X分钟发送短信给介绍人:
  260. case EnumPublic.SmsSendEvent.发放会员卡后X分钟发会员短信:
  261. case EnumPublic.SmsSendEvent.现金卡消费后X分钟后发提醒短信:
  262. case EnumPublic.SmsSendEvent.现金卡充值后X分钟后发提醒短信:
  263. case EnumPublic.SmsSendEvent.来单录入后X分钟:
  264. case EnumPublic.SmsSendEvent.会员积分变动后X分钟:
  265. case EnumPublic.SmsSendEvent.删除会员后X分钟:
  266. case EnumPublic.SmsSendEvent.注消会员后X分钟:
  267. case EnumPublic.SmsSendEvent.修改会员支付密码后X分钟:
  268. case EnumPublic.SmsSendEvent.会员服务卡使用后X分钟:
  269. case EnumPublic.SmsSendEvent.礼服出租订单后X分钟:
  270. case EnumPublic.SmsSendEvent.礼服出租还衣后X分钟:
  271. case EnumPublic.SmsSendEvent.礼服出售订单后X分钟:
  272. case EnumPublic.SmsSendEvent.积分兑换后X分钟发提醒短信:
  273. case EnumPublic.SmsSendEvent.会员返现卡提现后X分钟:
  274. case EnumPublic.SmsSendEvent.会员返现卡获得返现金后X分钟:
  275. case EnumPublic.SmsSendEvent.支付成功后X分钟发提醒消息:
  276. case EnumPublic.SmsSendEvent.客片上传完成后X分钟发通知短信:
  277. labTxt.Text = "分钟";
  278. this.txtReceiver.Text = "相关客户";
  279. break;
  280. case EnumPublic.SmsSendEvent.客户来电挂机后X分钟:
  281. case EnumPublic.SmsSendEvent.未知来电挂机后X分钟:
  282. this.plEventValue.Controls.Add(comBox);
  283. this.plEventValue.Controls.Add(labTxt2);
  284. labTxt2.Text = "发送周期";
  285. labTxt.Text = "分钟";
  286. this.txtReceiver.Text = "相关客户";
  287. break;
  288. case EnumPublic.SmsSendEvent.礼服出租还衣前X天:
  289. case EnumPublic.SmsSendEvent.礼服出租取衣前X天:
  290. case EnumPublic.SmsSendEvent.礼服出售取衣前X天:
  291. case EnumPublic.SmsSendEvent.客人生日前X天:
  292. case EnumPublic.SmsSendEvent.客人婚礼前X天:
  293. case EnumPublic.SmsSendEvent.结婚纪念日前X天:
  294. case EnumPublic.SmsSendEvent.宝宝生日前X天:
  295. case EnumPublic.SmsSendEvent.宝宝X天成长跟踪短信:
  296. case EnumPublic.SmsSendEvent.家长生日前X天:
  297. case EnumPublic.SmsSendEvent.怀孕X天周期跟踪短信:
  298. case EnumPublic.SmsSendEvent.会员积分有效期到期前X天:
  299. case EnumPublic.SmsSendEvent.会员储值有效期到期前X天:
  300. case EnumPublic.SmsSendEvent.会员服务套餐有效期到期前X天:
  301. case EnumPublic.SmsSendEvent.会员新摄会有效期到期前X天:
  302. case EnumPublic.SmsSendEvent.会员返现卡有效期到期前X天:
  303. case EnumPublic.SmsSendEvent.拍照预约后拍照前X天:
  304. case EnumPublic.SmsSendEvent.服务预约后服务前X天:
  305. case EnumPublic.SmsSendEvent.选片预约后选片前X天:
  306. case EnumPublic.SmsSendEvent.看样预约后看样前X天:
  307. labTxt.Text = "天";
  308. this.txtReceiver.Text = "相关客户";
  309. break;
  310. case EnumPublic.SmsSendEvent.宝宝生日前X天且X岁以下:
  311. labTxt.Text = "天";
  312. this.txtReceiver.Text = "相关客户";
  313. this.plEventValue.Controls.Add(number2);
  314. this.plEventValue.Controls.Add(labTxt2);
  315. labTxt2.Text = "岁以下";
  316. break;
  317. case EnumPublic.SmsSendEvent.员工生日前X天:
  318. labTxt.Text = "天";
  319. this.txtReceiver.Text = "相关员工";
  320. break;
  321. case EnumPublic.SmsSendEvent.员工来电挂机后X分钟:
  322. this.plEventValue.Controls.Add(comBox);
  323. this.plEventValue.Controls.Add(labTxt2);
  324. labTxt2.Text = "发送周期";
  325. labTxt.Text = "分钟";
  326. this.txtReceiver.Text = "相关员工";
  327. break;
  328. case EnumPublic.SmsSendEvent.宝宝X岁前X天成长跟踪短信:
  329. labTxt.Text = "岁 前";
  330. this.txtReceiver.Text = "相关客户";
  331. this.plEventValue.Controls.Add(number2);
  332. this.plEventValue.Controls.Add(labTxt2);
  333. labTxt2.Text = "天";
  334. break;
  335. case EnumPublic.SmsSendEvent.当积分接近X的百分之80时:
  336. case EnumPublic.SmsSendEvent.当积分达到或超过X分时:
  337. labTxt.Text = "分";
  338. this.txtReceiver.Text = "相关客户";
  339. break;
  340. case EnumPublic.SmsSendEvent.每天X时X分发送财务短信到X手机:
  341. labTxt.Text = "时";
  342. this.plEventValue.Controls.Add(number2);
  343. this.plEventValue.Controls.Add(labTxt2);
  344. labTxt2.Text = "分";
  345. this.txtSmsInfo.ReadOnly = true;
  346. this.txtSmsInfo.Text = "系统自动生成";
  347. this.txtReceiver.ReadOnly = false;
  348. this.linkSelectSms.Enabled = false;
  349. if (this.txtReceiver.Text.Trim().Contains("相关"))
  350. {
  351. this.txtReceiver.Text = "";
  352. }
  353. this.lbTips.Text = "";
  354. break;
  355. case EnumPublic.SmsSendEvent.员工生日前X天发送短信给X手机号:
  356. labTxt.Text = "天";
  357. this.txtReceiver.ReadOnly = false;
  358. this.linkSelectSms.Enabled = true;
  359. if (this.txtReceiver.Text.Trim().Contains("相关"))
  360. {
  361. this.txtReceiver.Text = "";
  362. }
  363. break;
  364. case EnumPublic.SmsSendEvent.女宾生日前X天发短信给男宾:
  365. case EnumPublic.SmsSendEvent.男宾生日前X天发短信给女宾:
  366. labTxt.Text = "天";
  367. this.txtReceiver.Text = "相关客户";
  368. break;
  369. case EnumPublic.SmsSendEvent.客户云选片完成后发通知短信:
  370. case EnumPublic.SmsSendEvent.客户云看样完成后发通知短信:
  371. this.plEventValue.Controls.Clear();
  372. this.txtReceiver.ReadOnly = false;
  373. if (this.txtReceiver.Text.Trim().Contains("相关"))
  374. {
  375. this.txtReceiver.Text = "";
  376. }
  377. break;
  378. }
  379. }
  380. /// <summary>
  381. /// 设置事件值
  382. /// </summary>
  383. /// <param name="value"></param>
  384. void SetSendEventValue(string value)
  385. {
  386. int i = 0;
  387. if (value.Trim().Length > 0)
  388. {
  389. if (int.TryParse(value, out i))
  390. {
  391. this.number.Value = i;
  392. }
  393. else if (value.Contains(":"))
  394. {
  395. string[] tempIs = value.Split(':');
  396. if (tempIs.Length > 0) {
  397. if (int.TryParse(tempIs[0], out i))
  398. {
  399. this.number.Value = i;
  400. }
  401. }
  402. if (tempIs.Length > 1)
  403. {
  404. if (int.TryParse(tempIs[1], out i))
  405. {
  406. this.number2.Value = i;
  407. }
  408. else if (tempIs[1].Trim().Length==1)
  409. {
  410. switch (tempIs[1].Trim())
  411. {
  412. case "y":
  413. comBox.SelectedIndex = 0;
  414. break;
  415. case "m":
  416. comBox.SelectedIndex = 1;
  417. break;
  418. case "d":
  419. comBox.SelectedIndex = 2;
  420. break;
  421. case "a":
  422. comBox.SelectedIndex = 3;
  423. break;
  424. }
  425. }
  426. }
  427. }
  428. }
  429. }
  430. /// <summary>
  431. /// 获取事件的说明属性信息
  432. /// </summary>
  433. /// <param name="sEvent"></param>
  434. /// <returns></returns>
  435. string GetControlPropertyAttribute(EnumPublic.SmsSendEvent sEvent)
  436. {
  437. string ret = LYFZ.WinAPI.CustomPublicMethod.ConvertEnumToDescription(sEvent);
  438. if (!ret.Contains("说明:")) {
  439. ret = "说明:“XXX先生/女士”、“XXX先生”、“XXX女士”为客户姓名和称呼";
  440. }
  441. string XXBString = "";
  442. if (SCategory == EnumPublic.SmsCategory.儿童短信)
  443. {
  444. if (!ret.Contains("XXB"))
  445. {
  446. XXBString = "、XXB 为宝宝(儿童)名字 ";
  447. }
  448. }
  449. if (sEvent == EnumPublic.SmsSendEvent.客户云选片完成后发通知短信 || sEvent == EnumPublic.SmsSendEvent.客户云看样完成后发通知短信)
  450. {
  451. return ret.Replace(":XXX", ":“XXX先生/女士”、“XXX先生”、“XXX女士”").Replace("姓名;", "姓名和称呼;")
  452. + " \r\n[注意替换代码一定要大写,客人称呼为“先生/女士”]";
  453. }
  454. else
  455. {
  456. return ret.Replace(":XXX", ":“XXX先生/女士”、“XXX先生”、“XXX女士”").Replace("姓名;", "姓名和称呼;")
  457. + "\r\nXXSPDM 为店名、XXSPTEL 为本店电话、XXSPDZ 为本店地址、XXSPDZM 为本店店长 "//XXSPWZ 为本店网址、
  458. + XXBString
  459. + " \r\n[注意替换代码一定要大写,客人称呼为“先生/女士”]";
  460. }
  461. }
  462. void frmAddSMSTemplate_Load(object sender, EventArgs e)
  463. {
  464. BindSendEvent();
  465. }
  466. /// <summary>
  467. /// 邦定短信事件
  468. /// </summary>
  469. void BindSendEvent()
  470. {
  471. this.cboxEvent.Items.Clear();
  472. this.cboxEvent.DataSource = GetEventList(this.SCategory);
  473. }
  474. List<string> GetEventList(EnumPublic.SmsCategory _SCategory)
  475. {
  476. List<string> elist = new List<string>();
  477. string[] arrys = Enum.GetNames(typeof(LYFZ.EnumPublic.SmsSendEvent));
  478. int[] continueValues = new int[] { 120, 121, 107, 108, 109, 110 };
  479. foreach (string sName in arrys)
  480. {
  481. LYFZ.EnumPublic.SmsSendEvent sEvent = (LYFZ.EnumPublic.SmsSendEvent)Enum.Parse(typeof(LYFZ.EnumPublic.SmsSendEvent), sName);
  482. int value = (int)sEvent;
  483. //用于调整“订单件齐后X分钟发送取件通知”的位置
  484. if (sEvent == EnumPublic.SmsSendEvent.订单件齐后X分钟发送取件通知) { continue; }
  485. if (_SCategory != EnumPublic.SmsCategory.公共短信
  486. && _SCategory != EnumPublic.SmsCategory.医院跟踪短信
  487. && _SCategory != EnumPublic.SmsCategory.礼服管理短信
  488. && sEvent == EnumPublic.SmsSendEvent.客人取件后X分钟)
  489. {
  490. elist.Add(EnumPublic.SmsSendEvent.订单件齐后X分钟发送取件通知.ToString());
  491. }
  492. // if (value == 120 || value == 121)
  493. if(continueValues.Any(i=>i==value))
  494. {
  495. continue;
  496. }
  497. //end
  498. switch (_SCategory)
  499. {
  500. case EnumPublic.SmsCategory.公共短信:
  501. if ((value > 900 && value < 9990) || value == 114)
  502. {
  503. elist.Add(sEvent.ToString());
  504. }
  505. break;
  506. case EnumPublic.SmsCategory.婚纱短信:
  507. if ((value < 200 || (value >= 300 && value < 400)) && value != 114)
  508. {
  509. elist.Add(sEvent.ToString());
  510. }
  511. break;
  512. case EnumPublic.SmsCategory.儿童短信:
  513. if (value < 300 && value != 114)
  514. {
  515. elist.Add(sEvent.ToString());
  516. }
  517. break;
  518. case EnumPublic.SmsCategory.写真短信:
  519. if (value < 200 && value != 114)
  520. {
  521. elist.Add(sEvent.ToString());
  522. }
  523. break;
  524. case EnumPublic.SmsCategory.医院跟踪短信:
  525. if (value == 217 || value == 218 || value == 219 || value == 9991 || value == 9992)
  526. {
  527. elist.Add(sEvent.ToString());
  528. }
  529. break;
  530. case EnumPublic.SmsCategory.婚庆订单短信:
  531. case EnumPublic.SmsCategory.服务订单短信:
  532. if ((value > 400 && value < 500) || value == 100 || value == 101 || value == 106)
  533. {
  534. if (value != 450)
  535. {
  536. if (value == 451)
  537. {
  538. elist.Insert(1, EnumPublic.SmsSendEvent.服务预约后X分钟.ToString());
  539. elist.Insert(2, sEvent.ToString());
  540. }
  541. else
  542. {
  543. elist.Add(sEvent.ToString());
  544. }
  545. }
  546. }
  547. break;
  548. case EnumPublic.SmsCategory.礼服管理短信:
  549. if ((value > 800 && value < 900))
  550. {
  551. elist.Add(sEvent.ToString());
  552. }
  553. break;
  554. }
  555. }
  556. switch (_SCategory)
  557. {
  558. case EnumPublic.SmsCategory.婚纱短信:
  559. case EnumPublic.SmsCategory.儿童短信:
  560. case EnumPublic.SmsCategory.写真短信:
  561. elist.Insert(3, EnumPublic.SmsSendEvent.服务预约后X分钟.ToString());
  562. elist.Insert(4, EnumPublic.SmsSendEvent.服务完成后X分钟.ToString());
  563. elist.Insert(5, EnumPublic.SmsSendEvent.客人预约选片后X分钟.ToString());
  564. elist.Insert(7, EnumPublic.SmsSendEvent.客人预约看样后X分钟.ToString());
  565. elist.Insert(2, EnumPublic.SmsSendEvent.拍照预约后拍照前X天.ToString());
  566. elist.Insert(5, EnumPublic.SmsSendEvent.服务预约后服务前X天.ToString());
  567. elist.Insert(8, EnumPublic.SmsSendEvent.选片预约后选片前X天.ToString());
  568. elist.Insert(11, EnumPublic.SmsSendEvent.看样预约后看样前X天.ToString());
  569. break;
  570. case EnumPublic.SmsCategory.婚庆订单短信:
  571. case EnumPublic.SmsCategory.服务订单短信:
  572. elist.Insert(2, EnumPublic.SmsSendEvent.服务预约后服务前X天.ToString());
  573. break;
  574. }
  575. return elist;
  576. }
  577. }
  578. }