コード例 #1
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            _filter   = new GiftCardProductFilter();
            _filterVM = new GiftCardProductFilterVM();

            _facade       = new GiftCardFacade(this);
            selectedSysNo = new List <int>();

            this.filtergd.DataContext = _filterVM;
        }
コード例 #2
0
ファイル: GiftCardFacade.cs プロジェクト: sanlonezhang/ql
        public void QueryGiftCardProduct(GiftCardProductFilterVM vm, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            GiftCardProductFilter filter = vm.ConvertVM <GiftCardProductFilterVM, GiftCardProductFilter>();

            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };
            string relativeUrl = "/IMService/GiftCardInfo/QueryGiftCardProductInfo";

            restClient.QueryDynamicData(relativeUrl, filter, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                callback(obj, args);
            });
        }
コード例 #3
0
ファイル: GiftCardFacade.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 查询礼品券关联商品
        /// </summary>
        /// <param name="vm"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="SortField"></param>
        /// <param name="callback"></param>
        public void QueryGiftVoucherProductRelation(GiftCardProductFilterVM vm, int PageSize, int PageIndex, string SortField,
                                                    Action <ObservableCollection <GiftVoucherProductRelationVM>, int> callback)
        {
            GiftCardProductFilter filter = vm.ConvertVM <GiftCardProductFilterVM, GiftCardProductFilter>();

            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };
            string relativeUrl = "/IMService/GiftCardInfo/QueryGiftVoucherProductRelation";

            restClient.QueryDynamicData(relativeUrl, filter, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                ObservableCollection <GiftVoucherProductRelationVM> result = DynamicConverter <GiftVoucherProductRelationVM>
                                                                             .ConvertToVMList <ObservableCollection <GiftVoucherProductRelationVM> >(args.Result.Rows);

                foreach (var item in result)
                {
                    foreach (var source in args.Result.Rows.ToList())
                    {
                        if (source.SysNo == item.SysNo)
                        {
                            item.RelationStatus = source.Status;
                            //add by cesc 2013-10-30
                            //如果不将请求类型'删除'手动更改,每次点页面上的'保存'按钮时,会将未审核通过的请求加载出来
                            if (item.Type == GVRReqType.Delete)
                            {
                                item.Type = null;
                            }
                        }
                    }
                }

                if (result.Count > 0)
                {
                    // 根据商品编号获取商品信息
                    PagingInfo paging = new PagingInfo
                    {
                        PageIndex = 0,
                        PageSize  = 1,
                    };

                    int count = 0;

                    foreach (var item in result)
                    {
                        restClient.QueryDynamicData("/IMService/Product/QueryProduct", new ProductQueryFilter()
                        {
                            PagingInfo   = paging,
                            ProductSysNo = item.ProductSysNo
                        }, (obj1, args1) =>
                        {
                            if (args1.FaultsHandle())
                            {
                                return;
                            }
                            List <ProductVM> productLst = DynamicConverter <ProductVM> .ConvertToVMList <List <ProductVM> >(args1.Result.Rows);
                            ProductVM pvm = productLst.FirstOrDefault();
                            if (null != pvm)
                            {
                                GiftVoucherProductRelationVM vpvm = EntityConverter <ProductVM, GiftVoucherProductRelationVM> .Convert(pvm, (s, t) =>
                                {
                                    t.ProductSysNo  = s.SysNo.Value;
                                    t.ProductStatus = s.Status;
                                    t.SaleInWeb     = s.GiftVoucherType == 1 ? true : false;
                                });

                                item.ProductID     = vpvm.ProductID;
                                item.ProductName   = vpvm.ProductName;
                                item.ProductType   = vpvm.ProductType;
                                item.ProductStatus = vpvm.ProductStatus;
                                item.AvailableQty  = vpvm.AvailableQty;
                                item.InventoryType = vpvm.InventoryType;
                                item.IsConsign     = vpvm.IsConsign;
                                item.SaleInWeb     = vpvm.SaleInWeb;
                            }

                            count++;

                            if (count == result.Count)
                            {
                                callback(result, args.Result.TotalCount);
                            }
                        });
                    }
                }
            });
        }