SetCloudSelectionInterface.aspx.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 LYFZ.WeixinServers.WeiXinAPP
  8. {
  9. public partial class SetCloudSelectionInterface : System.Web.UI.Page
  10. {
  11. LYFZ.WeixinServiceDate.DAL.DAL_SystemConfigure scDal = new WeixinServiceDate.DAL.DAL_SystemConfigure();
  12. public string NetIPUrl = "";
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. CommonHandler.CheckLoginJump(this);
  16. LYFZ.WeixinServiceDate.Model.Model_SystemConfigure scModel = scDal.GetModel("CloudSelectionUrl");
  17. if (!IsPostBack) {
  18. try
  19. {
  20. if (Request.QueryString["ipurl"] != null)
  21. {
  22. if (CommonHandler.CheckAdmin(this))
  23. {
  24. string ipurl = Request.QueryString["ipurl"].ToString().Trim();
  25. bool retBl = false;
  26. if (scModel != null && scModel.ID > 0)
  27. {
  28. scModel.Sconfig_Value = ipurl;
  29. scModel.Sconfig_CreateName = CommonHandler.GetAdminUser(this).Account;
  30. retBl = scDal.Update(scModel);
  31. }
  32. else
  33. {
  34. scModel = new WeixinServiceDate.Model.Model_SystemConfigure();
  35. scModel.Sconfig_Code = "CloudSelectionUrl";
  36. scModel.Sconfig_Value = ipurl;
  37. scModel.Sconfig_Name = "云选片接口地址";
  38. scModel.Sconfig_IsEnabled = true;
  39. scModel.Sconfig_CreateName = CommonHandler.GetAdminUser(this).Account;
  40. scModel.Sconfig_CreateDatetime = DateTime.Now;
  41. retBl = scDal.Add(scModel);
  42. }
  43. if (retBl)
  44. {
  45. Global.CloudSelectionUrl = ipurl;
  46. myMsegesBox("保存成功!");
  47. }
  48. else
  49. {
  50. myMsegesBox("保存失败,请重新");
  51. }
  52. }
  53. }
  54. }
  55. catch (Exception ex){
  56. myMsegesBox("保存失败,原因:"+ex.Message);
  57. }
  58. }
  59. if (scModel != null)
  60. {
  61. NetIPUrl = scModel.Sconfig_Value;
  62. }
  63. }
  64. void myMsegesBox(string msg)
  65. {
  66. Response.Write("<script>alert('" + msg + "');document.location='SetCloudSelectionInterface.aspx';</script>"); return;
  67. }
  68. }
  69. }