コード例 #1
0
        public ConsultaProductoViewModel()
        {
            _common            = new Helpers.CommonHelper();
            this.SearchCommand = new RelayCommand(async() =>
            {
                this.IsBusy = true;
                await this.Search();
                this.IsBusy = false;
            }, () => {
                if (string.IsNullOrEmpty(this.Serie))
                {
                    return(true);
                }
                if (string.IsNullOrEmpty(this.Marca) && string.IsNullOrEmpty(this.Modelo))
                {
                    return(true);
                }
                return(false);
            });
            this.FindMedidaCommand = new RelayCommand(async() =>
            {
                this.IsBusy      = true;
                this.Existencias = await _proxy.GetExistenciasAsync(this.Item.Id.Value, this.SelectedMedida);
                this.IsBusy      = false;
            }, () => this.Item != null && this.SelectedMedida != null);

            this.PropertyChanged += ConsultaProductoViewModel_PropertyChanged;
            if (this.IsInDesignMode)
            {
                this.Serie  = "0000003806584";
                this.Marca  = "ADD";
                this.Modelo = "1197";
                this.Item   = new Common.Entities.Producto
                {
                    Serie       = "0000003806584",
                    Marca       = "ADD",
                    Modelo      = "1197",
                    Talla       = "28.5",
                    Precio      = 1799.99m,
                    Corrida     = "A",
                    Electronica = false,
                    ParUnico    = true,
                    MaxPlazos   = 10,
                    Sucursal    = "08"
                };
                this.Corridas = new Common.Entities.MedidasCorridas
                {
                    Corridas = new Common.Entities.TallaPrecio[] {
                        new Common.Entities.TallaPrecio {
                            Corrida = "A", MedidaFin = "14-", MedidaInicio = "29-", Precio = 1099.99m
                        },
                        new Common.Entities.TallaPrecio {
                            Corrida = "B", MedidaFin = "24", MedidaInicio = "29-", Precio = 999m
                        },
                        new Common.Entities.TallaPrecio {
                            Corrida = "C", MedidaFin = "30", MedidaInicio = "39", Precio = 1234.56m
                        }
                    },
                    Medidas = new string[] { "20", "20-", "24-" }
                };
                this.SelectedMedida = "24-";
                this.Existencias    = new Common.Entities.SucursalExistencia[]
                {
                    //new Common.Entities.SucursalExistencia { Sucursal = "08", Count = 10 },
                    //new Common.Entities.SucursalExistencia { Sucursal = "01", Count = 30 },
                    //new Common.Entities.SucursalExistencia { Sucursal = "04", Count = 5 }
                };

                this.ItemStatus = Common.Constants.Status.CA;
                this.Promos     = new Common.Entities.Promocion[] {
                    new Common.Entities.Promocion {
                        PromocionId = 1, Nombre = "promo 1"
                    },
                    new Common.Entities.Promocion {
                        PromocionId = 1, Nombre = "promo 2"
                    },
                    new Common.Entities.Promocion {
                        PromocionId = 1, Nombre = "promo 3"
                    }
                };
            }
            else
            {
                _proxy = CommonServiceLocator.ServiceLocator.Current.GetInstance <Common.ServiceContracts.IDataServiceAsync>();
            }
        }