public int Insert(AppointmentItemInfo appointmentItemInfo) { var appointmentItemID = 0; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(appointmentItemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); appointmentItemID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(appointmentItemID); }
public List <AppointmentItemInfo> GetItemInfoList(string wxOpenID, string userName) { var list = new List <AppointmentItemInfo>(); string SQL_WHERE = $"WHERE {AppointmentItemAttribute.ID} IN (SELECT AppointmentItemID FROM wx_AppointmentContent WHERE UserName = '******')"; if (!string.IsNullOrEmpty(wxOpenID)) { SQL_WHERE = $"WHERE {AppointmentItemAttribute.ID} IN (SELECT AppointmentItemID FROM wx_AppointmentContent WHERE WXOpenID = '{PageUtils.FilterSql(wxOpenID)}')"; } var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var appointmentItemInfo = new AppointmentItemInfo(rdr); list.Add(appointmentItemInfo); } rdr.Close(); } return(list); }
public int Insert(AppointmentItemInfo appointmentItemInfo) { var appointmentItemId = 0; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(appointmentItemInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { appointmentItemId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(appointmentItemId); }
public void Update(AppointmentItemInfo appointmentItemInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(appointmentItemInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); }
public override void Submit_OnClick(object sender, EventArgs e) { try { var isAdd = false; var appointmentItemInfo = new AppointmentItemInfo(); appointmentItemInfo.PublishmentSystemId = PublishmentSystemId; if (_appointmentItemId > 0) { appointmentItemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(_appointmentItemId); } appointmentItemInfo.AppointmentId = _appointmentId; appointmentItemInfo.Title = TbTitle.Text; appointmentItemInfo.TopImageUrl = TopImageUrl.Value; appointmentItemInfo.IsDescription = CbIsDescription.Checked; appointmentItemInfo.DescriptionTitle = TbDescriptionTitle.Text; appointmentItemInfo.Description = TbDescription.Text; appointmentItemInfo.IsImageUrl = CbIsImageUrl.Checked; appointmentItemInfo.ImageUrlTitle = TbImageUrlTitle.Text; appointmentItemInfo.ImageUrl = TbContentImageUrl.Text; appointmentItemInfo.IsVideoUrl = CbIsVideoUrl.Checked; appointmentItemInfo.VideoUrlTitle = TbVideoUrlTitle.Text; appointmentItemInfo.VideoUrl = TbContentVideoUrl.Text; appointmentItemInfo.IsImageUrlCollection = CbIsImageUrlCollection.Checked; appointmentItemInfo.ImageUrlCollectionTitle = TbImageUrlCollectionTitle.Text; appointmentItemInfo.ImageUrlCollection = ImageUrlCollection.Value; appointmentItemInfo.LargeImageUrlCollection = LargeImageUrlCollection.Value; appointmentItemInfo.IsMap = CbIsMap.Checked; appointmentItemInfo.MapTitle = TbMapTitle.Text; appointmentItemInfo.MapAddress = TbMapAddress.Text; appointmentItemInfo.IsTel = CbIsTel.Checked; appointmentItemInfo.TelTitle = TbTelTitle.Text; appointmentItemInfo.Tel = TbTel.Text; if (_appointmentItemId > 0) { DataProviderWx.AppointmentItemDao.Update(appointmentItemInfo); Body.AddSiteLog(PublishmentSystemId, "修改预约项目", $"预约项目:{TbTitle.Text}"); } else { isAdd = true; _appointmentItemId = DataProviderWx.AppointmentItemDao.Insert(appointmentItemInfo); Body.AddSiteLog(PublishmentSystemId, "新增预约项目", $"预约项目:{TbTitle.Text}"); } string scripts = $"window.parent.addItem('{TbTitle.Text}', '{TbMapAddress.Text}','{TbTel.Text}','{PublishmentSystemId}','{_appointmentId}','{_appointmentItemId}','{isAdd}');"; PageUtils.CloseModalPageWithoutRefresh(Page, scripts); } catch (Exception ex) { FailMessage(ex, "失败:" + ex.Message); } }
public override void Submit_OnClick(object sender, EventArgs e) { try { var isAdd = false; var appointmentItemInfo = new AppointmentItemInfo(); appointmentItemInfo.PublishmentSystemID = PublishmentSystemId; if (appointmentItemID > 0) { appointmentItemInfo = DataProviderWX.AppointmentItemDAO.GetItemInfo(appointmentItemID); } appointmentItemInfo.AppointmentID = appointmentID; appointmentItemInfo.Title = tbTitle.Text; appointmentItemInfo.TopImageUrl = topImageUrl.Value; appointmentItemInfo.IsDescription = cbIsDescription.Checked; appointmentItemInfo.DescriptionTitle = tbDescriptionTitle.Text; appointmentItemInfo.Description = tbDescription.Text; appointmentItemInfo.IsImageUrl = cbIsImageUrl.Checked; appointmentItemInfo.ImageUrlTitle = tbImageUrlTitle.Text; appointmentItemInfo.ImageUrl = tbContentImageUrl.Text; appointmentItemInfo.IsVideoUrl = cbIsVideoUrl.Checked; appointmentItemInfo.VideoUrlTitle = tbVideoUrlTitle.Text; appointmentItemInfo.VideoUrl = tbContentVideoUrl.Text; appointmentItemInfo.IsImageUrlCollection = cbIsImageUrlCollection.Checked; appointmentItemInfo.ImageUrlCollectionTitle = tbImageUrlCollectionTitle.Text; appointmentItemInfo.ImageUrlCollection = imageUrlCollection.Value; appointmentItemInfo.LargeImageUrlCollection = largeImageUrlCollection.Value; appointmentItemInfo.IsMap = cbIsMap.Checked; appointmentItemInfo.MapTitle = tbMapTitle.Text; appointmentItemInfo.MapAddress = tbMapAddress.Text; appointmentItemInfo.IsTel = cbIsTel.Checked; appointmentItemInfo.TelTitle = tbTelTitle.Text; appointmentItemInfo.Tel = tbTel.Text; if (appointmentItemID > 0) { DataProviderWX.AppointmentItemDAO.Update(appointmentItemInfo); Body.AddLog(PublishmentSystemId, "修改预约项目", $"预约项目:{tbTitle.Text}"); } else { isAdd = true; appointmentItemID = DataProviderWX.AppointmentItemDAO.Insert(appointmentItemInfo); Body.AddLog(PublishmentSystemId, "新增预约项目", $"预约项目:{tbTitle.Text}"); } string scripts = $"window.parent.addItem('{tbTitle.Text}', '{tbMapAddress.Text}','{tbTel.Text}','{PublishmentSystemId}','{appointmentID}','{appointmentItemID}','{isAdd.ToString()}');"; PageUtils.CloseModalPageWithoutRefresh(Page, scripts); } catch (Exception ex) { FailMessage(ex, "失败:" + ex.Message); } }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var contentInfo = new AppointmentContentInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlRealName = e.Item.FindControl("ltlRealName") as Literal; var ltlAppointementTitle = e.Item.FindControl("ltlAppointementTitle") as Literal; var ltlMobile = e.Item.FindControl("ltlMobile") as Literal; var ltlExtendVal = e.Item.FindControl("ltlExtendVal") as Literal; var ltlEmail = e.Item.FindControl("ltlEmail") as Literal; var ltlAddDate = e.Item.FindControl("ltlAddDate") as Literal; var ltlStatus = e.Item.FindControl("ltlStatus") as Literal; var ltlMessage = e.Item.FindControl("ltlMessage") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; var ltlSelectUrl = e.Item.FindControl("ltlSelectUrl") as Literal; AppointmentItemInfo itemInfo = null; if (_itemInfoDictionary.ContainsKey(contentInfo.AppointmentItemId)) { itemInfo = _itemInfoDictionary[contentInfo.AppointmentItemId]; } else { itemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(contentInfo.AppointmentItemId); _itemInfoDictionary.Add(contentInfo.AppointmentItemId, itemInfo); } ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlRealName.Text = contentInfo.RealName; if (itemInfo != null) { ltlAppointementTitle.Text = itemInfo.Title; AppointmentTitle = itemInfo.Title; } ltlMobile.Text = contentInfo.Mobile; ltlEmail.Text = contentInfo.Email; ltlAddDate.Text = DateUtils.GetDateAndTimeString(contentInfo.AddDate); ltlStatus.Text = EAppointmentStatusUtils.GetText(EAppointmentStatusUtils.GetEnumType(contentInfo.Status)); ltlMessage.Text = contentInfo.Message; ltlEditUrl.Text = $@"<a href=""javascrip:;"" onclick=""{ModalAppointmentHandle.GetOpenWindowStringToSingle( PublishmentSystemId, contentInfo.Id)}"">预约处理</a>"; ltlSelectUrl.Text = $@"<a href=""javascrip:;"" onclick=""{ModalAppointmentContentDetail.GetOpenWindowStringToSingle( PublishmentSystemId, contentInfo.Id)}"">预约详情</a>"; } }
public AppointmentItemInfo GetItemInfo(int appointmentItemID) { AppointmentItemInfo appointmentItemInfo = null; string SQL_WHERE = $"WHERE ID = {appointmentItemID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { if (rdr.Read()) { appointmentItemInfo = new AppointmentItemInfo(rdr); } rdr.Close(); } return(appointmentItemInfo); }
public AppointmentItemInfo GetItemInfo(int appointmentItemId) { AppointmentItemInfo appointmentItemInfo = null; string sqlWhere = $"WHERE ID = {appointmentItemId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { appointmentItemInfo = new AppointmentItemInfo(rdr); } rdr.Close(); } return(appointmentItemInfo); }
public List <AppointmentItemInfo> GetAppointmentItemInfoList(int publishmentSystemID) { var list = new List <AppointmentItemInfo>(); string SQL_WHERE = $"WHERE {AppointmentItemAttribute.PublishmentSystemID} = {publishmentSystemID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var appointmentItemInfo = new AppointmentItemInfo(rdr); list.Add(appointmentItemInfo); } rdr.Close(); } return(list); }
public List <AppointmentItemInfo> GetAppointmentItemInfoList(int publishmentSystemId) { var list = new List <AppointmentItemInfo>(); string sqlWhere = $"WHERE {AppointmentItemAttribute.PublishmentSystemId} = {publishmentSystemId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var appointmentItemInfo = new AppointmentItemInfo(rdr); list.Add(appointmentItemInfo); } rdr.Close(); } return(list); }
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 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 = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(TbKeywords.Text)) { if (_appointmentId > 0) { var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, appointmentInfo.KeywordId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); } else { PhStep2.Visible = true; } } else if (selectedStep == 2) { var isItemReady = true; var appointmentItemInfo = new AppointmentItemInfo(); appointmentItemInfo.PublishmentSystemId = PublishmentSystemId; if (_appointmentItemId > 0) { appointmentItemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(_appointmentItemId); } appointmentItemInfo.AppointmentId = _appointmentId; appointmentItemInfo.Title = PageUtils.FilterXss(TbItemTitle.Text); appointmentItemInfo.TopImageUrl = TopImageUrl.Value; appointmentItemInfo.IsDescription = CbIsDescription.Checked; appointmentItemInfo.DescriptionTitle = TbDescriptionTitle.Text; appointmentItemInfo.Description = TbDescription.Text; appointmentItemInfo.IsImageUrl = CbIsImageUrl.Checked; appointmentItemInfo.ImageUrlTitle = TbImageUrlTitle.Text; appointmentItemInfo.ImageUrl = TbContentImageUrl.Text; appointmentItemInfo.IsVideoUrl = CbIsVideoUrl.Checked; appointmentItemInfo.VideoUrlTitle = TbVideoUrlTitle.Text; appointmentItemInfo.VideoUrl = TbContentVideoUrl.Text; appointmentItemInfo.IsImageUrlCollection = CbIsImageUrlCollection.Checked; appointmentItemInfo.ImageUrlCollectionTitle = TbImageUrlCollectionTitle.Text; appointmentItemInfo.ImageUrlCollection = ImageUrlCollection.Value; appointmentItemInfo.LargeImageUrlCollection = LargeImageUrlCollection.Value; appointmentItemInfo.IsMap = CbIsMap.Checked; appointmentItemInfo.MapTitle = TbMapTitle.Text; appointmentItemInfo.MapAddress = TbMapAddress.Text; appointmentItemInfo.IsTel = CbIsTel.Checked; appointmentItemInfo.TelTitle = TbTelTitle.Text; appointmentItemInfo.Tel = TbTel.Text; try { if (_appointmentItemId > 0) { DataProviderWx.AppointmentItemDao.Update(appointmentItemInfo); Body.AddSiteLog(PublishmentSystemId, "修改预约项目", $"预约项目:{TbTitle.Text}"); } else { _appointmentItemId = DataProviderWx.AppointmentItemDao.Insert(appointmentItemInfo); Body.AddSiteLog(PublishmentSystemId, "新增预约项目", $"预约项目:{TbTitle.Text}"); } } catch (Exception ex) { isItemReady = false; FailMessage(ex, "微预约项目设置失败!"); } if (isItemReady) { PhStep3.Visible = true; } else { PhStep2.Visible = true; } } else if (selectedStep == 3) { var isItemReady = true; var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); var itemIdList = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]); var attributeNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemAttributeName"]); var itemIsVisible = "off"; if (!string.IsNullOrEmpty(Request.Form["itemIsVisible"])) { itemIsVisible = Request.Form["itemIsVisible"]; } var isVisibleList = TranslateUtils.StringCollectionToStringList(itemIsVisible); if (isVisibleList.Count < itemIdList.Count) { for (var i = isVisibleList.Count; i < itemIdList.Count; i++) { isVisibleList.Add("off"); } } var configExtendInfoList = new List <ConfigExtendInfo>(); for (var i = 0; i < itemCount; i++) { var configExtendInfo = new ConfigExtendInfo { Id = itemIdList[i], PublishmentSystemId = PublishmentSystemId, KeywordType = EKeywordTypeUtils.GetValue(EKeywordType.Appointment), FunctionId = _appointmentId, AttributeName = attributeNameList[i], IsVisible = isVisibleList[i] }; if (string.IsNullOrEmpty(configExtendInfo.AttributeName)) { FailMessage("保存失败,属性名称为必填项"); isItemReady = false; } if (string.IsNullOrEmpty(configExtendInfo.IsVisible)) { FailMessage("保存失败,是否必填为显示项"); isItemReady = false; } if (configExtendInfo.IsVisible == "on") { configExtendInfo.IsVisible = "True"; } else { configExtendInfo.IsVisible = "False"; } configExtendInfoList.Add(configExtendInfo); } if (isItemReady) { DataProviderWx.ConfigExtendDao.DeleteAllNotInIdList(PublishmentSystemId, _appointmentId, itemIdList); foreach (var configExtendInfo in configExtendInfoList) { if (configExtendInfo.Id > 0) { DataProviderWx.ConfigExtendDao.Update(configExtendInfo); } else { DataProviderWx.ConfigExtendDao.Insert(configExtendInfo); } } } if (isItemReady) { PhStep4.Visible = true; BtnSubmit.Text = "确 认"; } else { PhStep3.Visible = true; } } else if (selectedStep == 4) { var appointmentInfo = new AppointmentInfo(); appointmentInfo.PublishmentSystemId = PublishmentSystemId; if (_appointmentId > 0) { appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId); DataProviderWx.KeywordDao.Update(PublishmentSystemId, appointmentInfo.KeywordId, EKeywordType.Appointment, EMatchType.Exact, TbKeywords.Text, !CbIsEnabled.Checked); } else { var keywordInfo = new KeywordInfo(); keywordInfo.KeywordId = 0; keywordInfo.PublishmentSystemId = PublishmentSystemId; keywordInfo.Keywords = TbKeywords.Text; keywordInfo.IsDisabled = !CbIsEnabled.Checked; keywordInfo.KeywordType = EKeywordType.Appointment; keywordInfo.MatchType = EMatchType.Exact; keywordInfo.Reply = string.Empty; keywordInfo.AddDate = DateTime.Now; keywordInfo.Taxis = 0; appointmentInfo.KeywordId = DataProviderWx.KeywordDao.Insert(keywordInfo); } appointmentInfo.StartDate = DtbStartDate.DateTime; appointmentInfo.EndDate = DtbEndDate.DateTime; appointmentInfo.Title = TbTitle.Text; appointmentInfo.ImageUrl = ImageUrl.Value; appointmentInfo.ContentResultTopImageUrl = ResultTopImageUrl.Value; appointmentInfo.Summary = TbSummary.Text; appointmentInfo.ContentIsSingle = true; appointmentInfo.EndTitle = TbEndTitle.Text; appointmentInfo.EndImageUrl = EndImageUrl.Value; appointmentInfo.EndSummary = TbEndSummary.Text; appointmentInfo.IsFormRealName = CbIsFormRealName.Checked ? "True" : "False"; appointmentInfo.FormRealNameTitle = TbFormRealNameTitle.Text; appointmentInfo.IsFormMobile = CbIsFormMobile.Checked ? "True" : "False"; appointmentInfo.FormMobileTitle = TbFormMobileTitle.Text; appointmentInfo.IsFormEmail = CbIsFormEmail.Checked ? "True" : "False"; appointmentInfo.FormEmailTitle = TbFormEmailTitle.Text; try { if (_appointmentId > 0) { DataProviderWx.AppointmentDao.Update(appointmentInfo); Body.AddSiteLog(PublishmentSystemId, "修改微预约", $"微预约:{TbTitle.Text}"); SuccessMessage("修改微预约成功!"); } else { _appointmentId = DataProviderWx.AppointmentDao.Insert(appointmentInfo); DataProviderWx.AppointmentItemDao.UpdateAppointmentId(PublishmentSystemId, _appointmentId); DataProviderWx.ConfigExtendDao.UpdateFuctionId(PublishmentSystemId, _appointmentId); Body.AddSiteLog(PublishmentSystemId, "添加微预约", $"微预约:{TbTitle.Text}"); SuccessMessage("添加微预约成功!"); } AddWaitAndRedirectScript(PageAppointment.GetRedirectUrl(PublishmentSystemId)); } catch (Exception ex) { FailMessage(ex, "微预约设置失败!"); } BtnSubmit.Visible = false; BtnReturn.Visible = false; } } }