市长热线演示版

workbuttonmanageEdit.aspx.cs 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. namespace HySoft.BaseCallCenter.Web.workordermanage.workorderset
  8. {
  9. public partial class workbuttonmanageEdit : BasePage
  10. {
  11. int id = 0;
  12. BLL.T_Wo_WorkOrderButton WorkOrdeButton = new BLL.T_Wo_WorkOrderButton();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. if (Action == "addedit")
  18. {
  19. if (Request.QueryString["id"] != null)
  20. {
  21. Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
  22. id = Convert.ToInt32(Request.QueryString["id"].ToString());
  23. model = WorkOrdeButton.GetModel(id);
  24. F_ParamDes.Text = model.F_Des;//描述
  25. textF_Sort.Text = model.F_Sort.ToString();//排序
  26. F_ParamCode.Text = model.F_Name;//状态名称
  27. F_ParamValue.Text = model.F_Code;
  28. }
  29. }
  30. }
  31. }
  32. /// <summary>
  33. /// 处理类型新增还是修改
  34. /// </summary>
  35. public string Action
  36. {
  37. get
  38. {
  39. if (Request.QueryString["action"] != null)
  40. {
  41. return Request.QueryString["action"].ToString().ToLower();
  42. }
  43. else
  44. {
  45. return "add";
  46. }
  47. }
  48. }
  49. /// <summary>
  50. /// 添加用户信息
  51. /// </summary>
  52. /// <returns></returns>
  53. public bool Add()
  54. {
  55. Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
  56. model.F_Des = F_ParamDes.Text.Trim();//描述
  57. model.F_Sort = Convert.ToInt32(textF_Sort.Text.Trim());//排序
  58. model.F_Name = F_ParamCode.Text.Trim();//状态名称
  59. model.F_Code = F_ParamValue.Text.Trim();
  60. model.F_DeleteFlag = 0;//是否删除
  61. bool result = WorkOrdeButton.Add(model);
  62. return result;
  63. }
  64. /// <summary>
  65. /// 修改用户信息
  66. /// </summary>
  67. /// <returns></returns>
  68. public bool Edit()
  69. {
  70. Model.T_Wo_WorkOrderButton model = new Model.T_Wo_WorkOrderButton();
  71. model.F_Des = F_ParamDes.Text.Trim();//描述
  72. model.F_Sort = Convert.ToInt32(textF_Sort.Text.Trim());//排序
  73. model.F_Name = F_ParamCode.Text.Trim();//状态名称
  74. model.F_Code = F_ParamValue.Text.Trim();
  75. model.F_DeleteFlag = 0;
  76. model.F_ButtonId =Convert.ToInt32(Request.QueryString["id"].ToString());
  77. bool result = WorkOrdeButton.Update(model);
  78. return result;
  79. }
  80. protected void btnSubmit_Click(object sender, EventArgs e)
  81. {
  82. try
  83. {
  84. bool result;
  85. string a = Request.QueryString["id"];
  86. if (string.IsNullOrEmpty(a) || a=="0")
  87. {
  88. InsertOptLogs(0, 0, "操作成功!workbuttonmanageEdit.aspx页面,添加操作。", 0);
  89. result = Add();
  90. }
  91. else
  92. {
  93. InsertOptLogs(0, 0, "操作成功!workbuttonmanageEdit.aspx页面,修改操作。", 0);
  94. result = Edit();
  95. }
  96. MessageBoxToWindow("提交成功", "提示", "success");
  97. }
  98. catch (Exception ex)
  99. {
  100. InsertOptLogs(0, 0, "操作异常!workbuttonmanageEdit.aspx页面,异常信息:"+ex.ToString(), 2);
  101. MessageBoxToWindow("异常信息", ex.Message, "catch");
  102. }
  103. }
  104. /// <summary>
  105. /// 弹出对话框
  106. /// </summary>
  107. /// <param name="title"></param>
  108. /// <param name="content"></param>
  109. /// <param name="type"></param>
  110. public void MessageBoxToWindow(string title, string content, string type)
  111. {
  112. string script = "";
  113. switch (type)
  114. {
  115. case "error"://失败
  116. type = "warning";
  117. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  118. break;
  119. case "success"://成功
  120. type = "info";
  121. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  122. break;
  123. case "catch"://异常
  124. type = "error";
  125. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  126. break;
  127. default:
  128. type = "question";
  129. break;
  130. }
  131. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  132. }
  133. }
  134. }