示例#1
0
 void UCHomePageSectionMaintain_Loaded(object sender, RoutedEventArgs e)
 {
     if (_isEditing)
     {
         var maintainFacade = new HomePageSectionFacade(CPApplication.Current.CurrentPage);
         maintainFacade.Load(_editingSysNo.ToString(), (s, args) =>
         {
             if (args.FaultsHandle())
             {
                 return;
             }
             _maintainVM = args.Result.Convert <HomePageSectionInfo, HomePageSectionMaintainVM>((info, vm) =>
             {
                 if (info.WebChannel != null)
                 {
                     vm.ChannelID = info.WebChannel.ChannelID;
                 }
             });
             this.DataContext = _maintainVM;
             LoadComboxData();
         });
     }
     else
     {
         _maintainVM      = new HomePageSectionMaintainVM();
         this.DataContext = _maintainVM;
         LoadComboxData();
     }
 }
示例#2
0
        private void DataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            //1.初始化查询条件
            //2.请求服务查询
            PagingInfo p = new PagingInfo
            {
                PageIndex = e.PageIndex,
                PageSize = e.PageSize,
                SortBy = e.SortField
            };
            HomePageSectionFacade facade = new HomePageSectionFacade(this);
            facade.Query(_queryVM, p, (s, args) =>
            {
                if (args.FaultsHandle())
                    return;

                this.DataGrid.ItemsSource = args.Result.Rows;
                this.DataGrid.TotalCount = args.Result.TotalCount;
            });
        }
示例#3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this))
            {
                return;
            }
            if (_maintainVM.C1List.Contains(","))
            {
                CurrentWindow.Alert(@"不能包含中文"",""", MessageType.Error);
                return;
            }
            var maintainFacade = new HomePageSectionFacade(CPApplication.Current.CurrentPage);

            if (_isEditing)
            {
                maintainFacade.Update(_maintainVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentWindow.Alert(ResHomePageSection.Info_EditSuccess);
                    CloseDialog(DialogResultType.OK);
                });
            }
            else
            {
                maintainFacade.Create(_maintainVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentWindow.Alert(ResHomePageSection.Info_AddSuccess);
                    CloseDialog(DialogResultType.OK);
                });
            }
        }