Exemple #1
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");
                    }
                }
            }
        }
Exemple #2
0
        private AffiliateDTO OldToNewAffiliate(data.bvc_Affiliate aff)
        {
            AffiliateDTO affiliate = new AffiliateDTO();

            BV5Address oldAddress = new BV5Address();
            oldAddress.FromXmlString(aff.Address);

            affiliate.Address = new AddressDTO();
            if (oldAddress != null)
            {
                oldAddress.CopyTo(affiliate.Address, EFConnString(settings.SourceConnectionString()));
            }
            affiliate.CommissionAmount = aff.CommissionAmount;
            switch (aff.CommissionType)
            {
                case 0:
                    affiliate.CommissionType = AffiliateCommissionTypeDTO.None;
                    break;
                case 1:
                    affiliate.CommissionType = AffiliateCommissionTypeDTO.PercentageCommission;
                    break;
                case 2:
                    affiliate.CommissionType = AffiliateCommissionTypeDTO.FlatRateCommission;
                    break;
            }
            affiliate.CustomThemeName = aff.StyleSheet;
            affiliate.DisplayName = aff.DisplayName;
            affiliate.DriversLicenseNumber = aff.DriversLicenseNumber;
            affiliate.Enabled = aff.Enabled;
            affiliate.Id = -1;
            affiliate.LastUpdatedUtc = aff.LastUpdated;
            affiliate.Notes = aff.Notes;
            affiliate.ReferralDays = aff.ReferralDays;
            affiliate.ReferralId = aff.ReferralID;
            if (affiliate.ReferralId == string.Empty) affiliate.ReferralId = aff.bvin;
            affiliate.TaxId = aff.TaxID;
            affiliate.WebSiteUrl = aff.WebSiteURL;
            affiliate.Contacts = new List<AffiliateContactDTO>();

            return affiliate;
        }
Exemple #3
0
        private void PopulateDto(data.bvc_Order old, OrderDTO o)
        {
            o.AffiliateID = old.AffiliateId ?? string.Empty;
            BV5Address oldBilling = new BV5Address();
            oldBilling.FromXmlString(old.BillingAddress);
            if (oldBilling != null)
            {
                oldBilling.CopyTo(o.BillingAddress, EFConnString(settings.SourceConnectionString()));
            }
            o.Bvin = old.Bvin ?? string.Empty;
            o.CustomProperties = TranslateOldProperties(old.CustomProperties);
            o.FraudScore = old.FraudScore;
            o.Id = old.id;
            o.Instructions = old.Instructions;
            o.IsPlaced = old.IsPlaced == 1;
            o.LastUpdatedUtc = old.LastUpdated;
            o.OrderNumber = old.OrderNumber ?? string.Empty;
            if (old.OrderDiscounts != 0)
            {
                o.OrderDiscountDetails.Add(new DiscountDetailDTO() { Amount = -1 * old.OrderDiscounts, Description = "BV 5 Order Discounts", Id = new Guid() });
            }
            o.PaymentStatus = OrderPaymentStatusDTO.Unknown;
            switch (old.PaymentStatus)
            {
                case 0:
                    o.PaymentStatus = OrderPaymentStatusDTO.Unknown;
                    break;
                case 1:
                    o.PaymentStatus = OrderPaymentStatusDTO.Unpaid;
                    break;
                case 2:
                    o.PaymentStatus = OrderPaymentStatusDTO.PartiallyPaid;
                    break;
                case 3:
                    o.PaymentStatus = OrderPaymentStatusDTO.Paid;
                    break;
                case 4:
                    o.PaymentStatus = OrderPaymentStatusDTO.Overpaid;
                    break;
            }
            BV5Address oldShipping = new BV5Address();
            oldShipping.FromXmlString(old.ShippingAddress);
            if (oldShipping != null) oldShipping.CopyTo(o.ShippingAddress, EFConnString(settings.SourceConnectionString()));
            o.ShippingMethodDisplayName = old.ShippingMethodDisplayName;
            o.ShippingMethodId = old.ShippingMethodId;
            o.ShippingProviderId = old.ShippingProviderId;
            o.ShippingProviderServiceCode = old.ShippingProviderServiceCode;
            o.ShippingStatus = OrderShippingStatusDTO.Unknown;
            switch (old.ShippingStatus)
            {
                case 0:
                    o.ShippingStatus = OrderShippingStatusDTO.Unknown;
                    break;
                case 1:
                    o.ShippingStatus = OrderShippingStatusDTO.Unshipped;
                    break;
                case 2:
                    o.ShippingStatus = OrderShippingStatusDTO.PartiallyShipped;
                    break;
                case 3:
                    o.ShippingStatus = OrderShippingStatusDTO.FullyShipped;
                    break;
                case 4:
                    o.ShippingStatus = OrderShippingStatusDTO.NonShipping;
                    break;
            }
            o.StatusCode = old.StatusCode ?? string.Empty;
            o.StatusName = old.StatusName;
            o.ThirdPartyOrderId = old.ThirdPartyOrderId;
            o.TimeOfOrderUtc = old.TimeOfOrder;
            o.TotalHandling = old.HandlingTotal;
            o.TotalShippingBeforeDiscounts = old.ShippingTotal + old.ShippingDiscounts;
            o.ShippingDiscountDetails.Add(new DiscountDetailDTO() { Amount = -1 * old.ShippingDiscounts, Description = "BV5 Shipping Discount", Id = new Guid() });
            o.TotalTax = old.TaxTotal;
            o.TotalTax2 = old.TaxTotal2;
            o.UserEmail = old.UserEmail;
            o.UserID = old.UserId;

            wl(" - Coupons for Order " + old.OrderNumber);
            o.Coupons = TranslateCoupons(o.Bvin);

            wl(" - Items For order " + old.OrderNumber);
            o.Items = TranslateItems(o.Bvin);
            LineItemHelper.SplitTaxesAcrossItems(old.TaxTotal2 + old.TaxTotal, old.SubTotal, o.Items);

            wl(" - Notes For order " + old.OrderNumber);
            o.Notes = TranslateNotes(o.Bvin);

            wl(" - Packages For order " + old.OrderNumber);
            o.Packages = TranslatePackages(o.Bvin);
        }
Exemple #4
0
        private void ImportSingleUser(data.bvc_User u)
        {
            if (u == null)
            {
                wl("Customer was null!");
                return;
            }
            wl("Importing Customer: " + u.Email);

            CustomerAccountDTO customer = new CustomerAccountDTO();
            customer.Bvin = u.bvin;
            customer.CreationDateUtc = u.CreationDate;
            customer.Email = u.Email;
            customer.FailedLoginCount = u.FailedLoginCount;
            customer.FirstName = u.FirstName;
            customer.LastLoginDateUtc = u.LastLoginDate;
            customer.LastName = u.LastName;
            customer.LastUpdatedUtc = u.LastUpdated;
            customer.Notes = u.Comment;
            customer.Password = string.Empty;
            customer.PricingGroupId = u.PricingGroup;
            customer.Salt = string.Empty;
            customer.TaxExempt = u.TaxExempt == 1 ? true : false;
            customer.Addresses = new List<AddressDTO>();

            // Preserve clear text passwords
            string newPassword = string.Empty;
            if (u.PasswordFormat == 0)
            {
                newPassword = u.Password;
            }

            BV5Address shipping = new BV5Address();
            shipping.FromXmlString(u.ShippingAddress);
            AddressDTO ship = new AddressDTO();
            ship.AddressType = AddressTypesDTO.Shipping;
            shipping.CopyTo(ship, EFConnString(settings.SourceConnectionString()));
            customer.Addresses.Add(ship);

            BV5Address billing = new BV5Address();
            billing.FromXmlString(u.BillingAddress);
            AddressDTO bill = new AddressDTO();
            bill.AddressType = AddressTypesDTO.Billing;
            billing.CopyTo(bill, EFConnString(settings.SourceConnectionString()));
            customer.Addresses.Add(bill);

            List<BV5Address> addresses = BV5Address.ReadAddressesFromXml(u.AddressBook);
            foreach (BV5Address addr in addresses)
            {
                AddressDTO a = new AddressDTO();
                a.AddressType = AddressTypesDTO.General;
                addr.CopyTo(a, EFConnString(settings.SourceConnectionString()));
                customer.Addresses.Add(a);
            }

            Api bv6proxy = GetBV6Proxy();
            var res = bv6proxy.CustomerAccountsCreateWithPassword(customer, newPassword);
            if (res != null)
            {
                if (res.Errors.Count > 0)
                {
                    DumpErrors(res.Errors);
                    return;
                }
                wl("SUCCESS");
            }
        }