UU跑腿标准版

dictionarytreeedit.aspx.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 dictionarytreeedit : 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["id"].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_DictionaryBase where F_DictionaryFlag='" + Flage + "'";
  31. dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
  32. if (dt.Rows.Count > 0)
  33. {
  34. F_DictionaryFlag.Text = dt.Rows[0]["F_DictionaryFlag"].ToString();
  35. F_DictionaryName.Text = dt.Rows[0]["F_DictionaryName"].ToString();
  36. F_Sort.Text = dt.Rows[0]["F_Sort"].ToString();
  37. }
  38. }
  39. /// <summary>
  40. /// 保存订单信息。
  41. /// </summary>
  42. /// <param name="sender"></param>
  43. /// <param name="e"></param>
  44. protected void btnSubmit_Click(object sender, EventArgs e)
  45. {
  46. HySoft.BaseCallCenter.Model.T_Sys_DictionaryBase orderModel = new Model.T_Sys_DictionaryBase();
  47. HySoft.BaseCallCenter.BLL.T_Sys_DictionaryBase orderBll = new BLL.T_Sys_DictionaryBase();
  48. try
  49. {
  50. orderModel.F_DictionaryFlag = F_DictionaryFlag.Text.Trim();
  51. orderModel.F_DictionaryName = F_DictionaryName.Text.Trim();
  52. orderModel.F_Sort = 0;
  53. orderModel.F_Describe = "";
  54. orderModel.F_State = "";
  55. if (F_Sort.Text.Trim() == "")
  56. {
  57. orderModel.F_Sort = 0;
  58. }
  59. else
  60. {
  61. try { orderModel.F_Sort = Convert.ToInt32(F_Sort.Text.Trim()); }
  62. catch { orderModel.F_Sort = 0; }
  63. }
  64. if (Request.QueryString["getPuction"] == "Add")
  65. {
  66. if (orderBll.Add(orderModel))
  67. {
  68. MessageBoxToWindow("新增成功", "新增提示", "success");
  69. }
  70. else
  71. {
  72. MessageBoxToWindow("新增失败,字典标志不能重复!", "新增提示!", "error");
  73. }
  74. }
  75. if (Request.QueryString["getPuction"] == "Edit")
  76. {
  77. orderModel.F_DictionaryFlag = Request.QueryString["id"];
  78. if (orderBll.Update(orderModel))
  79. {
  80. MessageBoxToWindow("修改成功", "修改提示!", "success");
  81. }
  82. else
  83. {
  84. MessageBoxToWindow("修改失败,字典标志不能重复!", "修改提示!", "error");
  85. }
  86. }
  87. }
  88. catch
  89. {
  90. MessageBoxToWindow("新增失败,字典标志不能重复!", "新增提示!", "error");
  91. }
  92. }
  93. #region 弹出对话框
  94. /// <summary>
  95. /// 弹出对话框
  96. /// </summary>
  97. /// <param name="title"></param>
  98. /// <param name="content"></param>
  99. /// <param name="type"></param>
  100. public void MessageBoxToWindow(string title, string content, string type)
  101. {
  102. string script = "";
  103. switch (type)
  104. {
  105. case "error"://失败
  106. type = "error";
  107. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  108. break;
  109. case "success"://成功
  110. type = "info";
  111. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
  112. break;
  113. case "catch"://异常
  114. type = "warning";
  115. script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
  116. break;
  117. default:
  118. type = "question";
  119. break;
  120. }
  121. ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
  122. }
  123. #endregion
  124. }
  125. }