Esempio n. 1
0
        public void FromDto(ProductImageDTO dto)
        {
            if (dto == null) return;

            this.AlternateText = dto.AlternateText ?? string.Empty;
            this.Bvin = dto.Bvin ?? string.Empty;
            this.Caption = dto.Caption ?? string.Empty;
            this.FileName = dto.FileName ?? string.Empty;
            this.LastUpdatedUtc = dto.LastUpdatedUtc;
            this.ProductId = dto.ProductId ?? string.Empty;
            this.SortOrder = dto.SortOrder;
            this.StoreId = dto.StoreId;
        }
Esempio n. 2
0
        // DTO
        public ProductImageDTO ToDto()
        {
            ProductImageDTO dto = new ProductImageDTO();

            dto.AlternateText = this.AlternateText;
            dto.Bvin = this.Bvin;
            dto.Caption = this.Caption;
            dto.FileName = this.FileName;
            dto.LastUpdatedUtc = this.LastUpdatedUtc;
            dto.ProductId = this.ProductId;
            dto.SortOrder = this.SortOrder;
            dto.StoreId = this.StoreId;
            
            return dto;
        }
Esempio n. 3
0
        private void MigrateProductAdditionalImages(string bvin)
        {
            wl(" - Migrating AdditionalImages...");

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

            var items = db.bvc_ProductImage.Where(y => y.ProductID == bvin);
            if (items == null) return;
            foreach (data.bvc_ProductImage old in items)
            {
                ProductImageDTO img = new ProductImageDTO();
                img.AlternateText = old.Caption;
                img.Bvin = old.ImageID.ToString();
                img.Caption = old.Caption;
                img.FileName = TextHelper.CleanFileName(System.IO.Path.GetFileName(old.FileName));
                img.LastUpdatedUtc = DateTime.UtcNow;
                img.ProductId = old.ProductID;
                img.SortOrder = 0;

                byte[] bytes = GetBytesForLocalImage(old.FileName);
                if (bytes == null) return;
                wl("Found Image: " + img.FileName + " [" + bytes.Length + " bytes]");

                var res = proxy.ProductImagesCreate(img, bytes);
                if (res != null)
                {
                    if (res.Errors.Count > 0)
                    {
                        DumpErrors(res.Errors);
                        wl("FAILED");
                    }
                }
                else
                {
                    wl("FAILED! EXCEPTION!");
                }
            }
        }
Esempio n. 4
0
 public ApiResponse<ProductImageDTO> ProductImagesUpdate(ProductImageDTO item)
 {
     ApiResponse<ProductImageDTO> result = new ApiResponse<ProductImageDTO>();
     result = RestHelper.PostRequest<ApiResponse<ProductImageDTO>>(this.fullApiUri + "productimages/" + Enc(item.Bvin) + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item));
     return result;
 }
Esempio n. 5
0
 public ApiResponse<ProductImageDTO> ProductImagesCreate(ProductImageDTO item, byte[] data)
 {
     ApiResponse<ProductImageDTO> result = new ApiResponse<ProductImageDTO>();
     result = RestHelper.PostRequest<ApiResponse<ProductImageDTO>>(this.fullApiUri + "productimages/?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item));
     if (data != null)
     {
         if (result.Content != null && result.Errors.Count < 1)
         {
             ProductImagesUpload(item.ProductId, result.Content.Bvin, result.Content.FileName, data);
         }
     }
     return result;
 }