MessagesTracking.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.HospitalTrackingSystem
  10. {
  11. public partial class MessagesTracking : LYFZ.Software.UI.HospitalTrackingSystem.MessagesTracking
  12. {
  13. public MessagesTracking()
  14. {
  15. this.Load += MessagesTracking_Load;
  16. this.Shown += MessagesTracking_Shown;
  17. this.bntSelect.Click += bntSelect_Click;
  18. this.btnTexting.Click += btnTexting_Click;
  19. this.btnSmsRules.Click += btnSmsRules_Click;
  20. this.btnExport.Click += btnExport_Click;
  21. this.btnClose.Click += btnClose_Click;
  22. this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
  23. this.dgvTrack.CellDoubleClick += dgvTrack_CellDoubleClick;
  24. this.radioButtonEx1.CheckedChanged += radioButtonEx1_CheckedChanged;
  25. this.radioButtonEx2.CheckedChanged += radioButtonEx2_CheckedChanged;
  26. this.radioButtonEx3.CheckedChanged += radioButtonEx3_CheckedChanged;
  27. this.btnTexting.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.SMSSend);
  28. this.btnExport.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.DataExport);
  29. }
  30. void MessagesTracking_Shown(object sender, EventArgs e)
  31. {
  32. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(
  33. VersionControl.VersionFunctionEnum.医院跟踪系统跟踪短信);
  34. if (!b)
  35. {
  36. this.Close();
  37. }
  38. List<Control> hideControls = new List<Control>();
  39. hideControls.Add(btnTexting);
  40. LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.短信管理医院跟踪短信, hideControls, null, null);
  41. }
  42. /// <summary>
  43. /// 选择复选框事件
  44. /// </summary>
  45. /// <param name="sender"></param>
  46. /// <param name="e"></param>
  47. void radioButtonEx3_CheckedChanged(object sender, EventArgs e)
  48. {
  49. if (this.radioButtonEx3.Checked == true)
  50. {
  51. this.radioButtonEx3.Checked = true;
  52. this.radioButtonEx1.Checked = false;
  53. this.radioButtonEx2.Checked = false;
  54. }
  55. }
  56. /// <summary>
  57. /// 选择复选框事件
  58. /// </summary>
  59. /// <param name="sender"></param>
  60. /// <param name="e"></param>
  61. void radioButtonEx2_CheckedChanged(object sender, EventArgs e)
  62. {
  63. if (radioButtonEx2.Checked == true)
  64. {
  65. this.radioButtonEx2.Checked = true;
  66. this.radioButtonEx1.Checked = false;
  67. this.radioButtonEx3.Checked = false;
  68. }
  69. }
  70. /// <summary>
  71. /// 选择复选框事件
  72. /// </summary>
  73. /// <param name="sender"></param>
  74. /// <param name="e"></param>
  75. void radioButtonEx1_CheckedChanged(object sender, EventArgs e)
  76. {
  77. if (radioButtonEx1.Checked == true)
  78. {
  79. this.radioButtonEx1.Checked = true;
  80. this.radioButtonEx2.Checked = false;
  81. this.radioButtonEx3.Checked = false;
  82. }
  83. }
  84. /// <summary>
  85. /// 双击事件
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. void dgvTrack_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  90. {
  91. if (this.dgvTrack.SelectedRows != null && this.dgvTrack.SelectedRows.Count > 0)
  92. {
  93. IntentionsEntered frm = new IntentionsEntered();
  94. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  95. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  96. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  97. frm.StrOrdNumber = this.dgvTrack.CurrentRow.Cells["来单批号"].Value.ToString();
  98. frm.Owner = this;
  99. frm.ShowDialog();
  100. if (frm.IsSaveed)
  101. { this.PublicFunctionRows(); }
  102. }
  103. }
  104. /// <summary>
  105. /// 关闭窗体
  106. /// </summary>
  107. /// <param name="sender"></param>
  108. /// <param name="e"></param>
  109. void btnClose_Click(object sender, EventArgs e)
  110. {
  111. if (MessageBoxCustom.Show("你确定要关闭吗?", "关闭提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  112. { this.Close(); }
  113. }
  114. /// <summary>
  115. /// 导出按钮
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. void btnExport_Click(object sender, EventArgs e)
  120. {
  121. if (this.dgvTrack.Rows.Count > 0)
  122. { this.dgvTrack.ExportDataTable(); }
  123. }
  124. /// <summary>
  125. /// 短信规则设置按钮
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. void btnSmsRules_Click(object sender, EventArgs e)
  130. {
  131. LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet frm = new LYFZ.Software.MainBusiness.SMSManagement.frmSMSTemplateSet();
  132. frm.Show();
  133. }
  134. /// <summary>
  135. /// 发短信按钮
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. void btnTexting_Click(object sender, EventArgs e)
  140. {
  141. LYFZ.Software.UI.SMSManagement.SmsSend.FrmSendSms frm = new UI.SMSManagement.SmsSend.FrmSendSms();
  142. if (dgvTrack.SelectedRows == null || dgvTrack.SelectedRows.Count == 0)
  143. {
  144. MessageBoxCustom.Show("请选择要发送短信的客人!");
  145. return;
  146. }
  147. string Sj1 = "";
  148. string User_Telephone = "";
  149. LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms sendSms = new SMSManagement.SmsSend.FrmSendSms();
  150. for (int i = 0; i < dgvTrack.SelectedRows.Count; i++)
  151. {
  152. User_Telephone = dgvTrack.SelectedRows[i].Cells["本人手机"].Value.ToString();
  153. //检查手机合法性
  154. if (!string.IsNullOrEmpty(User_Telephone))
  155. {
  156. string ret = LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(User_Telephone);
  157. if (ret.Trim().Length <= 0)
  158. {
  159. Sj1 += User_Telephone + ",";
  160. }
  161. else if (dgvTrack.SelectedRows.Count == 1)
  162. {
  163. MessageBoxCustom.Show("手机号无效:" + ret);
  164. return;
  165. }
  166. }
  167. }
  168. sendSms.Phone = Sj1.Trim(',');
  169. sendSms.ShowDialog();
  170. }
  171. /// <summary>
  172. /// 查询按钮
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. void bntSelect_Click(object sender, EventArgs e)
  177. { this.PublicFunctionRows(); }
  178. /// <summary>
  179. /// 窗体加载时
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. void MessagesTracking_Load(object sender, EventArgs e)
  184. { this.PublicFunctionRows(); }
  185. /// <summary>
  186. /// 创建行
  187. /// </summary>
  188. private void PublicFunctionRows()
  189. {
  190. this.UcPagerEx1.PageCurrent = 1;
  191. this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
  192. this.UcPagerEx1.Bind();
  193. }
  194. /// <summary>
  195. /// 分页数据
  196. /// </summary>
  197. /// <param name="e"></param>
  198. /// <returns></returns>
  199. int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
  200. {
  201. DataTable dt = new DataTable();
  202. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  203. pageData.TableName = "View_HospitalContact";
  204. pageData.PageIndex = this.UcPagerEx1.PageCurrent;
  205. pageData.PageSize = this.UcPagerEx1.PageSize;
  206. pageData.QueryCondition = GetWhereStr();
  207. pageData.QueryFieldName = "ID,来单批号,客户姓名,宝宝姓名,宝宝性别,生日类型,[宝宝生日/预产期],宝宝年龄,宝宝天数,是否农历,怀孕天数,本人手机,老公姓名,老公手机,发送来单短信,喂养方式,客户区域,客户类别,订单客户,业务种类,业务意向,来单医院,门市,备注,录入时间,录入时间查询";
  208. pageData.OrderStr = "ID";
  209. pageData.OrderType = 1;
  210. string strHideField = "ID,录入时间查询,订单客户";
  211. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  212. {
  213. dt = pageData.QueryDataTable().Tables[0];
  214. });
  215. try
  216. { this.dgvTrack.DataSource(dt, strHideField: strHideField); }
  217. catch
  218. { }
  219. try
  220. {
  221. this.UcPagerEx1.TbDataSource = dt;
  222. }
  223. catch { }
  224. this.dgvTrack.ClearSelection();
  225. return pageData.TotalCount;
  226. }
  227. /// <summary>
  228. /// 查询条件
  229. /// </summary>
  230. /// <returns></returns>
  231. private string GetWhereStr()
  232. {
  233. string StrWhere = " 1=1 ";
  234. string StrteBind = this.numericUpDown1.Value.ToString();
  235. string StrteEnd = this.numericUpDown2.Value.ToString();
  236. string StrQ = "怀孕天数";
  237. string StrN = "宝宝年龄";
  238. string StrD = "宝宝天数";
  239. if (this.radioButtonEx1.Checked == true)
  240. {
  241. if (StrteBind != "" && StrteEnd != "")
  242. {
  243. StrWhere += " and (" + StrD + " between '" + StrteBind + "' and '" + StrteEnd + "' ) ";
  244. }
  245. }
  246. if (this.radioButtonEx2.Checked == true)
  247. {
  248. if (StrteBind != "" && StrteEnd != "")
  249. {
  250. StrWhere += " and (" + StrN + " between '" + StrteBind + "' and '" + StrteEnd + "' ) ";
  251. }
  252. }
  253. if (this.radioButtonEx3.Checked == true)
  254. {
  255. if (StrteBind != "" && StrteEnd != "")
  256. {
  257. StrWhere += " and (" + StrQ + " between '" + StrteBind + "' and '" + StrteEnd + "' ) ";
  258. }
  259. }
  260. return StrWhere;
  261. }
  262. }
  263. }