コード例 #1
0
        public UCHotSaleCategoryMaintain(int currentSysNo)
        {
            InitializeComponent();

            this.lstChannelList.ItemsSource = CPApplication.Current.CurrentWebChannelList.ToList <UIWebChannel>();
            this.rbInvalid.Content          = EnumConverter.GetDescription(ADStatus.Deactive, typeof(ADStatus));
            this.rbValid.Content            = EnumConverter.GetDescription(ADStatus.Active, typeof(ADStatus));

            this.ucPageType.PageTypeLoadCompleted     += new EventHandler(ucPageType_PageTypeLoadCompleted);
            this.ucPageType.PagePositionLoadCompleted += new EventHandler(ucPageType_PagePositionLoadCompleted);
            if (currentSysNo > 0)
            {
                //当前界面正在编辑模式,加载数据
                _isEditing = true;
                var hotSaleCategoryFacade = new HotSaleCategoryFacade(CPApplication.Current.CurrentPage);
                hotSaleCategoryFacade.Load(currentSysNo, (vm) =>
                {
                    this.ucCategoeyPicker.LoadCategoryCompleted += new EventHandler <EventArgs>(ucCategoeyPicker_LoadCategoryCompleted);
                    _currentVM       = vm;
                    this.DataContext = _currentVM;
                    //cbUpdateSameGroupAl.Visibility = System.Windows.Visibility.Visible;
                });
                this.btnCreate.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                _isEditing       = false;
                _currentVM       = new HotSaleCategoryVM();
                this.DataContext = _currentVM;
                this.lstChannelList.SelectedIndex = 0;
                this.btnCreate.Visibility         = System.Windows.Visibility.Collapsed;
            }
        }
コード例 #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
            };

            _queryVM.PageType = this.ucPageType.PageType;
            HotSaleCategoryFacade facade = new HotSaleCategoryFacade(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)
        {
            Button button = sender as Button;

            if (button != null && button.Name == "btnCreate")
            {
                _isEditing       = false;
                _currentVM.SysNo = 0;
            }


            //输入验证不通过,则直接返回
            if (!ValidationManager.Validate(this))
            {
                return;
            }
            if (this.ucPageType.PageType == null)
            {
                CurrentWindow.Alert(ResHotSaleCategory.Info_PleaseSelectPageType);
                return;
            }
            _currentVM.PageType = this.ucPageType.PageType.Value;
            if (this.lstPosition.SelectedValue == null)
            {
                CurrentWindow.Alert(ResHotSaleCategory.Info_PleaseSelectPosition);
                return;
            }
            _currentVM.Position = int.Parse(this.lstPosition.SelectedValue.ToString());
            if (this.ucCategoeyPicker.ChooseCategory3SysNo == null)
            {
                CurrentWindow.Alert(ResHotSaleCategory.Info_PleaseSelectC3);
                return;
            }
            _currentVM.C3SysNo = this.ucCategoeyPicker.ChooseCategory3SysNo;
            var hotSaleCategoryFacade = new HotSaleCategoryFacade(CPApplication.Current.CurrentPage);

            if (_isEditing)
            {
                //编辑
                hotSaleCategoryFacade.Update(_currentVM, this.cbUpdateSameGroupAl.IsChecked, () =>
                {
                    CurrentWindow.Alert(ResHotSaleCategory.Info_EditSuccess);
                    CloseDialog(DialogResultType.OK);
                });
            }
            else
            {
                //新建
                hotSaleCategoryFacade.Create(_currentVM, () =>
                {
                    CurrentWindow.Alert(ResHotSaleCategory.Info_AddSuccess);
                    CloseDialog(DialogResultType.OK);
                });
            }
        }