Exemple #1
0
 private async void SalesProductViewModel_PackingInfoUpdated(SalesProductViewModel salesProduct)
 {
     await _SalesProductService.UpdatePackinInfo(new PackingInfo
     {
         SalesProductId = salesProduct.Id,
         PackingWeight  = salesProduct.PackResources.PackingWeight,
     });
 }
Exemple #2
0
 private async void SalesProductViewModel_PackingResourceUpdated(SalesProductViewModel salesProduct)
 {
     await _SalesProductService.UpdatePackResources(new PackingInfo
     {
         SalesProductId = salesProduct.Id,
         PackingWeight  = salesProduct.PackResources.PackingWeight,
         Resources      = salesProduct.PackResources.ItemList.Select(d => new PackResource
         {
             ExtraResourceId = d.Id,
             Count           = d.Count,
             SalesProductId  = salesProduct.Id,
         }).ToList(),
     });
 }
Exemple #3
0
        public IActionResult OnGet(int productid)
        {
            product = productRepo.GetById(productid);

            var category = catRepo.GetById(product.Category);
            var color    = colorRepo.GetById(product.Color);

            /// var brand = brandRepo.GetById(product.Brand);

            // var country = countryRepo.GetById(product.Country);



            productVM = new SalesProductViewModel()
            {
                Id   = product.Id,
                Name = product.Name,
                NormalSellingPrice   = product.NormalSellingPrice,
                discountSellingPrice = product.discountSellingPrice,
                salesDiscount        = (double)product.salesDiscount,
                prodSize             = product.prodSize,
                prodCode             = product.prodCode,
                productImageUrl      = product.productImageUrl,
                quantityAvailable    = product.quantityAvailable,
                Status        = product.status,
                laststockDate = product.lastStockDate,
                CategoryName  = product.Category,
                //   BrandName = product.Brand ,
                //  CountryName = product.Country ,
                //  ColorName = product.Country ,
                ShopId = product.shopId
            };


            if (product != null)
            {
                return(Page());
            }
            else
            {
                return(RedirectToPage("../NotFound"));
            }
        }
Exemple #4
0
        public async Task Initailize()
        {
            if (SalesManagerViewModel == null)
            {
                var salesProducts = await _SalesProductService.GetSalesProducts();

                var pigStock = salesProducts
                               .Select(d => d.Production.LivestockProduct)
                               .FirstOrDefault(d => d.Name.Equals("돼지"));

                // Create SalesManagerViewModel
                SalesManagerViewModel = new SalesManagerViewModel
                {
                    Id        = pigStock.Id,
                    Name      = pigStock.Name,
                    UnitPrice = pigStock.UnitPrice,
                    Weight    = pigStock.Weight,
                };

                foreach (var salesProduct in salesProducts.Where(d => d.Production.LivestockProduct.Name.Equals("돼지")))
                {
                    // Add ProductionViewModel
                    var productionViewMdoel = new ProductionViewModel(SalesManagerViewModel)
                    {
                        Id           = salesProduct.Id,
                        Name         = salesProduct.Production.Name,
                        Weight       = salesProduct.Production.Weight,
                        TransferRate = salesProduct.Production.TransferRate,
                        MarginRate   = salesProduct.Production.MarginRate,
                    };

                    productionViewMdoel.PropertyChanged += ProductionViewMdoel_PropertyChanged;
                    SalesManagerViewModel.Productions.Add(productionViewMdoel);

                    // Add SalesProductViewModel
                    var salesProductViewModel = new SalesProductViewModel(productionViewMdoel)
                    {
                        Id            = salesProduct.Id,
                        Name          = salesProduct.Production.Name,
                        CommisionRate = salesProduct.CommssionRate,
                        ShippingCost  = salesProduct.ShippingCost,
                        Weight        = salesProduct.Weight,
                    };

                    var packingInfo = salesProduct.PackingInfo;
                    if (packingInfo != null)
                    {
                        salesProductViewModel.PackResources.PackingWeight = packingInfo.PackingWeight;
                        foreach (var packResource in packingInfo.Resources)
                        {
                            salesProductViewModel.PackResources.ItemList.Add(new PackResourceViewModel
                            {
                                Id    = packResource.Resource.Id,
                                Name  = packResource.Resource.Name,
                                Price = packResource.Resource.Price,
                                Type  = packResource.Resource.Type,
                                Count = packResource.Count,
                            });
                        }
                    }

                    salesProductViewModel.PackResources.ApplyToAllProductRequest += PackResources_ApplyToAllProductRequest;
                    salesProductViewModel.PackingInfoUpdated     += SalesProductViewModel_PackingInfoUpdated;
                    salesProductViewModel.PackingResourceUpdated += SalesProductViewModel_PackingResourceUpdated;
                    salesProductViewModel.PropertyChanged        += SalesProductViewModel_PropertyChanged;
                    SalesManagerViewModel.SalesProducts.Add(salesProductViewModel);
                }

                // Initialize PropertyChangedEvent
                SalesManagerViewModel.PropertyChanged += SalesManagerViewModel_PropertyChanged;
            }
        }