예제 #1
0
    protected void lbtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            MiscellaneousController objMisc = new MiscellaneousController();
            StateManager stateTribute = StateManager.Instance;
            SessionValue objSessvalue = (SessionValue)stateTribute.Get("objSessionvalue", StateManager.State.Session);
            #region TributeNotes
            if (_typeName == "TributeNotes")
            {
                Response.Redirect("~/" + Session["TributeURL"] + "/managenote.aspx", false);

            }
            #endregion
            #region VideoGallery
            else if (_typeName == "VideoGallery")
            {

                Response.Redirect("~/" + Session["TributeURL"] + "/addvideo.aspx", false);

            }
            #endregion
            #region Event
            else if (_typeName == PortalEnums.TributeContentEnum.Event.ToString())
            {

                Response.Redirect("~/" + Session["TributeURL"] + "/manageevent.aspx", false);

            }
            #endregion
            #region EventFullView
            else if (_typeName == PortalEnums.TributeContentEnum.EventFullView.ToString())
            {

                Response.Redirect(Session["APP_BASE_DOMAIN"].ToString() + Session["TributeURL"].ToString() + "/manageevent.aspx" + "?EventID=" + Session["EventIdForEdit"].ToString());


            }
            #endregion
            #region PhotoGallery
            else if (_typeName == "PhotoGallery")
            {
                if (Equals(objSessionValue, null))//when not logged in
                {
                    if (IsCustomHeaderOn)
                        topHeight = 197;
                    else
                        topHeight = 78;
                }
                else
                {
                    if (IsCustomHeaderOn)
                        topHeight = 258;
                    else
                        topHeight = 131;
                }

                bool isAllowedPhotoCheck = false;
                string tributeEndDate = objMisc.GetTributeEndDate(_tributeId);
                DateTime date2 = new DateTime();
                //MG:Expiry Notice
                DateTime dt = new DateTime();
                if (!tributeEndDate.Equals("Never"))
                {
                    if (tributeEndDate.Contains("/"))
                    {
                        string[] date = tributeEndDate.Split('/');
                        date2 = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1]));

                    }
                }
                isAllowedPhotoCheck = objMisc.IsAllowedPhotoCheck(_photoAlbumId);



                if ((_packageId == 6) || (_packageId == 7) || (_packageId == 3) || (_packageId == 8) | ((_packageId == 5) && !isAllowedPhotoCheck && (date2 < DateTime.Now)))
                {
                    int CurrentAlbums = objMisc.GetCurrentPhotoAlbums(_tributeId);
                    if (CurrentAlbums >= (int.Parse(WebConfig.PhotoAlbumLimit)))
                    {
                        if (Equals(objSessionValue, null))//when not logged in
                        {
                            if (IsCustomHeaderOn)
                                topHeight = 197;
                            else
                                topHeight = 78;
                        }
                        else
                        {
                            if (IsCustomHeaderOn)
                                topHeight = 258;
                            else
                                topHeight = 131;
                        }

                        ScriptManager.RegisterStartupScript(Page, this.GetType(), "awe", "fnReachLimitExpiryPopup('location.href','document.title','Photos','" + _tributeUrl + "','" + _tributeId + "','" + appDomian + "','" + topHeight + "');", true);
                    }
                    else
                    {
                        StateManager stateManager = StateManager.Instance;
                        Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                        if (objTrb != null)
                        {

                            if (WebConfig.ApplicationMode.Equals("local"))
                            {
                                Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false);

                            }
                            else
                            {
                                appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby");
                                Response.Redirect(appDomian, false);

                            }

                        }
                    }
                }
                else
                {
                    StateManager stateManager = StateManager.Instance;
                    Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                    if (objTrb != null)
                    {
                        if (WebConfig.ApplicationMode.Equals("local"))
                        {
                            Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false);

                        }
                        else
                        {
                            appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx?albummode=Create&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby");
                            Response.Redirect(appDomian, false);
                        }
                    }
                }
            }
            #endregion
            #region PhotoAlbum
            else if (_typeName == "PhotoAlbum")
            {
                StateManager stateManager = StateManager.Instance;
                Tributes objTrb = (Tributes)stateManager.Get("TributeSession", StateManager.State.Session);
                if (objTrb != null)
                {
                    if (WebConfig.ApplicationMode.Equals("local"))
                    {
                        Response.Redirect("~/" + Session["TributeURL"] + "/managephotoalbum.aspx" + "?mode=addphotos&photoAlbumId=" + _photoAlbumId + "&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby"), false);

                    }
                    else
                    {
                        appDomian = "~/" + Session["TributeURL"] + "/managephotoalbum.aspx" + "?mode=addphotos&photoAlbumId=" + _photoAlbumId + "&Type=" + objTrb.TypeDescription.ToString().ToLower().Replace("new baby", "newbaby");
                        Response.Redirect(appDomian, false);
                    }
                }
            }
            #endregion
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }