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;
            }
        }
        private HotSaleCategory ConvertVMToEntity(HotSaleCategoryVM vm)
        {
            var data = vm.ConvertVM <HotSaleCategoryVM, HotSaleCategory>();

            data.CompanyCode = CPApplication.Current.CompanyCode;
            data.WebChannel  = new WebChannel
            {
                ChannelID = vm.ChannelID
            };

            return(data);
        }
        public void Create(HotSaleCategoryVM vm, Action cb)
        {
            var    data        = ConvertVMToEntity(vm);
            string relativeUrl = "/MKTService/HotSaleCategory/Insert";

            restClient.Create <object>(relativeUrl, data, (s, args) =>
            {
                if (args.FaultsHandle() || cb == null)
                {
                    return;
                }
                cb();
            });
        }
        public void Update(HotSaleCategoryVM vm, bool?updateSameGroupAll, Action cb)
        {
            var data = ConvertVMToEntity(vm);

            string relativeUrl = "/MKTService/HotSaleCategory/Update";

            if (updateSameGroupAll.HasValue && updateSameGroupAll.Value == true)
            {
                relativeUrl = "/MKTService/HotSaleCategory/UpdateSameGroupAll";
            }
            restClient.Update(relativeUrl, data, (s, args) =>
            {
                if (args.FaultsHandle() || cb == null)
                {
                    return;
                }
                cb();
            });
        }