private void btnSave_Click(object sender, RoutedEventArgs e) { vm = LayoutRoot.DataContext as StopWordsQueryVM; //StopWordsInfo item = vm.ConvertVM<StopWordsQueryVM, StopWordsInfo>(); if (!ValidationManager.Validate(this.LayoutRoot)) { return; } if (string.IsNullOrEmpty(vm.Keywords)) { CPApplication.Current.CurrentPage.Context.Window.Alert("阻止词内容不能为空!", MessageType.Error); return; } StopWordsInfo item = EntityConvertorExtensions.ConvertVM <StopWordsQueryVM, StopWordsInfo>(vm, (v, t) => { t.Keywords = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.Keywords); }); item.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode; facade.AddStopWordsInfo(item, (obj, args) => { if (args.FaultsHandle()) { return; } CPApplication.Current.CurrentPage.Context.Window.Alert(ResKeywords.Information_CreateSuccessful, Newegg.Oversea.Silverlight.Controls.Components.MessageType.Information); }); }
private void UCAddStopWords_Loaded(object sender, RoutedEventArgs e) { Loaded -= new RoutedEventHandler(UCAddStopWords_Loaded); facade = new StopWordsQueryFacade(CPApplication.Current.CurrentPage); if (SysNo > 0) { facade.LoadStopWordsInfo(SysNo, (obj, args) => { if (args.FaultsHandle()) { return; } vm = args.Result.Convert <StopWordsInfo, StopWordsQueryVM>(); vm.ChannelID = "1"; LayoutRoot.DataContext = vm; }); } else { vm = new StopWordsQueryVM(); vm.ChannelID = "1"; vm.Status = ADTStatus.Active; LayoutRoot.DataContext = vm; } }
public override void OnPageLoad(object sender, EventArgs e) { facade = new StopWordsQueryFacade(this); filter = new StopWordsQueryFilter(); model = new StopWordsQueryVM(); model.ChannelID = "1"; model.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode; QuerySection.DataContext = model; cbShowComment.ItemsSource = EnumConverter.GetKeyValuePairs <ADTStatus>(EnumConverter.EnumAppendItemType.All); base.OnPageLoad(sender, e); }
/// <summary> /// 单个编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hlUpdate_Click(object sender, RoutedEventArgs e) { StopWordsQueryVM vm = this.QueryResultGrid.SelectedItem as StopWordsQueryVM; StopWordsInfo item = EntityConvertorExtensions.ConvertVM <StopWordsQueryVM, StopWordsInfo>(vm, (v, t) => { t.Keywords = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.Keywords); }); List <StopWordsInfo> list = new List <StopWordsInfo>(); list.Add(item); facade.BatchUpdateStopWords(list, (obj, args) => { if (args.FaultsHandle()) { return; } Window.Alert(ResKeywords.Information_UpdateSuccessful, Newegg.Oversea.Silverlight.Controls.Components.MessageType.Information); QueryResultGrid.Bind(); }); }