市长热线演示版

smsSent.aspx.cs 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using HySoft.Common;
  9. namespace HySoft.BaseCallCenter.Web.smsmanage
  10. {
  11. public partial class smsSent : BasePage
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack) {
  16. LoadDic();
  17. }
  18. }
  19. public void LoadDic() {
  20. BLL.T_Sms_SmsModel bll_T_Sms_InfoType = new BLL.T_Sms_SmsModel();
  21. //指定DropDownList使用的数据源
  22. ddlInfoType.DataSource = bll_T_Sms_InfoType.GetModelList(" State=0");
  23. //指定DropDownList使用的表里的那些字段
  24. ddlInfoType.DataTextField = "Name"; //dropdownlist的Text的字段
  25. ddlInfoType.DataValueField = "ModelId";//dropdownlist的Value的字段
  26. ddlInfoType.DataBind();
  27. this.ddlInfoType.Items.Insert(0, new ListItem("--请选择--", ""));
  28. }
  29. public void Button1_Click(object sender, EventArgs e)
  30. {
  31. if (!string.IsNullOrEmpty(txtTelephone.Value)) {
  32. string[] arrStr = txtTelephone.Value.Split(',');
  33. foreach(string str in arrStr){
  34. AddSentSms(str);
  35. }
  36. }
  37. }
  38. public void AddSentSms(string strSent) {
  39. try
  40. {
  41. Model.T_SMS_SendSMSTask sentSmsModel = new Model.T_SMS_SendSMSTask();
  42. BLL.T_SMS_SendSMSTask sentSmsBll = new BLL.T_SMS_SendSMSTask();
  43. LoginUser p_LoginUser = new LoginUser(this.Context);
  44. sentSmsModel.TelNum = strSent;
  45. sentSmsModel.F_Name = p_LoginUser.UserName.ToString();
  46. sentSmsModel.Content = txtContent.Value;
  47. sentSmsModel.CommitTime = DateTime.Now;
  48. sentSmsModel.SendTime = DateTime.Now;
  49. sentSmsModel.LastSentTime = DateTime.Now;
  50. int refa = sentSmsBll.Add(sentSmsModel);
  51. if (refa>0)
  52. {
  53. MessageBoxToWindow("新增成功", "新增提示!", "success");
  54. }
  55. else
  56. {
  57. MessageBoxToWindow("新增失败", "新增提示!", "error");
  58. }
  59. }catch(Exception ex){
  60. }
  61. }
  62. #region 弹出对话框
  63. /// <summary>
  64. /// 弹出对话框
  65. /// </summary>
  66. /// <param name="title"></param>
  67. /// <param name="content"></param>
  68. /// <param name="type"></param>
  69. public void MessageBoxToWindow(string title, string content, string type)
  70. {
  71. string script = "";
  72. switch (type)
  73. {
  74. case "error"://失败
  75. type = "error";
  76. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  77. break;
  78. case "success"://成功
  79. type = "info";
  80. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  81. break;
  82. case "catch"://异常
  83. type = "warning";
  84. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  85. break;
  86. default:
  87. type = "question";
  88. break;
  89. }
  90. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  91. }
  92. #endregion
  93. }
  94. }