void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var appointmentItemInfo = new AppointmentItemInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlTitle = e.Item.FindControl("ltlTitle") as Literal; var ltlMapAddress = e.Item.FindControl("ltlMapAddress") as Literal; var ltlTel = e.Item.FindControl("ltlTel") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlTitle.Text = appointmentItemInfo.Title; ltlMapAddress.Text = appointmentItemInfo.MapAddress; ltlTel.Text = appointmentItemInfo.Tel; var urlEdit = ModalAppointmentItemAdd.GetOpenWindowStringToEdit(PublishmentSystemId, _appointmentId, appointmentItemInfo.Id); ltlEditUrl.Text = $@"<a href=""javascript:;"" onclick=""{urlEdit}"">编辑</a>"; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _appointmentId = Body.GetQueryInt("appointmentID"); _appointmentItemId = Body.GetQueryInt("appointmentItemID"); SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = 30; SpContents.SelectCommand = DataProviderWx.AppointmentItemDao.GetSelectString(PublishmentSystemId, _appointmentId); SpContents.SortField = AlbumAttribute.Id; SpContents.SortMode = SortMode.ASC; RptContents.ItemDataBound += rptContents_ItemDataBound; if (!IsPostBack) { var pageTitle = _appointmentId > 0 ? "编辑微预约" : "添加微预约"; BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdAppointment, pageTitle, AppManager.WeiXin.Permission.WebSite.Appointment); LtlPageTitle.Text = pageTitle; LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{AppointmentManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{AppointmentManager.GetContentImageUrl( PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlContentResultTopImageUrl.Text = $@"<img id=""preview_contentResultTopImageUrl"" src=""{AppointmentManager.GetContentResultTopImageUrl( PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{AppointmentManager.GetEndImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; SpContents.DataBind(); BtnAdd.Attributes.Add("onclick", ModalAppointmentItemAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _appointmentId, 0)); //string urlDelete = PageUtils.AddQueryString(BackgroundAppointmentMultipleAdd.GetRedirectUrl(base.PublishmentSystemId, this.appointmentID,this.tbTitle.Text), "Delete", "True"); //this.btnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的微预约项目", "此操作将删除所选微预约项目,确认吗?")); if (_appointmentId == 0) { DtbEndDate.DateTime = DateTime.Now.AddMonths(1); } else { var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId); if (appointmentInfo != null) { TbKeywords.Text = DataProviderWx.KeywordDao.GetKeywords(appointmentInfo.KeywordId); CbIsEnabled.Checked = !appointmentInfo.IsDisabled; DtbStartDate.DateTime = appointmentInfo.StartDate; DtbEndDate.DateTime = appointmentInfo.EndDate; TbTitle.Text = appointmentInfo.Title; if (!string.IsNullOrEmpty(appointmentInfo.ImageUrl)) { LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.ImageUrl)}"" width=""370"" align=""middle"" />"; } TbSummary.Text = appointmentInfo.Summary; if (!string.IsNullOrEmpty(appointmentInfo.ContentImageUrl)) { LtlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />"; } if (!string.IsNullOrEmpty(appointmentInfo.ContentResultTopImageUrl)) { LtlContentResultTopImageUrl.Text = $@"<img id=""preview_contentResultTopImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.ContentResultTopImageUrl)}"" width=""370"" align=""middle"" />"; } TbContentDescription.Text = appointmentInfo.ContentDescription; TbEndTitle.Text = appointmentInfo.EndTitle; TbEndSummary.Text = appointmentInfo.EndSummary; if (!string.IsNullOrEmpty(appointmentInfo.EndImageUrl)) { LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.EndImageUrl)}"" width=""370"" align=""middle"" />"; } ImageUrl.Value = appointmentInfo.ImageUrl; ContentImageUrl.Value = appointmentInfo.ContentImageUrl; ContentResultTopImageUrl.Value = appointmentInfo.ContentResultTopImageUrl; EndImageUrl.Value = appointmentInfo.EndImageUrl; #region 拓展属性 #region 姓名 if (appointmentInfo.IsFormRealName == "True") { CbIsFormRealName.Checked = true; TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormRealName)) { CbIsFormRealName.Checked = true; TbFormRealNameTitle.Text = "姓名"; } else { CbIsFormRealName.Checked = false; TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle; } #endregion #region 电话 if (appointmentInfo.IsFormMobile == "True") { CbIsFormMobile.Checked = true; TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormMobile)) { CbIsFormMobile.Checked = true; TbFormMobileTitle.Text = "电话"; } else { CbIsFormMobile.Checked = false; TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle; } #endregion #region 邮箱 if (appointmentInfo.IsFormEmail == "True") { CbIsFormEmail.Checked = true; TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormEmail)) { CbIsFormEmail.Checked = true; TbFormEmailTitle.Text = "邮箱"; } else { CbIsFormEmail.Checked = false; TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle; } #endregion _appointmentItemId = DataProviderWx.AppointmentItemDao.GetItemId(PublishmentSystemId, _appointmentId); var configExtendInfoList = DataProviderWx.ConfigExtendDao.GetConfigExtendInfoList(PublishmentSystemId, appointmentInfo.Id, EKeywordTypeUtils.GetValue(EKeywordType.Appointment)); var itemBuilder = new StringBuilder(); foreach (var configExtendInfo in configExtendInfoList) { if (string.IsNullOrEmpty(configExtendInfo.IsVisible)) { configExtendInfo.IsVisible = "checked=checked"; } else if (configExtendInfo.IsVisible == "True") { configExtendInfo.IsVisible = "checked=checked"; } else { configExtendInfo.IsVisible = ""; } itemBuilder.AppendFormat(@"{{id: '{0}', attributeName: '{1}',isVisible:'{2}'}},", configExtendInfo.Id, configExtendInfo.AttributeName, configExtendInfo.IsVisible); } if (itemBuilder.Length > 0) { itemBuilder.Length--; } LtlAwardItems.Text = $@"itemController.itemCount = {configExtendInfoList.Count};itemController.items = [{itemBuilder}];"; #endregion } } BtnReturn.Attributes.Add("onclick", $@"location.href=""{PageAppointment.GetRedirectUrl(PublishmentSystemId)}"";return false"); } }