Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session);

            if (Request.QueryString[Constants.PROVINCEID] != null)
            {
                provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString());
            }

            if (user.IsAdmin)
            {
                hlPCP.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=1", Constants.IS_PCP);
                hlCS.NavigateUrl  = string.Format("~/SelectRegion.aspx?{0}=0", Constants.IS_PCP);
            }
            else
            {
                if (user.HasMoreThanOneProvince() || provinceID == 0)
                {
                    hlPCP.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=1", Constants.IS_PCP);
                    hlCS.NavigateUrl  = string.Format("~/SelectRegion.aspx?{0}=0", Constants.IS_PCP);
                }
                else
                {
                    if (provinceID != -1)
                    {
                        hlPCP.NavigateUrl = string.Format("~/Default.aspx?{0}=1&{1}={2}", Constants.IS_PCP, Constants.PROVINCEID, provinceID.ToString());
                        hlCS.NavigateUrl  = string.Format("~/Default.aspx?{0}=0&{1}={2}", Constants.IS_PCP, Constants.PROVINCEID, provinceID.ToString());
                    }
                    else
                    {
                        hlPCP.NavigateUrl = string.Format("~/Default.aspx?{0}=1", Constants.IS_PCP);
                        hlCS.NavigateUrl  = string.Format("~/Default.aspx?{0}=0", Constants.IS_PCP);
                    }
                }
            }
        }
Esempio n. 2
0
        public static string GetURLByRole(SponserUser usr)
        {
            //1	Speciality Representative
            //2	Primary Care Representative
            //3	Hybrid Sales Representative
            //4	Sales Manager
            //5	Head Office

            string retURL = string.Empty;

            switch (usr.Role.ID)
            {
            case 1:


                if (usr.HasMoreThanOneProvince())
                {
                    retURL = "~/SelectRegion.aspx";
                }
                else
                {
                    retURL = string.Format("~/default.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince());
                }

                break;

            case 2:


                if (usr.HasMoreThanOneProvince())
                {
                    retURL = "~/SelectRegion.aspx";
                }
                else
                {
                    retURL = string.Format("~/default.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince());
                }

                break;

            case 3:

                if (usr.HasMoreThanOneProvince())
                {
                    retURL = "~/SelectProgram.aspx";
                }
                else
                {
                    retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince());
                }


                break;

            case 4:

                if (usr.HasMoreThanOneProvince())
                {
                    retURL = "~/SelectProgram.aspx";
                }
                else
                {
                    retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince());
                }

                break;

            case 5:

                if (usr.HasMoreThanOneProvince())
                {
                    retURL = "~/SelectProgram.aspx";
                }
                else
                {
                    if (usr.TerritoryCovergae_All.HasValue && usr.TerritoryCovergae_All.Value)
                    {
                        retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, 0);
                    }
                    else
                    {
                        retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince());
                    }
                }

                break;
            }

            return(retURL);
        }
Esempio n. 3
0
        protected override void OnInitComplete(EventArgs e)
        {
            // have to put in Page_Init, Page_Load doesn't work, it interferes with InvitedCheckbox_CheckedChanged and possibly other postback functions
            if (Request.QueryString[Constants.PROVINCEID] != null)
            {
                provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString());
            }

            if (Request.QueryString[Constants.IS_PCP] != null && Request.QueryString[Constants.IS_PCP].ToString() != "-1")
            {
                isPCP = Request.QueryString[Constants.IS_PCP].ToString() == "1";
            }

            if (provinceID != -1)
            {
                hlChangeProgram.NavigateUrl += string.Format("?{0}={1}", Constants.PROVINCEID, provinceID.ToString());
            }

            if (isPCP.HasValue)
            {
                hlChangeRegion.NavigateUrl += string.Format("?{0}={1}", Constants.IS_PCP, (isPCP.Value ? "1" : "0"));
            }


            user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session);

            if (!string.IsNullOrEmpty(user.Username))
            {
                LoadRegistrationStatus();

                if (provinceID == -1)
                {
                    LoadData(isPCP);
                }
                else
                {
                    LoadData(provinceID, isPCP);
                }


                if (!UserHelper.CanSelectProgram(user))
                {
                    hlChangeProgram.Enabled  = false;
                    hlChangeProgram.ImageUrl = "~/images/button_changeprogram_gray.png";
                }

                if (user.HasMoreThanOneProvince())
                {
                }
                else
                {
                    if (user.TerritoryCovergae_All.HasValue && user.TerritoryCovergae_All.Value)
                    {
                    }
                    else
                    {
                        hlChangeRegion.Enabled  = false;
                        hlChangeRegion.ImageUrl = "~/images/button_changeregion_gray.png";
                    }
                }
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }


            //LoadControlsForSponser();
            base.OnInitComplete(e);
        }