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); }
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); } }
/// <summary> /// Method to check if tribute in user favorite list and set btn string. /// </summary> private void CheckForFavorite() { try { MiscellaneousController _favController = new MiscellaneousController(); AddToFavorite objFavorite = new AddToFavorite(); objFavorite.TributeId = _tributeId; objFavorite.UserId = _userId; isInFavorite = _favController.GetUserTributeFavorites(objFavorite); if (isInFavorite > 0) { lbtnAddToFavorite.Text = ResourceText.GetString("lbtnRemoveFromFavourate_ST_Master"); toFav = ResourceText.GetString("txtRemoveFromFavorite_ST_Master"); toFavText = ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments" ? ResourceText.GetString("txtRemoveFavorite_ST_Master1") : ResourceText.GetString("txtRemoveFavorite_ST_Master"); } else { lbtnAddToFavorite.Text = ResourceText.GetString("lbtnAddFav_ST_Master"); toFav = ResourceText.GetString("txtAddToFavorite_ST_Master"); toFavText = ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments" ? ResourceText.GetString("txtAddFavorite_ST_Master1") : ResourceText.GetString("txtAddFavorite_ST_Master"); } } catch (Exception ex) { throw ex; } }
/// <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); }
/// <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; } }
/// <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; } } }
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); } } } } }
protected void Page_Load(object sender, EventArgs e) { Ajax.Utility.RegisterTypeForAjax(typeof(Users_log_in)); //this.Form.Action = Request.RawUrl; Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.AddHeader("Pragma", "no-cache"); showFbDialog.Text = "false"; //Page.Title = "Log In - Your Tribute"; if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments") { signUpYm.Visible = true; signUpYt.Visible = false; //Page.Title = "Log In - Your Moments"; ytExamplesBlock.Visible = false; } if (!this.IsPostBack) { var fbWebContext = FacebookWebContext.Current; if (FacebookWebContext.Current.Session != null) { if (FacebookWebContext.Current.AccessToken != null) { var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken); var me = (IDictionary<string, object>)fbwc.Get("me"); // get own information _FacebookUid = fbWebContext.UserId; // get own user id try { string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; // get first name and last name if (this._presenter.OnFacebookLogin(fbName)) { _showSignUpDialog = "false"; showFbDialog.Text = "false"; SaveSessionInDB(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID)); Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain; RedirectPage(); return; } else { string notice = string.Format("<h2>Welcome, {0}.</h2>" + "<h3>Login here to connect your Facebook login to your account<br/>" + "Or sign-up to create full account, connected with your Facebook credentials</h3>", fbName); Notice.InnerHtml = notice; Notice.Visible = true; lbtnLogin.Text = "Connect"; if (Request.QueryString["ytfblink"] != null) { showFbDialog.Text = "false"; } else { showFbDialog.Text = "true"; } } } catch (FacebookApiException ex) { _showSignUpDialog = "false"; ShowMessage("Something unexpected went wrong. Sorry. 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." + ex.ToString()); doFbLogout.Text = "true"; } } } Page.Form.DefaultButton = this.FindControl(lbtnLogin.ClientID).UniqueID; Page.Form.DefaultFocus = this.FindControl(txtLoginUsername.ClientID).UniqueID; // Page.Form.DefaultButton = this.FindControl(txtLoginUsername.ClientID).UniqueID; lbtnLogin.Attributes.Add("onclick", "JavaScript:HideIndecator();"); txtLoginUsername.Attributes.Add("onkeydown", "JavaScript:if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + lbtnLogin.UniqueID + "').click();return false;}} else {return true}; "); txtLoginPassword.Attributes.Add("onkeydown", "JavaScript:if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + lbtnLogin.UniqueID + "').click();return false;}} else {return true}; "); this._presenter.OnViewInitialized(); if (Request.QueryString["PageName"] != null) { string PageName = Request.QueryString["PageName"].ToString(); if (PageName == "TributeCreation") { //LHK: this is the maessage that appears in the background of Login label. lblMessage.InnerText = "In order to create and contribute, you first need to login to Your Tribute."; lblMessage.Visible = true; } } // Added For Event Handling - Parul else if (Request.QueryString["EventID"] != null) { _EventID = int.Parse(Request.QueryString["EventID"].ToString()); String TributeUrl = Request.QueryString["TributeUrl"].ToString(); String TypeDescription = Request.QueryString["TributeType"].ToString(); _presenter.GetEventName(); if (_EventName != "") { string href = "http://" + TypeDescription.Replace("New Baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/" + TributeUrl + "/event.aspx?EventID=" + EventID;// +"&TributeID=" + TributeID; lblMessage.InnerHtml = "You have been invited to the event " + "<a href='" + href + "'>" + _EventName + "</a>" + ". Please Log in or Sign up to RSVP to the event. <BR>To view the event details and RSVP later, " + "<a href='" + href + "'>" + "Click Here" + "</a>" + "."; lblMessage.Visible = true; } } else if (Request.QueryString["TributeName"] != null) { string TributeName = Request.QueryString["TributeName"].ToString(); string TributeId = Request.QueryString["Tributeid"].ToString(); SetNoticeHeader(TributeName, TributeId); } else if (Request.QueryString["TributeUrl"] != null) { Tributes objTribute = new Tributes(); objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString(); objTribute.TypeDescription = Request.QueryString["TributeType"].ToString(); MiscellaneousController objMisc = new MiscellaneousController(); SetNoticeHeader(objMisc.GetTributeSessionForUrlAndType(objTribute,WebConfig.ApplicationType.ToString())); } else { lblMessage.Visible = false; } if (lblMessage.Visible == false && Session["IsTributeDeleted"] != null && Convert.ToBoolean(Session["IsTributeDeleted"]) == true) { ShowMessage("<h2>Oops - there is a problem with tribute.</h2> <h3>Please correct the errors below:</h3>", "Tribute has been deleted by administrator.", true); Session["IsTributeDeleted"] = null; _showSignUpDialog = "false"; } } this._presenter.OnViewLoaded(); }
protected void lbtnAddToFavorite_Click(object sender, EventArgs e) { try { AddToFavorite objFavorite = new AddToFavorite(); int returnVal = 0; objFavorite.UserId = _userId; objFavorite.TributeId = _tributeId; if (isInFavorite > 0) { objFavorite.ModifiedBy = _userId; objFavorite.ModifiedDate = DateTime.Now; objFavorite.EmailAlert = chkFavoritesEmailNotifications.Checked; objFavorite.IsActive = true; objFavorite.IsDeleted = true; } else { objFavorite.CreatedBy = _userId; objFavorite.CreatedDate = DateTime.Now; objFavorite.EmailAlert = chkFavoritesEmailNotifications.Checked; objFavorite.IsActive = true; objFavorite.IsDeleted = false; } MiscellaneousController _controller = new MiscellaneousController(); if (isInFavorite > 0) _controller.RemoveFromFavotire(objFavorite); else returnVal = _controller.AddToFavorites(objFavorite); if (returnVal > 0) //already in favorite list { lblErrMsg.InnerHtml = ShowErrorMessage(ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments" ? ResourceText.GetString("errFavorite_Master1") : ResourceText.GetString("errFavorite_Master")); lblErrMsg.Visible = true; } else { lblErrMsg.Visible = false; } CheckForFavorite(); } catch (Exception ex) { throw ex; } }
protected void Page_Init(object sender, EventArgs e) { //Page.RegisterStartupScript("ScriptDescription", "<script type=\"text/javascript\"> alert('" + Request.Url.ToString() + "');</script>"); try { StateManager stateManager = StateManager.Instance; MiscellaneousController objMisc = new MiscellaneousController(); //-- Ashu(June2,2011) : Changes for jquery conflict issues & Javascript exception if (!(Request.Url.AbsolutePath.ToLower().EndsWith("managephotoalbum.aspx"))) { DivScript.Visible = true; divModalboxscript.Visible = true; } else { DivScript.Visible = false; divModalboxscript.Visible = false; } app_domin = WebConfig.AppBaseDomain; // to avoid redirection for create photo album page if (!(Request.Url.AbsolutePath.ToLower().EndsWith("managephotoalbum.aspx"))) { //if Tribute Type and Tribute Url are in querystring #region LHK:Redirection to upgradedUrl if (!this.IsPostBack) { Tributes objTrb = new Tributes(); //GetUpgradedUrl if ((Request.QueryString["TributeUrl"] != null)) { _tributeUrl = Request.QueryString["TributeUrl"].ToString(); objTrb.TributeUrl = _tributeUrl = Request.QueryString["TributeUrl"].ToString(); if (Request.QueryString["TributeType"] != null) { objTrb.TypeDescription = Request.QueryString["TributeType"].ToString(); } else if (Session["PhotoAlbumTributeSession"] != null) { objTrb = Session["PhotoAlbumTributeSession"] as Tributes; if (objTrb != null) if (string.IsNullOrEmpty(objTrb.TypeDescription)) Session["TributeType"] = objTrb.TypeDescription; } objTrb = objMisc.GetTributeUrlOnOldTributeUrl(objTrb, WebConfig.ApplicationType.ToString()); if (Request.QueryString["TributeType"] != null) { objTrb.TypeDescription = Request.QueryString["TributeType"].ToString(); } if (objTrb != null) { if (objTrb.TributeUrl != null) { if (!(string.IsNullOrEmpty(objTrb.TributeUrl.ToString())) && (!(_tributeUrl.Equals(objTrb.TributeUrl.ToString())))) { url = GetRedirectUrl(); Response.Redirect(url, true); } } } } } #endregion #region For Image uploader redirection //LHK: redirection from main domain to subdomain- for image uploader if (!(WebConfig.ApplicationMode.Equals("local"))) { if (Request.QueryString["Type"] != null && Request.QueryString["TributeUrl"] != null) { RediectUsingQueryString(); } else { RedirectUsingSession(); } } if (WebConfig.ApplicationMode.Equals("local")) { if (Request.QueryString["mode"] != null && Request.QueryString["TributeUrl"] != null) { if (Request.QueryString["mode"].ToString() == "Create") { if (FacebookWebContext.Current.Session != null) { url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photos.aspx?post_on_facebook=True"; } else { url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photos.aspx"; } } else if (Request.QueryString["mode"].ToString() == "AddPhotos") { url = WebConfig.AppBaseDomain + Request.QueryString["TributeUrl"].ToString() + "/photoalbum.aspx?photoAlbumId=" + Request.QueryString["AlbumId"].ToString(); } if (!string.IsNullOrEmpty(url)) Response.Redirect(url, false); } } #endregion } Tributes objTribute = new Tributes(); if ((Request.QueryString["TributeUrl"] != null) && (Request.QueryString["TributeType"] != null)) { objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString(); objTribute.TypeDescription = Request.QueryString["TributeType"].ToString(); stateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session); } else if (Request.QueryString["TributeUrl"] != null) { objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString(); if (Session["TributeType"] != null) objTribute.TypeDescription = Session["TributeType"].ToString(); else objTribute.TypeDescription = null; stateManager.Add("TributeSession", objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString()), TributesPortal.Utilities.StateManager.State.Session); } Tributes objTrib = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session); if (objTrib != null) { if (objTrib.CreatedDate != null) Session["TributeCreatedDate"] = objTrib.CreatedDate; if (objTrib.TributeUrl != null) Session["TributeURL"] = objTrib.TributeUrl; } TributePackage objpackage = new TributePackage(); objpackage.UserTributeId = objTribute.TributeId; object[] param = { objpackage }; objMisc.TriputePackageInfo(param); if (objpackage.CustomError == null) { _packageId = objpackage.PackageId; if (_packageId != 1 && objpackage.EndDate != null) { _endDate = (DateTime)objpackage.EndDate; Session["tributeEndDate"] = _endDate; } } } catch (Exception ex) { throw ex; } }
protected void Page_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"); } }
protected void Page_Load(object sender, EventArgs e) { try { GetValuesFromSession(); topHeight = 165; //DJ: Added code for expiry message string appDomian = string.Empty; if (WebConfig.ApplicationMode.Equals("local")) { appDomian = WebConfig.AppBaseDomain.ToString(); } else { appDomian = "http://" + _tributeType.ToLower().Replace("new baby", "newbaby") + "." + WebConfig.TopLevelDomain + "/"; } if (_tributeName != null) Page.Title = _tributeName + " | Photo Album"; //End UserIsAdminOrOwner(); aTributeHome.HRef = Session["APP_PATH"] + _tributeUrl + "/"; string tributeEndDate = _presenter.GetTributeEndDate(_tributeId); if (Request.QueryString["PhotoAlbumId"] != null) { int.TryParse(Request.QueryString["PhotoAlbumId"], out photoAlbumId); if (photoAlbumId > 0) Session["PhotoAlbumId"] = photoAlbumId.ToString(); } //MG:Expiry Notice //AG(20-jan-11): Added topheight for expiry page bool isCustomeHeaderOn = _presenter.GetCustomHeaderDetail(_tributeId); if (Equals(objSessionValue, null))//when not logged in { if (isCustomeHeaderOn) topHeight = 197; else topHeight = 91; } else { if (isCustomeHeaderOn) topHeight = 258; else topHeight = 131; } if (!this.IsPostBack) { this._presenter.GetPhotoAlbumData(GetPhotoObject()); } bool isAllowedPhotoCheck = false; MiscellaneousController objMisc = new MiscellaneousController(); 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])); } } _packageId = _presenter.GetPackIdonPhotoAlbumId(photoAlbumId); isAllowedPhotoCheck = objMisc.IsAllowedPhotoCheck(photoAlbumId); if (((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now))) { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "a", "fnExpiryNoticePopupClose();", true); //ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnExpiryNoticePopup('location.href','document.title','NonMemo','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true); ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','UpgradeAlbum','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true); } } catch (Exception ex) { Response.Redirect(WebConfig.AppBaseDomain.ToString() + "Errors/Error404.aspx"); } }
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; } }
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 } } } }
protected void lbtnAdd_Click(object sender, EventArgs e) { try { MiscellaneousController objMisc = new MiscellaneousController(); StateManager stateTribute = StateManager.Instance; SessionValue objSessvalue = (SessionValue)stateTribute.Get("objSessionvalue", StateManager.State.Session); #region TributeNotes if (_typeName == "TributeNotes") { Response.Redirect("~/" + Session["TributeURL"] + "/managenote.aspx", false); } #endregion #region VideoGallery else if (_typeName == "VideoGallery") { Response.Redirect("~/" + Session["TributeURL"] + "/addvideo.aspx", false); } #endregion #region Event else if (_typeName == PortalEnums.TributeContentEnum.Event.ToString()) { Response.Redirect("~/" + Session["TributeURL"] + "/manageevent.aspx", false); } #endregion #region EventFullView else if (_typeName == PortalEnums.TributeContentEnum.EventFullView.ToString()) { Response.Redirect(Session["APP_BASE_DOMAIN"].ToString() + Session["TributeURL"].ToString() + "/manageevent.aspx" + "?EventID=" + Session["EventIdForEdit"].ToString()); } #endregion #region PhotoGallery else if (_typeName == "PhotoGallery") { if (Equals(objSessionValue, null))//when not logged in { if (IsCustomHeaderOn) topHeight = 197; else topHeight = 78; } else { if (IsCustomHeaderOn) topHeight = 258; else topHeight = 131; } 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 == 6) || (_packageId == 7) || (_packageId == 3) || (_packageId == 8) | ((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now))) { int CurrentAlbums = objMisc.GetCurrentPhotoAlbums(_tributeId); if (CurrentAlbums >= (int.Parse(WebConfig.PhotoAlbumLimit))) { if (Equals(objSessionValue, null))//when not logged in { if (IsCustomHeaderOn) topHeight = 197; else topHeight = 78; } else { if (IsCustomHeaderOn) topHeight = 258; else topHeight = 131; } ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','Photos','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true); } else { StateManager stateManager = StateManager.Instance; Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session); if (objTrb != null) { if (WebConfig.ApplicationMode.Equals("local")) { Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false); } else { appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"); Response.Redirect(appDomian, false); } } } } else { StateManager stateManager = StateManager.Instance; Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session); if (objTrb != null) { if (WebConfig.ApplicationMode.Equals("local")) { Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false); } else { appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"); Response.Redirect(appDomian, false); } } } } #endregion #region PhotoAlbum else if (_typeName == "PhotoAlbum") { StateManager stateManager = StateManager.Instance; Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session); if (objTrb != null) { if (WebConfig.ApplicationMode.Equals("local")) { Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx" + "?mode=addphotos&photoAlbumId=" + _photoAlbumId + "&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false); } else { appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx" + "?mode=addphotos&photoAlbumId=" + _photoAlbumId + "&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"); Response.Redirect(appDomian, false); } } } #endregion } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Notice.Visible = false; StateManager stateManager1 = StateManager.Instance; SessionValue objSessionvalue = (SessionValue)stateManager1.Get("objSessionvalue", StateManager.State.Session); if (objSessionvalue != null) { // Added by Ashu on Oct 3, 2011 for rewrite URL if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments") myprofile.HRef = Session["APP_BASE_DOMAIN"] + "moments.aspx"; else myprofile.HRef = Session["APP_BASE_DOMAIN"] + "tributes.aspx"; Usernamelong.Text = objSessionvalue.UserName; lbtnSubmit.Attributes.Add("onclick", "Hideheader();"); TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance; //Tributes objtribute = (Tributes)stateManager.Get("TributeSession", TributesPortal.Utilities.StateManager.State.Session); //SetMessageHeader(objtribute.TributeName, objtribute.TributeId.ToString(), objtribute.TributeUrl, objtribute.TypeDescription); if ((Request.QueryString["TributeUrl"] != null) && (Request.QueryString["TributeType"] != null)) { Tributes objTribute = new Tributes(); objTribute.TributeUrl = Request.QueryString["TributeUrl"].ToString(); objTribute.TypeDescription = Request.QueryString["TributeType"].ToString(); MiscellaneousController objMisc = new MiscellaneousController(); Tributes objTributeDetail = objMisc.GetTributeSessionForUrlAndType(objTribute, WebConfig.ApplicationType.ToString()); stateManager1.Add("TributeSession", objTributeDetail, StateManager.State.Session); SetMessageHeader(objTributeDetail.TributeName, objTributeDetail.TributeId.ToString(), objTributeDetail.TributeUrl, objTributeDetail.TypeDescription); } } else { Response.Redirect("~/log_in.aspx"); } } }