public override void Submit_OnClick(object sender, EventArgs e) { if (IsPostBack && IsValid) { var errorMessage = string.Empty; try { var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); var userNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemUserName"]); var passwordList = TranslateUtils.StringCollectionToStringList(Request.Form["itemPassword"]); var operatorInfoList = new List <CardOperatorInfo>(); if (userNameList.Count == 0) { errorMessage = "保存失败,姓名为空!"; } else if (passwordList.Count == 0) { errorMessage = "保存失败,密码为空!"; } if (itemCount == userNameList.Count && itemCount == passwordList.Count) { for (var i = 0; i < itemCount; i++) { var userName = userNameList[i]; var password = passwordList[i]; if (string.IsNullOrEmpty(userName)) { errorMessage = "保存失败,姓名为空!"; break; } if (string.IsNullOrEmpty(password)) { errorMessage = "保存失败,密码为空!"; break; } var operatorInfo = new CardOperatorInfo { UserName = userName, Password = password }; operatorInfoList.Add(operatorInfo); } } if (!string.IsNullOrEmpty(errorMessage)) { FailMessage(errorMessage); } else { var cardInfo = DataProviderWx.CardDao.GetCardInfo(_cardId); cardInfo.ShopOperatorList = TranslateUtils.ObjectToJson(operatorInfoList); DataProviderWx.CardDao.Update(cardInfo); PageUtils.CloseModalPage(Page); } } 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.AddAdminLog(Body.AdministratorName, "修改会议(活动)", $"会议(活动):{TbTitle.Text}"); SuccessMessage("修改会议(活动)成功!"); } else { _conferenceId = DataProviderWx.ConferenceDao.Insert(conferenceInfo); //DataProviderWx.ConferenceItemDao.UpdateConferenceID(base.PublishmentSystemId, this.conferenceID); LogUtils.AddAdminLog(Body.AdministratorName, "添加会议(活动)", $"会议(活动):{TbTitle.Text}"); SuccessMessage("添加会议(活动)成功!"); } var redirectUrl = PageConference.GetRedirectUrl(PublishmentSystemId); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "会议(活动)设置失败!"); } BtnSubmit.Visible = false; BtnReturn.Visible = false; } } }