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

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _conferenceId = Body.GetQueryInt("conferenceID");

            if (!IsPostBack)
            {
                var pageTitle = _conferenceId > 0 ? "编辑会议(活动)" : "添加会议(活动)";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdConference, pageTitle, AppManager.WeiXin.Permission.WebSite.Conference);
                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{ConferenceManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                LtlBackgroundImageUrl.Text =
                    $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, string.Empty)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager
                        .GetBackgroundImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{ConferenceManager.GetEndImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                var selectImageClick  = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, "itemPicUrl_");
                var uploadImageClick  = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, "itemPicUrl_");
                var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, "itemPicUrl_");
                var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, "itemPicUrl_");
                LtlGuestScript.Text =
                    $@"guestController.selectImageClickString = ""{selectImageClick}"";guestController.uploadImageClickString = ""{uploadImageClick}"";guestController.cuttingImageClickString = ""{cuttingImageClick}"";guestController.previewImageClickString = ""{previewImageClick}"";";

                if (_conferenceId == 0)
                {
                    LtlAgendaScript.Text += "agendaController.agendaCount = 2;agendaController.items = [{}, {}];";
                    LtlGuestScript.Text  += "guestController.guestCount = 2;guestController.items = [{}, {}];";
                    DtbEndDate.DateTime   = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var conferenceInfo = DataProviderWx.ConferenceDao.GetConferenceInfo(_conferenceId);

                    TbKeywords.Text       = DataProviderWx.KeywordDao.GetKeywords(conferenceInfo.KeywordId);
                    CbIsEnabled.Checked   = !conferenceInfo.IsDisabled;
                    DtbStartDate.DateTime = conferenceInfo.StartDate;
                    DtbEndDate.DateTime   = conferenceInfo.EndDate;
                    TbTitle.Text          = conferenceInfo.Title;
                    if (!string.IsNullOrEmpty(conferenceInfo.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, conferenceInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbSummary.Text = conferenceInfo.Summary;
                    if (!string.IsNullOrEmpty(conferenceInfo.BackgroundImageUrl))
                    {
                        LtlBackgroundImageUrl.Text =
                            $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager
                                .GetBackgroundImageUrl(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    TbConferenceName.Text = conferenceInfo.ConferenceName;
                    TbAddress.Text        = conferenceInfo.Address;
                    TbDuration.Text       = conferenceInfo.Duration;
                    BreIntroduction.Text  = conferenceInfo.Introduction;

                    CbIsAgenda.Checked = conferenceInfo.IsAgenda;
                    TbAgendaTitle.Text = conferenceInfo.AgendaTitle;
                    var agendaInfoList = new List <ConferenceAgendaInfo>();
                    agendaInfoList = TranslateUtils.JsonToObject(conferenceInfo.AgendaList, agendaInfoList) as List <ConferenceAgendaInfo>;
                    if (agendaInfoList != null)
                    {
                        var agendaBuilder = new StringBuilder();
                        foreach (var agendaInfo in agendaInfoList)
                        {
                            agendaBuilder.AppendFormat(@"{{dateTime: '{0}', title: '{1}', summary: '{2}'}},", agendaInfo.DateTime, agendaInfo.Title, agendaInfo.Summary);
                        }
                        if (agendaBuilder.Length > 0)
                        {
                            agendaBuilder.Length--;
                        }

                        LtlAgendaScript.Text +=
                            $@"agendaController.agendaCount = {agendaInfoList.Count};agendaController.items = [{agendaBuilder}];";
                    }
                    else
                    {
                        LtlAgendaScript.Text += "agendaController.agendaCount = 0;agendaController.items = [{}];";
                    }

                    CbIsGuest.Checked = conferenceInfo.IsGuest;
                    TbGuestTitle.Text = conferenceInfo.GuestTitle;
                    var guestInfoList = new List <ConferenceGuestInfo>();
                    guestInfoList = TranslateUtils.JsonToObject(conferenceInfo.GuestList, guestInfoList) as List <ConferenceGuestInfo>;
                    if (guestInfoList != null)
                    {
                        var guestBuilder = new StringBuilder();
                        foreach (var guestInfo in guestInfoList)
                        {
                            guestBuilder.AppendFormat(@"{{displayName: '{0}', position: '{1}', picUrl: '{2}'}},", guestInfo.DisplayName, guestInfo.Position, guestInfo.PicUrl);
                        }
                        if (guestBuilder.Length > 0)
                        {
                            guestBuilder.Length--;
                        }

                        LtlGuestScript.Text +=
                            $@"guestController.guestCount = {guestInfoList.Count};guestController.items = [{guestBuilder}];";
                    }
                    else
                    {
                        LtlGuestScript.Text += "guestController.guestCount = 0;guestController.items = [{}];";
                    }

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

                    ImageUrl.Value           = conferenceInfo.ImageUrl;
                    BackgroundImageUrl.Value = conferenceInfo.BackgroundImageUrl;
                    EndImageUrl.Value        = conferenceInfo.EndImageUrl;
                }

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