Esempio n. 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["Delete"]))
            {
                var list = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (list.Count > 0)
                {
                    try
                    {
                        DataProviderWX.CouponDAO.Delete(list);
                        SuccessMessage("优惠劵删除成功!");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "优惠劵删除失败!");
                    }
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = 30;
            spContents.ConnectionString  = BaiRongDataProvider.ConnectionString;
            spContents.SelectCommand     = DataProviderWX.CouponDAO.GetSelectString(PublishmentSystemID);
            spContents.SortField         = CouponAttribute.ID;
            spContents.SortMode          = SortMode.ASC;
            rptContents.ItemDataBound   += new RepeaterItemEventHandler(rptContents_ItemDataBound);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Coupon, "优惠劵管理", AppManager.WeiXin.Permission.WebSite.Coupon);

                spContents.DataBind();

                btnAdd.Attributes.Add("onclick", Modal.CouponAdd.GetOpenWindowStringToAdd(PublishmentSystemID));

                var urlDelete = PageUtils.AddQueryString(GetRedirectUrl(PublishmentSystemID), "Delete", "True");
                btnDelete.Attributes.Add("onclick", JsUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的优惠劵", "此操作将删除所选优惠劵,确认吗?"));

                btnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{BackgroundCouponAct.GetRedirectUrl(PublishmentSystemID)}"";return false");
            }
        }
Esempio n. 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            actID = TranslateUtils.ToInt(GetQueryString("actID"));

            if (!IsPostBack)
            {
                var pageTitle = actID > 0 ? "编辑优惠劵活动" : "添加优惠劵活动";
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Coupon, pageTitle, AppManager.WeiXin.Permission.WebSite.Coupon);
                ltlPageTitle.Text = pageTitle;

                ltlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{CouponManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                ltlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{CouponManager.GetContentImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                ltlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{CouponManager.GetEndImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                if (actID > 0)
                {
                    var actInfo = DataProviderWX.CouponActDAO.GetActInfo(actID);

                    tbKeywords.Text       = DataProviderWX.KeywordDAO.GetKeywords(actInfo.KeywordID);
                    cbIsEnabled.Checked   = !actInfo.IsDisabled;
                    dtbStartDate.DateTime = actInfo.StartDate;
                    dtbEndDate.DateTime   = actInfo.EndDate;
                    tbTitle.Text          = actInfo.Title;
                    if (!string.IsNullOrEmpty(actInfo.ImageUrl))
                    {
                        ltlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, actInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    tbSummary.Text = actInfo.Summary;
                    if (!string.IsNullOrEmpty(actInfo.ContentImageUrl))
                    {
                        ltlContentImageUrl.Text =
                            $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, actInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    tbContentUsage.Text       = actInfo.ContentUsage;
                    tbContentDescription.Text = actInfo.ContentDescription;
                    tbAwardCode.Text          = actInfo.AwardCode;

                    tbEndTitle.Text   = actInfo.EndTitle;
                    tbEndSummary.Text = actInfo.EndSummary;
                    if (!string.IsNullOrEmpty(actInfo.EndImageUrl))
                    {
                        ltlEndImageUrl.Text =
                            $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, actInfo.EndImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    imageUrl.Value        = actInfo.ImageUrl;
                    contentImageUrl.Value = actInfo.ContentImageUrl;
                    endImageUrl.Value     = actInfo.EndImageUrl;

                    cbIsFormRealName.Checked = actInfo.IsFormRealName;
                    tbFormRealNameTitle.Text = actInfo.FormRealNameTitle;
                    cbIsFormMobile.Checked   = actInfo.IsFormMobile;
                    tbFormMobileTitle.Text   = actInfo.FormMobileTitle;
                    cbIsFormEmail.Checked    = actInfo.IsFormEmail;
                    tbFormEmailTitle.Text    = actInfo.FormEmailTitle;
                    cbIsFormAddress.Checked  = actInfo.IsFormAddress;
                    tbFormAddressTitle.Text  = actInfo.FormAddressTitle;
                }
                else
                {
                    dtbEndDate.DateTime = DateTime.Now.AddMonths(1);
                }

                btnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{BackgroundCouponAct.GetRedirectUrl(PublishmentSystemID)}"";return false");
            }
        }