Ejemplo n.º 1
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var actInfo = new CouponActInfo(e.Item.DataItem);

                var ltlItemIndex  = e.Item.FindControl("ltlItemIndex") as Literal;
                var ltlTitle      = e.Item.FindControl("ltlTitle") as Literal;
                var ltlKeywords   = e.Item.FindControl("ltlKeywords") as Literal;
                var ltlStartDate  = e.Item.FindControl("ltlStartDate") as Literal;
                var ltlEndDate    = e.Item.FindControl("ltlEndDate") as Literal;
                var ltlUserCount  = e.Item.FindControl("ltlUserCount") as Literal;
                var ltlPVCount    = e.Item.FindControl("ltlPVCount") as Literal;
                var ltlIsEnabled  = e.Item.FindControl("ltlIsEnabled") as Literal;
                var ltlCoupons    = e.Item.FindControl("ltlCoupons") as Literal;
                var ltlRelate     = e.Item.FindControl("ltlRelate") as Literal;
                var ltlPreviewUrl = e.Item.FindControl("ltlPreviewUrl") as Literal;
                var ltlEditUrl    = e.Item.FindControl("ltlEditUrl") as Literal;

                ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString();
                ltlTitle.Text     = actInfo.Title;
                ltlKeywords.Text  = DataProviderWX.KeywordDAO.GetKeywords(actInfo.KeywordID);
                ltlStartDate.Text = DateUtils.GetDateAndTimeString(actInfo.StartDate);
                ltlEndDate.Text   = DateUtils.GetDateAndTimeString(actInfo.EndDate);
                ltlUserCount.Text = actInfo.UserCount.ToString();
                ltlPVCount.Text   = actInfo.PVCount.ToString();

                ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!actInfo.IsDisabled);

                var couponInfoList = DataProviderWX.CouponDAO.GetCouponInfoList(PublishmentSystemID, actInfo.ID);
                foreach (var couponInfo in couponInfoList)
                {
                    ltlCoupons.Text +=
                        $@"<a href=""{BackgroundCouponSN.GetRedirectUrl(PublishmentSystemID, couponInfo.ID,
                            GetRedirectUrl(PublishmentSystemID))}"">{couponInfo.Title}</a>&nbsp;&nbsp;" +
                        ",";
                }
                if (ltlCoupons.Text.Length > 0)
                {
                    ltlCoupons.Text = ltlCoupons.Text.Substring(0, ltlCoupons.Text.Length - 1);
                }
                ltlRelate.Text =
                    $@"<a href=""javascript:;"" onclick=""{Modal.CouponRelated.GetOpenWindowString(
                        PublishmentSystemID, actInfo.ID)}"">关联优惠劵</a>";

                if (couponInfoList.Count > 0)
                {
                    var urlPreview = CouponManager.GetCouponHoldUrl(PublishmentSystemInfo, actInfo.ID);
                    urlPreview         = BackgroundPreview.GetRedirectUrlToMobile(urlPreview);
                    ltlPreviewUrl.Text = $@"<a target=""_blank"" href=""{urlPreview}"">预览</a>";
                }

                var urlEdit = BackgroundCouponActAdd.GetRedirectUrl(PublishmentSystemID, actInfo.ID);
                ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>";
            }
        }
Ejemplo n.º 2
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                actTitle = null;

                var couponInfo = new CouponInfo(e.Item.DataItem);

                var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal;
                var ltlTitle     = e.Item.FindControl("ltlTitle") as Literal;
                var ltlActTitle  = e.Item.FindControl("ltlActTitle") as Literal;
                var ltlTotalNum  = e.Item.FindControl("ltlTotalNum") as Literal;
                var ltlHoldNum   = e.Item.FindControl("ltlHoldNum") as Literal;
                var ltlCashNum   = e.Item.FindControl("ltlCashNum") as Literal;
                var ltlAddDate   = e.Item.FindControl("ltlAddDate") as Literal;
                var ltlSN        = e.Item.FindControl("ltlSN") as Literal;
                var ltlEditUrl   = e.Item.FindControl("ltlEditUrl") as Literal;

                ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString();
                ltlTitle.Text     = couponInfo.Title;
                if (couponInfo.ActID > 0 && actTitle == null)
                {
                    actTitle = DataProviderWX.CouponActDAO.GetTitle(couponInfo.ActID);
                }
                if (actTitle != null)
                {
                    ltlActTitle.Text = actTitle;
                }
                ltlTotalNum.Text = couponInfo.TotalNum.ToString();
                ltlHoldNum.Text  = DataProviderWX.CouponSNDAO.GetHoldNum(PublishmentSystemID, couponInfo.ID).ToString();
                ltlCashNum.Text  = DataProviderWX.CouponSNDAO.GetCashNum(PublishmentSystemID, couponInfo.ID).ToString();
                ltlAddDate.Text  = DateUtils.GetDateString(couponInfo.AddDate);

                ltlSN.Text =
                    $@"<a href=""{BackgroundCouponSN.GetRedirectUrl(PublishmentSystemID, couponInfo.ID,
                        GetRedirectUrl(PublishmentSystemID))}"">优惠劵明细</a>";

                var urlEdit = Modal.CouponAdd.GetOpenWindowStringToEdit(PublishmentSystemID, couponInfo.ID);
                ltlEditUrl.Text = $@"<a href=""javascript:;"" onclick=""{urlEdit}"">编辑</a>";
            }
        }