UU跑腿标准版

functionanniuedit.aspx.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.sysmanage
  10. {
  11. public partial class functionanniuedit : System.Web.UI.Page
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. if (Request.QueryString["getPuction"].ToString() == "Edit")
  18. {
  19. getOrderInformerEdit(Request.QueryString["singleFlage"].ToString());
  20. }
  21. }
  22. }
  23. /// <summary>
  24. /// 初始化信息
  25. /// </summary>
  26. private void getOrderInformerEdit(string Flage)
  27. {
  28. DataTable dt = new DataTable();
  29. DataTable dtItems = new DataTable();
  30. string sql = "select * from T_Sys_ModuleFunctionsOpt where F_Id='" + Flage + "'";
  31. dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  32. if (dt.Rows.Count > 0)
  33. {
  34. F_OptCode.Text = dt.Rows[0]["F_OptCode"].ToString();
  35. F_OptName.Text = dt.Rows[0]["F_OptName"].ToString();
  36. F_Remark.Text = dt.Rows[0]["F_Remark"].ToString();
  37. hfID.Value = dt.Rows[0]["F_FunctionId"].ToString();
  38. }
  39. }
  40. /// <summary>
  41. /// 保存订单信息。
  42. /// </summary>
  43. /// <param name="sender"></param>
  44. /// <param name="e"></param>
  45. protected void btnSubmit_Click(object sender, EventArgs e)
  46. {
  47. HySoft.BaseCallCenter.Model.T_Sys_ModuleFunctionsOpt orderModel = new Model.T_Sys_ModuleFunctionsOpt();
  48. HySoft.BaseCallCenter.BLL.T_Sys_ModuleFunctionsOpt orderBll = new BLL.T_Sys_ModuleFunctionsOpt();
  49. try
  50. {
  51. if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
  52. {
  53. orderModel.F_FunctionId = Convert.ToInt32(Request.QueryString["id"].ToString());
  54. hfInitList.Value = Request.QueryString["id"].ToString();
  55. }
  56. orderModel.F_OptName = F_OptName.Text.Trim();
  57. orderModel.F_OptCode = F_OptCode.Text.Trim();
  58. orderModel.F_Remark = F_Remark.Text.Trim();
  59. if (Request.QueryString["getPuction"] == "Add")
  60. {
  61. if (orderBll.Add(orderModel) > 0)
  62. {
  63. MessageBoxToWindow("新增成功", "新增提示", "success");
  64. }
  65. else
  66. {
  67. MessageBoxToWindow("新增失败,字典标志不能重复!", "新增提示!", "error");
  68. }
  69. }
  70. if (Request.QueryString["getPuction"] == "Edit")
  71. {
  72. orderModel.F_FunctionId = Convert.ToInt32(hfID.Value);
  73. hfInitList.Value = Request.QueryString["singleFlage"];
  74. orderModel.F_Id = Convert.ToInt32(Request.QueryString["singleFlage"]);
  75. if (orderBll.Update(orderModel))
  76. {
  77. MessageBoxToWindow("修改成功", "修改提示!", "success");
  78. }
  79. else
  80. {
  81. MessageBoxToWindow("修改失败!", "修改提示!", "error");
  82. }
  83. }
  84. }
  85. catch
  86. {
  87. MessageBoxToWindow("失败", "提示!", "error");
  88. }
  89. }
  90. #region 弹出对话框
  91. /// <summary>
  92. /// 弹出对话框
  93. /// </summary>
  94. /// <param name="title"></param>
  95. /// <param name="content"></param>
  96. /// <param name="type"></param>
  97. public void MessageBoxToWindow(string title, string content, string type)
  98. {
  99. string script = "";
  100. switch (type)
  101. {
  102. case "error"://失败
  103. type = "error";
  104. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  105. break;
  106. case "success"://成功
  107. type = "info";
  108. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  109. break;
  110. case "catch"://异常
  111. type = "warning";
  112. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  113. break;
  114. default:
  115. type = "question";
  116. break;
  117. }
  118. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  119. }
  120. #endregion
  121. }
  122. }