Exemplo n.º 1
0
        //DTO
        public VendorManufacturerDTO ToDto()
        {
            VendorManufacturerDTO dto = new VendorManufacturerDTO();

            this.Bvin = string.Empty;
            this.LastUpdated = DateTime.UtcNow;
            this.DisplayName = string.Empty;
            this.EmailAddress = string.Empty;
            this.Address = new Contacts.Address();
            this.DropShipEmailTemplateId = string.Empty;
            this.Contacts = new List<VendorManufacturerContact>();
            this.ContactType = VendorManufacturerType.Unknown;

            return dto;
        }
Exemplo n.º 2
0
        public void FromDto(VendorManufacturerDTO dto)
        {
            if (dto == null) return;

            this.Bvin = dto.Bvin;
            this.LastUpdated = dto.LastUpdated;
            this.DisplayName = dto.DisplayName;
            this.EmailAddress = dto.EmailAddress;
            this.Address.FromDto(dto.Address);
            this.DropShipEmailTemplateId = dto.DropShipEmailTemplateId;
            this.Contacts.Clear();
            foreach (VendorManufacturerContactDTO c in dto.Contacts)
            {
                VendorManufacturerContact v = new VendorManufacturerContact();
                v.FromDto(c);
                this.Contacts.Add(v);
            }
            this.ContactType = (VendorManufacturerType)((int)dto.ContactType);

        }
Exemplo n.º 3
0
        private void ImportVendors()
        {
            Header("Importing Vendors");

            data.bvc2004Entities oldDatabase = GetOldDatabase();
            foreach (data.bvc_Vendor old in oldDatabase.bvc_Vendor)
            {
                wl("Item: " + old.DisplayName);

                VendorManufacturerDTO vm = new VendorManufacturerDTO();

                BVC2004Address oldAddr = new BVC2004Address();
                oldAddr.FromXmlString(old.Address);                
                if (oldAddr != null)
                {
                    oldAddr.CopyTo(vm.Address, EFConnString(settings.SourceConnectionString()));
                }
                vm.Bvin = old.ID.ToString();                
                vm.ContactType = VendorManufacturerTypeDTO.Vendor;
                vm.DisplayName = old.DisplayName;
                vm.DropShipEmailTemplateId = string.Empty;
                vm.EmailAddress = old.EmailAddress;
                vm.LastUpdated = DateTime.UtcNow;

                Api bv6proxy = GetBV6Proxy();
                var res = bv6proxy.VendorCreate(vm);
                if (res != null)
                {
                    if (res.Errors.Count() > 0)
                    {
                        DumpErrors(res.Errors);
                        wl("FAILED");
                    }
                    else
                    {
                        wl("SUCCESS");
                    }
                }
            }
        }
Exemplo n.º 4
0
        // Manufacturer Vendor
        private void ImportManufacturers()
        {
            Header("Importing Manufacturers");

            foreach (data.bvc_Manufacturer old in oldDatabase.bvc_Manufacturer)
            {
                wl("Item: " + old.DisplayName);

                VendorManufacturerDTO vm = new VendorManufacturerDTO();

                BV5Address oldAddr = new BV5Address();
                oldAddr.FromXmlString(old.Address);
                if (oldAddr != null)
                {
                    oldAddr.CopyTo(vm.Address, EFConnString(settings.SourceConnectionString()));
                }
                vm.Bvin = old.bvin;
                vm.ContactType = VendorManufacturerTypeDTO.Manufacturer;
                vm.DisplayName = old.DisplayName;
                vm.DropShipEmailTemplateId = old.DropShipEmailTemplateId;
                vm.EmailAddress = old.EmailAddress;
                vm.LastUpdated = old.LastUpdated;

                Api bv6proxy = GetBV6Proxy();
                var res = bv6proxy.ManufacturerCreate(vm);
                if (res != null)
                {
                    if (res.Errors.Count() > 0)
                    {
                        DumpErrors(res.Errors);
                        wl("FAILED");
                    }
                    else
                    {
                        wl("SUCCESS");
                    }
                }
            }
        }
Exemplo n.º 5
0
 public ApiResponse<VendorManufacturerDTO> ManufacturerUpdate(VendorManufacturerDTO item)
 {
     ApiResponse<VendorManufacturerDTO> result = new ApiResponse<VendorManufacturerDTO>();
     result = RestHelper.PostRequest<ApiResponse<VendorManufacturerDTO>>(this.fullApiUri + "manufacturers/" + Enc(item.Bvin) + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item));
     return result;
 }