市长热线演示版

questioncategoryedit.aspx.cs 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.askmanage
  9. {
  10. public partial class questioncategoryedit : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. if (!IsPostBack)
  15. {
  16. if (!string.IsNullOrEmpty(Request.QueryString["id"]))
  17. {
  18. InitObj(Request.QueryString["id"].Trim());
  19. }
  20. }
  21. }
  22. void InitObj(string id)
  23. {
  24. try
  25. {
  26. T_Ask_QuestionCategoryObj = new BLL.T_Ask_QuestionCategory().GetModel(Convert.ToInt32(id));
  27. }
  28. catch (Exception ex)
  29. {
  30. }
  31. }
  32. private Model.T_Ask_QuestionCategory T_Ask_QuestionCategoryObj
  33. {
  34. get
  35. {
  36. Model.T_Ask_QuestionCategory model = new Model.T_Ask_QuestionCategory();
  37. if (Request.QueryString["otype"].Trim() == "modify")
  38. {
  39. model.F_CategoryId = Convert.ToInt32(Request.QueryString["id"].Trim());
  40. }
  41. else
  42. {
  43. model.F_CategoryId = 0;
  44. }
  45. //model.F_CategoryNumber = F_CategoryNumber;
  46. model.F_CategoryName = F_CategoryName.Text.Trim();
  47. model.F_CreateOn = DateTime.Now;
  48. try
  49. {
  50. LoginUser p_LoginUser = new LoginUser(this.Context);
  51. model.F_CreateBy = p_LoginUser.UserID;
  52. }
  53. catch { }
  54. model.F_DeleteFlag = 0;
  55. return model;
  56. }
  57. set
  58. {
  59. if (value != null)
  60. {
  61. this.F_CategoryId.Value = value.F_CategoryId.ToString();
  62. F_CategoryName.Text = value.F_CategoryName.Trim();
  63. }
  64. }
  65. }
  66. protected void btnSubmit_Click(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. if (Request.QueryString["otype"] == "new")
  71. {
  72. if (new BLL.T_Ask_QuestionCategory().Add(T_Ask_QuestionCategoryObj) > 0)
  73. {
  74. MessageBoxToWindow("新增成功", "新增提示", "success");
  75. }
  76. else
  77. {
  78. MessageBoxToWindow("新增失败", "新增提示!", "error");
  79. }
  80. }
  81. if (Request.QueryString["otype"] == "modify")
  82. {
  83. if (new BLL.T_Ask_QuestionCategory().Update(T_Ask_QuestionCategoryObj))
  84. {
  85. MessageBoxToWindow("修改成功", "修改提示!", "success");
  86. }
  87. else
  88. {
  89. MessageBoxToWindow("修改失败!", "修改提示!", "error");
  90. }
  91. }
  92. }
  93. catch
  94. {
  95. MessageBoxToWindow("保存失败!", "保存提示!", "error");
  96. }
  97. }
  98. #region 弹出对话框
  99. /// <summary>
  100. /// 弹出对话框
  101. /// </summary>
  102. /// <param name="title"></param>
  103. /// <param name="content"></param>
  104. /// <param name="type"></param>
  105. public void MessageBoxToWindow(string title, string content, string type)
  106. {
  107. string script = "";
  108. switch (type)
  109. {
  110. case "error"://失败
  111. type = "error";
  112. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  113. break;
  114. case "success"://成功
  115. type = "info";
  116. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  117. break;
  118. case "catch"://异常
  119. type = "warning";
  120. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  121. break;
  122. default:
  123. type = "question";
  124. break;
  125. }
  126. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  127. }
  128. #endregion
  129. }
  130. }