示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            _pageBase = (UserPageBase)Page;

            if (_pageBase.GetCurrentOffer() == null)
            {
                this.Visible = false;
                return;
            }

            List<Collective.Offer> lstLinkedOffers = Collective.Offer.ListOffersForClient(_pageBase.GetCurrentOffer().CollectiveCategoryId, null, PutovalicaUtil.GetLanguageId(), 3);

            this.rptOtherOffers.DataSource = lstLinkedOffers;
            this.rptOtherOffers.DataBind();
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _pageBase = (UserPageBase)Page;

        _currOffer = _pageBase.GetCurrentOffer();

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

        if (!IsPostBack)
        {
            this.ddlSelCount.Attributes["onChange"] = "changeCount(this)";
            this.ddlSelCount.Attributes["basicPrice"] = _currOffer.Price.ToString().Replace(',', '.');

            int couponsPerUser = _currOffer.NumberOfCouponsPerUser.HasValue ? _currOffer.NumberOfCouponsPerUser.Value : 1;
            for (int i = 0; i < couponsPerUser; ++i)
            {
                this.ddlSelCount.Items.Add(new ListItem((i + 1).ToString(), (i + 1).ToString()));
            }

            if (_pageBase.GetLoggedCollectiveUser() != null)
            {
                _userBoughtCount = _currOffer.GetUserBoughtCount(_pageBase.GetLoggedCollectiveUser().Id);

                StringBuilder sbScript = new StringBuilder();
                sbScript.Append("\n");
                sbScript.Append("var _userBoughtCount=" + _userBoughtCount.ToString() + ";\n");
                sbScript.Append("var _maxBoughtCount=" + (_currOffer.NumberOfCouponsPerUser.HasValue ? _currOffer.NumberOfCouponsPerUser.Value : 1).ToString() + ";\n");
                sbScript.Append("\n");

                Page.ClientScript.RegisterStartupScript(this.GetType(), "startupScript", sbScript.ToString(), true);

                phLoginRegister.Visible = false;
                phBuyForm.Visible = true;
            }
            else
            {
                phLoginRegister.Visible = true;
                phBuyForm.Visible = false;
            }
        }
    }