市长热线演示版

workflowEdit.aspx.cs 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 workflowEdit : BasePage
  10. {
  11. BLL.T_Wf_WorkFlow WorkOrdeFlow = new BLL.T_Wf_WorkFlow();
  12. int id = 0;
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack) {
  16. if (Action == "addedit")
  17. {
  18. if (Request.QueryString["id"] != null)
  19. {
  20. Model.T_Wf_WorkFlow model = new Model.T_Wf_WorkFlow();
  21. id = Convert.ToInt32(Request.QueryString["id"].ToString());
  22. model = WorkOrdeFlow.GetModel(id);
  23. F_ParamDes.Text = model.F_XML;//描述
  24. textF_Date.Text = model.F_StartDate.ToString();//排序
  25. F_ParamName.Text = model.F_Name;//状态名称
  26. if (model.F_State == false)
  27. {
  28. F_ParamState.Text ="0";
  29. }
  30. if(model.F_State == true)
  31. {
  32. F_ParamState.Text = "1";
  33. }
  34. }
  35. }
  36. }
  37. }
  38. /// <summary>
  39. /// 处理类型新增还是修改
  40. /// </summary>
  41. public string Action
  42. {
  43. get
  44. {
  45. if (Request.QueryString["action"] != null)
  46. {
  47. return Request.QueryString["action"].ToString().ToLower();
  48. }
  49. else
  50. {
  51. return "add";
  52. }
  53. }
  54. }
  55. /// <summary>
  56. /// 添加用户信息
  57. /// </summary>
  58. /// <returns></returns>
  59. public bool Add()
  60. {
  61. Model.T_Wf_WorkFlow model = new Model.T_Wf_WorkFlow();
  62. model.F_Name = F_ParamName.Text.Trim();//名称
  63. if (F_ParamState.SelectedValue.Trim() == "0")
  64. {
  65. model.F_State = false;//状态
  66. }
  67. else if (F_ParamState.SelectedValue.Trim() == "1")
  68. {
  69. model.F_State = true;//状态
  70. }
  71. model.F_CreateDate = DateTime.Now;
  72. model.F_CreateName = "8000";
  73. if (!string.IsNullOrEmpty(textF_Date.Text))
  74. {
  75. model.F_StartDate =Convert.ToDateTime(textF_Date.Text);
  76. }
  77. model.F_XML = F_ParamDes.Text;//是否删除
  78. bool result = WorkOrdeFlow.Add(model);
  79. return result;
  80. }
  81. /// <summary>
  82. /// 修改用户信息
  83. /// </summary>
  84. /// <returns></returns>
  85. public bool Edit()
  86. {
  87. Model.T_Wf_WorkFlow model = new Model.T_Wf_WorkFlow();
  88. model = new BLL.T_Wf_WorkFlow().GetModel(Convert.ToInt32(Request.QueryString["id"].ToString()));
  89. model.F_Name = F_ParamName.Text.Trim();//名称
  90. if (F_ParamState.SelectedValue.Trim() == "0")
  91. {
  92. model.F_State = false;//状态
  93. }
  94. else if (F_ParamState.SelectedValue.Trim() == "1")
  95. {
  96. model.F_State = true;//状态
  97. }
  98. model.F_EditDate = DateTime.Now;
  99. model.F_EditName = "8000";
  100. if (!string.IsNullOrEmpty(textF_Date.Text))
  101. {
  102. model.F_StartDate = Convert.ToDateTime(textF_Date.Text);
  103. }
  104. model.F_XML = F_ParamDes.Text;//
  105. model.F_ID = Convert.ToInt32(Request.QueryString["id"].ToString());
  106. bool result = WorkOrdeFlow.Update(model);
  107. return result;
  108. }
  109. /// <summary>
  110. /// 弹出对话框
  111. /// </summary>
  112. /// <param name="title"></param>
  113. /// <param name="content"></param>
  114. /// <param name="type"></param>
  115. public void MessageBoxToWindow(string title, string content, string type)
  116. {
  117. string script = "";
  118. switch (type)
  119. {
  120. case "error"://失败
  121. type = "warning";
  122. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  123. break;
  124. case "success"://成功
  125. type = "info";
  126. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  127. break;
  128. case "catch"://异常
  129. type = "error";
  130. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  131. break;
  132. default:
  133. type = "question";
  134. break;
  135. }
  136. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  137. }
  138. protected void btnSubmit_Click(object sender, EventArgs e)
  139. {
  140. try
  141. {
  142. bool result;
  143. string a = Request.QueryString["id"];
  144. if (string.IsNullOrEmpty(a) || a == "0")
  145. {
  146. InsertOptLogs(0, 0, "操作成功!workflowEdit.aspx页面,添加操作。", 0);
  147. result = Add();
  148. }
  149. else
  150. {
  151. InsertOptLogs(0, 0, "操作成功!workflowEdit.aspx页面,修改操作。", 0);
  152. result = Edit();
  153. }
  154. MessageBoxToWindow("提交成功", "提示", "success");
  155. }
  156. catch (Exception ex)
  157. {
  158. InsertOptLogs(0, 0, "操作异常!workflowEdit.aspx页面,异常信息:"+ex.ToString(), 2);
  159. MessageBoxToWindow("异常信息", ex.Message, "catch");
  160. }
  161. }
  162. }
  163. }