/// <summary> /// 编辑热门搜索关键字 /// </summary> /// <param name="item"></param> public void EditHotSearchKeywords(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_UpdateHotKeywordsInfo"); dc.SetParameterValue <HotSearchKeyWords>(item); dc.ExecuteNonQuery(); }
/// <summary> /// 添加热门搜索关键字-不显示状态 /// </summary> /// <param name="item"></param> public void InsertHotKeywordsInfoHidder(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_InsertHotKeywordsInfoHidder"); dc.SetParameterValue <HotSearchKeyWords>(item); dc.ExecuteNonQuery(); }
/// <summary> /// 添加热门搜索关键字for SearchKeyword /// </summary> /// <param name="item"></param> public void AddHotSearchKeywordsForSearch(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_InsertSearchKeywordForHotKeyword"); dc.SetParameterValue <HotSearchKeyWords>(item); dc.ExecuteNonQuery(); }
/// <summary> /// 判断在同后台类别的前台类别下,是否有相同名称的关键字 /// </summary> /// <param name="item"></param> /// <returns></returns> public int IsSameNameHotSearchKeyword(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_IsSameNameHotSearchKeyword"); dc.SetParameterValue <HotSearchKeyWords>(item); return(dc.ExecuteScalar <int>()); }
/// <summary> /// 扩展生效功能 /// 操作同类后的记录,无则修改,有则增加 /// </summary> /// <param name="item"></param> /// <returns></returns> public void OperExpandECCategoryHotSearchKeyword(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_OperExpandEC_CategoryHotSearchKeyword"); dc.SetParameterValue <HotSearchKeyWords>(item); dc.ExecuteNonQuery(); }
/// <summary> /// 编辑热门搜索关键字 /// </summary> /// <param name="item"></param> public virtual void EditHotSearchKeywords(HotSearchKeyWords item) { List <HotSearchKeyWords> list = keywordDA.GetHotKeywordsEditByKeyword(item); if (list.Count < 1) { if (!item.SysNo.HasValue) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_InputValueISNull")); } if (!item.PageID.HasValue) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_NeedSelectTheCategory")); } else if (item.IsOnlineShow.HasValue && item.IsOnlineShow == NYNStatus.Yes && !keywordDA.GetHotKeywordsMaxLenthBySysNo(item)) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } else { keywordDA.EditHotSearchKeywords(item); } } else { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_ExsitTheSameInfo")); } }
/// <summary> /// 获取热门关键字的最大长度 /// </summary> /// <param name="item"></param> /// <returns></returns> public int GetHotKeywordsMaxLenth(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keywords_GetHotKeywordsMaxLenth"); dc.SetParameterValue <HotSearchKeyWords>(item); DataTable dt = dc.ExecuteDataTable(); return(int.Parse(dt.Rows[0][0].ToString())); }
/// <summary> /// 适用底层类别,扩展生效判断 /// 根据PageID,查询相同的C3前台类别SysNO /// </summary> /// <param name="item"></param> /// <returns></returns> public List <HotSearchKeyWords> GetOtherHotSearchKeywordECCategoryList(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_GetOtherHotSearchKeywordEC_CategoryList"); dc.SetParameterValue <HotSearchKeyWords>(item); DataTable dt = dc.ExecuteDataTable(); return(dc.ExecuteEntityList <HotSearchKeyWords>()); }
/// <summary> /// 加载热门搜索关键字 /// </summary> /// <param name="sysNo"></param> /// <returns></returns> public HotSearchKeyWords LoadHotSearchKeywords(int sysNo) { DataCommand dc = DataCommandManager.GetDataCommand("InsertCustomerRight"); dc.SetParameterValue("@SysNo", sysNo); DataTable dt = dc.ExecuteDataTable(); HotSearchKeyWords keywords = new HotSearchKeyWords(); keywords = DataMapper.GetEntity <HotSearchKeyWords>(dt.Rows[0]); keywords.Keywords = new LanguageContent("zh-CN", dt.Rows[0]["Keywords"].ToString().Trim()); return(keywords); }
/// <summary> /// 根据关键字获取类似的关键字列表 /// </summary> /// <param name="item"></param> /// <returns></returns> public List <string> GetSearchedKeywordsInfoByKeyword(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_GetSearchedKeywordsInfoByKeyword"); dc.SetParameterValue <HotSearchKeyWords>(item); DataTable dt = dc.ExecuteDataTable(); List <string> list = new List <string>(); foreach (DataRow dr in dt.Rows) { list.Add(dr[0].ToString()); } return(list); }
/// <summary> /// 预览 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hlViewItem_Click(object sender, RoutedEventArgs e) { HotKeywordsVM vm = QueryResultGrid.SelectedItem as HotKeywordsVM; HotKeywordsVM vmItem = gridVM.SingleOrDefault(a => a.SysNo.Value == vm.SysNo.Value); HotSearchKeyWords item = EntityConvertorExtensions.ConvertVM <HotKeywordsVM, HotSearchKeyWords>(vmItem, (v, t) => { t.Keywords = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.Keywords); }); UCViewHotSearchKeywords usercontrol = new UCViewHotSearchKeywords(); usercontrol.Model = item; usercontrol.Dialog = Window.ShowDialog(ResKeywords.Title_ReviewHotKeywords, usercontrol, OnMaintainDialogResult); }
/// <summary> /// /// </summary> /// <param name="item"></param> /// <returns></returns> public List <HotSearchKeyWords> GetHotKeywordsEditByKeyword(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keyword_GetHotKeywordsEditByKeyword"); dc.SetParameterValue <HotSearchKeyWords>(item); DataTable dt = dc.ExecuteDataTable(); List <HotSearchKeyWords> list = new List <HotSearchKeyWords>(); foreach (DataRow dr in dt.Rows) { list.Add(DataMapper.GetEntity <HotSearchKeyWords>(dr)); } return(list); }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (!ValidationManager.Validate(this.LayoutRoot)) { return; } HotSearchKeyWords item = EntityConvertorExtensions.ConvertVM <HotKeywordsVM, HotSearchKeyWords>(VM, (v, t) => { t.Keywords = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.Keywords); }); item.CompanyCode = CPApplication.Current.CompanyCode; item.PageType = this.ucPageType.PageType; item.PageID = this.ucPageType.PageID ?? 0; item.Extend = this.ucPageType.IsExtendValid; if (!VM.SysNo.HasValue) { facade.AddHotSearchKeywords(item, (obj, args) => { if (args.FaultsHandle()) { return; } CloseDialog(DialogResultType.OK); CPApplication.Current.CurrentPage.Context.Window.Alert(ResKeywords.Information_CreateSuccessful, MessageType.Information); }); } else { facade.EditHotSearchKeywords(item, (obj, args) => { if (args.FaultsHandle()) { return; } CloseDialog(DialogResultType.OK); CPApplication.Current.CurrentPage.Context.Window.Alert(ResKeywords.Information_UpdateSuccessful, MessageType.Information); }); } }
/// <summary> /// 获取热门关键字的最大长度,根据已经存在的关键字 /// </summary> /// <param name="item"></param> /// <returns></returns> public bool GetHotKeywordsMaxLenthBySysNo(HotSearchKeyWords item) { DataCommand dc = DataCommandManager.GetDataCommand("Keywords_CheckKeywordMaxLenthBySysNo"); dc.SetParameterValue <HotSearchKeyWords>(item); DataTable dt = dc.ExecuteDataTable(); StringBuilder maxKeywords = new StringBuilder(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { maxKeywords.Append(dr[0].ToString()); } } maxKeywords.Append(item.Keywords.Content); if (maxKeywords.ToString().Length > 41) { return(false); } return(true); }
/// <summary> /// 添加热门搜索关键字 /// </summary> /// <param name="item"></param> public virtual void AddHotSearchKeywords(HotSearchKeyWords item) { item.PageID = string.IsNullOrEmpty(item.PageID.ToString()) ? 0 : item.PageID.Value; List <string> list = new List <string>(); if (item.IsOnlineShow == ECCentral.BizEntity.MKT.NYNStatus.Yes) { list = keywordDA.GetHotKeywordsInfoByKeyword(item); } else { list = keywordDA.GetHotKeywordsInfoByKeywordbyTrue(item); } bool bMaxLen = keywordDA.GetHotKeywordsMaxLenthBySysNo(item); if (list.Count < 1) { if (item.PageType == 0 || item.PageType > 100) { List <string> listByKeyword = keywordDA.GetSearchedKeywordsInfoByKeyword(item); if (listByKeyword.Count < 1) { if (!bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } else { keywordDA.AddHotSearchKeywordsForSearch(item); } } if (item.IsOnlineShow == ECCentral.BizEntity.MKT.NYNStatus.Yes && !bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } if (item.IsOnlineShow == ECCentral.BizEntity.MKT.NYNStatus.Yes) { keywordDA.AddHotSearchKeywords(item); } else { keywordDA.InsertHotKeywordsInfoHidder(item); } } else if (item.PageType == 3) //如果是底层类别才有扩展生效处理 { #region 如果是底层类别才有扩展生效处理 if (!item.PageID.HasValue) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_NeedSelectTheCategory")); } if (!bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } if (item.IsOnlineShow == ECCentral.BizEntity.MKT.NYNStatus.No) { keywordDA.InsertHotKeywordsInfoHidder(item); } else { keywordDA.AddHotSearchKeywords(item); } //判断搜索关键字是否有同名的 List <string> listByKeyword = keywordDA.GetSearchedKeywordsInfoByKeyword(item); if (listByKeyword.Count < 1) { if (!bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } else { keywordDA.AddHotSearchKeywordsForSearch(item); } } //如果选择了“扩展生效”执行以下逻辑 if (item.Extend.HasValue && item.Extend.Value) {//查询C3相同的前台类别数据 List <HotSearchKeyWords> listByExtend = keywordDA.GetOtherHotSearchKeywordECCategoryList(item); if (listByExtend.Count > 0) { foreach (HotSearchKeyWords keyword in listByExtend) { item.PageID = keyword.PageID.Value; int sameNameSum = 0; sameNameSum = keywordDA.IsSameNameHotSearchKeyword(item); //如果在该前台类别下有同名的关键字,则不执行以下逻辑 if (sameNameSum <= 0) { bool bMaxLenExpand = keywordDA.GetHotKeywordsMaxLenthBySysNo(item); if (bMaxLenExpand) { keywordDA.OperExpandECCategoryHotSearchKeyword(item); } } } } } #endregion } else { #region other if (!item.PageID.HasValue) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_NeedSelectTheCategory")); } else { if (!item.PageID.HasValue) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_NeedSelectTheCategory")); } if (!bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } if (item.IsOnlineShow == ECCentral.BizEntity.MKT.NYNStatus.No) { keywordDA.InsertHotKeywordsInfoHidder(item); } else { keywordDA.AddHotSearchKeywords(item); } //判断搜索关键字是否有同名的 List <string> listByKeyword = keywordDA.GetSearchedKeywordsInfoByKeyword(item); if (listByKeyword.Count < 1) { if (!bMaxLen) { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_TheKeywordsLengthLessThan")); } else { keywordDA.AddHotSearchKeywordsForSearch(item); } } } #endregion } } else { throw new BizException(ResouceManager.GetMessageString("MKT.Keywords", "Keywords_ExsitTheSameInfo")); } }
/// <summary> /// 预览关键字 /// </summary> /// <param name="item"></param> /// <returns></returns> public virtual List <string> GetHotKeywordsListByPageType(HotSearchKeyWords item) { return(keywordDA.GetHotKeywordsListByPageType(item)); }
/// <summary> /// 编辑热门搜索关键字 /// </summary> /// <param name="item"></param> public virtual void EditHotSearchKeywords(HotSearchKeyWords item) { ObjectFactory <HotKeywordsProcessor> .Instance.EditHotSearchKeywords(item); }
/// <summary> /// 获取热门关键字编辑人员列表 /// </summary> /// <param name="item"></param> /// <param name="callback"></param> public void GetHotKeywordsListByPageType(HotSearchKeyWords item, EventHandler <RestClientEventArgs <List <string> > > callback) { string relativeUrl = "/MKTService/KeywordsInfo/GetHotKeywordsListByPageType"; restClient.Query <List <string> >(relativeUrl, item, callback); }
/// <summary> /// 更新热门关键字 /// </summary> /// <param name="item"></param> /// <param name="callback"></param> public void EditHotSearchKeywords(HotSearchKeyWords item, EventHandler <RestClientEventArgs <dynamic> > callback) { string relativeUrl = "/MKTService/KeywordsInfo/EditHotSearchKeywords"; restClient.Update(relativeUrl, item, callback); }
public virtual void EditHotSearchKeywords(HotSearchKeyWords item) { hotKeywordsAppService.EditHotSearchKeywords(item); }
public virtual List <string> GetHotKeywordsListByPageType(HotSearchKeyWords item) { return(hotKeywordsAppService.GetHotKeywordsListByPageType(item)); }
/// <summary> /// 预览关键字 /// </summary> /// <param name="item"></param> /// <returns></returns> public virtual List <string> GetHotKeywordsListByPageType(HotSearchKeyWords item) { return(ObjectFactory <HotKeywordsProcessor> .Instance.GetHotKeywordsListByPageType(item)); }