예제 #1
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);
                    }

                }
            }
        }
    }