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

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

            if (!IsPostBack)
            {
                var pageTitle = lotteryID > 0 ? "编辑摇摇乐" : "添加摇摇乐";
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Function, AppManager.WeiXin.LeftMenu.Function.ID_YaoYao, pageTitle, AppManager.WeiXin.Permission.WebSite.YaoYao);
                ltlPageTitle.Text = pageTitle;

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

                if (lotteryID == 0)
                {
                    ltlAwardItems.Text  = "itemController.itemCount = 2;itemController.items = [{}, {}];";
                    dtbEndDate.DateTime = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID);

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

                    tbAwardUsage.Text         = lotteryInfo.AwardUsage;
                    cbIsAwardTotalNum.Checked = lotteryInfo.IsAwardTotalNum;
                    tbAwardMaxCount.Text      = lotteryInfo.AwardMaxCount.ToString();
                    tbAwardMaxDailyCount.Text = lotteryInfo.AwardMaxDailyCount.ToString();
                    tbAwardCode.Text          = lotteryInfo.AwardCode;

                    cbIsFormRealName.Checked = lotteryInfo.IsFormRealName;
                    tbFormRealNameTitle.Text = lotteryInfo.FormRealNameTitle;
                    cbIsFormMobile.Checked   = lotteryInfo.IsFormMobile;
                    tbFormMobileTitle.Text   = lotteryInfo.FormMobileTitle;
                    cbIsFormEmail.Checked    = lotteryInfo.IsFormEmail;
                    tbFormEmailTitle.Text    = lotteryInfo.FormEmailTitle;
                    cbIsFormAddress.Checked  = lotteryInfo.IsFormAddress;
                    tbFormAddressTitle.Text  = lotteryInfo.FormAddressTitle;

                    if (!string.IsNullOrEmpty(lotteryInfo.AwardImageUrl))
                    {
                        ltlAwardImageUrl.Text =
                            $@"<img id=""preview_awardImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, lotteryInfo.AwardImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    var awardInfoList = DataProviderWX.LotteryAwardDAO.GetLotteryAwardInfoList(PublishmentSystemID, lotteryID);
                    var itemBuilder   = new StringBuilder();
                    foreach (var awardInfo in awardInfoList)
                    {
                        itemBuilder.AppendFormat(@"{{id: '{0}', awardName: '{1}', title: '{2}', totalNum: '{3}', probability: '{4}'}},", awardInfo.ID, awardInfo.AwardName, awardInfo.Title, awardInfo.TotalNum, awardInfo.Probability);
                    }
                    if (itemBuilder.Length > 0)
                    {
                        itemBuilder.Length--;
                    }

                    ltlAwardItems.Text = $@"
itemController.itemCount = {awardInfoList.Count};itemController.items = [{itemBuilder.ToString()}];";

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

                    imageUrl.Value        = lotteryInfo.ImageUrl;
                    contentImageUrl.Value = lotteryInfo.ContentImageUrl;
                    awardImageUrl.Value   = lotteryInfo.AwardImageUrl;
                    endImageUrl.Value     = lotteryInfo.EndImageUrl;
                }

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

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _lotteryId = Body.GetQueryInt("lotteryID");

            if (!IsPostBack)
            {
                var pageTitle = _lotteryId > 0 ? "编辑大转盘" : "添加大转盘";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdBigWheel, pageTitle, AppManager.WeiXin.Permission.WebSite.BigWheel);

                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{LotteryManager.GetImageUrl(PublishmentSystemInfo,
                        ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{LotteryManager.GetContentImageUrl(
                        PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentAwardImageUrl.Text =
                    $@"<img id=""preview_contentAwardImageUrl"" src=""{LotteryManager.GetContentAwardImageUrl(
                        PublishmentSystemInfo, ELotteryType.BigWheel, string.Empty, 0)}"" width=""370"" align=""middle"" />";
                LtlAwardImageUrl.Text =
                    $@"<img id=""preview_awardImageUrl"" src=""{LotteryManager.GetAwardImageUrl(PublishmentSystemInfo,
                        ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{LotteryManager.GetEndImageUrl(PublishmentSystemInfo,
                        ELotteryType.BigWheel, string.Empty)}"" width=""370"" align=""middle"" />";

                if (_lotteryId == 0)
                {
                    LtlAwardItems.Text  = "itemController.itemCount = 2;itemController.items = [{}, {}];";
                    DtbEndDate.DateTime = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var lotteryInfo = DataProviderWx.LotteryDao.GetLotteryInfo(_lotteryId);

                    TbKeywords.Text       = DataProviderWx.KeywordDao.GetKeywords(lotteryInfo.KeywordId);
                    CbIsEnabled.Checked   = !lotteryInfo.IsDisabled;
                    DtbStartDate.DateTime = lotteryInfo.StartDate;
                    DtbEndDate.DateTime   = lotteryInfo.EndDate;
                    TbTitle.Text          = lotteryInfo.Title;
                    if (!string.IsNullOrEmpty(lotteryInfo.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, lotteryInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbSummary.Text = lotteryInfo.Summary;
                    if (!string.IsNullOrEmpty(lotteryInfo.ContentImageUrl))
                    {
                        LtlContentImageUrl.Text =
                            $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, lotteryInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbContentUsage.Text = lotteryInfo.ContentUsage;

                    TbAwardUsage.Text         = lotteryInfo.AwardUsage;
                    CbIsAwardTotalNum.Checked = lotteryInfo.IsAwardTotalNum;
                    TbAwardMaxCount.Text      = lotteryInfo.AwardMaxCount.ToString();
                    TbAwardMaxDailyCount.Text = lotteryInfo.AwardMaxDailyCount.ToString();
                    TbAwardCode.Text          = lotteryInfo.AwardCode;

                    CbIsFormRealName.Checked = lotteryInfo.IsFormRealName;
                    TbFormRealNameTitle.Text = lotteryInfo.FormRealNameTitle;
                    CbIsFormMobile.Checked   = lotteryInfo.IsFormMobile;
                    TbFormMobileTitle.Text   = lotteryInfo.FormMobileTitle;
                    CbIsFormEmail.Checked    = lotteryInfo.IsFormEmail;
                    TbFormEmailTitle.Text    = lotteryInfo.FormEmailTitle;
                    CbIsFormAddress.Checked  = lotteryInfo.IsFormAddress;
                    TbFormAddressTitle.Text  = lotteryInfo.FormAddressTitle;

                    if (!string.IsNullOrEmpty(lotteryInfo.ContentAwardImageUrl))
                    {
                        LtlContentAwardImageUrl.Text =
                            $@"<img id=""preview_contentAwardImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, lotteryInfo.ContentAwardImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    if (!string.IsNullOrEmpty(lotteryInfo.AwardImageUrl))
                    {
                        LtlAwardImageUrl.Text =
                            $@"<img id=""preview_awardImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, lotteryInfo.AwardImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    var awardInfoList = DataProviderWx.LotteryAwardDao.GetLotteryAwardInfoList(PublishmentSystemId, _lotteryId);
                    var itemBuilder   = new StringBuilder();
                    foreach (var awardInfo in awardInfoList)
                    {
                        itemBuilder.AppendFormat(@"{{id: '{0}', awardName: '{1}', title: '{2}', totalNum: '{3}', probability: '{4}'}},", awardInfo.Id, awardInfo.AwardName, awardInfo.Title, awardInfo.TotalNum, awardInfo.Probability);
                    }
                    if (itemBuilder.Length > 0)
                    {
                        itemBuilder.Length--;
                    }

                    LtlAwardItems.Text = $@"
itemController.itemCount = {awardInfoList.Count};itemController.items = [{itemBuilder}];";

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

                    ImageUrl.Value             = lotteryInfo.ImageUrl;
                    ContentImageUrl.Value      = lotteryInfo.ContentImageUrl;
                    ContentAwardImageUrl.Value = lotteryInfo.ContentAwardImageUrl;
                    AwardImageUrl.Value        = lotteryInfo.AwardImageUrl;
                    EndImageUrl.Value          = lotteryInfo.EndImageUrl;
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageLottery.GetRedirectUrl(PublishmentSystemId, ELotteryType.BigWheel)}"";return false");
            }
        }