예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserPageBase pageBase = (UserPageBase)Page;
        Collective.User user = pageBase.GetLoggedCollectiveUser();

        if(user == null)
            Response.Redirect(Page.ResolveUrl("~/default.aspx"));

        int coupId;
        if(Int32.TryParse(Request.QueryString["coupid"], out coupId))
        {
            _coup = Collective.Coupon.GetCouponForClient(coupId, PutovalicaUtil.GetLanguageId());

            if(user.Id != _coup.UserId)
                Response.Redirect(Page.ResolveUrl("~/default.aspx"));

            _offer = Collective.Offer.GetOffer(_coup.CollectiveOfferId, PutovalicaUtil.GetLanguageId());

            if (_offer.AgencyId.HasValue)
            {
                _agency = Collective.Agency.GetAgency(_offer.AgencyId.Value);
            }

            phAgency.Visible = _agency != null;
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            UserPageBase pageBase = (UserPageBase)Page;
            currOffer = pageBase.GetCurrentOffer();

            if (currOffer == null)
                Response.Redirect(Page.ResolveUrl("~/Default.aspx"));

            this.phGMapsIframe.Visible = currOffer.Longitude.HasValue && currOffer.Latitude.HasValue;

            this.phAgencyInfo.Visible = false;

            if (currOffer.AgencyId.HasValue)
            {
                this.offerAgency = Collective.Agency.GetAgency(currOffer.AgencyId.Value);
                if (this.offerAgency != null)
                {
                    this.phAgencyInfo.Visible = true;
                    string contactLine = !String.IsNullOrEmpty(this.offerAgency.ContactPhone) ? this.offerAgency.ContactPhone : string.Empty;
                    if (!String.IsNullOrEmpty(offerAgency.ContactEmail))
                    {
                        contactLine += !String.IsNullOrEmpty(contactLine) ? ", " : string.Empty;
                        contactLine += offerAgency.ContactEmail;
                    }

                    this.ltContact.Text = contactLine;
                }
            }

            isOfferSuccess = currOffer.BoughtCount >= currOffer.MinBoughtCount;
        }
        else
        {
            this.Visible = false;
            return;
        }
    }