public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var conflictKeywords = string.Empty; var storeItemInfo = new StoreItemInfo(); if (storeItemID > 0) { storeItemInfo = DataProviderWX.StoreItemDAO.GetStoreItemInfo(storeItemID); } storeItemInfo.PublishmentSystemID = PublishmentSystemID; storeItemInfo.StoreID = storeID; storeItemInfo.CategoryID = Convert.ToInt32(ddlStoreCategoryName.SelectedValue); storeItemInfo.StoreName = tbStoreName.Text; storeItemInfo.Tel = tbStoreTel.Text; storeItemInfo.Mobile = tbStoreMobile.Text; storeItemInfo.Address = tbStoreAddress.Text; storeItemInfo.ImageUrl = imageUrl.Value; storeItemInfo.Latitude = txtLatitude.Value; storeItemInfo.Longitude = txtLongitude.Value; storeItemInfo.Summary = tbSummary.Text; try { if (storeItemID > 0) { DataProviderWX.StoreItemDAO.Update(PublishmentSystemID, storeItemInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改微门店信息", $"微门店:{tbStoreName.Text}"); SuccessMessage("修改微门店成功!"); } else { storeItemID = DataProviderWX.StoreItemDAO.Insert(PublishmentSystemID, storeItemInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加微门店信息", $"微门店:{tbStoreName.Text}"); SuccessMessage("添加微门店成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_storeItem.aspx?publishmentSystemID={PublishmentSystemID}&storeID={storeID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "微门店设置失败!"); } } }
public override void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { if (categoryID == 0) { var categoryInfo = new StoreCategoryInfo(); categoryInfo.PublishmentSystemID = PublishmentSystemID; categoryInfo.CategoryName = CategoryName.Text; categoryInfo.ParentID = TranslateUtils.ToInt(ParentID.SelectedValue); DataProviderWX.StoreCategoryDAO.Insert(PublishmentSystemID, categoryInfo); } else { var categoryInfo = DataProviderWX.StoreCategoryDAO.GetCategoryInfo(categoryID); categoryInfo.CategoryName = CategoryName.Text; categoryInfo.ParentID = TranslateUtils.ToInt(ParentID.SelectedValue); DataProviderWX.StoreCategoryDAO.Update(PublishmentSystemID, categoryInfo);; } LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "维护门店属性信息"); SuccessMessage("类别设置成功!"); isChanged = true; } catch (Exception ex) { FailMessage(ex, "类别设置失败!"); } if (isChanged) { JsUtils.OpenWindow.CloseModalPage(Page); } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { try { if (!string.IsNullOrEmpty(tbUserNameList.Text)) { var userNameList = TranslateUtils.StringCollectionToStringList(tbUserNameList.Text); foreach (var userName in userNameList) { var cardSNInfo = new CardSNInfo(); cardSNInfo.PublishmentSystemID = PublishmentSystemID; cardSNInfo.CardID = cardID; cardSNInfo.SN = DataProviderWX.CardSNDAO.GetNextCardSN(PublishmentSystemID, cardID); cardSNInfo.Amount = 0; cardSNInfo.UserName = userName; cardSNInfo.IsDisabled = true; cardSNInfo.AddDate = DateTime.Now; var isExist = DataProviderWX.CardSNDAO.isExists(PublishmentSystemID, cardID, userName); if (!isExist) { DataProviderWX.CardSNDAO.Insert(cardSNInfo); } } } LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "领取会员卡成功", $"会员卡:{tbUserNameList.Text}"); SuccessMessage("领取会员卡成功!"); } catch (Exception ex) { FailMessage(ex, "领取会员卡失败!"); } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { if (phStep1.Visible) { phStep2.Visible = true; phStep3.Visible = phStep1.Visible = false; } else if (phStep2.Visible) { var accountType = EWXAccountTypeUtils.GetEnumType(rblWXAccountType.SelectedValue); if (accountType == EWXAccountType.Subscribe) { var accountInfo = WeiXinManager.GetAccountInfo(PublishmentSystemID); accountInfo.AccountType = rblWXAccountType.SelectedValue; accountInfo.WeChatID = tbWhchatID.Text; try { DataProviderWX.AccountDAO.Update(accountInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "绑定微信公众帐号", $"站点:{PublishmentSystemInfo.PublishmentSystemName}"); SuccessMessage("绑定微信公众帐号成功!"); AddWaitAndRedirectScript(returnUrl); } catch (Exception ex) { FailMessage(ex, "绑定微信公众帐号失败!"); } } else { phStep3.Visible = true; phStep1.Visible = phStep2.Visible = false; } } else { var accountInfo = WeiXinManager.GetAccountInfo(PublishmentSystemID); accountInfo.AccountType = rblWXAccountType.SelectedValue; accountInfo.WeChatID = tbWhchatID.Text; accountInfo.AppID = tbAppID.Text; accountInfo.AppSecret = tbAppSecret.Text; try { DataProviderWX.AccountDAO.Update(accountInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "绑定微信公众帐号", $"站点:{PublishmentSystemInfo.PublishmentSystemName}"); SuccessMessage("绑定微信公众帐号成功!"); AddWaitAndRedirectScript(returnUrl); } catch (Exception ex) { FailMessage(ex, "绑定微信公众帐号失败!"); } } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } else if (phStep4.Visible) { selectedStep = 4; } else if (phStep5.Visible) { selectedStep = 5; } phStep1.Visible = phStep2.Visible = phStep3.Visible = phStep4.Visible = phStep5.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (lotteryID > 0) { var lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, lotteryInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; } else if (selectedStep == 3) { var isItemReady = true; var awardMaxCount = TranslateUtils.ToInt(tbAwardMaxCount.Text); var awardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text); if (awardMaxDailyCount > awardMaxCount) { FailMessage("摇摇乐保存失败,每人每天最多允许抽奖次数必须小于每人最多抽奖次数"); isItemReady = false; } if (isItemReady) { var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); if (itemCount < 1) { FailMessage("摇摇乐保存失败,至少需要设置一个奖项"); isItemReady = false; } else { var itemIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]); var awardNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemAwardName"]); var titleList = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]); var totalNumList = TranslateUtils.StringCollectionToIntList(Request.Form["itemTotalNum"]); var probabilityList = TranslateUtils.StringCollectionToDecimalList(Request.Form["itemProbability"]); decimal probabilityAll = 0; var awardInfoList = new List <LotteryAwardInfo>(); for (var i = 0; i < itemCount; i++) { var awardInfo = new LotteryAwardInfo { ID = itemIDList[i], PublishmentSystemID = PublishmentSystemID, LotteryID = lotteryID, AwardName = awardNameList[i], Title = titleList[i], TotalNum = totalNumList[i], Probability = probabilityList[i] }; if (string.IsNullOrEmpty(awardInfo.AwardName)) { FailMessage("保存失败,奖项名称为必填项"); isItemReady = false; } if (string.IsNullOrEmpty(awardInfo.Title)) { FailMessage("保存失败,奖品名为必填项"); isItemReady = false; } if (awardInfo.Probability < 0 || awardInfo.Probability > 100) { FailMessage("保存失败,各项中奖概率总和不能超过100%"); isItemReady = false; } probabilityAll += awardInfo.Probability; awardInfoList.Add(awardInfo); } if (probabilityAll <= 0 || probabilityAll > 100) { FailMessage("摇摇乐保存失败,获奖概率之和必须在1%到100%之间"); isItemReady = false; } if (isItemReady) { DataProviderWX.LotteryAwardDAO.DeleteAllNotInIDList(PublishmentSystemID, lotteryID, itemIDList); foreach (var awardInfo in awardInfoList) { var newAwardInfo = DataProviderWX.LotteryAwardDAO.GetAwardInfo(awardInfo.ID); if (awardInfo.ID > 0) { var wonNum = DataProviderWX.LotteryWinnerDAO.GetTotalNum(awardInfo.ID); if (awardInfo.TotalNum < wonNum) { awardInfo.TotalNum = wonNum; } awardInfo.WonNum = newAwardInfo.WonNum; DataProviderWX.LotteryAwardDAO.Update(awardInfo); } else { DataProviderWX.LotteryAwardDAO.Insert(awardInfo); } } } } } if (isItemReady) { phStep4.Visible = true; } else { phStep3.Visible = true; } } else if (selectedStep == 4) { phStep5.Visible = true; btnSubmit.Text = "确 认"; } else if (selectedStep == 5) { var lotteryInfo = new LotteryInfo(); if (lotteryID > 0) { lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID); } lotteryInfo.PublishmentSystemID = PublishmentSystemID; lotteryInfo.LotteryType = ELotteryTypeUtils.GetValue(ELotteryType.YaoYao); lotteryInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, lotteryID > 0, tbKeywords.Text, EKeywordType.YaoYao, lotteryInfo.KeywordID); lotteryInfo.IsDisabled = !cbIsEnabled.Checked; lotteryInfo.StartDate = dtbStartDate.DateTime; lotteryInfo.EndDate = dtbEndDate.DateTime; lotteryInfo.Title = PageUtils.FilterXSS(tbTitle.Text); lotteryInfo.ImageUrl = imageUrl.Value;; lotteryInfo.Summary = tbSummary.Text; lotteryInfo.ContentImageUrl = contentImageUrl.Value; lotteryInfo.ContentUsage = tbContentUsage.Text; lotteryInfo.AwardUsage = tbAwardUsage.Text; lotteryInfo.IsAwardTotalNum = cbIsAwardTotalNum.Checked; lotteryInfo.AwardMaxCount = TranslateUtils.ToInt(tbAwardMaxCount.Text); lotteryInfo.AwardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text); lotteryInfo.AwardCode = tbAwardCode.Text; lotteryInfo.AwardImageUrl = awardImageUrl.Value; lotteryInfo.IsFormRealName = cbIsFormRealName.Checked; lotteryInfo.FormRealNameTitle = tbFormRealNameTitle.Text; lotteryInfo.IsFormMobile = cbIsFormMobile.Checked; lotteryInfo.FormMobileTitle = tbFormMobileTitle.Text; lotteryInfo.IsFormEmail = cbIsFormEmail.Checked; lotteryInfo.FormEmailTitle = tbFormEmailTitle.Text; lotteryInfo.IsFormAddress = cbIsFormAddress.Checked; lotteryInfo.FormAddressTitle = tbFormAddressTitle.Text; lotteryInfo.EndTitle = tbEndTitle.Text; lotteryInfo.EndImageUrl = endImageUrl.Value; lotteryInfo.EndSummary = tbEndSummary.Text; try { if (lotteryID > 0) { DataProviderWX.LotteryDAO.Update(lotteryInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改摇摇乐", $"摇摇乐:{tbTitle.Text}"); SuccessMessage("修改摇摇乐成功!"); } else { lotteryID = DataProviderWX.LotteryDAO.Insert(lotteryInfo); DataProviderWX.LotteryAwardDAO.UpdateLotteryID(PublishmentSystemID, lotteryID); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加摇摇乐", $"摇摇乐:{tbTitle.Text}"); SuccessMessage("添加摇摇乐成功!"); } var redirectUrl = BackgroundLottery.GetRedirectUrl(PublishmentSystemID, ELotteryType.YaoYao); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "摇摇乐设置失败!"); } } } }
private IResponseMessageBase GetResponseMessage(KeywordInfo keywordInfo, string keyword) { try { if (keywordInfo != null && !keywordInfo.IsDisabled) { if (keywordInfo.KeywordType == EKeywordType.Text) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestText); var responseMessage = CreateResponseMessage <ResponseMessageText>(); responseMessage.Content = keywordInfo.Reply; return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.News) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestNews); var responseMessage = CreateResponseMessage <ResponseMessageNews>(); foreach (var resourceInfo in DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordInfo.KeywordID)) { var imageUrl = PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, resourceInfo.ImageUrl)); var pageUrl = string.Empty; if (resourceInfo.ResourceType == EResourceType.Site) { if (resourceInfo.ChannelID > 0 && resourceInfo.ContentID > 0) { pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, resourceInfo.ChannelID, resourceInfo.ContentID, false); } else if (resourceInfo.ChannelID > 0) { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, resourceInfo.ChannelID); } else { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId); } } else if (resourceInfo.ResourceType == EResourceType.Content) { pageUrl = PageUtilityWX.GetWeiXinFileUrl(publishmentSystemInfo, resourceInfo.KeywordID, resourceInfo.ResourceID); } else if (resourceInfo.ResourceType == EResourceType.Url) { pageUrl = resourceInfo.NavigationUrl; } responseMessage.Articles.Add(new Article() { Title = resourceInfo.Title, Description = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content), PicUrl = imageUrl, Url = pageUrl }); } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Coupon) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CouponManager.Trigger(keywordInfo, keyword, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Vote) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = VoteManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Message) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MessageManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Appointment) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AppointmentManager.Trigger(keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Conference) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = ConferenceManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Map) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MapManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.View360) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = View360Manager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Album) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AlbumManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Scratch) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Scratch, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.BigWheel) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.BigWheel, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.GoldEgg) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.GoldEgg, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Flap) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Flap, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.YaoYao) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.YaoYao, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Search) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = SearchManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Store) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = StoreManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Collect) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CollectManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Card) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CardManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } } } catch (Exception ex) { LogUtils.AddLog(string.Empty, "Gexia Error", ex.StackTrace); } return(null); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } else if (phStep4.Visible) { selectedStep = 4; } phStep1.Visible = phStep2.Visible = phStep3.Visible = phStep4.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (actID > 0) { var actInfo = DataProviderWX.CouponActDAO.GetActInfo(actID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, actInfo.KeywordID, tbKeywords.Text, out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, tbKeywords.Text, out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; } else if (selectedStep == 3) { phStep4.Visible = true; btnSubmit.Text = "确 认"; } else if (selectedStep == 4) { var actInfo = new CouponActInfo(); if (actID > 0) { actInfo = DataProviderWX.CouponActDAO.GetActInfo(actID); } actInfo.PublishmentSystemID = PublishmentSystemID; actInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, actID > 0, PageUtils.FilterXSS(tbKeywords.Text), EKeywordType.Coupon, actInfo.KeywordID); actInfo.IsDisabled = !cbIsEnabled.Checked; actInfo.StartDate = dtbStartDate.DateTime; actInfo.EndDate = dtbEndDate.DateTime; actInfo.Title = tbTitle.Text; actInfo.ImageUrl = imageUrl.Value;; actInfo.Summary = tbSummary.Text; actInfo.ContentImageUrl = contentImageUrl.Value;; actInfo.ContentUsage = tbContentUsage.Text; actInfo.ContentDescription = tbContentDescription.Text; actInfo.AwardCode = tbAwardCode.Text; actInfo.IsFormRealName = cbIsFormRealName.Checked; actInfo.FormRealNameTitle = tbFormRealNameTitle.Text; actInfo.IsFormMobile = cbIsFormMobile.Checked; actInfo.FormMobileTitle = tbFormMobileTitle.Text; actInfo.IsFormEmail = cbIsFormEmail.Checked; actInfo.FormEmailTitle = tbFormEmailTitle.Text; actInfo.IsFormAddress = cbIsFormAddress.Checked; actInfo.FormAddressTitle = tbFormAddressTitle.Text; actInfo.EndTitle = tbEndTitle.Text; actInfo.EndImageUrl = endImageUrl.Value; actInfo.EndSummary = tbEndSummary.Text; try { if (actID > 0) { DataProviderWX.CouponActDAO.Update(actInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改优惠劵活动", $"优惠劵活动:{tbTitle.Text}"); SuccessMessage("修改优惠劵活动成功!"); } else { actID = DataProviderWX.CouponActDAO.Insert(actInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加优惠劵活动", $"优惠劵活动:{tbTitle.Text}"); SuccessMessage("添加优惠劵活动成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_couponAct.aspx?publishmentSystemID={PublishmentSystemID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "优惠劵活动设置失败!"); } btnSubmit.Visible = false; btnReturn.Visible = false; } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } phStep1.Visible = phStep2.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (view360ID > 0) { var view360Info = DataProviderWX.View360DAO.GetView360Info(view360ID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, view360Info.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; btnSubmit.Text = "确 认"; } } else if (selectedStep == 2) { var view360Info = new View360Info(); if (view360ID > 0) { view360Info = DataProviderWX.View360DAO.GetView360Info(view360ID); } view360Info.PublishmentSystemID = PublishmentSystemID; view360Info.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, view360ID > 0, tbKeywords.Text, EKeywordType.View360, view360Info.KeywordID); view360Info.IsDisabled = !cbIsEnabled.Checked; view360Info.Title = PageUtils.FilterXSS(tbTitle.Text); view360Info.ImageUrl = imageUrl.Value;; view360Info.Summary = tbSummary.Text; view360Info.ContentImageUrl1 = tbContentImageUrl1.Text; view360Info.ContentImageUrl2 = tbContentImageUrl2.Text; view360Info.ContentImageUrl3 = tbContentImageUrl3.Text; view360Info.ContentImageUrl4 = tbContentImageUrl4.Text; view360Info.ContentImageUrl5 = tbContentImageUrl5.Text; view360Info.ContentImageUrl6 = tbContentImageUrl6.Text; try { if (view360ID > 0) { DataProviderWX.View360DAO.Update(view360Info); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改360全景", $"360全景:{tbTitle.Text}"); SuccessMessage("修改360全景成功!"); } else { view360ID = DataProviderWX.View360DAO.Insert(view360Info); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加360全景", $"360全景:{tbTitle.Text}"); SuccessMessage("添加360全景成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_view360.aspx?publishmentSystemID={PublishmentSystemID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "360全景设置失败!"); } btnSubmit.Visible = false; btnReturn.Visible = false; } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } phStep1.Visible = phStep2.Visible = phStep3.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (collectID > 0) { var collectInfo = DataProviderWX.CollectDAO.GetCollectInfo(collectID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, collectInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; btnSubmit.Text = "确 认"; } else if (selectedStep == 3) { var collectInfo = new CollectInfo(); if (collectID > 0) { collectInfo = DataProviderWX.CollectDAO.GetCollectInfo(collectID); } collectInfo.PublishmentSystemID = PublishmentSystemID; collectInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, collectID > 0, tbKeywords.Text, EKeywordType.Collect, collectInfo.KeywordID); collectInfo.IsDisabled = !cbIsEnabled.Checked; collectInfo.StartDate = dtbStartDate.DateTime; collectInfo.EndDate = dtbEndDate.DateTime; collectInfo.Title = PageUtils.FilterXSS(tbTitle.Text); collectInfo.ImageUrl = imageUrl.Value;; collectInfo.Summary = tbSummary.Text; collectInfo.ContentImageUrl = contentImageUrl.Value; collectInfo.ContentDescription = tbContentDescription.Text; collectInfo.ContentMaxVote = TranslateUtils.ToInt(tbContentMaxVote.Text); collectInfo.ContentIsCheck = TranslateUtils.ToBool(ddlContentIsCheck.SelectedValue); collectInfo.EndTitle = tbEndTitle.Text; collectInfo.EndImageUrl = endImageUrl.Value; collectInfo.EndSummary = tbEndSummary.Text; try { if (collectID > 0) { DataProviderWX.CollectDAO.Update(collectInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改征集活动", $"征集活动:{tbTitle.Text}"); SuccessMessage("修改征集活动成功!"); } else { collectID = DataProviderWX.CollectDAO.Insert(collectInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加征集活动", $"征集活动:{tbTitle.Text}"); SuccessMessage("添加征集活动成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_collect.aspx?publishmentSystemID={PublishmentSystemID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "征集活动设置失败!"); } btnSubmit.Visible = false; btnReturn.Visible = false; } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } phStep1.Visible = phStep2.Visible = phStep3.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (voteID > 0) { var voteInfo = DataProviderWX.VoteDAO.GetVoteInfo(voteID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, voteInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { var isItemReady = true; var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); if (itemCount < 2) { FailMessage("投票保存失败,至少设置两个投票项"); isItemReady = false; } else { var isImageOption = TranslateUtils.ToBool(ddlContentIsImageOption.SelectedValue); var itemIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]); var titleList = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]); var imageUrlList = TranslateUtils.StringCollectionToStringList(Request.Form["itemImageUrl"]); var navigationUrlList = TranslateUtils.StringCollectionToStringList(Request.Form["itemNavigationUrl"]); var voteNumList = TranslateUtils.StringCollectionToIntList(Request.Form["itemVoteNum"]); var voteItemInfoList = new List <VoteItemInfo>(); for (var i = 0; i < itemCount; i++) { var imageUrl = string.Empty; if (isImageOption) { imageUrl = imageUrlList[i]; } var itemInfo = new VoteItemInfo { ID = itemIDList[i], VoteID = voteID, PublishmentSystemID = PublishmentSystemID, Title = titleList[i], ImageUrl = imageUrl, NavigationUrl = navigationUrlList[i], VoteNum = voteNumList[i] }; if (isImageOption && string.IsNullOrEmpty(itemInfo.ImageUrl)) { FailMessage("投票保存失败,图片地址为必填项"); isItemReady = false; } if (string.IsNullOrEmpty(itemInfo.Title)) { FailMessage("投票保存失败,选项标题为必填项"); isItemReady = false; } voteItemInfoList.Add(itemInfo); } if (isItemReady) { //DataProviderWX.VoteItemDAO.DeleteAll(base.PublishmentSystemID, this.voteID); foreach (var itemInfo in voteItemInfoList) { var newVoteItemInfo = DataProviderWX.VoteItemDAO.GetVoteItemInfo(itemInfo.ID); if (itemInfo.ID > 0) { itemInfo.VoteNum = newVoteItemInfo.VoteNum; DataProviderWX.VoteItemDAO.Update(itemInfo); } else { DataProviderWX.VoteItemDAO.Insert(itemInfo); } } } } if (isItemReady) { phStep3.Visible = true; btnSubmit.Text = "确 认"; } else { phStep2.Visible = true; } } else if (selectedStep == 3) { var voteInfo = new VoteInfo(); if (voteID > 0) { voteInfo = DataProviderWX.VoteDAO.GetVoteInfo(voteID); } voteInfo.PublishmentSystemID = PublishmentSystemID; voteInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, voteID > 0, tbKeywords.Text, EKeywordType.Vote, voteInfo.KeywordID); voteInfo.IsDisabled = !cbIsEnabled.Checked; voteInfo.StartDate = dtbStartDate.DateTime; voteInfo.EndDate = dtbEndDate.DateTime; voteInfo.Title = PageUtils.FilterXSS(tbTitle.Text); voteInfo.ImageUrl = imageUrl.Value;; voteInfo.Summary = tbSummary.Text; voteInfo.ContentImageUrl = contentImageUrl.Value; voteInfo.ContentDescription = tbContentDescription.Text; voteInfo.ContentIsImageOption = TranslateUtils.ToBool(ddlContentIsImageOption.SelectedValue).ToString(); voteInfo.ContentIsCheckBox = TranslateUtils.ToBool(ddlContentIsCheckBox.SelectedValue).ToString(); voteInfo.ContentResultVisible = EVoteResultVisibleUtils.GetValue(EVoteResultVisible.After); voteInfo.EndTitle = tbEndTitle.Text; voteInfo.EndImageUrl = endImageUrl.Value; voteInfo.EndSummary = tbEndSummary.Text; try { if (voteID > 0) { DataProviderWX.VoteDAO.Update(voteInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改投票活动", $"投票活动:{tbTitle.Text}"); SuccessMessage("修改投票活动成功!"); } else { voteID = DataProviderWX.VoteDAO.Insert(voteInfo); DataProviderWX.VoteItemDAO.UpdateVoteID(PublishmentSystemID, voteID); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加投票活动", $"投票活动:{tbTitle.Text}"); SuccessMessage("添加投票活动成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_vote.aspx?publishmentSystemID={PublishmentSystemID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "投票活动设置失败!"); } btnSubmit.Visible = false; btnReturn.Visible = false; } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } phStep1.Visible = phStep2.Visible = phStep3.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (searchID > 0) { var searchInfo = DataProviderWX.SearchDAO.GetSearchInfo(searchID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, searchInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { var isItemReady = true; if (isItemReady) { var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); if (itemCount > 0) { var itemIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]); var imageCssClassList = TranslateUtils.StringCollectionToStringList(Request.Form["itemImageCssClass"]); var keywordTypeList = TranslateUtils.StringCollectionToStringList(Request.Form["itemKeywordType"]); var functionIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemFunctionID"]); var channelIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemChannelID"]); var contentIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemContentID"]); var titleList = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]); var navigationTypeList = TranslateUtils.StringCollectionToStringList(Request.Form["itemNavigationType"]); var urlList = TranslateUtils.StringCollectionToStringList(Request.Form["itemUrl"]); var navigationInfoList = new List <SearchNavigationInfo>(); for (var i = 0; i < itemCount; i++) { var navigationInfo = new SearchNavigationInfo { ID = itemIDList[i], PublishmentSystemID = PublishmentSystemID, SearchID = searchID, Title = titleList[i], Url = urlList[i], ImageCssClass = imageCssClassList[i], NavigationType = navigationTypeList[i], KeywordType = keywordTypeList[i], FunctionID = functionIDList[i], ChannelID = channelIDList[i], ContentID = contentIDList[i] }; if (string.IsNullOrEmpty(navigationInfo.Title)) { FailMessage("保存失败,导航链接名称为必填项"); isItemReady = false; } if (string.IsNullOrEmpty(navigationInfo.ImageCssClass)) { FailMessage("保存失败,导航链接图标为必填项"); isItemReady = false; } if (navigationInfo.NavigationType == ENavigationTypeUtils.GetValue(ENavigationType.Url) && string.IsNullOrEmpty(navigationInfo.Url)) { FailMessage("保存失败,导航链接地址为必填项"); isItemReady = false; } navigationInfoList.Add(navigationInfo); } if (isItemReady) { DataProviderWX.SearchNavigationDAO.DeleteAllNotInIDList(PublishmentSystemID, searchID, itemIDList); foreach (var navigationInfo in navigationInfoList) { if (navigationInfo.ID > 0) { DataProviderWX.SearchNavigationDAO.Update(navigationInfo); } else { DataProviderWX.SearchNavigationDAO.Insert(navigationInfo); } } } } } if (isItemReady) { phStep3.Visible = true; btnSubmit.Text = "确 认"; } else { phStep2.Visible = true; } } else if (selectedStep == 3) { var searchInfo = new SearchInfo(); if (searchID > 0) { searchInfo = DataProviderWX.SearchDAO.GetSearchInfo(searchID); } searchInfo.PublishmentSystemID = PublishmentSystemID; searchInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, searchID > 0, tbKeywords.Text, EKeywordType.Search, searchInfo.KeywordID); searchInfo.IsDisabled = !cbIsEnabled.Checked; searchInfo.Title = PageUtils.FilterXSS(tbTitle.Text); searchInfo.ImageUrl = imageUrl.Value;; searchInfo.Summary = tbSummary.Text; searchInfo.ContentImageUrl = contentImageUrl.Value; searchInfo.IsOutsiteSearch = cbIsOutsiteSearch.Checked; searchInfo.IsNavigation = cbIsNavigation.Checked; searchInfo.NavTitleColor = tbNavTitleColor.Text; searchInfo.NavImageColor = tbNavImageColor.Text; searchInfo.ImageAreaTitle = tbImageAreaTitle.Text; searchInfo.ImageAreaChannelID = TranslateUtils.ToInt(Request.Form["imageChannelID"]); searchInfo.TextAreaTitle = tbTextAreaTitle.Text; searchInfo.TextAreaChannelID = TranslateUtils.ToInt(Request.Form["textChannelID"]); try { if (searchID > 0) { DataProviderWX.SearchDAO.Update(searchInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改微搜索", $"微搜索:{tbTitle.Text}"); SuccessMessage("修改微搜索成功!"); } else { searchID = DataProviderWX.SearchDAO.Insert(searchInfo); DataProviderWX.SearchNavigationDAO.UpdateSearchID(PublishmentSystemID, searchID); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加微搜索", $"微搜索:{tbTitle.Text}"); SuccessMessage("添加微搜索成功!"); } var redirectUrl = BackgroundSearch.GetRedirectUrl(PublishmentSystemID); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "微搜索设置失败!"); } } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (storeID > 0) { var storeInfo = DataProviderWX.StoreDAO.GetStoreInfo(storeID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, storeInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); } else { var storeInfo = new StoreInfo(); if (storeID > 0) { storeInfo = DataProviderWX.StoreDAO.GetStoreInfo(storeID); } storeInfo.PublishmentSystemID = PublishmentSystemID; storeInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, storeID > 0, tbKeywords.Text, EKeywordType.Store, storeInfo.KeywordID); storeInfo.IsDisabled = !cbIsEnabled.Checked; storeInfo.Title = PageUtils.FilterXSS(tbTitle.Text); storeInfo.ImageUrl = imageUrl.Value;; storeInfo.Summary = tbSummary.Text; try { if (storeID > 0) { DataProviderWX.StoreDAO.Update(storeInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改微门店", $"微门店:{tbTitle.Text}"); SuccessMessage("修改微门店成功!"); } else { storeID = DataProviderWX.StoreDAO.Insert(storeInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加微门店", $"微门店:{tbTitle.Text}"); SuccessMessage("添加微门店成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_storeItem.aspx?publishmentSystemID={PublishmentSystemID}&storeID={storeID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "微门店设置失败!"); } } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } phStep1.Visible = phStep2.Visible = phStep3.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (cardID > 0) { var cardInfo = DataProviderWX.CardDAO.GetCardInfo(cardID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, cardInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; btnSubmit.Text = "确 认"; } else if (selectedStep == 3) { var cardInfo = new CardInfo(); if (cardID > 0) { cardInfo = DataProviderWX.CardDAO.GetCardInfo(cardID); } else { cardInfo.ShopOperatorList = "[{\"UserName\":" + tbShopManage.Text + ",\"Password\":" + tbShopPassword.Text + ",\"ID\":0}]"; } cardInfo.PublishmentSystemID = PublishmentSystemID; cardInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, cardID > 0, PageUtils.FilterXSS(tbKeywords.Text), EKeywordType.Card, cardInfo.KeywordID); cardInfo.IsDisabled = !cbIsEnabled.Checked; cardInfo.Title = PageUtils.FilterXSS(tbTitle.Text); cardInfo.ImageUrl = imageUrl.Value; cardInfo.Summary = tbSummary.Text; cardInfo.CardTitle = tbCardTitle.Text; cardInfo.CardTitleColor = tbCardTitleColor.Text; cardInfo.CardNoColor = tbCardSNColor.Text; cardInfo.ContentFrontImageUrl = contentFrontImageUrl.Value; cardInfo.ContentBackImageUrl = contentBackImageUrl.Value; cardInfo.ShopName = tbShopName.Text; cardInfo.ShopAddress = tbShopAddress.Text; if (!string.IsNullOrEmpty(shopPosition.Value)) { cardInfo.ShopPosition = shopPosition.Value; } cardInfo.ShopTel = tbShopTel.Text; cardInfo.ShopPassword = tbShopPassword.Text; try { if (cardID > 0) { DataProviderWX.CardDAO.Update(cardInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改会员卡", $"会员卡:{tbTitle.Text}"); SuccessMessage("修改会员卡成功!"); } else { cardID = DataProviderWX.CardDAO.Insert(cardInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加会员卡", $"会员卡:{tbTitle.Text}"); SuccessMessage("添加会员卡成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_card.aspx?publishmentSystemID={PublishmentSystemID}&CardID={cardID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "会员卡设置失败!"); } } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } else if (phStep4.Visible) { selectedStep = 4; } else if (phStep5.Visible) { selectedStep = 5; } phStep1.Visible = phStep2.Visible = phStep3.Visible = phStep4.Visible = phStep5.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (conferenceID > 0) { var conferenceInfo = DataProviderWX.ConferenceDAO.GetConferenceInfo(conferenceID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, conferenceInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; } else if (selectedStep == 3) { var isItemReady = true; var agendaCount = TranslateUtils.ToInt(Request.Form["agendaCount"]); if (cbIsAgenda.Checked && agendaCount < 2) { FailMessage("微会议保存失败,至少需要设置两个日程项"); isItemReady = false; } else { var dateTimeList = TranslateUtils.StringCollectionToStringList(Request.Form["itemDateTime"]); var titleList = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]); var summaryList = TranslateUtils.StringCollectionToStringList(Request.Form["itemSummary"]); var agendaInfoList = new List <ConferenceAgendaInfo>(); for (var i = 0; i < agendaCount; i++) { var dateTime = dateTimeList[i]; var title = titleList[i]; var summary = summaryList[i]; if (string.IsNullOrEmpty(dateTime) || string.IsNullOrEmpty(title)) { FailMessage("微会议保存失败,日程项不能为空"); isItemReady = false; } var agendaInfo = new ConferenceAgendaInfo { dateTime = dateTime, title = title, summary = summary }; agendaInfoList.Add(agendaInfo); } if (isItemReady) { Page.Session.Add("BackgroundConferenceAdd.AgendaList", TranslateUtils.ObjectToJson(agendaInfoList)); } } if (isItemReady) { phStep4.Visible = true; } else { phStep3.Visible = true; } } else if (selectedStep == 4) { var isItemReady = true; var guestCount = TranslateUtils.ToInt(Request.Form["guestCount"]); if (cbIsGuest.Checked && guestCount < 2) { FailMessage("微会议保存失败,至少需要设置两个嘉宾项"); isItemReady = false; } else { var displayNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemDisplayName"]); var positionList = TranslateUtils.StringCollectionToStringList(Request.Form["itemPosition"]); var picUrlList = TranslateUtils.StringCollectionToStringList(Request.Form["itemPicUrl"]); var guestInfoList = new List <ConferenceGuestInfo>(); for (var i = 0; i < guestCount; i++) { var displayName = displayNameList[i]; var position = positionList[i]; var picUrl = picUrlList[i]; if (string.IsNullOrEmpty(displayName) || string.IsNullOrEmpty(position)) { FailMessage("微会议保存失败,嘉宾项不能为空"); isItemReady = false; } var guestInfo = new ConferenceGuestInfo { displayName = displayName, position = position, picUrl = picUrl }; guestInfoList.Add(guestInfo); } if (isItemReady) { Page.Session.Add("BackgroundConferenceAdd.GuestList", TranslateUtils.ObjectToJson(guestInfoList)); } } if (isItemReady) { phStep5.Visible = true; btnSubmit.Text = "确 认"; } else { phStep4.Visible = true; } } else if (selectedStep == 5) { var conferenceInfo = new ConferenceInfo(); if (conferenceID > 0) { conferenceInfo = DataProviderWX.ConferenceDAO.GetConferenceInfo(conferenceID); } conferenceInfo.PublishmentSystemID = PublishmentSystemID; conferenceInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, conferenceID > 0, tbKeywords.Text, EKeywordType.Conference, conferenceInfo.KeywordID); conferenceInfo.IsDisabled = !cbIsEnabled.Checked; conferenceInfo.StartDate = dtbStartDate.DateTime; conferenceInfo.EndDate = dtbEndDate.DateTime; conferenceInfo.Title = PageUtils.FilterXSS(tbTitle.Text); conferenceInfo.ImageUrl = imageUrl.Value;; conferenceInfo.Summary = tbSummary.Text; conferenceInfo.BackgroundImageUrl = backgroundImageUrl.Value; conferenceInfo.ConferenceName = tbConferenceName.Text; conferenceInfo.Address = tbAddress.Text; conferenceInfo.Duration = tbDuration.Text; conferenceInfo.Introduction = breIntroduction.Text; conferenceInfo.IsAgenda = cbIsAgenda.Checked; conferenceInfo.AgendaTitle = tbAgendaTitle.Text; conferenceInfo.AgendaList = Page.Session["BackgroundConferenceAdd.AgendaList"] as string; Page.Session.Remove("BackgroundConferenceAdd.AgendaList"); conferenceInfo.IsGuest = cbIsGuest.Checked; conferenceInfo.GuestTitle = tbGuestTitle.Text; conferenceInfo.GuestList = Page.Session["BackgroundConferenceAdd.GuestList"] as string; Page.Session.Remove("BackgroundConferenceAdd.GuestList"); conferenceInfo.EndTitle = tbEndTitle.Text; conferenceInfo.EndImageUrl = endImageUrl.Value; conferenceInfo.EndSummary = tbEndSummary.Text; try { if (conferenceID > 0) { DataProviderWX.ConferenceDAO.Update(conferenceInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改会议(活动)", $"会议(活动):{tbTitle.Text}"); SuccessMessage("修改会议(活动)成功!"); } else { conferenceID = DataProviderWX.ConferenceDAO.Insert(conferenceInfo); //DataProviderWX.ConferenceItemDAO.UpdateConferenceID(base.PublishmentSystemID, this.conferenceID); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加会议(活动)", $"会议(活动):{tbTitle.Text}"); SuccessMessage("添加会议(活动)成功!"); } var redirectUrl = PageUtils.GetWXUrl( $"background_conference.aspx?publishmentSystemID={PublishmentSystemID}"); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "会议(活动)设置失败!"); } btnSubmit.Visible = false; btnReturn.Visible = false; } } }