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;
    }
 /// <summary>
 /// Method to get the theme for tribute
 /// </summary>
 public Templates GetExistingTheme()
 {
     Tributes objTribute = new Tributes();
     MiscellaneousController _controller = new MiscellaneousController();
     objTribute.TributeId = _tributeId;
     return _controller.GetThemeFolderForTribute(objTribute);
 }
Exemplo n.º 3
0
 private void SetNoticeHeader(Tributes objTribute)
 {
     TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
     stateManager.Add("TributeSession", objTribute, TributesPortal.Utilities.StateManager.State.Session);
     String strbul = "<h2>You have been selected to be an administrator of the Tribute: <a href='http://" + objTribute.TypeDescription + "." + WebConfig.TopLevelDomain + "/" + objTribute.TributeUrl + "'>" + objTribute.TributeName + "</a></h2>";
     strbul += " <h3>Please log in or sign up to continue.</h3>";
     Notice.InnerHtml = strbul;
     Notice.Visible = true;
 }
    private void GetValuesFromSession()
    {
        StateManager objStateManager = StateManager.Instance;

        //to get user id from session as user is logged in user
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (!Equals(objSessionValue, null))
        {
            //Commented by LHK: as this is implemented in header now.EmptyDivAboveMainPanel.Visible = false;
            _isUserLoggedIn = true;
            _userId = objSessionValue.UserId;
            if (objSessionValue.UserType == 1)
            {
                if (objSessionValue.IsUsernameVisiable)
                {
                    _userName = objSessionValue.UserName;
                }
                else
                {
                    _userName = (objSessionValue.FirstName + " " + objSessionValue.LastName);
                }
            }
            else
            {
                _userName = objSessionValue.FirstName == string.Empty ? objSessionValue.UserName : (objSessionValue.FirstName + " " + objSessionValue.LastName);
            }
        }
        if (!(_userEmail == null || _userEmail == ""))
        {
            _userEmail = objSessionValue.UserEmail;
        }
        else
        {
            _userEmail = string.Empty;
        }
        objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);

        if (!Equals(objTribute, null))
        {
            _tributeId = objTribute.TributeId;
            _tributeName = objTribute.TributeName;
            _tributeType = objTribute.TypeDescription;
            _tributeUrl = objTribute.TributeUrl;
            _isActive = objTribute.IsActive;
            _TributePackageType = objTribute.TributePackageType;
            if (!objTribute.Date2.Equals(null))
            {
                _endDate = (DateTime)objTribute.Date2;
            }

        }

        if (Session["TributeSession"] == null)
            CreateTributeSession(); //to create the tribute session values if user comes to this page from link or from favorites list.

        else if (objStateManager.Get("VideoSession", StateManager.State.Session) != null)
        {
            _videoId = int.Parse(objStateManager.Get("VideoSession", StateManager.State.Session).ToString());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {

            Response.Cache.SetExpires(DateTime.Now);
            StateManager objStateManager = StateManager.Instance;
            //fetching values from session
            GetValuesFromSession();
            Tributes objTrb = new Tributes();
            Tributes objTrbForLinkMem = new Tributes();
            Videos objVideos = new Videos();
            HeaderHome.Visible = false;
            divEditButton.Visible = false;
            dvUploadPhoto.Visible = false;
            divLearnMore.Visible = false;
            divViewMemorialTribute.Visible = false;
            divOrderDVD.Visible = false;

            divHeaderUC.Visible = false;
            lblDate1.Visible = false;
            lblAge.Visible = false;
            SetControlsValue();

            //url check
            if ((Request.QueryString["tributeId"] != null) && (int.TryParse(Request.QueryString["tributeId"].ToString(), out _tributeId)))
            {
                // For passing in Create Tribute Button of Modal Popup
                Session["TributeId"] = _tributeId.ToString();

                packageId = _presenter.GetTributePackageId(_tributeId);

                //LHK: Check for expiry message
                string tributeEndDate = _presenter.GetTributeEndDate(_tributeId);
                #region if loop
                if (tributeEndDate != "")
                {
                    string errorHtml = string.Empty;
                    if (!tributeEndDate.Equals("Never"))
                    {
                        DateTime dt1 = DateTime.Now;

                        DateTime.TryParseExact(tributeEndDate, "MM'/'dd'/'yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt1);
                        if (dt1 > DateTime.Now)
                        {
                            VideoExpiryDate = dt1.ToString("dd/MM/yyyy");
                            if (WebConfig.ApplicationMode.Equals("local"))
                            {
                                errorHtml = "<img src='../assets/images/warn.png'/> The video can be viewed until<b> " + dt1.ToString("MMMM dd, yyyy") + "</b>. To keep it online longer, <a href='" + Session["APP_PATH"].ToString() + "tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "' style='font-weight:bold'>click here to upgrade</a>";
                            }
                            else
                            {
                                errorHtml = "<img src='../assets/images/warn.png'/> The video can be viewed until <b> " + dt1.ToString("MMMM dd, yyyy") + "</b>. To keep it online longer, <a href='http://video." + WebConfig.TopLevelDomain + "/tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "' style='font-weight:bold'>click here to upgrade</a>";
                            }
                        }
                        else
                        {
                            VideoExpiryDate = dt1.ToString("dd/MM/yyyy");
                            if (WebConfig.ApplicationMode.Equals("local"))
                            {
                                errorHtml = "<img src='../assets/images/error_pic.png'/> This video has expired. To reactivate the video so that it can be viewed for life. <a href='" + Session["APP_PATH"].ToString() + "tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "'style='color:Red;font-weight:bold' >click here to upgrade</a>";
                            }
                            else
                            {
                                errorHtml = "<img src='../assets/images/error_pic.png'/> This video has expired. To reactivate the video so that it can be viewed for life. <a href='http://video." + WebConfig.TopLevelDomain + "/tribute/videotributesponsor.aspx?tributeId=" + _tributeId + "'style='color:Red;font-weight:bold' >click here to upgrade</a>";
                            }
                        }
                    }
                    else
                    {
                        VideoExpiryDate = null;
                        errorHtml = "<img src='../assets/images/warn.png'/> This video has been upgraded and can be viewed forever!";
                    }
                    if (packageId == 1 || packageId == 2 || packageId == 9 || packageId == 10)
                    {
                        lblErrorMessage.Text = errorHtml;
                    }
                    else
                    {
                        lblVidOnlyErrorMessage.Text = errorHtml;
                    }
                }
                #endregion

                #region HeaderHome
                //HeaderHome visible for logged in user
                if (_userId > 0)
                {

                    HeaderHome.Visible = true;

                }
                #endregion
                //fetching Tribute Details on TributeId
                objTrb = _presenter.GetTributeFieldDetails(_tributeId);

                #region loop for video tribute
                if (objTrb != null)
                {
                    if (objTrb.TributeType == 8)
                    {
                        //fetching Video Details on tributeId
                        _tributeType = "Video";
                        objVideos = _presenter.GetVideoDetailsOnUserTributeId(_tributeId);

                        //for Link mem tribute id
                        _presenter.GetLinkVideoMemorialTribute(_userId, _tributeId);
                        //check VideoFile mapping wrt to tributeId. (video url contains fileName)
                        #region ifloopAdmin check
                        if (objVideos != null)
                        {
                            if (objVideos.TributeVideoId != null)
                            {

                                if (_userId == _videoUserId)
                                {
                                    isAdmin = true;
                                }
                                //objTrbForLinkMem = _presenter.GetDetailOfLinkedtribute(Convert.ToInt32(_linkMemTributeId.ToString()));
                                //Session["TributeURlofLinkMemTrb"] = objTrbForLinkMem.TributeUrl.ToString();
                            }
                        }
                        #endregion

                        if (_linkMemTributeId > 0)
                        {
                            objTrbForLinkMem = _presenter.GetDetailOfLinkedtribute(Convert.ToInt32(_linkMemTributeId.ToString()));
                            if (objTrbForLinkMem != null)
                                Session["TributeURlofLinkMemTrb"] = objTrbForLinkMem.TributeUrl.ToString();
                        }
                        //if (objTrb.TributeType.Equals(8))
                        //{
                        //fetching Video Details on tributeId
                        objVideos = _presenter.GetVideoDetailsOnUserTributeId(_tributeId);

                        //check VideoFile mapping wrt to tributeId. (video url contains fileName)
                        #region if loop3
                        if (objVideos != null)
                        {
                            if (objVideos.TributeVideoId != null)
                            {
                                if (_userId == 0)
                                {
                                    // TributeCustomHeader.Visible = false;
                                    divHeaderUC.Visible = false;
                                    _userId = _userTributeId;
                                }
                                lblMailforDVD.Text = "<a href='mailto:" + TributeUserEmail.ToString() + "?subject=Request to order Video Tribute on DVD'>Email funeral home to order a DVD</a> ";
                                //LHK: 7/1/2011 -check for private removed if (_isPrivate)

                                ShowVideo();

                                //AG: Added for visit count
                                if (_tributeId > 0)
                                {
                                    this._presenter.AddTributeCount(_tributeId);
                                }

                                Users objUsers = _presenter.GetUserNameOnUserId(_userId);
                                TributeCustomHeader.UserName = objUsers.UserName.ToString();

                                GetHeaderDetailsOnUserId(_userId);
                                if (IsCustomHeaderOn == true)
                                {
                                    TributeCustomHeader.Visible = true;
                                    //EmptyDivAboveMainPanel.Visible = false;
                                    //LHK:7/1/2011-revomed TributeCustomHeader
                                }
                                else
                                {
                                    TributeCustomHeader.Visible = false;
                                    divHeaderUC.Visible = false;
                                    if (!_isUserLoggedIn)
                                    {
                                        //LHK: to add a blank div for saparation between header and page body.
                                        //EmptyDivAboveMainPanel.Visible = true;
                                    }
                                }
                                if (!this.IsPostBack)
                                {
                                    try
                                    {
                                        this._presenter.OnViewInitialized();
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                }
                                this._presenter.OnViewLoaded();
                                SetControlsVisibility();
                            }
                            else
                            {
                                Response.Redirect("~/Errors/Error404.aspx", false);
                            }
                        }
                        else
                        {
                            Response.Redirect("~/Errors/Error404.aspx", false);
                        }
                        #endregion
                    }
                }
                else
                {
                    Response.Redirect("~/Errors/Error404.aspx", false);

                }
                #endregion

                //AG: Added new folder name
                string folderName = this._presenter.GetExistingFolderName(_tributeId);
                //body.Attributes.Add("onload", "Themer('" + themeValue + "');");
                string appPath = string.Empty;
                if (WebConfig.ApplicationMode.ToLower().Equals("local"))
                {
                    appPath = WebConfig.AppBaseDomain;
                }
                else
                {
                    appPath = string.Format("{0}{1}{2}", "http://www.", WebConfig.TopLevelDomain, "/");
                }
                idSheet.Attributes.Add("href", appPath + "assets/themes/" + folderName + "/theme.css"); //to set the selected theme
            }
            else
            {
                Response.Redirect("~/Errors/Error404.aspx", false);
            }

            //LHK:EmptyDivAboveMainPanel
            StateManager stateMngr = StateManager.Instance;
            SessionValue objSessvalue = (SessionValue)stateMngr.Get("objSessionvalue", StateManager.State.Session);

            if (_tributeUrl != null)
            {
                GetCustomHeaderVisible(_tributeUrl, WebConfig.ApplicationType.ToString());
            }
            if (!(objSessvalue != null))
            {
                if (!IsCstmHeaderOn)
                {
                    EmptyDivAboveMainPanel.Visible = true;
                }
            }
            //LHK:EmptyDivAboveMainPanel
            if (_tributeName != null) Page.Title = _tributeName + " | " + _tributeType + " Tribute";
        }
        catch (Exception ex)
        {
            //throw ex;
            Response.Redirect("~/Errors/Error404.aspx", false);
        }
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Ajax.Utility.RegisterTypeForAjax(typeof(Shared_Story));
        //code for YT MObile redirections
        string redirctMobileUrl = string.Empty;

        MiscellaneousController objMisc = new MiscellaneousController();
        if (!IsPostBack)
        {
            DeviceManager deviceManager = new DeviceManager
            {
                UserAgent = Request.UserAgent,
                IsMobileBrowser = Request.Browser.IsMobileDevice
            };
            // Added by Varun Goel for NoRedirection functionality on 28 Jan 2013
            TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;
            objSessionValue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session);

            // Validate if Session value for NoRedirection is set
            if (deviceManager.IsMobileDevice() && (objSessionValue == null || objSessionValue.NoRedirection == null || objSessionValue.NoRedirection == false))
            {
                #region MObile Redirect

                Tributes obTrb = new Tributes();
                string mTrbUrl = string.Empty;
                string mTrbType = string.Empty;
                string strStartUrl = string.Empty;
                int mTabId = 0;
                if (Request.QueryString["TributeUrl"] != null)
                {
                    obTrb.TributeUrl = mTrbUrl = Request.QueryString["TributeUrl"].ToString();
                }
                if (Request.QueryString["TributeType"] != null)
                {
                    obTrb.TypeDescription = mTrbType = Request.QueryString["TributeType"].ToString();
                }
                if (!(string.IsNullOrEmpty(mTrbUrl)) && !(string.IsNullOrEmpty(mTrbType)))
                {
                    obTrb = objMisc.GetTributeUrlOnOldTributeUrl(obTrb, WebConfig.ApplicationType.ToString());

                    strStartUrl = string.Format("{0}{1}{2}{3}{4}{5}", "https://www.", WebConfig.TopLevelDomain, "/mobile/index.html?tributeurl=", obTrb.TributeUrl, "&tributetype=", mTrbType);

                        string url = Request.Url.ToString().ToLower();

                        #region story

                        if (url.Contains("story.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=story";
                            #endregion
                            #region notes

                        else if (url.Contains("notes.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=notes";
                            #endregion
                            #region note

                        else if (url.Contains("notefullview.aspx"))
                        {
                            if ((Request.QueryString["noteId"] != null))
                            {
                                if (int.TryParse(Request.QueryString["noteId"], out mTabId))
                                {
                                    redirctMobileUrl = strStartUrl + "&page=note&id=" + mTabId.ToString();
                                }
                                else
                                {
                                    redirctMobileUrl = strStartUrl + "&page=notes";
                                }
                            }
                            else
                            {
                                redirctMobileUrl = strStartUrl + "&page=notes";
                            }
                        }
                            #endregion
                            #region events

                        else if (url.Contains("event.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=events";
                            #endregion
                            #region event

                        else if (url.Contains("eventfullview.aspx"))
                        {
                            if ((Request.QueryString["EventID"] != null))
                            {
                                if (int.TryParse(Request.QueryString["EventID"], out mTabId))
                                {
                                    redirctMobileUrl = strStartUrl + "&page=event&id=" + mTabId.ToString();
                                }
                                else
                                {
                                    redirctMobileUrl = strStartUrl + "&page=events";
                                }
                            }
                            else
                            {
                                redirctMobileUrl = strStartUrl + "&page=events";
                            }
                        }
                            #endregion
                            #region guestbook

                        else if (url.Contains("guestbook.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=guestbook";
                            #endregion
                            #region gift

                        else if (url.Contains("gift.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=memorials";
                            #endregion
                            #region photogallery

                        else if (url.Contains("photogallery.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=gallery";
                            #endregion
                            #region photoalbum

                        else if (url.Contains("photoalbum.aspx"))
                        {
                            if ((Request.QueryString["PhotoAlbumId"] != null))
                            {
                                if (int.TryParse(Request.QueryString["PhotoAlbumId"], out mTabId))
                                {
                                    redirctMobileUrl = strStartUrl + "&page=photoalbum&id=" + mTabId.ToString();
                                }
                                else
                                {
                                    redirctMobileUrl = strStartUrl + "&page=gallery";
                                }
                            }
                            else
                            {
                                redirctMobileUrl = strStartUrl + "&page=gallery";
                            }
                        }
                            #endregion
                            #region photoview

                        else if (url.Contains("photoview.aspx"))
                        {
                            if ((Request.QueryString["PhotoId"] != null))
                            {
                                if (int.TryParse(Request.QueryString["PhotoId"], out mTabId))
                                {
                                    redirctMobileUrl = strStartUrl + "&page=photo&id=" + mTabId.ToString();
                                }
                                else
                                {
                                    redirctMobileUrl = strStartUrl + "&page=gallery";
                                }
                            }
                            else
                            {
                                redirctMobileUrl = strStartUrl + "&page=gallery";
                            }
                        }
                            #endregion
                            #region photoview

                        else if (url.Contains("photoview.aspx"))
                            redirctMobileUrl = strStartUrl + "&page=gallery";
                            #endregion
                            #region managevideo

                        else if (url.ToLower().Contains("managevideo.aspx"))
                        {
                            #region videoTribute

                            if (url.ToLower().Contains("videotype=videotribute"))
                            {
                                redirctMobileUrl = string.Empty;
                            }
                                #endregion

                            else if ((Request.QueryString["videoId"] != null))
                            {
                                if (int.TryParse(Request.QueryString["videoId"], out mTabId))
                                {
                                    redirctMobileUrl = strStartUrl + "&page=video&id=" + mTabId.ToString();
                                }
                                else
                                {
                                    redirctMobileUrl = strStartUrl + "&page=gallery";
                                }
                            }
                            else
                            {
                                redirctMobileUrl = strStartUrl + "&page=gallery";
                            }
                        }
                            #endregion
                            #region videos

                        else if (url.ToLower().Contains("videogallery.aspx"))
                        {
                            redirctMobileUrl = strStartUrl + "&page=gallery";
                        }
                            #endregion

                        else
                        {
                            redirctMobileUrl = strStartUrl + "&page=home";
                        }
                    }

                    #endregion
                
            }
        }
        if (string.IsNullOrEmpty(redirctMobileUrl))
            {
                try
                {

                    PageUrl = GetRedirectUrl();
                    PageTitle = Page.Title.ToString();
                    codedURL = HttpUtility.UrlEncode(PageUrl).ToString();
                    codedtitle = HttpUtility.UrlEncode(PageTitle).ToString();

                    if (Request.QueryString["topurl"] != null)
                    {
                        _TopUrl = Request.QueryString["topurl"].ToString();
                        Response.Cookies["topurl"].Value = _TopUrl;
                        Response.Cookies["topurl"].Domain = _TopUrl;
                        Response.Cookies["topurl"].Expires = DateTime.Now.AddHours(4);
                    }

                    if (Request.Cookies["topurl"] != null)
                    {
                        hdnTopUrl.Value = Request.Cookies["topurl"].Value.ToString();
                    }
                    if (Session["isInIframe"] != null)
                    {
                        isInIframe = bool.Parse(Session["isInIframe"].ToString());
                    }

                    // New code added on 07 june 2011 by rupendra to handle Apple safari problem
                    if (Request.Browser.Browser.ToString().Trim().Equals("AppleMAC-Safari"))
                    {
                    }

                    //LHK:EmptyDivAboveMainPanel
                    StateManager stateTribute = StateManager.Instance;
                    SessionValue objSessvalue =
                        (SessionValue)stateTribute.Get("objSessionvalue", StateManager.State.Session);
                    if ((Request.QueryString["TributeUrl"] != null))
                    {
                        string _trbUrl = Request.QueryString["TributeUrl"].ToString();
                        GetCustomHeaderVisible(_trbUrl, WebConfig.ApplicationType.ToString());
                    }
                    if (!(objSessvalue != null))
                    {
                        if (!IsCustomHeaderOn)
                        {
                            EmptyDivAboveMainPanel.Visible = true;
                        }
                    }
                    //LHK:EmptyDivAboveMainPanel

                    if (WebConfig.ApplicationMode.Equals("local"))
                    {
                        appDomian = WebConfig.AppBaseDomain.ToString();
                    }
                    else
                    {
                        StateManager stateManager = StateManager.Instance;
                        Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                        //Ashu 18 aug for session null
                        if (objTrib != null)
                        {
                            if (objTrib.TypeDescription != null)
                            {
                                appDomian = "http://" +
                                            objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") +
                                            "." + WebConfig.TopLevelDomain + "/";
                            }
                            else if (Session["PhotoAlbumTributeSession"] != null)
                            {
                                objTrib = Session["PhotoAlbumTributeSession"] as Tributes;
                                if (objTrib.TypeDescription != null)
                                    appDomian = "http://" +
                                                objTrib.TypeDescription.ToString().ToLower().Replace("new baby",
                                                                                                     "newbaby") + "." +
                                                WebConfig.TopLevelDomain + "/";
                            }
                        }
                        else if (Session["PhotoAlbumTributeSession"] != null)
                        {
                            objTrib = Session["PhotoAlbumTributeSession"] as Tributes;
                            if (objTrib != null)
                            {
                                if (objTrib.TypeDescription != null)
                                    appDomian = "http://" +
                                                objTrib.TypeDescription.ToString().ToLower().Replace("new baby",
                                                                                                     "newbaby") + "." +
                                                WebConfig.TopLevelDomain + "/";
                            }
                        }
                    }


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

                        // get the Tribute and User detail from the Session           
                        GetValuesFromSession();
                        // Set the Class of the div according the Page Name
                        SetClass();
                        SetTabClass();
                        // This function will set the Left Menu
                        SetMenuOptions();
                        SetMenuItemClass();
                        // This Function will load themes in the left panel and loads the selected theme for the tribute.
                        LoadThemes();
                        //Method to check if tribute already in favorite list.
                        CheckForFavorite();
                        //to set affiliate link.
                        AffiliateLinks(_tributeType);
                        StateManager objStateManager = StateManager.Instance;
                        if (objStateManager.Get("NoteSession", StateManager.State.Session) != null)
                            _noteId =
                                int.Parse(objStateManager.Get("NoteSession", StateManager.State.Session).ToString());
                        if (objStateManager.Get("VideoSession", StateManager.State.Session) != null)
                            _videoId =
                                int.Parse(objStateManager.Get("VideoSession", StateManager.State.Session).ToString());
                        if (objStateManager.Get("PhotoViewSession", StateManager.State.Session) != null)
                            _photoId =
                                int.Parse(objStateManager.Get("PhotoViewSession", StateManager.State.Session).ToString());
                        if (objStateManager.Get("PhotoAlbumId", StateManager.State.Session) != null)
                            _photoAlbumId =
                                int.Parse(objStateManager.Get("PhotoAlbumId", StateManager.State.Session).ToString());
                        if (objStateManager.Get("XmlFilePath", StateManager.State.Session) != null)
                            //to get xml file name for slideshow
                            _xmlFilePath = objStateManager.Get("XmlFilePath", StateManager.State.Session).ToString();
                        //to get photo number from where to start slideshow.
                        if (objStateManager.Get("SlideShowStartPhoto", StateManager.State.Session) != null)
                            //to get start photo number in slideshow.
                            _recordNumber =
                                int.Parse(
                                    objStateManager.Get("SlideShowStartPhoto", StateManager.State.Session).ToString());
                        else
                            _recordNumber = 0;

                        // Set the controls value
                        SetControlsValue();



                        SetPageNameInSession(_typeName);
                        if (!(string.IsNullOrEmpty(_tributeType)))
                        {
                            if (_tributeType == "Anniversary")
                                _themeName = "AnniversaryDefault";
                            else if (_tributeType == "Birthday")
                                _themeName = "BirthdayDefault";
                            else if (_tributeType == "Graduation")
                                _themeName = "GraduationDefault";
                            else if (_tributeType == "Memorial")
                                _themeName = "MemorialDefault";
                            else if (_tributeType == "New Baby")
                                _themeName = "BabyDefault";
                            else if (_tributeType == "Wedding")
                                _themeName = "WeddingDefault";
                        }

                        //LHK: for photo upgrade changes
                        if ((liAdd.Visible == false) && (liEdit.Visible == false) && (liView.Visible == false) &&
                            (liDownloadalbum.Visible == false) && (liVieFullPhoto.Visible == false))
                            divSubTool.Visible = false;
                    }
                    catch (Exception ex)
                    {
                        LogError(ex.Message, ex.StackTrace);
                        throw ex;
                    }
                }
                catch (Exception ex)
                {
                    LogError(ex.Message, ex.StackTrace);
                    throw ex;
                }
            }
            else
            {
                Response.Redirect(redirctMobileUrl, false);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Method to get the theme for tribute
 /// </summary>
 public Templates GetExistingTheme()
 {
     Tributes objTribute = new Tributes();
     MiscellaneousController _controller = new MiscellaneousController();
     try
     {
         objTribute.TributeId = _tributeId;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return _controller.GetThemeForTribute(objTribute);
 }
Exemplo n.º 8
0
    /// <summary>
    /// Method to set text to menu options
    /// </summary>
    /// <param name="typeName">TypeName</param>
    private void SetMenuItemText()
    {
        fbTitle.Content = this.Page.Title.ToString();
        StateManager stateManager = StateManager.Instance;
        string[] virtualDir = CommonUtilities.GetPath();
        MiscellaneousController objMisc = new MiscellaneousController();
        TributesUserInfo _objTributeUserInfo = new TributesUserInfo();
        Tributes objTributes = new Tributes();
        objTributes.TributeId = _tributeId;
        if (_tributeId > 0)
        {
            _objTributeUserInfo.Tributes = objTributes;
            objMisc.GetTributeByID(_objTributeUserInfo);

            Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
            try
            {
                if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments")
                {
                    lblGuestBook.Text = "Leave a message";
                    liManageTribute.InnerHtml = "<a href='" + Session["APP_BASE_DOMAIN"] + "AdminMyMomentsPrivacy.aspx?tributeid=" + _tributeId + "&sby=manage'> Manage Website </a>";
                }
                else
                {
                    if (_tributeType != null)
                    {
                        if (_tributeType.ToLower().Equals("memorial"))
                            lblGuestBook.Text = "Leave condolences";
                        else
                            lblGuestBook.Text = "Leave a message";
                    }
                    liManageTribute.InnerHtml = "<a href='" + Session["APP_BASE_DOMAIN"] + "adminmytributesprivacy.aspx?tributeid=" + _tributeId + "&sby=manage'>" + ResourceText.GetString("lbtnManageTributeSite_GB_Master") + "</a>";
                }
                if (_typeName == "GuestBook")
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblloginmsg_GB_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopupFromSubDomain(location.href,document.title);'>Log in</a> or <a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                }
                else if (_typeName == PortalEnums.TributeContentEnum.Story.ToString())
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblloginmsg_ST_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopupFromSubDomain(location.href,document.title);'>Log in</a> or <a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";

                    if (!string.IsNullOrEmpty(_objTributeUserInfo.Tributes.MessageWithoutHtml.ToString()))
                    {
                        fbDescription = _objTributeUserInfo.Tributes.MessageWithoutHtml.ToString();
                    }
                }
                if (_typeName == PortalEnums.TributeContentEnum.Gift.ToString())
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblloginmsg_GT_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopupFromSubDomain(location.href,document.title);'>Log in</a> or <a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                }
                if (_typeName == PortalEnums.TributeContentEnum.Event.ToString())
                {
                    lbtnAdd.Text = "Add an event";
                }
                if (_typeName == PortalEnums.TributeContentEnum.ManageEvent.ToString())
                {
                    lbtnBackTo.Text = "Back To Event";
                }
                if (_typeName == PortalEnums.TributeContentEnum.EventFullView.ToString())
                {
                    lbtnEdit.Text = "Edit event";
                }
                if (_typeName == PortalEnums.TributeContentEnum.InviteGuest.ToString())
                {
                    lbtnBackTo.Text = "Back To Event";
                }
                #region FOR NOTES PAGES
                else if (_typeName == "TributeNotes")
                {
                    lbtnAdd.Text = ResourceText.GetString("lbtnAddNote_Note_Master");
                }
                else if (_typeName == "AddNote" || _typeName == "EditNote")
                {
                    lbtnBackTo.Text = ResourceText.GetString("lbtnBackToNotes_Note_Master");
                }
                else if (_typeName == "NoteFullView")
                {
                    lbtnEdit.Text = ResourceText.GetString("lbtnEditNote_Note_Master");
                }
                #endregion
                #region FOR VIDEO PAGES
                else if (_typeName == "AddVideo" || _typeName == "EditVideo")
                {
                    lbtnBackTo.Text = ResourceText.GetString("lbtnBackToVideos_Video_Master");
                }
                else if (_typeName == "VideoGallery")
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblLogin_VideoGallery_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>Log in</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                    lbtnAdd.Text = ResourceText.GetString("lbtnAddVideo_Video_Master");
                }
                else if (_typeName == "ManageVideo")
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblLoginComment_ManageVideo_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>Log in</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                    lbtnEdit.Text = ResourceText.GetString("lbtnEditVideo_Video_Master");
                }
                else if (_typeName == "ManageVideoTribute")
                {

                    pLogin.InnerHtml = ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments" ? ResourceText.GetString("lblLoginComment_VideoTribute_Master1") : ResourceText.GetString("lblLoginComment_VideoTribute_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>Log in</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                    lbtnEdit.Text = ResourceText.GetString("lbtnEditVideoTribute_MV");
                }
                #endregion
                #region FOR PHOTO PAGES
                else if (_typeName == "AddPhotoAlbum")
                {
                    lbtnBackTo.Text = ResourceText.GetString("lbtnBackToPhotos_Photo_Master");
                }
                else if (_typeName == "AddPhotosToAlbum")
                {
                    lbtnBackTo.Text = "Back to photo album"; //ResourceText.GetString("lbtnBackToPhotos_Photo_Master");
                }
                else if (_typeName == "EditPhotoAlbum")
                {
                    lbtnBackTo.Text = ResourceText.GetString("lbtnBackToPhotos_EditPhoto_Master");
                }
                else if (_typeName == "PhotoGallery")
                {
                    pLogin.InnerHtml = ResourceText.GetString("lblLogin_PhotoGallery_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>Log in</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                    lbtnAdd.Text = ResourceText.GetString("lbtnCreateAlbum_Photo_Master");
                }
                else if (_typeName == "PhotoAlbum")
                {
                    pLogin.InnerHtml = ResourceText.GetString("txtLogin_PA_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>Log in</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>Sign up</a>";
                    lbtnAdd.Text = ResourceText.GetString("lbtnAddPhotos_PA_Master");
                    lbtnEdit.Text = ResourceText.GetString("lbtnEditAlbum_PA_Master");
                }
                else if (_typeName == "PhotoFullView")
                {
                    pLogin.InnerHtml = ResourceText.GetString("txtLogin_PV_Master") + " <a href='javascript: void(0);' onclick='UserLoginModalpopup(location.href,document.title);'>" + ResourceText.GetString("lnkLogin_Master") + "</a>" + ResourceText.GetString("lblOr_ST_Master") + "<a href='javascript: void(0);' onclick='UserSignupModalpopupFromSubDomain(location.href,document.title);'>" + ResourceText.GetString("lnkSignup_Master") + "</a>";
                    lbtnEdit.Text = ResourceText.GetString("lbtnEditPhoto_PV_Master");
                }
                else if (_typeName == "ManagePhoto")
                {
                    lbtnBackTo.Text = ResourceText.GetString("lbtnBackToPhotos_MP_Master");
                }

                if (objTrib != null)
                {
                    if (string.IsNullOrEmpty(fbDescription))
                        fbDescription = _objTributeUserInfo.Tributes.WelcomeMessage.ToString();
                    if (string.IsNullOrEmpty(fbThumbnail))
                        fbThumbnail = virtualDir[2] + _objTributeUserInfo.Tributes.TributeImage.ToString();
                }
                fbDesc.Content = fbDescription;
                fbThumb.Content = fbThumbnail;
                PageDesc.Content = fbDescription;
                PageThumb.Href = fbThumbnail;
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
Exemplo n.º 9
0
    protected void lBtnDownloadAlbum_Click(object sender, EventArgs e)
    {

        MiscellaneousController objMisc = new MiscellaneousController();
        string[] getPath = CommonUtilities.GetPath();

        StateManager objStateManager = StateManager.Instance;
        //to get logged in user name from session as user is logged in user
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (Request.QueryString["PhotoAlbumId"] != null)
        {
            if (int.TryParse(Request.QueryString["PhotoAlbumId"], out _photoAlbumId))
            {
                DownloadPhotoAlbumId = _photoAlbumId;
                Session["PhotoAlbumId"] = _photoAlbumId.ToString();
                string imagePath = string.Empty;
                Tributes objTributes = objTribute = (Tributes)objStateManager.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);
                if (objTributes != null)
                {
                    if (string.IsNullOrEmpty(objTributes.TributePackageType))
                    {
                        _packageId = objMisc.GetTributePackageId(_tributeId);
                    }
                }
                bool isAllowedPhotoCheck = false;
                string tributeEndDate = objMisc.GetTributeEndDate(_tributeId);
                DateTime date2 = new DateTime();
                //MG:Expiry Notice
                DateTime dt = new DateTime();
                if (!tributeEndDate.Equals("Never"))
                {
                    if (tributeEndDate.Contains("/"))
                    {
                        string[] date = tributeEndDate.Split('/');
                        date2 = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1]));

                    }
                }
                isAllowedPhotoCheck = objMisc.IsAllowedPhotoCheck(_photoAlbumId);

                if (((_packageId == 3) || (_packageId == 6) || (_packageId == 7) || (_packageId == 8)) || ((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now)))
                {
                    #region popup

                    if (Equals(objSessionValue, null))//when not logged in
                    {
                        if (IsCustomHeaderOn)
                            topHeight = 198;
                        else
                            topHeight = 81;
                    }
                    else
                    {
                        if (IsCustomHeaderOn)
                            topHeight = 261;
                        else
                            topHeight = 133;
                    }
                    if (Request.QueryString["PhotoAlbumId"] != null)
                    {
                        if (_photoAlbumId > 0)
                            Session["PhotoAlbumId"] = _photoAlbumId.ToString();
                    }
                    if (WebConfig.ApplicationMode.Equals("local"))
                    {
                        appDomian = WebConfig.AppBaseDomain.ToString();
                    }
                    else
                    {
                        StateManager stateManager = StateManager.Instance;
                        Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                        appDomian = "http://" + objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                    }
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradeAlbum','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
                    #endregion
                }
                else
                {
                    #region allowFunctionality
                    List<Photos> objListPhotos = new List<Photos>();
                    Photos objPhotos = new Photos();
                    if (Request.QueryString["PhotoAlbumId"] != null)
                    {
                        int.TryParse(Request.QueryString["PhotoAlbumId"], out DownloadPhotoAlbumId);
                        objPhotos.PhotoAlbumId = DownloadPhotoAlbumId;
                    }

                    objListPhotos = objMisc.GetPhotoImagesList(objPhotos);

                    if ((DownloadPhotoAlbumId > 0) && (objListPhotos.Count > 0))
                    {

                        // zip up the files
                        try
                        {
                            string sTargetFolderPath = getPath[0] + "/" + getPath[1] + "/" + _tributeUrl.Replace(" ", "_") + "_" + _tributeType.Replace(" ", "_");

                            //to create directory for image.
                            string galleryPath = getPath[0] + "/" + getPath[1] + "/" + getPath[6];
                            string sZipFileName = "Album_" + DownloadPhotoAlbumId.ToString();
                            string[] filenames = Directory.GetFiles(sTargetFolderPath);
                            // Zip up the files - From SharpZipLib Demo Code
                            using (ZipOutputStream s = new ZipOutputStream(File.Create(galleryPath + "\\" + sZipFileName + ".zip")))
                            {
                                s.SetLevel(9); // 0-9, 9 being the highest level of compression

                                byte[] buffer = new byte[4096];
                                foreach (Photos objPhoto in objListPhotos)
                                {
                                    bool Foundflag = true;
                                    string ImageFile = string.Empty;
                                    string smallFile = string.Empty;
                                    ImageFile = sTargetFolderPath + "\\" + "/Big_" + objPhoto.PhotoImage;
                                    smallFile = sTargetFolderPath + "\\" + objPhoto.PhotoImage;
                                    foreach (string file in filenames)
                                    {
                                        if ((file.EndsWith("Big_" + objPhoto.PhotoImage)) && (File.Exists(ImageFile)))
                                        {
                                            Foundflag = false; //FlagsAttribute set false for small image
                                            //Code to zip 
                                            ZipEntry entry = new ZipEntry(Path.GetFileName(ImageFile));

                                            entry.DateTime = DateTime.Now;
                                            s.PutNextEntry(entry);

                                            using (FileStream fs = File.OpenRead(ImageFile))
                                            {
                                                int sourceBytes;
                                                do
                                                {
                                                    sourceBytes = fs.Read(buffer, 0, buffer.Length);
                                                    s.Write(buffer, 0, sourceBytes);

                                                } while (sourceBytes > 0);
                                            }
                                            //Code to zip till here 
                                        }
                                    }
                                    if (Foundflag) // if big image is not found.
                                    {
                                        foreach (string file in filenames)
                                        {
                                            if ((file.EndsWith(objPhoto.PhotoImage)) && (File.Exists(smallFile)) && (!(file.EndsWith("Big_" + objPhoto.PhotoImage))))
                                            //(File.Exists(smallFile))
                                            {
                                                ZipEntry entry = new ZipEntry(Path.GetFileName(file));

                                                entry.DateTime = DateTime.Now;
                                                s.PutNextEntry(entry);

                                                using (FileStream fs = File.OpenRead(file))
                                                {
                                                    int sourceBytes;
                                                    do
                                                    {
                                                        sourceBytes = fs.Read(buffer, 0, buffer.Length);
                                                        s.Write(buffer, 0, sourceBytes);

                                                    } while (sourceBytes > 0);
                                                }
                                            }
                                        }
                                    }
                                }
                                s.Finish();
                                s.Close();
                            }
                            Response.ContentType = "zip";

                            string sfile = sZipFileName + ".zip";
                            Response.AppendHeader("Content-Disposition", "attachment; filename=" + sfile);

                            Response.TransmitFile(galleryPath + "\\" + sfile);

                            Response.End();

                        }
                        catch  //Exception ex) //  by Ud  
                        {

                        }
                    }
                    #endregion
                }
            }
        }
    }
    /// <summary>
    /// This function will get the values (User Id and Tribute Detail) from the session
    /// </summary>
    private void GetValuesFromSession()
    {
        try
        {
            StateManager objStateManager = StateManager.Instance;

            //to get logged in user name from session as user is logged in user
            objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);

            objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);
            if (Request.QueryString["fbmode"] != null)
            {
                if (Request.QueryString["fbmode"] == "facebook")
                {
                    _tributeId = int.Parse(Request.QueryString["TributeId"].ToString());
                    _tributeType = Request.QueryString["TributeType"].ToString();
                    _tributeName = Request.QueryString["TributeName"].ToString();
                    _tributeUrl = Request.QueryString["TributeUrl"].ToString();
                }
                else
                    Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
            }
            else if (!Equals(objTribute, null))
            {
                _tributeId = objTribute.TributeId;
                _tributeType = objTribute.TypeDescription;
                _tributeName = objTribute.TributeName;
                _tributeUrl = objTribute.TributeUrl;
                _isActive = objTribute.IsActive;
            }
            //else
            //{
            //    Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
            //}

            //to display login and logout option based on the Session value for the user.
            if (!Equals(objSessionValue, null))
            {
                _userId = objSessionValue.UserId;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void GetPhotoSessionValues()
    {
        try
        {
            StateManager objStateManager = StateManager.Instance;
            //to get user id from session as user is logged in user
            objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
            if (objSessionValue == null)
            {
                LogError("3", "User session is null");
            }
            if (!Equals(objSessionValue, null))
            {

                _userId = objSessionValue.UserId;
                _userName = objSessionValue.FirstName == string.Empty ? objSessionValue.UserName : (objSessionValue.FirstName + " " + objSessionValue.LastName);
            }

            string strPath = "";
            if (Request.RawUrl.Contains("/"))
            {
                strPath = Request.RawUrl.ToString().Substring(0, Request.RawUrl.ToString().LastIndexOf('/'));
                strPath = strPath.Substring(strPath.LastIndexOf('/') + 1);
            }
            if ((strPath != "") && (Request.QueryString["Type"] != null))
            {
                objTribute = _presenter.GetTributeSessionForUrlAndType(strPath, Request.QueryString["Type"].ToString().ToLower().Replace("newbaby", "new baby"));
                Session["PhotoAlbumTributeSession"] = objTribute;
            }

            //to get tribute id and name from session
            if (Session["PhotoAlbumTributeSession"] != null)
            {
                objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
            }
            else
            {
                LogError("Null", "PhotoAlbumTributeSession is null");
            }

            if (objTribute != null)
            {
                if (objTribute.TributeId > 0)
                {
                    _tributeId = objTribute.TributeId;
                    _tributeName = objTribute.TributeName;
                    _tributeType = objTribute.TypeDescription;
                    _tributeUrl = objTribute.TributeUrl;
                }
            }
            //to check if user is not loggedin
            if (_userId == 0) //if user is not a logged in user redirect to login page
            {
                Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()));
            }
        }
        catch (Exception ex)
        {
            LogError(ex.Message, ex.StackTrace);
        }
    }
    private void CreatePath()
    {
        string[] getPath = CommonUtilities.GetPath();
        //to create directory for image.
        if (Session["PhotoAlbumTributeSession"] != null)
        {
            objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
        }

        if (objTribute != null)
        {
            if (objTribute.TributeId > 0)
            {
                _tributeId = objTribute.TributeId;
                _tributeName = objTribute.TributeName;
                _tributeType = objTribute.TypeDescription;
                _tributeUrl = objTribute.TributeUrl;
            }
        }
        if (_tributeType != null && _tributeUrl != null)
        {
            galleryPath = getPath[0] + "/" + getPath[1] + "/" + _tributeUrl.Replace(" ", "_") + "_" + _tributeType.Replace(" ", "_");
            DirectoryInfo objDir = new DirectoryInfo(galleryPath);
            if (!objDir.Exists) //if directory does not exists creates a directory
                objDir.Create();

            // for big pictures
            galleryPathForBigImages = getPath[0] + "/" + getPath[1] + "/" + _tributeUrl.Replace(" ", "_") + "_" + _tributeType.Replace(" ", "_");
            DirectoryInfo objBigImagesDir = new DirectoryInfo(galleryPathForBigImages);
            if (!objBigImagesDir.Exists) //if directory does not exists creates a directory
                objBigImagesDir.Create();

            //to create directory for thumnail of that image.
            galleryPathForThumbnails = getPath[0] + "/" + getPath[1] + "/" + getPath[3] + "/" + _tributeUrl.Replace(" ", "_") + "_" + _tributeType.Replace(" ", "_");
            DirectoryInfo objThumbnailDir = new DirectoryInfo(galleryPathForThumbnails);
            if (!objThumbnailDir.Exists) //if directory does not exists creates a directory
                objThumbnailDir.Create();
        }
    }
    protected void lbtnCreateAlbum_Click(object sender, EventArgs e)
    {
        string[] imageNames;
        if (Session["ImageUploaded"] != null)
        {
            string images = Session["ImageUploaded"].ToString();
            imageNames = images.Split(',');
        }
        else
        {
            imageNames = new string[2];
        }

        try
        {
            #region  SaveImage
            objListPhoto = new List<Photos>();
            Photos objPhoto = new Photos();

            if (Session["PhotoAlbumId"] != null)
            {
                int.TryParse(Session["PhotoAlbumId"].ToString(), out _photoAlbumId);
                PhotoAlbumID = _photoAlbumId;
            }

            if (HttpContext.Current.Session["FileCount"] != null && HttpContext.Current.Session["FileCount"] != "")
            {
                int.TryParse(HttpContext.Current.Session["FileCount"].ToString(), out filecount);
                HttpContext.Current.Session["FileCount"] = null;
            }

            if (PhotoAlbumID == 0)
            {
                _photoAlbumName = txtAlbumName.Text;
                _presenter.CreateAlbum();
                AddPhotoEmail = false;
            }

            if (PhotoAlbumID > 0)
            {
                foreach (var imageFileName in imageNames)
                {
                    #region MyRegion

                    string[] desc = imageFileName.Split(':');
                    string imageName = desc[0];
                    string photoComment = string.Empty;
                    for (int count = 1; count < desc.Length; count++)
                    {
                        photoComment += " : " + desc[count];
                    }

                    if (!string.IsNullOrEmpty(imageName))
                    {
                        //thumbnailNames[i] = thumbnailName;
                        //to get tribute id and name from session
                        if (Session["PhotoAlbumTributeSession"] != null)
                        {
                            objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
                        }
                        if (objTribute != null)
                        {
                            if (objTribute.TributeId > 0)
                            {
                                _tributeId = objTribute.TributeId;
                                _tributeName = objTribute.TributeName;
                                _tributeType = objTribute.TypeDescription;
                                _tributeUrl = objTribute.TributeUrl;

                            }
                        }

                        // set the ID to the last photo ID uploaded so that we can send the email in PhotoUploadPresenter
                        objPhoto.PhotoImage = imageName;
                        objPhoto.PhotoId = UploadedPhotoID;
                        if (objPhoto.PhotoCaption == null)
                            objPhoto.PhotoCaption = string.Empty;
                        objPhoto.PhotoDesc = replaceSpecialCharacter(photoComment);
                        objPhoto.ModuleTypeName = MODULE_TYPE_NAME;
                        objPhoto.UserTributeId = _tributeId;
                        objPhoto.CreatedBy = _userId;
                        objPhoto.CreatedDate = DateTime.Now;
                        objPhoto.IsActive = true;
                        objPhoto.IsDeleted = false;
                        objPhoto.UserName = _userName;
                        objPhoto.TributeName = _tributeName;
                        objPhoto.TributeType = _tributeType;
                        objPhoto.TributeUrl = _tributeUrl;
                        objPhoto.PathToVisit = Request.ServerVariables["SERVER_NAME"] + Request.ApplicationPath;
                        objPhoto.PhotoAlbumId = PhotoAlbumID;

                        _presenter.SaveImageList(objPhoto, AddPhotoEmail);

                        filecount--;
                        if (filecount == 0)
                        {
                            Session["PhotoAlbumId"] = null;
                            Session["PhotoAlbumName"] = null;
                            if (WebConfig.ApplicationMode.Equals("local"))
                                Session["PhotoAlbumTributeSession"] = null;
                            Session["PhotoAlbumobjUserInfo"] = null;
                        }
                        if (UploadedPhotoID > 0)
                        {
                            AddPhotoEmail = false;
                        }

                        // Added by rupendra on June 20, 2011 to redirect on album aftwer updating the page
                        if (Request.QueryString["photoAlbumId"] != null)
                        {
                            _photoAlbumId = 0;
                            int.TryParse(Request.QueryString["photoAlbumId"], out _photoAlbumId);
                            if (PhotoAlbumId > 0)
                                Session["PhotoAlbumID2"] = _photoAlbumId;
                        }
                    }
                    #endregion
                }
            }
            if (_mode == PAGE_MODE_ADD_PHOTOS)
            {
                Response.Redirect("~/" + Session["TributeURL"] + "/photoalbum.aspx?photoAlbumId=" + _photoAlbumId, false);
            }
            else
            {
                Response.Redirect("~/" + Session["TributeURL"] + "/photos.aspx", false);
            }
            #endregion
        }
        catch (Exception ex)
        {
            LogError(ex.Message, ex.StackTrace);
            if (ex.Message.Contains("The process cannot access the file"))
            {
                if (_mode == PAGE_MODE_ADD_PHOTOS)
                {
                    Response.Redirect("~/" + Session["TributeURL"] + "/photoalbum.aspx?photoAlbumId=" + _photoAlbumId, false);
                }
                else
                {
                    Response.Redirect("~/" + Session["TributeURL"] + "/photos.aspx", false);
                }
            }
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// This function will get the values (User Id and Tribute Detail) from the session
    /// </summary>
    private void GetValuesFromSession()
    {
        try
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            // get values from session
            StateManager objStateManager = StateManager.Instance;

            //to get user id from session as user is logged in user
            objSessionValue = (SessionValue)objStateManager.Get(PortalEnums.SessionValueEnum.objSessionvalue.ToString(), StateManager.State.Session);
            if (objSessionValue != null)
            {
                _UserId = objSessionValue.UserId;
                if (objSessionValue.FirstName == string.Empty)
                    _FirstName = objSessionValue.UserName;
                else
                {
                    _FirstName = objSessionValue.FirstName;
                    _LastName = objSessionValue.LastName;
                }
            }
            else
            {
                _IsAdmin = false;
            }

            // to get tribute detail from session
            objTribute = (Tributes)objStateManager.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);

            if (Request.QueryString["mode"] != null) //if user is coming through link
            {
                if (Request.QueryString["TributeId"] != null)
                    _TributeId = int.Parse(Request.QueryString["TributeId"].ToString());

                if (Request.QueryString["TributeName"] != null)
                    _TributeName = Request.QueryString["TributeName"].ToString();

                if (Request.QueryString["TributeType"] != null)
                    _TributeType = Request.QueryString["TributeType"].ToString();

                if (Session["TributeSession"] == null)
                    CreateTributeSession(); //to create the tribute session values if user comest o this page from link or from favorites list.

            }
            else if (objTribute != null)
            {
                _TributeId = objTribute.TributeId;
                _TributeName = objTribute.TributeName;
                _TributeType = objTribute.TypeDescription;
                _TributeURL = objTribute.TributeUrl;
                _isActive = objTribute.IsActive;
                _TributePackageType = objTribute.TributePackageType;
            }

            if (_TributeId == 0)
            {
                Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 15
0
 /// <summary>
 /// Method to create the tribute session values if user comes to this page from link or from favorites list.
 /// </summary>
 private void CreateTributeSession()
 {
     Tributes objTribute = new Tributes();
     objTribute.TributeId = _TributeId;
     objTribute.TributeName = _TributeName;
     objTribute.TypeDescription = _TributeType;
     objTribute.TributeUrl = _TributeURL;
     objTribute.IsActive = _isActive;
     TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
     stateManager.Add(PortalEnums.SessionValueEnum.TributeSession.ToString(), objTribute, TributesPortal.Utilities.StateManager.State.Session);
 }
Exemplo n.º 16
0
    protected void lbtnBackTo_Click(object sender, EventArgs e)
    {
        string redirecturl = "";
        if (Session["PhotoAlbumTributeSession"] != null)
        {
            objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
            _tributeId = objTribute.TributeId;
            _tributeType = objTribute.TypeDescription;
            _tributeTypeName = objTribute.TypeDescription.ToLower().Replace("new baby", "newbaby");
            _tributeName = objTribute.TributeName;
            _createdDate = objTribute.CreatedDate;
            _tributeUrl = objTribute.TributeUrl;
            _isActive = objTribute.IsActive;
        }
        if (WebConfig.ApplicationMode.Equals("local"))
        {
            redirecturl = WebConfig.AppBaseDomain;
        }
        else
        {
            redirecturl = "http://" + _tributeType.ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";


        }
        try
        {
            if (_tributeUrl != null)
            {
                if (_typeName == "AddNote" || _typeName == "EditNote")
                    Response.Redirect(redirecturl + _tributeUrl + "/notes.aspx", false);
                else if (_typeName == "AddVideo" || _typeName == "EditVideo") //for back to video
                {
                    Response.Redirect(redirecturl + _tributeUrl + "/videos.aspx", false);
                    //Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.VideoGallery.ToString()), false);
                }
                else if (_typeName == PortalEnums.TributeContentEnum.ManageEvent.ToString())
                    Response.Redirect(redirecturl + _tributeUrl + "/events.aspx", false);
                else if (_typeName == PortalEnums.TributeContentEnum.InviteGuest.ToString())
                    Response.Redirect(redirecturl + _tributeUrl + "/events.aspx", false);
                else if (_typeName == "AddPhotoAlbum")
                    Response.Redirect(redirecturl + _tributeUrl + "/photos.aspx", false);
                else if (_typeName == "ManagePhoto")
                    Response.Redirect(redirecturl + _tributeUrl + "/photo.aspx", false);
                else if (_typeName == "AddPhotosToAlbum")
                    Response.Redirect(redirecturl + _tributeUrl + "/photos.aspx", false);
                else if (_typeName == "EditPhotoAlbum")
                    Response.Redirect(redirecturl + _tributeUrl + "/photoalbum.aspx", false);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 17
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;
        }

    }
Exemplo n.º 18
0
 public void lbtnImage_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["PhotoAlbumId"] != null)
     {
         if (int.TryParse(Request.QueryString["PhotoAlbumId"], out photoAlbumId))
         {
             StateManager stateManager = StateManager.Instance;
             DownloadPhotoAlbumId = photoAlbumId;
             Session["PhotoAlbumId"] = photoAlbumId.ToString();
             string imagePath = string.Empty;
             Tributes objTributes = objTribute = (Tributes)stateManager.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);
             if ((_packageId == 6) || (_packageId == 7) || (_packageId == 8))
             {
                 if (Equals(objSessionValue, null))//when not logged in
                 {
                     if (IsCustomHeaderOn)
                         topHeight = 198;
                     else
                         topHeight = 81;
                 }
                 else
                 {
                     if (IsCustomHeaderOn)
                         topHeight = 261;
                     else
                         topHeight = 133;
                 }
                 if (Request.QueryString["PhotoAlbumId"] != null)
                 {
                     if (photoAlbumId > 0)
                         Session["PhotoAlbumId"] = photoAlbumId.ToString();
                 }
                 if (WebConfig.ApplicationMode.Equals("local"))
                 {
                     appDomian = WebConfig.AppBaseDomain.ToString();
                 }
                 else
                 {
                     Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                     appDomian = "http://" + objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                 }
                 ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradeAlbum','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
             }
         }
     }
 }
Exemplo n.º 19
0
    protected void lBtnVieFullPhoto_Click(object sender, EventArgs e)
    {
        MiscellaneousController objMisc = new MiscellaneousController();
        Photos objPhotos = new Photos();
        string[] getPath = CommonUtilities.GetPath();

        StateManager objStateManager = StateManager.Instance;
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (Request.QueryString["PhotoId"] != null)
        {
            if (int.TryParse(Request.QueryString["PhotoId"], out _photoId))
            {
                string strOriginalImage = string.Empty;
                string DirBigImage = string.Empty;
                string imagePath = string.Empty;
                objPhotos.PhotoId = _photoId;
                objPhotos = objMisc.GetPhotoDetail(objPhotos);
                Tributes objTributes = objTribute = (Tributes)objStateManager.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);
                if (objTributes != null)
                {
                    if (string.IsNullOrEmpty(objTributes.TributePackageType))
                    {
                        _packageId = objMisc.GetTributePackageId(_tributeId);
                    }
                }
                bool isAllowedPhotoCheck = false;
                string tributeEndDate = objMisc.GetTributeEndDate(_tributeId);
                DateTime date2 = new DateTime();
                //MG:Expiry Notice
                DateTime dt = new DateTime();
                if (!tributeEndDate.Equals("Never"))
                {
                    if (tributeEndDate.Contains("/"))
                    {
                        string[] date = tributeEndDate.Split('/');
                        date2 = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1]));

                    }
                }
                isAllowedPhotoCheck = objMisc.IsAllowedPhotoCheck(_photoAlbumId);

                if (((_packageId == 3) || (_packageId == 6) || (_packageId == 7) || (_packageId == 8)) || ((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now)))
                {
                    if (Equals(objSessionValue, null))//when not logged in
                    {
                        if (IsCustomHeaderOn)
                            topHeight = 198;
                        else
                            topHeight = 88;
                    }
                    else
                    {
                        if (IsCustomHeaderOn)
                            topHeight = 261;
                        else
                            topHeight = 133;
                    }
                    if (Request.QueryString["PhotoId"] != null)
                    {
                        if (int.TryParse(Request.QueryString["PhotoId"], out _photoId))
                            Session["PhotoId"] = _photoId.ToString();
                    }
                    if (WebConfig.ApplicationMode.Equals("local"))
                    {
                        appDomian = WebConfig.AppBaseDomain.ToString();
                    }
                    else
                    {
                        StateManager stateManager = StateManager.Instance;
                        Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                        appDomian = "http://" + objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                    }
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradePhoto','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
                }
                else if (objTributes != null)
                {
                    if (Request.QueryString["TributeUrl"] != null)
                        _tributeUrl = Request.QueryString["TributeUrl"].ToString();

                    string DefaultPath = getPath[0] + "/" + getPath[1] + "/" + _tributeUrl + "_" + objTributes.TypeDescription;
                    //DirectoryInfo objDir = new DirectoryInfo(DirBigImage);
                    DirBigImage = "Big_" + objPhotos.PhotoImage;
                    if (!File.Exists(Path.Combine(DefaultPath, DirBigImage)))
                    {
                        //show big image
                        imagePath = getPath[2] + "/" + _tributeUrl + "_" + objTributes.TypeDescription + "/" + objPhotos.PhotoImage;

                        Page.ClientScript.RegisterStartupScript(GetType(), "open window", "function f(){ window.open('" + imagePath + "'); return false; } f();", true);

                    }
                    else
                    {
                        //show small image

                        imagePath = getPath[2] + "/" + _tributeUrl + "_" + objTributes.TypeDescription + "/" + DirBigImage;

                        Page.ClientScript.RegisterStartupScript(GetType(), "open window", "function f(){ window.open('" + imagePath + "'); return false; } f();", true);
                    }

                }
            }
        }
    }
Exemplo n.º 20
0
    /// <summary>
    /// Method to get the values from session and query string.
    /// </summary>
    private void GetValuesFromSession()
    {
        StateManager objStateManager = StateManager.Instance;
        //to get user id from session as user is logged in user
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (!Equals(objSessionValue, null))
            _userId = objSessionValue.UserId;

        objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);
        if (objTribute != null)
        {
            if (objTribute.TributeId <= 0 && Session["PhotoAlbumTributeSession"] != null)
            {
                objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
            }
        }
        else if (Session["PhotoAlbumTributeSession"] != null)
        {
            objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
        }
        //to get photo album id from querystring
        object albumSession = objStateManager.Get("PhotoAlbumId", StateManager.State.Session);
        if (Request.QueryString["PhotoAlbumId"] != null)
        {
            photoAlbumId = int.Parse(Request.QueryString["PhotoAlbumId"].ToString());
            objStateManager.Add("PhotoAlbumId", photoAlbumId, StateManager.State.Session);
        }
        else if (!Equals(albumSession, null))
        {
            photoAlbumId = int.Parse(albumSession.ToString());
        }
        else
            photoAlbumId = 0;

        if (Request.QueryString["mode"] != null || Request.QueryString["fbmode"] != null) //if user is coming through link
        {
            if (Request.QueryString["TributeId"] != null)
                _tributeId = int.Parse(Request.QueryString["TributeId"].ToString());

            if (Request.QueryString["TributeName"] != null)
                _tributeName = Request.QueryString["TributeName"].ToString();

            if (Request.QueryString["TributeType"] != null)
                _tributeType = Request.QueryString["TributeType"].ToString();

            if (Request.QueryString["TributeUrl"] != null)
                _tributeUrl = Request.QueryString["TributeUrl"].ToString();

            //CreateTributeSession(); //to create the tribute session values if user comes o this page from link or from favorites list.
        }
        else if (!Equals(objTribute, null))
        {
            if (objTribute.TributeId > 0)
            {
                _tributeId = objTribute.TributeId;
                _tributeName = objTribute.TributeName;
                _tributeType = objTribute.TypeDescription;
                _tributeUrl = objTribute.TributeUrl;
                _isActive = objTribute.IsActive;
                _TributePackageType = objTribute.TributePackageType;
            }
            if (!objTribute.Date2.Equals(null))
            {
                _endDate = (DateTime)objTribute.Date2;
            }

        }
        else
            Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);

        if (Session["TributeSession"] == null)
            CreateTributeSession(); //to create the tribute session values if user comest o this page from link or from favorites list.

        //to get page size from config file
        pageSize = (int.Parse(WebConfig.Pagesize_PhotoAlbum));

        //to get current page number, if user clicks on page number in paging it gets tha page number from query string
        //else page number is 1
        if (Request.QueryString["PageNo"] != null)
            currentPage = int.Parse(Request.QueryString["PageNo"].ToString());
        else
            currentPage = 1;
    }
Exemplo n.º 21
0
    /// <summary>
    /// Method to load themes in the left panel
    /// </summary>
    private void LoadThemes()
    {
        try
        {
            StateManager stateManager = StateManager.Instance;
            MiscellaneousController objMisc = new MiscellaneousController();
            string strPath = "";
            if (Request.RawUrl.Contains("/"))
            {
                strPath = Request.RawUrl.ToString().Substring(0, Request.RawUrl.ToString().LastIndexOf('/'));
                strPath = strPath.Substring(strPath.LastIndexOf('/') + 1);
            }
            if ((strPath != "") && (Request.QueryString["Type"] != null))
            {
                objTribute.TributeUrl = strPath;
                objTribute.TypeDescription = Request.QueryString["Type"].ToString().ToLower().Replace("newbaby", "new baby");
                objTribute = objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString());
            }

            if (objTribute != null)
            {
                if (objTribute.TributeId > 0)
                {
                    _tributeId = objTribute.TributeId;
                    _tributeName = objTribute.TributeName;
                    _tributeType = objTribute.TypeDescription;
                    _tributeUrl = objTribute.TributeUrl;
                }
            }
            Templates objTributeType = new Templates();
            objTributeType.TributeType = _tributeType; // "Wedding";

            int existingTheme = GetExistingTheme().TemplateID;
            MiscellaneousController _controller = new MiscellaneousController();
            List<Templates> lstThemes = _controller.GetThemesFolderList(objTributeType, WebConfig.ApplicationType);

            StringBuilder sbChangeSiteTheme = new StringBuilder();
            foreach (Templates objThemes in lstThemes)
            {
                sbChangeSiteTheme.Append("<div class='yt-Form-Field yt-Form-Field-Radio' id='" + objThemes.ThemeCssClass + "'>"); // + objThemes.TemplateName.Remove(objThemes.TemplateName.IndexOf(" "), 1) + "'>");
                sbChangeSiteTheme.Append("<input name='rdoTheme' type='radio' runat='server' id='rdo" + objThemes.TemplateID + "' onclick='javascript:Themer(\"" + objThemes.ThemeValue + "\");GetSelectedTheme(" + objThemes.TemplateID + ",\"" + objThemes.ThemeValue + "\");' value='" + objThemes.ThemeValue + "'");
                string appPath = string.Empty;
                if (WebConfig.ApplicationMode.ToLower().Equals("local"))
                {
                    appPath = WebConfig.AppBaseDomain;
                }
                else
                {
                    appPath = string.Format("{0}{1}{2}", "http://www.", WebConfig.TopLevelDomain, "/");
                }
                if (hdnSelectedTheme.Value != string.Empty)
                {
                    if (int.Parse(hdnSelectedTheme.Value) == objThemes.TemplateID)
                    {
                        sbChangeSiteTheme.Append(" Checked='Checked' />");
                        idSheet.Href = appPath + "assets/themes/" + objThemes.FolderName + "/theme.css"; //to set the selected theme
                    }
                    else
                        sbChangeSiteTheme.Append("  />");
                }
                else
                {
                    if (existingTheme == objThemes.TemplateID)
                    {
                        sbChangeSiteTheme.Append(" Checked='Checked' />");
                        idSheet.Href = appPath + "assets/themes/" + objThemes.FolderName + "/theme.css"; //to set the selected theme
                    }
                    else
                        sbChangeSiteTheme.Append("  />");
                }
                sbChangeSiteTheme.Append("<label for='rdo" + objThemes.TemplateID + "'>"); //rdo" + objThemes.TemplateName + "'>");
                sbChangeSiteTheme.Append(objThemes.TemplateName + " <span class='yt-ThemeColorPrimary'></span><span class='yt-ThemeColorSecondary'></span></label>");
                sbChangeSiteTheme.Append("</div>");
            }
            litThemes.Text = sbChangeSiteTheme.ToString();

            stateManager.Add("ThemeOnMaster", lstThemes, StateManager.State.Session);
        }
        catch (Exception ex)
        {
            throw ex;
        }


    }
Exemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Ajax.Utility.RegisterTypeForAjax(typeof(Photo_PhotoView));
        this.Form.Action = Request.RawUrl;
        try
        {
            //LHK: 3:59 PM 9/5/2011 - Wordpress topURL
            if (Request.QueryString["topurl"] != null)
            {
                _TopUrl = Request.QueryString["topurl"].ToString();
                Response.Cookies["topurl"].Value = _TopUrl;
                Response.Cookies["topurl"].Domain = _TopUrl;
                Response.Cookies["topurl"].Expires = DateTime.Now.AddHours(4);
            }
            lbtnPost.Attributes.Add("onclick", "setIsInTopurl();");

            GetValuesFromSession(); //to get values of logged in user and selected tribute from session.
            UserIsAdmin();
            SetValuesToControls();
            SetControlsVisibility();

            //Start - Modification on 9-Dec-09 for the enhancement 3 of the Phase 1
            if (_tributeName != null) Page.Title = _tributeName + " | Photo";
            //End

            if (!this.IsPostBack)
            {
                this._presenter.GetPhotoDetails();
                //Page.SetFocus(txtPhotoComment);
            }

            if (Request.QueryString["PhotoId"] != null)
            {
                if (int.TryParse(Request.QueryString["PhotoId"], out _photoId))
                    Session["PhotoId"] = _photoId.ToString();
            }
            MiscellaneousController objMisc = new MiscellaneousController();
            bool isAllowedPhotoCheck = false;
            string tributeEndDate = objMisc.GetTributeEndDate(_tributeId);
            DateTime date2 = new DateTime();
            //MG:Expiry Notice
            DateTime dt = new DateTime();
            if (!tributeEndDate.Equals("Never"))
            {
                if (tributeEndDate.Contains("/"))
                {
                    string[] date = tributeEndDate.Split('/');
                    date2 = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1]));

                }
            }
            isAllowedPhotoCheck = objMisc.IsAllowedPhotoCheckonPhotoId(PhotoId);
            _packageId = objMisc.GetPackIdonPhotoId(PhotoId);
            StateManager objStateManager = StateManager.Instance;
            IsCustomHeaderOn = _presenter.GetCustomHeaderDetail(_tributeId);
            //to get user id from session as user is logged in user
            objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
            if (((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now)))
            {
                if (Equals(objSessionValue, null))//when not logged in
                {
                    if (IsCustomHeaderOn)
                        topHeight = 198;
                    else
                        topHeight = 88;
                }
                else
                {
                    if (IsCustomHeaderOn)
                        topHeight = 261;
                    else
                        topHeight = 133;
                }

                if (WebConfig.ApplicationMode.Equals("local"))
                {
                    appDomian = WebConfig.AppBaseDomain.ToString();
                }
                else
                {
                    StateManager stateManager = StateManager.Instance;
                    Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                    appDomian = "http://" + objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                }
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradePhoto','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
            }

            if (Request.QueryString["View"] != null)
            {

                TributePackage objpackage = new TributePackage();
                Tributes objTributes = objTribute = (Tributes)objStateManager.Get(PortalEnums.SessionValueEnum.TributeSession.ToString(), StateManager.State.Session);
                if (objTributes != null)
                {
                    if (string.IsNullOrEmpty(objTributes.TributePackageType))
                    {
                        _packageId = _presenter.GetTributePackageId(_tributeId);
                    }
                    else
                    {
                        if (objTributes.TributePackageType.Equals("Tribute (Never)"))
                            _packageId = 4;
                        else if (objTributes.TributePackageType.StartsWith("Tribute ("))
                            _packageId = 5;
                    }
                }
                if (!this.IsPostBack)
                {

                    if (WebConfig.ApplicationMode.Equals("local"))
                    {
                        appDomian = WebConfig.AppBaseDomain.ToString();
                    }
                    else
                    {
                        appDomian = "http://" + _tributeType.ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                    }
                    IsCustomHeaderOn = _presenter.GetCustomHeaderDetail(_tributeId);
                    if ((_packageId == 6) || (_packageId == 7) || (_packageId == 8))
                    {
                        if (Equals(objSessionValue, null))//when not logged in
                        {
                            if (IsCustomHeaderOn)
                                topHeight = 198;
                            else
                                topHeight = 81;
                        }
                        else
                        {
                            if (IsCustomHeaderOn)
                                topHeight = 261;
                            else
                                topHeight = 133;
                        }
                        if (Request.QueryString["PhotoId"] != null)
                        {
                            if (int.TryParse(Request.QueryString["PhotoId"], out _photoId))
                                Session["PhotoId"] = _photoId.ToString();
                        }
                        if (WebConfig.ApplicationMode.Equals("local"))
                        {
                            appDomian = WebConfig.AppBaseDomain.ToString();
                        }
                        else
                        {
                            StateManager stateManager = StateManager.Instance;
                            Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                            appDomian = "http://" + objTrib.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/";
                        }
                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradePhoto','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
                    }
                    else if ((objTributes.TributePackageType.Equals("Tribute (Never)")) || (objTributes.TributePackageType.StartsWith("Tribute (")))
                    {
                        if (objTributes != null)
                        {

                            if (Request.QueryString["TributeUrl"] != null)
                                _tributeUrl = Request.QueryString["TributeUrl"].ToString();

                            if (!File.Exists(strBigImage))
                            {
                                //show big image
                                string redirectScript = "<script>window.open('" + strBigImage + "');</script>";
                                Response.Write(redirectScript);

                            }
                            else if (!File.Exists(SmallImage))
                            {
                                //show small image
                                string redirectScript = "<script>window.open('" + SmallImage + "');</script>";
                                Response.Write(redirectScript);
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect(WebConfig.AppBaseDomain.ToString() + "Errors/Error404.aspx");
        }
    }
Exemplo n.º 23
0
    /// <summary>
    /// This function will get the values (User Id and Tribute Detail) from the session
    /// </summary>
    private void GetValuesFromSession()
    {
        try
        {
            StateManager objStateManager = StateManager.Instance;
            //to get logged in user name from session as user is logged in user
            objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);

            //LHK:for empty div above body
            if (TributeCustomHeader.Visible)
            {
                if (objSessionValue == null)
                    ytHeader.Visible = false;
            }
            //LHK: till here

            objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);
            if (objTribute != null)
            {
                if (objTribute.TributeId <= 0 && Session["PhotoAlbumTributeSession"] != null)
                {
                    objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
                }
            }
            else if (Session["PhotoAlbumTributeSession"] != null)
            {
                objTribute = Session["PhotoAlbumTributeSession"] as Tributes;
            }
            if (Request.QueryString["fbmode"] != null)
            {
                if (Request.QueryString["fbmode"] == "facebook")
                {
                    _tributeId = int.Parse(Request.QueryString["TributeId"].ToString());
                    _tributeType = Request.QueryString["TributeType"].ToString();
                    _tributeTypeName = Request.QueryString["TributeType"].ToString().ToLower().Replace("new baby", "newbaby");
                    _tributeName = Request.QueryString["TributeName"].ToString();
                    _tributeUrl = Request.QueryString["TributeUrl"].ToString();
                }
                else
                    Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
            }
            else if ((Request.QueryString["videoType"] != null) && (Request.QueryString["videoId"] != null))
            {
                int videoId = int.Parse(Request.QueryString["videoId"].ToString());
                TributesPortal.BusinessLogic.VideoManager videoManager = new TributesPortal.BusinessLogic.VideoManager();
                Videos videos = videoManager.GetVideoTributeDetails(videoId);
                if (!(string.IsNullOrEmpty(objTribute.TypeDescription)))
                {
                    objTribute.TributeName = videos.TributeName;
                    _tributeName = objTribute.TributeName;
                    _isActive = videos.IsTributeActive;
                    _tributeType = objTribute.TypeDescription;
                    _tributeTypeName = objTribute.TypeDescription.ToLower().Replace("new baby", "newbaby");
                    _tributeUrl = Request.QueryString["TributeUrl"].ToString();
                }
            }
            else if (!Equals(objTribute, null))
            {
                if (objTribute.TributeId > 0)
                {

                    _tributeId = objTribute.TributeId;
                    _tributeType = objTribute.TypeDescription;
                    _tributeTypeName = objTribute.TypeDescription.ToLower().Replace("new baby", "newbaby");
                    _tributeName = objTribute.TributeName;
                    _createdDate = objTribute.CreatedDate;
                    _tributeUrl = objTribute.TributeUrl;
                    _isActive = objTribute.IsActive;
                }

                if (Session["tributeEndDate"] != null)
                    _endDate = (DateTime)Session["tributeEndDate"];

            }
            else
            {
                Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
            }

            if (Session["TributeCreatedDate"] != null && (Convert.ToDateTime(Session["TributeCreatedDate"])) < Convert.ToDateTime(WebConfig.Launch_Day) && DateTime.Today <= Convert.ToDateTime(WebConfig.Launch_Day).AddDays(180))
            {
                CommonUtilities utility = new CommonUtilities();
                if (objSessionValue != null && objSessionValue.UserId > 0)
                {
                    if (!utility.ReadCookie(objSessionValue.UserId))
                    {
                        utility.CreateCookie(objSessionValue.UserId);
                    }
                }
                else if (objSessionValue == null)
                {
                    if (!utility.ReadCookie(0))
                    {

                        utility.CreateCookie(-1);
                    }
                }
            }


            if (!Equals(objSessionValue, null))
            {


                _userId = objSessionValue.UserId;
                _userName = objSessionValue.UserName;
                _firstName = objSessionValue.FirstName;
                _lastName = objSessionValue.LastName;
                _emailID = objSessionValue.UserEmail;
            }
            else
            {
                if (_isActive.Equals(false))
                {
                    SetExpiry();
                }


            }
            //else page number is 1
            if (Request.QueryString["PageNo"] != null)
                currentPage = int.Parse(Request.QueryString["PageNo"].ToString());
            else
                currentPage = 1;

            //to set values to hidden variables for facebook
            hdnTributeId.Value = _tributeId.ToString();
            hdnTributeName.Value = _tributeName;
            hdnTributeType.Value = _tributeType;
            hdnTributeUrl.Value = _tributeUrl;

            if (Session["TributeSession"] == null)
                CreateTributeSession(); //to create the tribute session values if user comest o this page from link or from favorites list.


            if (_packageId != 1)
            {
                if (_isActive.Equals(false))
                {
                    SetExpiry();
                    if (_endDate != null && _endDate < DateTime.Today)
                    {
                        TimeSpan diff = DateTime.Now.Subtract(DateTime.Parse(_endDate.ToString()));
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 24
0
    private void GetValuesFromSession()
    {
        StateManager objStateManager = StateManager.Instance;

        //to get user id from session as user is logged in user
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (!Equals(objSessionValue, null))
        {
            _userId = objSessionValue.UserId;
            _userName = objSessionValue.FirstName == string.Empty ? objSessionValue.UserName : (objSessionValue.FirstName + " " + objSessionValue.LastName);
        }

        //to get photo id from query string
        if (Request.QueryString["PhotoId"] != null) //to pick value of selected note from querystring
        {
            _photoId = int.Parse(Request.QueryString["PhotoId"].ToString());
            objStateManager.Add("PhotoViewSession", _photoId, StateManager.State.Session);
        }
        else if (objStateManager.Get("PhotoViewSession", StateManager.State.Session) != null)
        {
            _photoId = int.Parse(objStateManager.Get("PhotoViewSession", StateManager.State.Session).ToString());
        }

        objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);

        pageSize = (int.Parse(WebConfig.Pagesize_Notes_Comments));

        //to get current page number, if user clicks on page number in paging it gets tha page number from query string
        //else page number is 1
        if (Request.QueryString["PageNo"] != null)
            currentPage = int.Parse(Request.QueryString["PageNo"].ToString());
        else
            currentPage = 1;

        if (Request.QueryString["mode"] != null || Request.QueryString["fbmode"] != null) //if user is coming through link
        {
            if (Request.QueryString["TributeId"] != null)
                _tributeId = int.Parse(Request.QueryString["TributeId"].ToString());

            if (Request.QueryString["TributeName"] != null)
                _tributeName = Request.QueryString["TributeName"].ToString();

            if (Request.QueryString["TributeType"] != null)
                _tributeType = Request.QueryString["TributeType"].ToString();

            if (Request.QueryString["TributeUrl"] != null)
                _tributeUrl = Request.QueryString["TributeUrl"].ToString();

            //CreateTributeSession(); //to create the tribute session values if user comes o this page from link or from favorites list.
        }
        else if (!Equals(objTribute, null))
        {
            _tributeId = objTribute.TributeId;
            _tributeName = objTribute.TributeName;
            _tributeType = objTribute.TypeDescription;
            _tributeUrl = objTribute.TributeUrl;
            _isActive = objTribute.IsActive;
        }
        else
            Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);

        if (Session["TributeSession"] == null)
            CreateTributeSession(); //to create the tribute session values if user comest o this page from link or from favorites list.

        objPhotoDetails = (Photos)objStateManager.Get("PhotoDetails", StateManager.State.Session);
        // get package id
        //TributePackage objpackage = new TributePackage();
        //objpackage.UserTributeId = objTribute.TributeId;
        //object[] param = { objpackage };
        //_packageId = _presenter.TriputePackageId(param);
    }
Exemplo n.º 25
0
    protected void lbtnSaveTheme_Click(object sender, EventArgs e)
    {
        try
        {
            if (hdnSelectedTheme.Value != string.Empty) // || hdnSelectedTheme.Value != null)
            {
                Tributes objTribute = new Tributes();
                MiscellaneousController _controller = new MiscellaneousController();
                objTribute.TributeId = _tributeId;
                objTribute.ThemeId = int.Parse(hdnSelectedTheme.Value);
                objTribute.ModifiedBy = _userId;
                objTribute.ModifiedDate = DateTime.Now;

                _controller.UpdateTributeTheme(objTribute);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 private void SaveValues(int TributeId)
 {
     Tributes objTribute = new Tributes();
     objTribute.TributeId = TributeId;
     _presenter.GetTributeSession(objTribute);
     _tributeName = objTribute.TributeName;
     _tributeType = objTribute.TypeDescription;
     TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
     stateManager.Add("TributeSession", objTribute, TributesPortal.Utilities.StateManager.State.Session);
 }
 private void CreateTributeSession()
 {
     Tributes objTribute = new Tributes();
     objTribute.TributeId = _tributeId;
     objTribute.TributeName = _tributeName;
     objTribute.TypeDescription = _tributeType;
     objTribute.TributeUrl = _tributeUrl;
     objTribute.IsActive = _isActive;
     TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
     stateManager.Add("TributeSession", objTribute, TributesPortal.Utilities.StateManager.State.Session);
 }
Exemplo n.º 28
0
    /// <summary>
    /// Method to get values from session and querystring
    /// </summary>
    private void GetValuesFromSession()
    {
        StateManager objStateManager = StateManager.Instance;

        //to get user id from session as user is logged in user
        objSessionValue = (SessionValue)objStateManager.Get("objSessionvalue", StateManager.State.Session);
        if (!Equals(objSessionValue, null))
            _userId = objSessionValue.UserId;

        //if user is not logged in user redirect to login page
        if (_userId == 0)
            Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()) + "?PhotoId=" + _photoId, false);

        //to get photo id from query string
        if (Request.QueryString["PhotoId"] != null) //to pick value of selected note from querystring
            _photoId = int.Parse(Request.QueryString["PhotoId"].ToString());
        else
            _photoId = 0;

        objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);

        if (!Equals(objTribute, null))
        {
            _tributeId = objTribute.TributeId;
            _tributeName = objTribute.TributeName;
            _tributeType = objTribute.TypeDescription;
            _tributeUrl = objTribute.TributeUrl;
        }
    }
    private void SignMe()
    {
        try
        {
                errorVerification.Visible = false;
                bool avability = CheckAvailablity();
                if (avability != true)
                {
                    int email = _presenter.EmailAvailable();
                    if (email == 0)
                    {
                        UserRegistration objUserReg = SaveAccount();
                        _presenter.SavePersonalAccount(objUserReg);
                        if (objUserReg.CustomError != null)
                        {
                            if (objUserReg.CustomError.ErrorMessage.Contains("Facebook"))
                            {
                                objUserReg.CustomError.ErrorMessage = objUserReg.CustomError.ErrorMessage +
                          " Please <a href=\"#\" onclick=\"fb_logout(); return false;\">" +
                          "   <img id=\"fb_logout_image\" src=\"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif\" alt=\"Connect\"/>" +
                          "</a> and try again.";
                            }
                            lblErrMsg.InnerHtml = ShowMessage(headertext, objUserReg.CustomError.ErrorMessage, 1);
                            lblErrMsg.Visible = true;
                        }
                        else
                        {
                            SessionValue objSessionValue = new SessionValue(objUserReg.Users.UserId,
                                                                             objUserReg.Users.UserName,
                                                                             objUserReg.Users.FirstName,
                                                                             objUserReg.Users.LastName,
                                                                             objUserReg.Users.Email,
                                                                             objUserReg.UserBusiness == null ? 1 : 2, "Basic", objUserReg.Users.IsUsernameVisiable);
                            StateManager stateManager = StateManager.Instance;
                            stateManager.Add("objSessionvalue", objSessionValue, StateManager.State.Session);

                            if (chkAgreeReceiveNewsletters.Checked)
                            {
                                bool retval = AddMailChimpSubscriber(objUserReg.Users.UserType);
                            }

                            //Add Personal User to MailChimpLists

                            // Added For Event Handling - Parul
                            if (Request.QueryString["EventID"] != null)
                            {
                                string EventID = Request.QueryString["EventID"];
                                string TributeUrl = Request.QueryString["TributeUrl"];
                                string EmailID = Request.QueryString["Email"];
                                if (EmailID == txtEmail.Text.Trim())
                                {
                                    string queryString = "?EventID=" + EventID;
                                    if (WebConfig.ApplicationMode.Equals("local"))
                                    {
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + TributeUrl + "/event.aspx" + queryString, false);
                                    }
                                    else
                                    {
                                        Response.Redirect("http://" + Request.QueryString["TributeType"] + "." + WebConfig.TopLevelDomain + "/" + TributeUrl + "/event.aspx" + queryString, false);
                                    }
                                }
                                else
                                {
                                    // Added by Ashu on Oct 3, 2011 for rewrite URL
                                    if (ConfigurationManager.AppSettings["ApplicationType"].ToLower() == "yourmoments")
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + "moments.aspx", false);
                                    else
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + "tributes.aspx", false);
                                }
                            }
                            else if (Request.QueryString["TributeUrl"] != null)
                            {
                                string emailId = Request.QueryString["Email"];

                                if (emailId == txtEmail.Text.Trim())
                                {
                                    if (WebConfig.ApplicationMode.Equals("local"))
                                    {
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + Request.QueryString["TributeUrl"] + "/inviteadminconfirmation.aspx", false);
                                    }
                                    else
                                    {
                                        Response.Redirect("http://" + Request.QueryString["TributeType"].Replace("New Baby", "newbaby").ToLower() + "." + TributesPortal.Utilities.WebConfig.TopLevelDomain + "/" + Request.QueryString["TributeUrl"] + "/inviteadminconfirmation.aspx");
                                    }
                                }
                                else
                                {
                                    if (WebConfig.ApplicationMode.Equals("local"))
                                    {
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + Request.QueryString["TributeUrl"], false);
                                    }
                                    else
                                    {
                                        Response.Redirect("http://" + Request.QueryString["TributeType"].Replace("New Baby", "newbaby").ToLower() + "." + TributesPortal.Utilities.WebConfig.TopLevelDomain + "/" + Request.QueryString["TributeUrl"], false);
                                    }

                                }
                            }
                            else if (Request.QueryString["TributeID"] != null)
                            {
                                string tributeName = Request.QueryString["TributeName"];
                                string tributeId = Request.QueryString["TributeID"];
                                string emailId = Request.QueryString["Email"];

                                if (emailId == txtEmail.Text.Trim())
                                {
                                    Tributes objTribute = new Tributes();
                                    objTribute.TributeId = int.Parse(tributeId);
                                    objTribute.TributeName = tributeName;
                                    TributesPortal.Utilities.StateManager stateTributes = TributesPortal.Utilities.StateManager.Instance;
                                    stateTributes.Add("TributeSession", objTribute, TributesPortal.Utilities.StateManager.State.Session);
                                    Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.UserLogin2AdminConformation.ToString()));
                                }
                                else
                                {
                                    if (WebConfig.ApplicationMode.Equals("local"))
                                    {
                                        Response.Redirect(Session["APP_BASE_DOMAIN"] + Request.QueryString["TributeUrl"], false);
                                    }
                                    else
                                    {
                                        //Uncomment the line below and comment the line above for server.
                                        Response.Redirect("http://" + Request.QueryString["TributeType"].Replace("New Baby", "newbaby").ToLower() + "." + TributesPortal.Utilities.WebConfig.TopLevelDomain + "/" + Request.QueryString["TributeUrl"], false);
                                    }
                                }
                            }
                            else if (Request.QueryString["PageName"] != null)
                            {
                                string pageName = Request.QueryString["PageName"];

                                if (pageName == "TributeCreation")
                                {
                                    string querystring = string.Empty;
                                    int accountType = 0;
                                    int.TryParse(Request.QueryString["AccountType"], out accountType);
                                    if (accountType > 0)
                                    {
                                        if (Request.QueryString["Type"] != null)
                                        {
                                            querystring = "?Type=" + Request.QueryString["Type"];
                                        }
                                        if (Request.QueryString["TributeType"] != null)
                                        {
                                            querystring = "TributeType=" + Request.QueryString["TributeType"];
                                        }
                                        if (Request.QueryString["AccountType"] != null)
                                        {
                                            if (string.IsNullOrEmpty(querystring))
                                                querystring += "AccountType=" + Request.QueryString["AccountType"];
                                            else
                                                querystring += "&AccountType=" + Request.QueryString["AccountType"];
                                        }
                                    }
                                    Response.Redirect(Session["APP_BASE_DOMAIN"] + "create.aspx" + "?" + querystring, false);
                                }
                            }

                            else
                            {
                                string str = Redirect.RedirectToPage(Redirect.PageList.UserAccounts.ToString());
                                Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID));
                                Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain;
                                Session["mytribute"] = false;
                                // Added by Ashu on Oct 3, 2011 for rewrite URL
                                if (ConfigurationManager.AppSettings["ApplicationType"].ToLower() == "yourmoments")
                                    Response.Redirect(Session["APP_BASE_DOMAIN"] + "moments.aspx", false);
                                else
                                    Response.Redirect(Session["APP_BASE_DOMAIN"] + "tributes.aspx", false);
                            }
                        }
                    }
                    else
                    {
                        lblErrMsg.InnerHtml = ShowMessage(headertext, "User already exists for this email: " + txtEmail.Text, 1);//COMDIFFRES: is this message correct?
                        lblErrMsg.Visible = true;
                    }
                }
        }
        catch (Exception ex)
        {
            lblErrMsg.InnerHtml = ShowMessage(headertext, ex.Message, 1);
            lblErrMsg.Visible = true;
        }
    }
Exemplo n.º 30
0
 private void SetNoticeHeader(string tributename, string tributeid)
 {
     Tributes objTribute = new Tributes();
     objTribute.TributeId = int.Parse(tributeid);
     objTribute.TributeName = tributename;
     TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
     stateManager.Add("TributeSession", objTribute, TributesPortal.Utilities.StateManager.State.Session);
     String strbul = "";
     // Added by Ashu on Oct 4, 2011 for rewrite URL
     if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments")
         strbul = "<h2>You have been selected to be an administrator of the Tribute: <a href='MomentsHomePage.aspx'>" + tributename + "</a></h2>";
     else if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourtribute")
         strbul = "<h2>You have been selected to be an administrator of the Tribute: <a href='tributehomepage.aspx'>" + tributename + "</a></h2>";
     strbul += " <h3>Please log in or sign up to continue.</h3>";
     Notice.InnerHtml = strbul;
     Notice.Visible = true;
 }