zoukankan      html  css  js  c++  java
  • 切换城市功能

    与切换城市类似,实例为切换不同的数据库源。

    主要功能:

      1. 记录请求页面

      2. 切换数据库源

      3. 返回到请求页面

     1 public partial class SelectDB : BasePage
     2 {
     3     ......
     4     public string SrcUrl 
     5     {
     6         get { return Session["srcurl"] == null || Session["srcurl"].ToString().Equals("/SignOn.aspx") ? "QueryPlanByMonth.aspx" : Session["srcurl"].ToString(); }
     7         private set { Session["srcurl"] = value; } 
     8     }
     9     protected void Page_Load(object sender, EventArgs e)
    10     {
    11         if (!IsPostBack)
    12         {
    13             if (Request.UrlReferrer != null)
    14             {
    15                 SrcUrl = Request.UrlReferrer.AbsolutePath;
    16             }
    17         }
    18     }
    19     protected void LbtnFQ_Click(object sender, EventArgs e)
    20     {
    21         SetConnAndRedirect("AAConn");
    22     }
    23     protected void LbtnFG_Click(object sender, EventArgs e)
    24     {
    25         SetConnAndRedirect("BBGConn");
    26     }
    27 
    28     private void SetConnAndRedirect(string conn)
    29     {
    30         base.DBConn = conn;
    31         Response.Redirect(SrcUrl);
    32     }
    33 }
    34 public class BasePage : Page
    35 {
    36     ......
    37     protected string DBConn {
    38         private get
    39         {
    40             return Session["DBConn"] == null ?
    41                     "LFConn" :
    42                     Session["DBConn"].ToString();
    43             }
    44         set { Session["DBConn"] = value; } 
    45     }
    46     ......
    47 }
  • 相关阅读:
    树状数组进阶
    vscode远程连接linux服务器
    常用的协议以及协议相对应的端口号
    C++四种强制类型转化
    口胡(然而有代码)<第二章>
    11.TED演讲:如何赚更多钱?读后感
    tomcat一些认识
    压测ab
    mysql 加表字段
    最短Hamilton路径
  • 原文地址:https://www.cnblogs.com/zhuhc/p/3455094.html
Copyright © 2011-2022 走看看