Пример #1
0
        /// <summary>
        /// 查询分类属性
        /// </summary>
        /// <param name="model"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="SortField"></param>
        /// <param name="callback"></param>
        public void QueryProductChannelInfo(ProductChannelQueryVM model, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            ProductChannelInfoQueryFilter filter = model.ConvertVM <ProductChannelQueryVM, ProductChannelInfoQueryFilter>();

            filter.PagingInfo = new PagingInfo
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };


            restClient.QueryDynamicData(GetRelativeUrl, filter,
                                        (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                if (!(args.Result == null || args.Result.Rows == null))
                {
                    foreach (var item in args.Result.Rows)
                    {
                        item.IsChecked = false;
                    }
                }
                callback(obj, args);
            }
                                        );
        }
Пример #2
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            model = (ProductChannelQueryVM)this.DataContext;

            if (this.model.ChannelSysNo > 0)
            {
                var ucPicker = new UCProductSearch();
                ucPicker.SelectionMode = SelectionMode.Multiple;
                ucPicker.DialogHandler = CPApplication.Current.CurrentPage.Context.Window.ShowDialog("选择商品", ucPicker, (obj, args) =>
                {
                    if (args.DialogResult == DialogResultType.OK)
                    {
                        if (args.Data != null)
                        {
                            var selectedProductList = args.Data as List <Basic.Components.UserControls.ProductPicker.ProductVM>;

                            List <ProductChannelInfo> productList = new List <ProductChannelInfo>();

                            selectedProductList.ForEach(p => productList.Add(new ProductChannelInfo {
                                ChannelInfo = new ChannelInfo {
                                    SysNo = this.model.ChannelSysNo
                                }
                                , ProductSysNo = p.SysNo
                                , ProductID    = p.ProductID
                                , CreateUser   = new UserInfo {
                                    SysNo             = CPApplication.Current.LoginUser.userSysNo
                                    , UserName        = CPApplication.Current.LoginUser.LoginName
                                    , UserDisplayName = CPApplication.Current.LoginUser.DisplayName
                                }
                            }));

                            var facade = new ProductChannelInfoFacade(this);

                            facade.CreateProductChannelInfo(productList, (o, a) =>
                            {
                                if (a.FaultsHandle())
                                {
                                    dgProductChannelQueryResult.Bind();
                                    return;
                                }
                            });
                        }
                    }
                });
            }
            else
            {
                Window.Alert("请先选择渠道!", MessageType.Information);
                return;
            }
        }
Пример #3
0
        private void dgProductChannelQueryResult_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            ProductChannelInfoQueryFacade facade = new ProductChannelInfoQueryFacade(this);

            model = (ProductChannelQueryVM)this.DataContext;
            facade.QueryProductChannelInfo(model, e.PageSize, e.PageIndex, e.SortField, (obj, args) =>
            {
                var list = new List <dynamic>();
                foreach (var row in args.Result.Rows)
                {
                    list.Add(row);
                }

                this.dgProductChannelQueryResult.ItemsSource = list;
                this.dgProductChannelQueryResult.TotalCount  = args.Result.TotalCount;
            });
            cbDemo.IsChecked = false;
        }
Пример #4
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            model = new ProductChannelQueryVM();

            ProductChannelInfoFacade facade = new ProductChannelInfoFacade();

            facade.GetChannelInfoList((obj, arg) =>
            {
                if (arg.FaultsHandle())
                {
                    return;
                }
                model.ChannelList = arg.Result;

                model.ChannelList.Insert(0, new ChannelInfo()
                {
                    SysNo = 0, ChannelName = "所有"
                });

                this.DataContext = model;
                cbChannelProductStatus.SelectedIndex = 0;
            });
        }