示例#1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            isEntity.Value = Request.QueryString["isEntity"];
            cardID         = TranslateUtils.ToInt(Request.QueryString["cardID"]);

            if (!string.IsNullOrEmpty(Request.QueryString["Delete"]))
            {
                var list = TranslateUtils.StringCollectionToIntList(Request.QueryString["IDCollection"]);
                if (list.Count > 0)
                {
                    try
                    {
                        DataProviderWX.CardSNDAO.Delete(PublishmentSystemID, list);

                        SuccessMessage("会员卡删除成功!");
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "会员卡删除失败!");
                    }
                }
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = 20;
            spContents.ConnectionString  = BaiRongDataProvider.ConnectionString;
            spContents.SelectCommand     = DataProviderWX.CardSNDAO.GetSelectString(PublishmentSystemID, TranslateUtils.ToInt(Request.QueryString["cardID"]), Request.QueryString["cardSN"], Request.QueryString["userName"], Request.QueryString["mobile"]);
            spContents.SortField         = CardSNAttribute.AddDate;
            spContents.SortMode          = SortMode.DESC;
            rptContents.ItemDataBound   += new RepeaterItemEventHandler(rptContents_ItemDataBound);

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Card, "会员卡管理", AppManager.WeiXin.Permission.WebSite.Card);
                spContents.DataBind();

                tbCardSN.Text   = Request.QueryString["cardSN"];
                tbUserName.Text = Request.QueryString["userName"];
                tbMobile.Text   = Request.QueryString["mobile"];

                var urlAdd = BackgroundCardSNAdd.GetRedirectUrl(PublishmentSystemID, cardID);
                btnAdd.Attributes.Add("onclick", $"location.href='{urlAdd}';return false");

                btnStatus.Attributes.Add("onclick", Modal.CardSNSetting.GetOpenWindowString(PublishmentSystemID, cardID, TranslateUtils.ToBool(isEntity.Value)));
                btnExport.Attributes.Add("onclick", Modal.ExportCardSN.GetOpenWindowString(PublishmentSystemID, cardID));
                var urlDelete = PageUtils.AddQueryString(GetRedirectUrl(PublishmentSystemID, cardID, tbCardSN.Text, tbUserName.Text, tbMobile.Text, TranslateUtils.ToBool(isEntity.Value)), "Delete", "True");
                btnDelete.Attributes.Add("onclick", JsUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的会员卡", "此操作将删除所选会员卡,确认吗?"));

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

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

            if (!IsPostBack)
            {
                var pageTitle = cardID > 0 ? "编辑会员卡" : "添加会员卡";
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_Card, pageTitle, AppManager.WeiXin.Permission.WebSite.Card);
                ltlPageTitle.Text = pageTitle;

                ltlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{CardManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                ltlContentFrontImageUrl.Text =
                    $@"<img id=""preview_contentFrontImageUrl"" src=""{CardManager.GetContentFrontImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                ltlContentBackImageUrl.Text =
                    $@"<img id=""preview_contentBackImageUrl"" src=""{CardManager.GetContentBackImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";

                if (cardID > 0)
                {
                    var cardInfo = DataProviderWX.CardDAO.GetCardInfo(cardID);

                    tbKeywords.Text     = DataProviderWX.KeywordDAO.GetKeywords(cardInfo.KeywordID);
                    cbIsEnabled.Checked = !cardInfo.IsDisabled;
                    tbTitle.Text        = cardInfo.Title;
                    if (!string.IsNullOrEmpty(cardInfo.ImageUrl))
                    {
                        ltlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, cardInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    if (!string.IsNullOrEmpty(cardInfo.ContentFrontImageUrl))
                    {
                        ltlContentFrontImageUrl.Text =
                            $@"<img id=""preview_contentFrontImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, cardInfo.ContentFrontImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    if (!string.IsNullOrEmpty(cardInfo.ContentBackImageUrl))
                    {
                        ltlContentBackImageUrl.Text =
                            $@"<img id=""preview_contentBackImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, cardInfo.ContentBackImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    tbSummary.Text = cardInfo.Summary;

                    tbCardTitle.Text      = cardInfo.CardTitle;
                    tbCardTitleColor.Text = cardInfo.CardTitleColor;
                    tbCardSNColor.Text    = cardInfo.CardNoColor;

                    tbShopName.Text = cardInfo.ShopName;
                    if (!string.IsNullOrEmpty(cardInfo.ShopPosition))
                    {
                        shopPosition.Value = cardInfo.ShopPosition;
                    }
                    if (!string.IsNullOrEmpty(cardInfo.ShopAddress))
                    {
                        tbShopAddress.Text = cardInfo.ShopAddress;
                        ltlMap.Text        =
                            $@"<iframe style=""width:100%;height:100%;background-color:#ffffff;margin-bottom:15px;"" scrolling=""auto"" frameborder=""0"" width=""100%"" height=""100%"" src=""{MapManager
                                .GetMapUrl(cardInfo.ShopAddress)}""></iframe>";
                    }
                    tbShopTel.Text      = cardInfo.ShopTel;
                    tbShopPassword.Text = cardInfo.ShopPassword;

                    imageUrl.Value             = cardInfo.ImageUrl;
                    contentFrontImageUrl.Value = cardInfo.ContentFrontImageUrl;
                    contentBackImageUrl.Value  = cardInfo.ContentBackImageUrl;
                }

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