市长热线演示版

smsTypeEdit.aspx.cs 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 HySoft.Common;
  8. namespace HySoft.BaseCallCenter.Web.smsmanage
  9. {
  10. public partial class smsTypeEdit : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. Response.Expires = -1;
  15. if (!IsPostBack)
  16. {
  17. if (!string.IsNullOrEmpty(Request.QueryString["id"]))
  18. {
  19. Model.T_Sms_SmsModel T_Sms_SmsModel = new BLL.T_Sms_SmsModel().GetModel(Convert.ToInt32(Request.QueryString["id"]));
  20. this.txtName.Text = T_Sms_SmsModel.Name;
  21. this.txtContents.Text = T_Sms_SmsModel.Contents;
  22. this.txtRemark.Text = T_Sms_SmsModel.Remark;
  23. }
  24. }
  25. }
  26. #region 保存信息
  27. private void SaveInfo()
  28. {
  29. try
  30. {
  31. if (!string.IsNullOrEmpty(Request.QueryString["action"]))
  32. {
  33. if (Request.QueryString["action"].Trim() == "Add")
  34. {
  35. Model.T_Sms_SmsModel T_Sms_SmsModel=new Model.T_Sms_SmsModel();
  36. T_Sms_SmsModel.Name = this.txtName.Text;
  37. T_Sms_SmsModel.Contents = this.txtContents.Text;
  38. T_Sms_SmsModel.Remark = this.txtRemark.Text;
  39. T_Sms_SmsModel.AddTime = DateTime.Now;
  40. T_Sms_SmsModel.State = "0";
  41. LoginUser p_LoginUser = new LoginUser(this.Context);
  42. if (p_LoginUser != null)
  43. {
  44. T_Sms_SmsModel.AddPeople = p_LoginUser.UserCode;
  45. }
  46. int bl = new BLL.T_Sms_SmsModel().Add(T_Sms_SmsModel);
  47. if (bl > 0)
  48. {
  49. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  50. }
  51. else
  52. {
  53. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  54. }
  55. }
  56. if (Request.QueryString["action"].Trim() == "Modify")
  57. {
  58. Model.T_Sms_SmsModel T_Sms_SmsModel = new BLL.T_Sms_SmsModel().GetModel(Convert.ToInt32(Request.QueryString["id"])); ;
  59. T_Sms_SmsModel.Name = this.txtName.Text;
  60. T_Sms_SmsModel.Contents = this.txtContents.Text;
  61. T_Sms_SmsModel.Remark = this.txtRemark.Text;
  62. LoginUser p_LoginUser = new LoginUser(this.Context);
  63. if (p_LoginUser != null)
  64. {
  65. T_Sms_SmsModel.EditPeople = p_LoginUser.UserCode;
  66. }
  67. T_Sms_SmsModel.EditTime = DateTime.Now;
  68. bool bl = new BLL.T_Sms_SmsModel().Update(T_Sms_SmsModel);
  69. if (bl)
  70. {
  71. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
  72. }
  73. else
  74. {
  75. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
  76. }
  77. }
  78. }
  79. }
  80. catch
  81. {
  82. ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
  83. }
  84. }
  85. #endregion
  86. protected void btnSubmit_Click(object sender, EventArgs e)
  87. {
  88. SaveInfo();
  89. }
  90. }
  91. }