Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // translate the page title which will appear on the browser header
            //string pageTitle = ("page" + MainContent.Page.Title).Replace(" ", "").Replace("(", "").Replace(")", "");
            //try
            //{
            //  pageTitle = (string)GetGlobalResourceObject("portal", pageTitle);
            //}
            //catch (Exception) { }
            //if (pageTitle != "page")
            //{
            //  MainContent.Page.Title = pageTitle;
            //}


            //// put the child page name in footer
            //butPageName.Text = MainContent.Page.Title;
            //headerTitle.Text = MainContent.Page.Title;

            //if cannot localize means session has expired so restart
            bool isOk = se.localize();

            if (!isOk)
            {
                Response.Redirect("~/v7/default.aspx", true);
            }

            // show/hide footer/header
            if (se.secure)
            {
                panHeader.Visible = true;
                panHeader.Visible = true; //TODO: is this supposed to be for the footer?

                // create sessions link for debugging
                if (fn.host() == "localhost" || se.membLevel == 5)
                {
                    butPageName.NavigateUrl = "~/v7/administrator/sessions.aspx";
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(Session["culture"].ToString());
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(Session["culture"].ToString());

            // if Edge we don't need the hide/show eye
            if (Request.UserAgent.IndexOf("Edge") > -1)
            {
                eyeMembId.Visible  = false;
                eyeMembPwd.Visible = false;
            }

            if (Session["secure"] == null)
            {
                Session["secure"] = false;
            }

            if (!IsPostBack)
            {
                // set default language before change
                if (Session["culture"].ToString() == "en-US")
                {
                    radLang.Items.FindByValue("en-US").Selected = true;
                    radLang.Items.FindByValue("fr-CA").Selected = false;
                }
                else if (Session["culture"].ToString() == "fr-CA")
                {
                    radLang.Items.FindByValue("en-US").Selected = false;
                    radLang.Items.FindByValue("fr-CA").Selected = true;
                }

                se.localize();

                // did we start with a SignIn call from NOP
                Session["isVisitor"] = false; // assume is a not visitor unless we have them enrolled on V5.dbo.memb
                if (Request["storeId"] != null & Request["returnUrl"] != null & Request["cancelUrl"] != null & Request["custId"] != null)
                {
                    Session["storeId"]      = Request["storeId"];
                    Session["nopReturnUrl"] = Request["returnUrl"];
                    Session["nopCancelUrl"] = Request["cancelUrl"];
                    Session["custId"]       = Request["custId"];
                    //Session["source"] = "nopSignIn";    // we will change this to "nop" later but need to know if we have to save the ReturnUrl
                }


                // did we start with membGuid?
                if (Request["membGuid"] != null)
                {
                    Session["source"] = Request["source"];

                    if (Request["source"] == "nop")
                    {
                        me.membGuidTemp         = Request["membGuid"];
                        cu.custId               = me.memberByGuid(me.membGuidTemp);
                        Session["membGuidTemp"] = me.membGuidTemp;
                        Session["profile"]      = Request["profile"];
                        Session["returnUrl"]    = "";           // we need to add on a valid token if using this returnUrl, ie: &token=aasdfasdfds
                        Session["nopReturnUrl"] = Request["returnUrl"];

                        // store the NOP returnUrl (not the Profile URL) in apps.dbo.ecomRegister.ecomReturnUrl so we can access the NOP Store
                        // added the Ecom_NewAcctId for ease of NOP account management
                        ap.saveNopReturnUrl(Session["membGuidTemp"].ToString(), Session["nopReturnUrl"].ToString(), cu.custId);
                    }

                    if (Request["source"] == "v8")
                    {
                        me.membGuidTemp         = Request["membGuid"];
                        cu.custId               = me.memberByGuid(me.membGuidTemp);
                        Session["membGuidTemp"] = me.membGuidTemp;
                        Session["profile"]      = Request["profile"];

                        // if NOP get nopReturnUrl for Store tile
                        ap.getNopReturnUrl(me.membId, out string nopReturnUrl);
                        Session["nopReturnUrl"] = nopReturnUrl;
                    }

                    if (Request["source"] == "v5")
                    {
                        me.membGuidTemp         = Request["membGuid"].ToString().Replace("{", "").Replace("}", ""); // remove V5 guid braces - V8 doesn't like them
                        cu.custId               = me.memberByGuid(me.membGuidTemp);
                        Session["membGuidTemp"] = me.membGuidTemp;
                        Session["nopReturnUrl"] = "";
                    }

                    // get profile data if available (it won't be for V5)
                    cu.customerProfile(cu.custId, out string profileId, out string profileReturnUrl, out string profileColor, out string profileLogo);
                    Session["profile"]   = profileId;
                    Session["returnUrl"] = profileReturnUrl;
                    Session["color"]     = fn.fDefault(profileColor, "#0178b9"); // no longer used
                    Session["logo"]      = fn.fDefault(profileLogo, "vubz.png");

                    if (cu.custId != null)
                    {
                        // get some customer values
                        cu.customer(cu.custId);

                        Session["secure"] = true;

                        // store key customer values
                        Session["cust"]       = fn.left(cu.custId, 4);
                        Session["custId"]     = cu.custId;
                        Session["custAcctId"] = me.membAcctId;

                        Session["custChannelManager"] = cu.custChannelManager;
                        Session["custChannelNop"]     = cu.custChannelNop;
                        Session["custParentId"]       = cu.custParentId;
                        Session["custEmailAlert"]     = cu.getEmailAlert(cu.custAcctId);

                        Session["isChild"] = (cu.custParentId.Trim() == "") ? false : true; // used for tiles

                        // store key member values
                        Session["membGuid"]      = me.membGuid;
                        Session["membFirstName"] = me.membFirstName;
                        Session["membLastName"]  = me.membLastName;
                        Session["membEmail"]     = me.membEmail;
                        Session["membId"]        = me.membId;
                        Session["membNo"]        = me.membNo;
                        Session["membLevel"]     = me.membLevel;


                        // temp hack
                        if (Session["cust"].ToString() == "CCHS")
                        {
                            Session["logo"] = "cchs.png";
                        }
                    }
                }

                // language passed in? ie lang=FR (only checked if valid guid passed in --- ??)
                if (Request["lang"] == null)
                {
                    Session["culture"] = "en-US";
                }
                else
                {
                    if (Request["lang"].ToLower() == "en")
                    {
                        Session["culture"] = "en-US";
                    }
                    if (Request["lang"].ToLower() == "fr")
                    {
                        Session["culture"] = "fr-CA";
                    }
                }
                Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(Session["culture"].ToString());
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(Session["culture"].ToString());

                // first session visit?
                if ((bool)Session["secure"] == false)
                {
                    tabSignIn.Visible = true;
                }
            }

            //      Session["lang"] = "xx";
            Session["lang"] = Session["culture"].ToString().Substring(0, 2);

            // get logo from profile
            if (Session["logo"] != null)
            {
                string imageUrl = "/vubizApps/styles/logos/" + Session["logo"].ToString();
                logo.ImageUrl = imageUrl;
            }

            // preset credentials for fast testing ( mucks up signin to use anything else )
            if (fn.host() == "localhost")
            {
                //txtMembId.Attributes["value"] = "VUV5_FAC";
                //txtCustId.Text = "CCHS2544";

                //txtMembId.Attributes["value"] = "*****@*****.**";
                //txtMembPwd.Text = "password";

                txtMembId.Attributes["value"] = "VUV8_ADM";
                txtCustId.Text = "CFIB5288";

                //txtCustId.Text = "EVHR3DUX";


                //txtMembId.Attributes["value"] = "JANBOSS";
                //txtMembPwd.Attributes["value"] = "TANGERINE";
            }

            // manage tiles
            if ((bool)Session["secure"])
            {
                lvTiles.Visible = true;
            }

            // capture tile click
            if (IsPostBack)
            {
                string targetType = Request["tileTargetType"]; // sender used for target type (1,2,3)
                string target     = Request["tileTarget"];     // parameter used for target
                if (targetType.Length > 0 && target.Length > 0)
                {
                    Session["pageName"] = target;

                    se.localize();

                    // replace URLs with [[session]]
                    target = target.Replace("[[custAcctId]]", se.custAcctId);
                    target = target.Replace("[[custId]]", se.custId);
                    target = target.Replace("[[membId]]", se.membId);
                    target = target.Replace("[[membNo]]", se.membNo.ToString());
                    target = target.Replace("[[membGuidTemp]]", se.membGuidTemp);
                    target = target.Replace("[[nopReturnUrl]]", se.nopReturnUrl);
                    target = target.Replace("[[lang]]", se.lang);
                    target = target.Replace("[[profile]]", se.profile);

                    // except [[token]]
                    target = target.Replace("[[token]]", ap.token(10));


                    // link to same tab (typically local app)
                    if (targetType == "1")
                    {
                        Response.Redirect(target);
                    }

                    // link to another tab (typically external app)
                    if (targetType == "2")
                    {
                        //         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + target + "','_blank')", true);
                        Response.Redirect("iFrame.aspx?url=" + Server.UrlEncode(target));
                    }

                    // link to another menuGroup
                    if (targetType == "3")
                    {
                        Session["tileGroup"] = target;
                        lvTiles.DataBind();
                    }
                }
            }
        }