Пример #1
0
        private void MigrateProductInventory(string bvin)
        {
            wl(" - Migrating Inventory...");

            data.bvc2004Entities db = new data.bvc2004Entities(EFConnString(settings.SourceConnectionString()));
            Api proxy = GetBV6Proxy();

            var itemMain = db.bvc_Product.Where(y => y.ID == bvin).FirstOrDefault();
            if (itemMain == null) return;

            var old = itemMain.bvc_ProductInventory.FirstOrDefault();
            if (old == null) return;

            ProductInventoryDTO inv = new ProductInventoryDTO();
            inv.LowStockPoint = 0;
            inv.ProductBvin = bvin;
            inv.QuantityOnHand = old.Qty;
            inv.QuantityReserved = 0;

            var res = proxy.ProductInventoryCreate(inv);
            if (res != null)
            {
                if (res.Errors.Count > 0)
                {
                    DumpErrors(res.Errors);
                    wl("FAILED");
                }
            }
            else
            {
                wl("FAILED! EXCEPTION!");
            }
        }
Пример #2
0
        private void MigrateProductInventory(string bvin)
        {
            wl(" - Migrating Inventory...");

            data.BV53Entities db = new data.BV53Entities(EFConnString(settings.SourceConnectionString()));
            Api proxy = GetBV6Proxy();

            var old = db.bvc_ProductInventory.Where(y => y.ProductBvin == bvin).FirstOrDefault();
            if (old == null) return;

            ProductInventoryDTO inv = new ProductInventoryDTO();
            inv.LowStockPoint = (int)(old.ReorderLevel ?? 0);
            inv.ProductBvin = bvin;
            inv.QuantityOnHand = (int)((old.QuantityAvailableForSale ?? 0) + old.QuantityReserved);
            inv.QuantityReserved = (int)old.QuantityReserved;

            var res = proxy.ProductInventoryCreate(inv);
            if (res != null)
            {
                if (res.Errors.Count > 0)
                {
                    DumpErrors(res.Errors);
                    wl("FAILED");
                }
            }
            else
            {
                wl("FAILED! EXCEPTION!");
            }
        }
Пример #3
0
        //DTO
        public ProductInventoryDTO ToDto()
        {
            ProductInventoryDTO dto = new ProductInventoryDTO();

            dto.Bvin = this.Bvin;
            dto.LastUpdated = this.LastUpdated;
            dto.LowStockPoint = this.LowStockPoint;
            dto.ProductBvin = this.ProductBvin;
            dto.QuantityOnHand = this.QuantityOnHand;
            dto.QuantityReserved = this.QuantityReserved;
            dto.VariantId = this.VariantId;

            return dto;
        }
Пример #4
0
        public void FromDto(ProductInventoryDTO dto)
        {
            if (dto == null) return;

            this.Bvin = dto.Bvin;
            this.LastUpdated = dto.LastUpdated;
            this.LowStockPoint = dto.LowStockPoint;
            this.ProductBvin = dto.ProductBvin;
            this.QuantityOnHand = dto.QuantityOnHand;
            this.QuantityReserved = dto.QuantityReserved;
            this.VariantId = dto.VariantId;

        }
Пример #5
0
 public ApiResponse<ProductInventoryDTO> ProductInventoryUpdate(ProductInventoryDTO item)
 {
     ApiResponse<ProductInventoryDTO> result = new ApiResponse<ProductInventoryDTO>();
     result = RestHelper.PostRequest<ApiResponse<ProductInventoryDTO>>(this.fullApiUri + "productinventory/" + Enc(item.Bvin) + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item));
     return result;
 }