Пример #1
0
    protected void Page_Init(object sender, EventArgs e)
    {
        //Page.RegisterStartupScript("ScriptDescription", "<script type=\"text/javascript\">    alert('" + Request.Url.ToString() + "');</script>");
        try
        {
            StateManager stateManager = StateManager.Instance;
            MiscellaneousController objMisc = new MiscellaneousController();

            //-- Ashu(June2,2011) : Changes for jquery conflict issues & Javascript exception

            if (!(Request.Url.AbsolutePath.ToLower().EndsWith("managephotoalbum.aspx")))
            {
                DivScript.Visible = true;
                divModalboxscript.Visible = true;
            }
            else
            {
                DivScript.Visible = false;
                divModalboxscript.Visible = false;
            }

            app_domin = WebConfig.AppBaseDomain;
            // to avoid redirection for create photo album page
            if (!(Request.Url.AbsolutePath.ToLower().EndsWith("managephotoalbum.aspx")))
            {
                //if Tribute Type and Tribute Url are in querystring        
                #region LHK:Redirection to upgradedUrl

                if (!this.IsPostBack)
                {
                    Tributes objTrb = new Tributes();
                    //GetUpgradedUrl
                    if ((Request.QueryString["TributeUrl"] != null))
                    {
                        _tributeUrl = Request.QueryString["TributeUrl"].ToString();
                        objTrb.TributeUrl = _tributeUrl = Request.QueryString["TributeUrl"].ToString();

                        if (Request.QueryString["TributeType"] != null)
                        {
                            objTrb.TypeDescription = Request.QueryString["TributeType"].ToString();
                        }
                        else if (Session["PhotoAlbumTributeSession"] != null)
                        {
                            objTrb = Session["PhotoAlbumTributeSession"] as Tributes;
                            if (objTrb != null)
                                if (string.IsNullOrEmpty(objTrb.TypeDescription))
                                    Session["TributeType"] = objTrb.TypeDescription;
                        }
                        objTrb = objMisc.GetTributeUrlOnOldTributeUrl(objTrb, WebConfig.ApplicationType.ToString());

                        if (Request.QueryString["TributeType"] != null)
                        {
                            objTrb.TypeDescription = Request.QueryString["TributeType"].ToString();
                        }

                        if (objTrb != null)
                        {
                            if (objTrb.TributeUrl != null)
                            {
                                if (!(string.IsNullOrEmpty(objTrb.TributeUrl.ToString())) && (!(_tributeUrl.Equals(objTrb.TributeUrl.ToString()))))
                                {
                                    url = GetRedirectUrl();
                                    Response.Redirect(url, true);

                                }
                            }
                        }
                    }
                }
                #endregion

                #region For Image uploader redirection
                //LHK: redirection from main domain to subdomain- for image uploader
                if (!(WebConfig.ApplicationMode.Equals("local")))
                {

                    if (Request.QueryString["Type"] != null && Request.QueryString["TributeUrl"] != null)
                    {
                        RediectUsingQueryString();
                    }
                    else
                    {
                        RedirectUsingSession();
                    }
                }
                if (WebConfig.ApplicationMode.Equals("local"))
                {
                    if (Request.QueryString["mode"] != null && Request.QueryString["TributeUrl"] != null)
                    {
                        if (Request.QueryString["mode"].ToString() == "Create")
                        {
                            if (FacebookWebContext.Current.Session != null)
                            {
                                url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photos.aspx?post_on_facebook=True";
                            }
                            else
                            {
                                url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photos.aspx";

                            }
                        }
                        else if (Request.QueryString["mode"].ToString() == "AddPhotos")
                        {
                            url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photoalbum.aspx?photoAlbumId=" + Request.QueryString["AlbumId"].ToString();
                        }
                        if (!string.IsNullOrEmpty(url))
                            Response.Redirect(url, false);
                    }
                }
                #endregion

            }
            Tributes objTribute = new Tributes();

            if ((Request.QueryString["TributeUrl"] != null) && (Request.QueryString["TributeType"] != null))
            {
                objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString();
                objTribute.TypeDescription = Request.QueryString["TributeType"].ToString();
                stateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session);
            }

            else if (Request.QueryString["TributeUrl"] != null)
            {
                objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString();

                if (Session["TributeType"] != null)
                    objTribute.TypeDescription = Session["TributeType"].ToString();
                else
                    objTribute.TypeDescription = null;

                stateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session);

            }
            Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
            if (objTrib != null)
            {
                if (objTrib.CreatedDate != null)
                    Session["TributeCreatedDate"] = objTrib.CreatedDate;
                if (objTrib.TributeUrl != null)
                    Session["TributeURL"] = objTrib.TributeUrl;
            }

            TributePackage objpackage = new TributePackage();
            objpackage.UserTributeId = objTribute.TributeId;

            object[] param = { objpackage };
            objMisc.TriputePackageInfo(param);
            if (objpackage.CustomError == null)
            {
                _packageId = objpackage.PackageId;
                if (_packageId != 1 && objpackage.EndDate != null)
                {
                    _endDate = (DateTime)objpackage.EndDate;
                    Session["tributeEndDate"] = _endDate;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }
    protected void Page_Init(object sender, EventArgs e)
    {
        StateManager objStateManager = StateManager.Instance;
        MiscellaneousController objMisc = new MiscellaneousController();
        objTribute = new Tributes();

        if ((Request.QueryString["TributeUrl"] != null) && (Request.QueryString["TributeType"] != null))
        {
            objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString();
            objTribute.TypeDescription = Request.QueryString["TributeType"].ToString();
            objStateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute,WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session);
        }
        else if (Request.QueryString["TributeUrl"] != null)
        {
            objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString();
            objTribute.TypeDescription = null;
            objStateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute,WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session);
        }

        TributePackage objpackage = new TributePackage();
        objpackage.UserTributeId = objTribute.TributeId;
        object[] param = { objpackage };
        objMisc.TriputePackageInfo(param);
        if (objpackage.CustomError == null)
            _packageId = objpackage.PackageId;
    }