コード例 #1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this.LayoutRoot))
            {
                return;
            }

            if (string.IsNullOrEmpty(VM.ProductSysNo))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("请选择商品!");
                return;
            }
            if (string.IsNullOrEmpty(VM.Priority))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("优先级不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(VM.Keywords))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("请输入关键字!");
                return;
            }


            ProductKeywordsInfo item = EntityConvertorExtensions.ConvertVM <KeyWordsForProductQueryVM, ProductKeywordsInfo>(VM, (v, t) =>
            {
                t.Keywords = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.Keywords);
            });

            item.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
            if (isAdd)
            {
                item.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
                facade.AddProductKeywords(item, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResKeywords.Information_CreateSuccessful, Newegg.Oversea.Silverlight.Controls.Components.MessageType.Information);
                });
            }
            else
            {
                facade.EditProductKeywords(item, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResKeywords.Information_UpdateSuccessful, Newegg.Oversea.Silverlight.Controls.Components.MessageType.Information);
                });
            }
        }