コード例 #1
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            _Facade = new GroupBuyingFacade(this);
            _VM     = new GroupBuyingQueryVM();
            _Facade.GetGroupBuyingTypes((s, args) =>
            {
                if (!args.FaultsHandle())
                {
                    foreach (var gbt in args.Result)
                    {
                        _VM.GroupBuyingTypeList.Add(new KeyValuePair <int, string>(gbt.Key, gbt.Value));
                    }
                    _Facade.GetGroupBuyingAreas((s1, args1) =>
                    {
                        if (!args1.FaultsHandle())
                        {
                            foreach (var gba in args1.Result)
                            {
                                _VM.GroupBuyingAreaList.Add(new KeyValuePair <int, string>(gba.Key, gba.Value));
                            }

                            _VM.GroupBuyingTypeList.Insert(0, new KeyValuePair <int, string>(0, ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All));
                            _VM.GroupBuyingAreaList.Insert(0, new KeyValuePair <int, string>(0, ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All));
                            this.DataContext = _VM;
                            this.cmbGroupBuyingCategoryType.SelectedIndex = 0;
                            this.cmbGroupBuyingArea.SelectedIndex         = 0;
                        }
                    });
                }
            });
            this.DataContext = _VM;
        }
コード例 #2
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            this.ucItemMaster.ProductSelected += new EventHandler <ProductSelectedEventArgs>(ucItemMaster_ProductSelected);

            _Facade    = new GroupBuyingFacade(this);
            _viewModel = new GroupBuyingMaintainVM();

            if (this.Request.QueryString.ContainsKey("op"))
            {
                _op = this.Request.QueryString["op"];
            }
            if (this.Request.QueryString.ContainsKey("sysNo"))
            {
                sysNo = this.Request.QueryString["sysNo"];
                _Facade.Load(sysNo, (s, args) =>
                {
                    _viewModel       = args.Result;
                    this.DataContext = _viewModel;
                    _viewModel.ValidationErrors.Clear();

                    if (_viewModel.CategoryType == GroupBuyingCategoryType.Virtual)
                    {
                        new ExternalServiceFacade(this).QueryVendorStoreList(this._viewModel.GroupBuyingVendorSysNo, (se, a) =>
                        {
                            if (a.FaultsHandle())
                            {
                                return;
                            }
                            List <VendorStoreVM> list = DynamicConverter <VendorStoreVM> .ConvertToVMList(a.Result.Rows);
                            _viewModel.VendorStoreList.Clear();
                            list.ForEach(p =>
                            {
                                _viewModel.VendorStoreList.Add(p);
                            });
                            foreach (var item in _viewModel.VendorStoreList)
                            {
                                var re = _viewModel.VendorStoreSysNoList.FirstOrDefault(p => p == item.SysNo.Value);
                                if (re > 0)
                                {
                                    item.IsChecked = true;
                                }
                            }
                        });
                    }

                    InitPage(sysNo);

                    new GroupBuyingFacade(this).GetProductOriginalPrice(int.Parse(_viewModel.ProductSysNo), _viewModel.IsByGroup ? "Y" : "N", (obj, a) =>
                    {
                        //_viewModel.OriginalPrice = (a.Result == null || a.Result[0] == null ? 0m : decimal.Round(decimal.Parse(a.Result[0].ToString()), 2));
                        if (a.Result.Count > 4)
                        {
                            _viewModel.GroupBuyingVendorSysNo = int.Parse(a.Result[3].ToString());
                            _viewModel.GroupBuyingVendorName  = a.Result[4].ToString();
                        }
                    });
                });
            }
            else
            {
                _Facade.GetGroupBuyingTypes((s, args) =>
                {
                    if (!args.FaultsHandle())
                    {
                        // _viewModel.GroupBuyingTypeList.Add(0, ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All);
                        foreach (var gbt in args.Result)
                        {
                            _viewModel.GroupBuyingTypeList.Add(gbt.Key, gbt.Value);
                        }
                        _Facade.GetGroupBuyingAreas((s1, args1) =>
                        {
                            if (!args1.FaultsHandle())
                            {
                                //_viewModel.GroupBuyingAreaList.Add(0, ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All);
                                foreach (var gba in args1.Result)
                                {
                                    _viewModel.GroupBuyingAreaList.Add(gba.Key, gba.Value);
                                }
                                this.DataContext = _viewModel;

                                InitPage(sysNo);
                            }
                        });
                    }
                });
            }
            //this.DataContext = _viewModel;
        }