private void SetSessionValue(int UserID,string UserName,string FirstName, string LastName, bool IsUsernameVisiable)
    {
        SessionValue _objSessionValue = new SessionValue(UserID, UserName, FirstName, LastName,"",1,"", IsUsernameVisiable);

            TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;
            stateManager.Add("objSessionvalueAdmin", _objSessionValue, StateManager.State.Session);
    }
示例#2
0
    public void GetSessionKeyValues()
    {
        UsersController _controller1 = new UsersController();
        //List<SessionValue> _objSession = new List<SessionValue>();
        List<SessionValue> _objSession = _controller1.GetSessionValuesDetails(Session.SessionID);
        TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;

        SessionValue objVal = new SessionValue();

        if (_objSession.Count > 0)
        {
            foreach (SessionValue obj in _objSession)
            {
                if (obj.SessionKey == "UserId")
                    objVal.UserId = Convert.ToInt32(obj.SessionValues);

                if (obj.SessionKey == "UserName")
                    objVal.UserName = obj.SessionValues;

                if (obj.SessionKey == "Email")
                    objVal.UserEmail = obj.SessionValues;

                if (obj.SessionKey == "FirstName")
                    objVal.FirstName = obj.SessionValues;

                if (obj.SessionKey == "LastName")
                    objVal.LastName = obj.SessionValues;

                if (obj.SessionKey == "UserType")
                    objVal.UserType = Convert.ToInt32(obj.SessionValues);

                if (obj.SessionKey == "UserTypeDescription")
                    objVal.UserTypeDescription = obj.SessionValues;

                if (obj.SessionKey == "IsUsernameVisiable")
                    objVal.IsUsernameVisiable = Convert.ToBoolean(obj.SessionValues);

                // Added by Rupendra to get User image

                if (obj.SessionKey == "UserImage")
                    objVal.UserImage = obj.SessionValues;

                // Added by Varun on 25 Jan 2013 for NoRedirection functionality
                if (obj.SessionKey == "NoRedirection")
                {
                    bool val;
                    objVal.NoRedirection = bool.TryParse(obj.SessionValues, out val);
                }
            }

            stateManager.Add("objSessionValue", objVal, StateManager.State.Session);
        }
    }
    protected void doFacebookSignup()
    {
        var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken);
        var me = (IDictionary<string, object>)fbwc.Get("me");
        string fbName = (string)me["first_name"] + " " + (string)me["last_name"];
        string UserName = fbName.ToLower().Replace(" ", "_").Replace("'", "");/*+
            "_"+_FacebookUid.ToString()*/

        string fql = "Select current_location,pic_square,email from user where uid = " + (string)me["id"];
        JsonArray me2 = (JsonArray)fbwc.Query(fql);
        var mm = (IDictionary<string, object>)me2[0];

        Nullable<int> state = null;
        Nullable<int> country = null;
        string _UserImage = "images/bg_ProfilePhoto.gif";

        if (!string.IsNullOrEmpty((string)mm["pic_square"]))
        {
            _UserImage = (string)mm["pic_square"]; // get user image
        }
        string city = "";
        JsonObject hl = (JsonObject)mm["current_location"];
        if ((string)hl[0] != null)
        {
            city = (string)hl[0];
            UserManager usrmngr = new UserManager();
            object[] param = { (string)hl[2],(string)hl[1] };
            if (usrmngr.GetstateIdByName(param) > 0)
            {
                state = usrmngr.GetstateIdByName(param);
            }
            if (usrmngr.GetCountryIdByName((string)hl[2]) > 0)
            {
                country = usrmngr.GetCountryIdByName((string)hl[2]);
            }

        }

        string password_ = string.Empty;
        string email_ = string.Empty;  //user.proxied_email;
        string result = (string)mm["email"];
        if (!string.IsNullOrEmpty(result))
        {
            email_ = result;
            password_ = RandomPassword.Generate(8, 10);
            password_ = TributePortalSecurity.Security.EncryptSymmetric(password_);

        }
        UserRegistration objUserReg = new UserRegistration();
        TributesPortal.BusinessEntities.Users objUsers =
            new TributesPortal.BusinessEntities.Users(
             UserName, password_,
             (string)me["first_name"], (string)me["last_name"], email_,
             "", false,
             city, state, country, 1, _FacebookUid);
        objUsers.UserImage = _UserImage;
        objUserReg.Users = objUsers;

        /*System.Decimal identity = (System.Decimal)*/
        UserInfoManager umgr = new UserInfoManager();
        umgr.SavePersonalAccount(objUserReg);

        if (objUserReg.CustomError != null)
        {
            messageText.Text=string.Format("<h2>Sorry, {0}.</h2>" +
                "<h3>Those Facebook credentials are already used in some other Your Tribute Account</h3>",
                fbName);
        }
        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);
            TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
            stateManager.Add("objSessionvalue", _objSessionValue, TributesPortal.Utilities.StateManager.State.Session);

            SaveSessionInDB();
            Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID));
            Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain;

            showDialog.Text = "false";
            refreshPage.Text = "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());
        }
    }
    /// <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;
        }
    }
    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
                }
            }
        }
    }
    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);
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //this.Form.Action = Request.RawUrl;
        System.Diagnostics.Debug.WriteLine("In Tribute/Home -- Page_Load");
         //code for YT Mobile redirections
        string redirctMobileUrl = string.Empty;
        if (!IsPostBack)
        {
            System.Diagnostics.Debug.WriteLine("In Tribute/Home -- Postback");

            DeviceManager deviceManager = new DeviceManager
            {
                UserAgent = Request.UserAgent,
                IsMobileBrowser = Request.Browser.IsMobileDevice
            };

            // Added by Varun Goel on 25 Jan 2013 for NoRedirection functionality
            TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;

            objSessionValue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session);
            System.Diagnostics.Debug.WriteLine("In Tribute/Home -- Validating");
            if (objSessionValue != null)
                System.Diagnostics.Debug.WriteLine("In Tribute/Home -- Validating redirection:"+ objSessionValue.NoRedirection);
            if (objSessionValue == null || objSessionValue.NoRedirection == null || objSessionValue.NoRedirection == false)
            {
                System.Diagnostics.Debug.WriteLine("In Tribute/Home -- After validation inside if for redirection");
                if (deviceManager.IsMobileDevice())
                {
                    // Redirection URL
                    redirctMobileUrl = string.Format("{0}{1}{2}", "https://www.", WebConfig.TopLevelDomain, "/mobile/Search.html");
                    Response.Redirect(redirctMobileUrl, false);
                }
            }
        }
        if (string.IsNullOrEmpty(redirctMobileUrl))
        {

            // Added by Ashu on Oct 11, 2011
            if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments")
            {
                YT2.Attributes["class"] = "blue";
                YT4.Attributes["class"] = "blue";
                // YT5.Attributes["class"] = "";
                YMDiv.Attributes.Add("style", "display:block");
                YTDiv.Attributes.Add("style", "display:none");
                CreateBtn.Attributes["class"] = "actionbuttonBlue";
                YMSlider.Attributes.Add("style", "display:block");
                YTSlider.Attributes.Add("style", "display:none");
                Bottombackground.Attributes.Add("style", "display:block;");
                YTAnnouncement.Attributes.Add("style", "display:none;");
                YT11.InnerHtml = @"Create your own Website for free!";
                HomeTitle.InnerHtml = @"Your Moments Event Websites – Celebrate a wedding, baby, anniversary or other significant
        event.";
            if (TributesPortal.Utilities.WebConfig.TopLevelDomain.ToLower().Contains(".in"))
                LinkOtherDomain = "http://www.yourtribute.in";
            else
                LinkOtherDomain = "http://www.yourtribute.com";

        }
        else if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourtribute")
        {
            HomeTitle.InnerHtml = @"Your Tribute - Free Online Obituaries & Premium Memorial Websites";
            YT2.Attributes["class"] = "Purple-MT";
            YT4.Attributes["class"] = "Gray-MT";
           // YT5.Attributes["class"] = "Gray-MT";
            bButtons.Attributes["class"] = "bigButtons-MT";
            YMDiv.Attributes.Add("style", "display:none");
            YTDiv.Attributes.Add("style", "display:block");
            CreateBtn.Attributes["class"] = "actionbuttonPurple";
            YMSlider.Attributes.Add("style", "display:none");
            YTSlider.Attributes.Add("style", "display:block");
            Bottombackground.Attributes.Add("style", "display:none;");
            YTAnnouncement.Attributes.Add("style", "display:block;");
            if (TributesPortal.Utilities.WebConfig.TopLevelDomain.ToLower().Contains(".in"))
                LinkOtherDomain = "http://www.yourtribute.in";
            else
                LinkOtherDomain = "http://www.yourtribute.com";
        }

        //        Session["Site"] = "Moment";
        //        if (Session["Site"] != null)
        //        {
        //            if (Session["Site"].ToString() == "Moment")
        //            {
        //                YTTile.InnerHtml = @"Your Moments Event Websites – Celebrate a wedding, baby or other significant
        //                                   event.";
        //                YT1.InnerHtml = "Your Moments";
        //                YT2.InnerHtml = "What is Your Moment?";
        //                YT3.InnerHtml=@" A web-based tool, that lets you set up a personal website to plan, share
        //                                and remember a significant event or special someone. A Website can be created in
        //                                minutes, but remains online for life to provide an everlasting record of the special
        //                                occasion.";
        //                YT4.InnerHtml = "Why Your Moments?";
        //                YT5.InnerHtml= @"It is easy and elegant. Create a personalized Website for your event in minutes.
        //                                Your Moments includes many of the features of popular online invitation, photo sharing,blogging,
        //                                and social networking websites, in an easy-to-use intuitive interface.";
        //                YT6.InnerHtml = @"Choose from our collection of themes created by our top designers. Multiple themes
        //                                are available for each website type with more added all the time!";
        //                YT7.InnerHtml = @" One-step login using your Facebook account. Invite Facebook friends to your website
        //                                and events and easily publish to your wall in one click.";
        //                YT8.InnerHtml = @"We don’t think you should have to keep paying to keep your important event online.
        //                                Your Moments and all of its content will remain online for life, we guarantee it!";
        //                YT9.InnerHtml = @"Celebrate a significant event or a special someone with Your Moments.";
        //                YT10.InnerHtml = @"Website";
        //                YT11.InnerHtml = @"Create your own Website for free!";
        //                YT12.InnerHtml = "Your Moments";
        //                YT13.InnerHtml = @" Create a personal website  for your significant event in minutes. Send
        //                                    stylish online invitations with RSVP. Add photos and videos and let your friends
        //                                    and family do the same. Receive personal messages in your guestbook as well as virtual
        //                                    gifts. Plus many more easy-to-use features!";
        //                YT14.InnerHtml = @"Create a personal website for your new baby in minutes. Send beautiful
        //                                                online baby anouncements. Share stories and add photos and videos from before and
        //                                                after the birth. Receive personal messages in your guestbook. Plus much more!";
        //                YT15.InnerHtml = "New Baby Website:";
        //                YT16.InnerHtml = @" Create a personal website for your graduation in minutes. Send beautiful
        //                                                grad invites. Add photos from before and after the event. Receive personal messages
        //                                                in your guestbook and virtual gifts. Plus many more easy-to-use features!";
        //                YT17.InnerHtml = "Graduation Website:";
        //                YT18.InnerHtml = @" Create a personal website for your wedding in minutes. Send beautiful
        //                                                online invitations with RSVP. Add photos from before and after the wedding and let
        //                                                your guests do the same. Receive personal messages in your guestbook. Plus much
        //                                                more!";
        //                YT19.InnerHtml = "Wedding Website:";
        //                YT20.InnerHtml=@" Create a personal website for your birthday in minutes. Send stylish
        //                                    online birthday invitations with RSVP. Add photos from before and after the event
        //                                    and let your friends do the same. Receive messages in your guestbook, virtual gifts,
        //                                    and more!";
        //                YT21.InnerHtml = "Birthday Tribute:";
        //                YT22.InnerHtml = @"Create a personal website for your loved one in minutes. Share their
        //                                                story. Send stylish online thank you cards. Add photos and videos and let friends
        //                                                and family do the same. Receive personal messages in the guestbook and much more!";
        //                YT23.InnerHtml = " Memorial Website:";
        //                YT24.InnerHtml = @" Create a personal website (a Tribute) for your anniversary in minutes. Send stylish
        //                                                online invitations. Add photos and videos from before and after the event. Receive
        //                                                personal messages in the guestbook and virtual gifts. Plus many more easy-to-use
        //                                                features!";
        //                YT25.InnerHtml = " Anniversary Tribute:";

        //                lnkCreateBtn.HRef = Session["APP_BASE_DOMAIN"].ToString() + "pricing.aspx";
        //                lnkCreateBtn.Attributes["class"] = "MomentleftBigButton";

        //            }
        //            else
        //            {
        //                YTTile.InnerHtml = @"Your Tribute Event Websites – Celebrate a wedding, baby, memorial or other significant
        //                                     event.";
        //                YT1.InnerHtml = "Your Tribute";
        //                YT2.InnerHtml = "What is Your Tribute?";
        //                YT3.InnerHtml = @" A web-based tool, that lets you set up a personal website (a Tribute) to plan, share
        //                            and remember a significant event or special someone. A Tribute can be created in
        //                            minutes, but remains online for life to provide an everlasting record of the special
        //                            occasion.";
        //                YT4.InnerHtml = "Why Your Tribute?";
        //                YT5.InnerHtml = @"It is easy and elegant. Create a personalized Tribute for your event in minutes.
        //                            Your Tribute includes many of the features of popular online invitation, photo sharing,
        //                            blogging, and social networking websites, in an easy-to-use intuitive interface.";
        //                YT6.InnerHtml=@"Choose from our collection of themes created by our top designers. Multiple themes
        //                                are available for each tribute type with more added all the time!";
        //                YT7.InnerHtml = @" One-step login using your Facebook account. Invite Facebook friends to your tribute
        //                                and events and easily publish to your wall in one click.";
        //                YT8.InnerHtml = @"We don’t think you should have to keep paying to keep your important event online.
        //                                Your Tribute and all of its content will remain online for life, we guarantee it!";
        //                YT9.InnerHtml = @"Celebrate a significant event or a special someone with Your Tribute.";
        //                YT10.InnerHtml = "Tributes";
        //                YT11.InnerHtml = @"Create your own Tribute for free!";
        //                YT12.InnerHtml = "Your Tribute";
        //                YT13.InnerHtml = @" Create a personal website (a Tribute) for your significant event in minutes. Send
        //                                    stylish online invitations with RSVP. Add photos and videos and let your friends
        //                                    and family do the same. Receive personal messages in your guestbook as well as virtual
        //                                    gifts. Plus many more easy-to-use features!";
        //                YT14.InnerHtml = @"Create a personal website (a Tribute) for your new baby in minutes. Send beautiful
        //                                   online baby anouncements. Share stories and add photos and videos from before and
        //                                   after the birth. Receive personal messages in your guestbook. Plus much more!";
        //                YT15.InnerHtml="New Baby Tribute:";
        //                YT16.InnerHtml = @" Create a personal website (a Tribute) for your graduation in minutes. Send beautiful
        //                                    grad invites. Add photos from before and after the event. Receive personal messages
        //                                    in your guestbook and virtual gifts. Plus many more easy-to-use features!";
        //                YT17.InnerHtml = "Graduation Tribute:";
        //                YT18.InnerHtml = @" Create a personal website (a Tribute) for your wedding in minutes. Send beautiful
        //                                    online invitations with RSVP. Add photos from before and after the wedding and let
        //                                    your guests do the same. Receive personal messages in your guestbook. Plus much
        //                                    more!";
        //                YT19.InnerHtml = "Wedding Tribute:";
        //                YT20.InnerHtml = @" Create a personal website (a Tribute) for your birthday in minutes. Send stylish
        //                                    online birthday invitations with RSVP. Add photos from before and after the event
        //                                    and let your friends do the same. Receive messages in your guestbook, virtual gifts,
        //                                    and more!";
        //                YT21.InnerHtml = "Birthday Tribute:";
        //                YT22.InnerHtml = @"Create a personal website (a Tribute) for your loved one in minutes. Share their
        //                                    story. Send stylish online thank you cards. Add photos and videos and let friends
        //                                    and family do the same. Receive personal messages in the guestbook and much more!";
        //                YT23.InnerHtml = " Memorial Tribute:";
        //                YT24.InnerHtml = @" Create a personal website (a Tribute) for your anniversary in minutes. Send stylish
        //                                                online invitations. Add photos and videos from before and after the event. Receive
        //                                                personal messages in the guestbook and virtual gifts. Plus many more easy-to-use
        //                                                features!";
        //                YT25.InnerHtml = " Anniversary Tribute:";

            //                lnkCreateBtn.HRef= Session["APP_BASE_DOMAIN"].ToString() + "pricing.aspx";
            //                lnkCreateBtn.Attributes["class"]="leftBigButton";
            //            }
            //        }
        }

        else
        {
            Response.Redirect(redirctMobileUrl, false);
        }
    }
 /// <summary>
 /// Method to get values from session
 /// </summary>
 private void GetSessionValues()
 {
     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.UserName;
     }
     else if (Equals(objSessionValue, null) || _userId == 0)
     {
         //Response.Redirect("log_in.aspx");
         Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()));
     }
 }
    /// <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;

            _CompleteGuestList = (IList<CompleteGuestList>)objStateManager.Get("CompleteGuestList", StateManager.State.Session);
            _MealOptions = (string)objStateManager.Get("MealOptions", StateManager.State.Session);

            //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;
            }
            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 (Request.QueryString["TributeURL"] != null)
                    _TributeUrl = Request.QueryString["TributeURL"].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;
                //_isPrivate = objTribute.IsPrivate;
                //_IsAskForMeal = objTribute .
            }

            if (Request.QueryString["TributeId"] != null)
            {
                _TributeId = int.Parse(Request.QueryString["TributeId"].ToString());
            }
            if (Request.QueryString["EventId"] != null)
            {
                _EventId = int.Parse(Request.QueryString["EventId"].ToString());
                Session["EventIdForEdit"] = _EventId;
            }
            if (Request.QueryString["Hashcode"] != null)
            {
                _Hashcode = Request.QueryString["Hashcode"].ToString();
            }

            if ((_TributeId == 0) || ((_EventId == 0)))
            {
                //Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()), false);
                Response.Redirect(WebConfig.AppBaseDomain.ToString() + "Errors/Error404.aspx");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
示例#11
0
    private void PageBase_PreLoad(object sender, EventArgs e)
    {
        // Code added by Varun for NoRedirection functionality - 28 Jan 2013
        SessionValue _objSessionValue = null;

        TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;

        // Validate if Query string contains NoRedirection -- true
        string noRedirection = Convert.ToString(HttpContext.Current.Request.QueryString["NoRedirection"]);

        if (noRedirection != null && noRedirection.ToLower() == "true")
        {
            // Save NoRedirection value in Database
            UsersController _controller = new UsersController();
            _objSessionValue = new SessionValue(true);
            stateManager.Add("objSessionvalue", _objSessionValue, StateManager.State.Session);
            _controller.SessionStore(_objSessionValue, HttpContext.Current.Session.SessionID);
        }
    }
    protected void repRSVP_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            DropDownList ddlMealOption = (DropDownList)e.Item.FindControl("ddlMealOption");
            ddlMealOption.Items.Clear();
            if (_MealOptions != null && _MealOptions.Length > 0)
            {
                foreach (string item in _MealOptions.Split('#'))
                {
                    ddlMealOption.Items.Add(item);
                }
                ddlMealOption.Items.Insert(0, new ListItem("Select a meal option:", "0"));
            }
            else
                e.Item.FindControl("trMealOption").Visible = false;

            CompleteGuestList CompleteGuestList = (CompleteGuestList)e.Item.DataItem;

            StateManager objStateManager = StateManager.Instance;
            objSessionValue = (SessionValue)objStateManager.Get(PortalEnums.SessionValueEnum.objSessionvalue.ToString(), StateManager.State.Session);
            if (CompleteGuestList != null)
            {
                ((TextBox)e.Item.FindControl("txtFirstName")).Text = CompleteGuestList.FirstName;
                ((TextBox)e.Item.FindControl("txtLastName")).Text = CompleteGuestList.LastName;
                ((TextBox)e.Item.FindControl("txtPhoneNumber")).Text = CompleteGuestList.PhoneNumber;
                ((TextBox)e.Item.FindControl("txtEmail")).Text = CompleteGuestList.Email;

                if (ddlMealOption.Items.Count > 0)
                {
                    if (ddlMealOption.Items.FindByText(CompleteGuestList.MealOption) != null)
                        ddlMealOption.Items.FindByText(CompleteGuestList.MealOption).Selected = true;
                }

                if (CompleteGuestList.RsvpStatus == "Attending")
                    ((RadioButtonList)e.Item.FindControl("rblRSVP")).SelectedIndex = 0;
                if (CompleteGuestList.RsvpStatus == "Maybe Attending")
                    ((RadioButtonList)e.Item.FindControl("rblRSVP")).SelectedIndex = 1;
                if (CompleteGuestList.RsvpStatus == "Not Attending")
                    ((RadioButtonList)e.Item.FindControl("rblRSVP")).SelectedIndex = 1;

                txtComment.Text = CompleteGuestList.Comment;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "Contact Your " + ConfigurationManager.AppSettings["ApplicationWord"].ToString();
        if (!this.IsPostBack)
        {
            //code for YT Mobile redirections
            string redirctMobileUrl = string.Empty;

            DeviceManager deviceManager = new DeviceManager
            {
                UserAgent = Request.UserAgent,
                IsMobileBrowser = Request.Browser.IsMobileDevice
            };

            // Added by Varun Goel on 25 Jan 2013 for NoRedirection functionality
            TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;

            objSessionValue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session);
            if (objSessionValue == null || objSessionValue.NoRedirection == null || objSessionValue.NoRedirection == false)
            {
                if (deviceManager.IsMobileDevice())
                {
                    // Redirection URL
                    redirctMobileUrl = string.Format("{0}{1}{2}", "https://www.", WebConfig.TopLevelDomain, "/mobile/ContactUs.html");
                    Response.Redirect(redirctMobileUrl, false);
                }
            }
        }
    }
    /// <summary>
    /// This function will get the User Detail and Search Parameter from the session
    /// </summary>
    private void GetValuesFromSession()
    {
        try
        {
            Response.Cache.SetExpires(DateTime.Now);

            // Create State manager instance
            StateManager objStateManager = StateManager.Instance;

            // To get user id from session as user is logged in user
            _SessionValue = (SessionValue)objStateManager.Get(PortalEnums.SessionValueEnum.objSessionvalue.ToString(), StateManager.State.Session);
            if (_SessionValue != null)
            {
                _UserId = _SessionValue.UserId;
                _UserName = _SessionValue.UserName;
                //myprofile.Visible = true;
                // To display login and logout option based on the Session value for the user.
                //spanLogout.InnerHtml = "<a href='Logout.aspx'>Log out</a>";
            }
            else
            {
                //myprofile.Visible = false;
                //spanLogout.InnerHtml = "<a href='javascript: void(0);' onclick='doModalLogin();'>Log in</a>";
                //spanLogout.InnerHtml = "<a href='javascript: void(0);' onclick='UserLoginModalpopupFromSubDomain(location.href,document.title);' >Log in</a>";
            }

            // To get current page number, if user clicks on page number in paging it gets the 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["username"] != null)
            {
                _BusinessUserName = Request.QueryString["username"].ToString();
                objStateManager.Add("BusinessUserName", _BusinessUserName, StateManager.State.Session);
                //maindiv.Visible = true;
                //Div1.Visible = false;
                //  SpanTribute.Visible = true;
                //this.Page.Title = "Your Tribute - {" + _BusinessUserName + "}'s Tributes";

            }
            else if (Session["BusinessUserName"] != null)
            {
                _BusinessUserName = Session["BusinessUserName"].ToString();
                //maindiv.Visible = true;
                //Div1.Visible = false;
            }
            else
            {
                SetUserControlsVisibility();
            }

            // To get page size from config file
            _PageSize = (int.Parse(WebConfig.Pagesize_Gift));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    /// <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;
    }
    /// <summary>
    /// Method to get the data from session for Logged in user and selected tribute details.
    /// </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 (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);
            }
        }

        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;
            }

        }
        else 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();

        }
        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_Videos_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;

        //to get video id from querystring
        if (Request.QueryString["videoId"] != null)
        {
            _videoId = int.Parse(Request.QueryString["videoId"].ToString());
            objStateManager.Add("VideoSession", _videoId, StateManager.State.Session);
        }
        else if (objStateManager.Get("VideoSession", StateManager.State.Session) != null)
        {
            _videoId = int.Parse(objStateManager.Get("VideoSession", StateManager.State.Session).ToString());
        }

        //to get value if full view is for video tribute
        if (Request.QueryString["videoType"] != null)
            _videoType = Request.QueryString["videoType"].ToString();
    }
    /// <summary>
    /// This function will get the User Details from the session
    /// </summary>
    private void GetValuesFromSession()
    {
        try
        {
            // Create StateManager instance
            StateManager objStateManager = StateManager.Instance;

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

            if (!Equals(objSessionValue, null))
            {
                _UserID = objSessionValue.UserId;
                _UserName = objSessionValue.UserName;
                //Added by deepak nagar.
                myprofile.Visible = true;
            }
            else
            {
                myprofile.Visible = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void GetSessionValues()
    {
        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 tribute id and name from session
        objTribute = (Tributes)objStateManager.Get("TributeSession", StateManager.State.Session);
        if (!Equals(objTribute, null))
        {
            _tributeId = objTribute.TributeId;
            _tributeName = objTribute.TributeName;
            _tributeType = objTribute.TypeDescription;
            _tributeUrl = objTribute.TributeUrl;
        }

        if (!Equals(Request.QueryString["mode"], null))
        {
            mode = Request.QueryString["mode"].ToString();
            if(objStateManager.Get("NoteSession", StateManager.State.Session)!=null)
                _noteId = int.Parse(objStateManager.Get("NoteSession", StateManager.State.Session).ToString());
        }

        //to check if user is loggedin or is admin
        if (_userId == 0) //if user is not a logged in user redirect to login page
            Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()));
        else if (!UserIsAdmin()) //if user is not admin of tribute redirect to login page
            Response.Redirect(Redirect.RedirectToPage(Redirect.PageList.Inner2LoginPage.ToString()));
    }
    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");
        }
    }
示例#20
0
    protected void lbtnFacebookSignup_Click(object sender, EventArgs e)
    {
        var fbWebContext = FacebookWebContext.Current;
        if (FacebookWebContext.Current.Session != null)
        {
            var fbwc = new FacebookWebClient(FacebookWebContext.Current.AccessToken);
            var me = (IDictionary<string, object>)fbwc.Get("me");
            _FacebookUid = fbWebContext.UserId;
            try
            {
                string fbName = (string)me["first_name"] + " " + (string)me["last_name"];

                string UserName = fbName.ToLower().Replace(" ", "_").Replace("'", "");/*+
                    "_"+_FacebookUid.ToString()*/

                Nullable<int> state = null;
                Nullable<int> country = null;
                string _UserImage = "images/bg_ProfilePhoto.gif";
                //if (!string.IsNullOrEmpty(user.pic_square))
                string fql = "Select current_location,pic_square,email from user where uid = " + fbWebContext.UserId;
                JsonArray me2 = (JsonArray)fbwc.Query(fql);
                var mm = (IDictionary<string, object>)me2[0];

                if (!string.IsNullOrEmpty((string)mm["pic_square"]))
                {
                    _UserImage = (string)mm["pic_square"]; // get user image
                }

                string city = "";
                if ((JsonObject)mm["current_location"] != null)
                {
                    JsonObject hl = (JsonObject)mm["current_location"];
                    city = (string)hl[0];

                    if (_presenter.GetFacebookStateId((string)hl[2], (string)hl[1]) > 0)
                    {
                        state = _presenter.GetFacebookStateId((string)hl[2], (string)hl[1]);
                    }
                    if (_presenter.GetFacebookCountryId((string)hl[2]) > 0)
                    {
                        country = _presenter.GetFacebookCountryId((string)hl[2]);
                    }

                }

                string password_ = string.Empty;
                _FBEmail = string.Empty;  //user.proxied_email;

                string result = (string)mm["email"];
                if (!string.IsNullOrEmpty(result))
                {

                    _FBEmail = result;
                    password_ = RandomPassword.Generate(8, 10);
                    password_ = TributePortalSecurity.Security.EncryptSymmetric(password_);

                }

                int _email = _presenter.EmailAvailable();
                if (_email == 0)
                {

                    UserRegistration objUserReg = new UserRegistration();
                    TributesPortal.BusinessEntities.Users objUsers =
                        new TributesPortal.BusinessEntities.Users(
                         UserName, password_,
                         (string)me["first_name"], (string)me["last_name"], _FBEmail,
                         "", false,
                         city, state, country, 1, _FacebookUid, ApplicationType);
                    objUsers.UserImage = _UserImage;
                    // objUsers.ApplicationType = ApplicationType;
                    objUserReg.Users = objUsers;

                    /*System.Decimal identity = (System.Decimal)*/
                    _presenter.DoShortFacebookSignup(objUserReg);

                    if (objUserReg.CustomError != null)
                    {
                        ShowMessage(string.Format("<h2>Sorry, {0}.</h2>" +
                            "<h3>Those Facebook credentials are already used in some other Your Tribute Account</h3>", fbName), "", 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);
                        TributesPortal.Utilities.StateManager stateManager = TributesPortal.Utilities.StateManager.Instance;
                        stateManager.Add("objSessionvalue", _objSessionValue, TributesPortal.Utilities.StateManager.State.Session);

                        SaveSessionInDB();
                        Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", Session.SessionID));
                        Response.Cookies["ASP.NET_SessionId"].Domain = "." + WebConfig.TopLevelDomain;
                        RedirectPage();
                        return;
                    }
                }
                else
                {
                    ShowMessage(headertext, "User already exists for this email: " + _FBEmail, true);//COMDIFFRES: is this message correct?
                    _showSignUpDialog = "false";
                }

            }
            catch (Exception ex)
            {
                ShowMessage(headertext, ex.Message, true);
                _showSignUpDialog = "false";
                // killFacebookCookies();
                // ShowMessage("Your Facebook session has timed out. Please logout and try again");
            }

        }
    }
    /// <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;
        }
    }
示例#22
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;
        }
    }
示例#23
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);
                    }

                }
            }
        }
    }
    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);
        }
    }
示例#25
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);
            }
        }
    private void GetSessionValues()
    {
        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 (String.IsNullOrEmpty(objSessionValue.ToString()))
        {
            LogError("GetSessionValues", "User session is null");
        }
        if (!Equals(objSessionValue, null))
        {
            _userId = objSessionValue.UserId;

        }
        if (!Equals(Request.QueryString["mode"], null))
        {
            _mode = Request.QueryString["mode"].ToString();
            _photoAlbumId = int.Parse(Request.QueryString["photoAlbumId"].ToString());
            hdnAlbumId.Value = _photoAlbumId.ToString();
        }
        else
            hdnAlbumId.Value = string.Empty;

        //to get photo album name from session
        if (objStateManager.Get("PhotoAlbumName", StateManager.State.Session) != null)
            _photoAlbumName = objStateManager.Get("PhotoAlbumName", StateManager.State.Session).ToString();
        else
            _photoAlbumName = string.Empty;
        //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()));
        }

        if (!Equals(Request.QueryString["result"], null))
            _result = Request.QueryString["result"].ToString();
    }
 private void SetSessionValue(GenralUserInfo _objGenralUserInfo)
 {
     SessionValue _objSessionValue = new SessionValue(_objGenralUserInfo.RecentUsers.UserID,
                                                            _objGenralUserInfo.RecentUsers.UserName,
                                                            _objGenralUserInfo.RecentUsers.FirstName,
                                                            _objGenralUserInfo.RecentUsers.LastName,
                                                            _objGenralUserInfo.RecentUsers.UserEmail,
                                                            int.Parse(_objGenralUserInfo.RecentUsers.UserType),
                                                            _objGenralUserInfo.RecentUsers.UserTypeDescription,
                                                            _objGenralUserInfo.RecentUsers.IsUsernameVisiable
                                                            );
     TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;
     stateManager.Add("objSessionvalue", _objSessionValue, StateManager.State.Session);
 }
    /// <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 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;
        }
    }
示例#30
-1
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //code for YT Mobile redirections
            string redirctMobileUrl = string.Empty;

            DeviceManager deviceManager = new DeviceManager
            {
                UserAgent = Request.UserAgent,
                IsMobileBrowser = Request.Browser.IsMobileDevice
            };

            // Added by Varun Goel on 25 Jan 2013 for NoRedirection functionality
            TributesPortal.Utilities.StateManager stateManager = StateManager.Instance;

            objSessionValue = (SessionValue)stateManager.Get("objSessionvalue", StateManager.State.Session);
            if (objSessionValue == null || objSessionValue.NoRedirection == null || objSessionValue.NoRedirection == false)
            {
                if (deviceManager.IsMobileDevice())
                {
                    // Redirection URL
                    redirctMobileUrl = string.Format("{0}{1}{2}", "https://www.", WebConfig.TopLevelDomain, "/mobile/Tour.html");
                    Response.Redirect(redirctMobileUrl, false);
                }
            }

        }
        if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourmoments")
        {
            yourtribute.Visible = false;
            yourmoments.Visible = true;
            tourTitle.InnerHtml=@"Tour - See how to create a Website for your significant event";
        }
        else if (ConfigurationManager.AppSettings["ApplicationType"].ToString().ToLower() == "yourtribute")
        {
            yourtribute.Visible = true;
            yourmoments.Visible = false;
        }
    }