示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string retUrl = "";

            retUrl = Request.ServerVariables["Script_Name"].ToString();
            string qstring = Request.QueryString.ToString();

            if (Request.QueryString.ToString() != "")
            {
                retUrl += "?" + Request.QueryString.ToString();
            }
            // 保留登入前網址
            Session["retUrl_CompanyShop"] = Server.UrlEncode(retUrl);

            if (Session["cs_code"] == null || Session["cs_code"].ToString() == "")
            {
                DataTable Dt_CompanyShop = objCP.GetUsersCompanyShopData(UserNo, "", true);
                if (Dt_CompanyShop.Rows.Count > 0)
                {
                    Session["cs_code"] = Dt_CompanyShop.Rows[0]["code"].ToString();
                }
                else
                {
                    Response.Redirect("CompanyShopSelect.aspx");
                    Response.End();
                }
            }

            UserNo = HttpUtility.HtmlEncode(Session["UserNo"].ToString().Trim());
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserNo"] == null || Session["UserNo"].ToString().Trim() == "")
     {
         string retUrl = "";
         retUrl = Request.ServerVariables["Script_Name"].ToString();
         string qstring = Request.QueryString.ToString();
         if (Request.QueryString.ToString() != "")
         {
             retUrl += "?" + Request.QueryString.ToString();
         }
         // 保留登入前網址
         Session["retUrl"] = Server.UrlEncode(retUrl);
         Response.Write("<script>alert('您離開系統時間太久,請重新登入!!');</script>");
         Response.Redirect("~/SignIn.aspx");
         Response.End();
     }
     else
     {
         UserNo = HttpUtility.HtmlEncode(Session["UserNo"].ToString().Trim());
     }
     if (Request.QueryString["cs_code"] != null)
     {
         cs_code = HttpUtility.HtmlEncode(Request.QueryString["cs_code"].ToString().Trim());
     }
     if (cs_code != "")
     {
         DataTable Dt = objCP.GetUsersCompanyShopData(UserNo, cs_code, false);
         if (Dt.Rows.Count > 0)
         {
             if (objCP.InsertCompanyUseLog("CompanyShop", UserNo, cs_code))
             {
                 Session["cs_code"] = cs_code;
                 if (Session["retUrl_CompanyShop"] != null && Session["retUrl_CompanyShop"].ToString() != "")
                 {
                     string retUrl = HttpContext.Current.Session["retUrl_CompanyShop"].ToString();
                     Response.Redirect(retUrl);
                     Response.End();
                 }
             }
             else
             {
                 Literal1.Text = "操作失敗,請聯絡管理員";
             }
         }
         else
         {
             Literal1.Text = "您無操作此權限,請聯絡管理員";
         }
     }
     else
     {
         Literal1.Text = "請選擇右上角的店家";
     }
 }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url      = Request.Url.AbsolutePath.ToString().Trim();
            string pagename = "";

            #region ==Session身分判定==

            if (Session["UserNo"] == null || Session["UserNo"].ToString().Trim() == "")
            {
                string retUrl = "";
                retUrl = Request.ServerVariables["Script_Name"].ToString();
                string qstring = Request.QueryString.ToString();
                if (Request.QueryString.ToString() != "")
                {
                    retUrl += "?" + Request.QueryString.ToString();
                }
                // 保留登入前網址
                Session["retUrl"] = Server.UrlEncode(retUrl);
                Response.Write("<script>alert('您離開系統時間太久,請重新登入!!');</script>");
                Response.Redirect("~/SignIn.aspx");
                Response.End();
            }
            else
            {
                UserNo = HttpUtility.HtmlEncode(Session["UserNo"].ToString().Trim());
            }

            #endregion

            #region ==店家切換==

            DataTable Dt_CompanyShop = objCP.GetUsersCompanyShopData(UserNo, "", false);
            for (int i = 0; i < Dt_CompanyShop.Rows.Count; i++)
            {
                TopComanyShopMenu += string.Format(TopCompanyShopFormat, Dt_CompanyShop.Rows[i]["cs_name"].ToString(), Dt_CompanyShop.Rows[i]["code"].ToString());
            }


            #endregion

            DataTable Dt_Menu = objMU.MenuControl(UserNo);
            lit_Menu.Text = "";

            for (int i = 0; i < Dt_Menu.Rows.Count; i++)
            {
                bool   IsMaster = Convert.ToBoolean(Dt_Menu.Rows[i]["IsMaster"]);
                string Active   = "";
                if (Dt_Menu.Rows[i]["PageUrl"].ToString().Trim() == url)
                {
                    Active = " active";
                    //lit_PageName.Text = Dt_Menu.Rows[i]["PageName"].ToString().Trim();
                }
                pagename = Dt_Menu.Rows[i]["PageName"].ToString();
                if (IsMaster)
                {
                    if (i != 0)
                    {
                        lit_Menu.Text += @"</ul><div style=""
						    padding-left: 10px;
						    padding-right: 10px;
					    ""><hr></div>"                    ;
                    }
                    lit_Menu.Text += @" <ul class=""nav flex-column"">";
                    lit_Menu.Text += string.Format(MasterFormat, Dt_Menu.Rows[i]["PageUrl"].ToString().Trim(), pagename, Active);
                }
                else
                {
                    lit_Menu.Text += string.Format(DetailFormat, Dt_Menu.Rows[i]["PageUrl"].ToString().Trim(), pagename, Active);
                }
                if (i == (Dt_Menu.Rows.Count - 1))
                {
                    lit_Menu.Text += @"</ul>";
                }
            }
        }