public VendorManufacturerDTO()
 {
     Bvin = string.Empty;
     StoreId = 0;
     LastUpdated = DateTime.UtcNow;
     DisplayName = string.Empty;
     EmailAddress = string.Empty;
     Address = new AddressDTO();
     DropShipEmailTemplateId = string.Empty;
     Contacts = new List<VendorManufacturerContactDTO>();
     ContactType = VendorManufacturerTypeDTO.Vendor;
 }
Exemplo n.º 2
0
		// Constructor			
		public CustomerAccountDTO()
		{
            this.Addresses = new List<AddressDTO>();
            this.Bvin = string.Empty;
            this.CreationDateUtc = DateTime.UtcNow;
            this.Email = string.Empty;
            this.FailedLoginCount = 0;
            this.FirstName = string.Empty;
            this.LastLoginDateUtc = DateTime.UtcNow;
            this.LastName = string.Empty;
            this.LastUpdatedUtc = DateTime.UtcNow;
            this.Notes = string.Empty;
            this.Password = string.Empty;
            this.PricingGroupId = string.Empty;
            this.Salt = string.Empty;
            this.TaxExempt = false;
            this.ShippingAddress = new AddressDTO();
            this.BillingAddress = new AddressDTO();
		}	
Exemplo n.º 3
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.ID.ToString();
            customer.CreationDateUtc = u.CreationDate;
            customer.Email = u.Email;
            customer.FailedLoginCount = 0;
            customer.FirstName = u.FirstName;
            customer.LastLoginDateUtc = u.LastLoginDate;
            customer.LastName = u.LastName;
            customer.LastUpdatedUtc = DateTime.UtcNow;
            customer.Notes = u.Comment;
            customer.Password = string.Empty;
            customer.PricingGroupId = string.Empty;            
            if (u.PricingLevel > 0)
            {
                customer.PricingGroupId = "BVC2004" + u.PricingLevel.ToString().Trim();
            }
            customer.Salt = string.Empty;
            customer.TaxExempt = u.TaxExempt == 1 ? true : false;
            customer.Addresses = new List<AddressDTO>();

            // Preserve clear text passwords
            string newPassword = u.Password;
            customer.Password = newPassword;


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

            Api bv6proxy = GetBV6Proxy();
            var res = bv6proxy.CustomerAccountsCreateWithPassword(customer, newPassword);
            if (res != null)
            {
                if (res.Errors.Count > 0)
                {
                    DumpErrors(res.Errors);
                    return;
                }
                wl("SUCCESS");
            }
        }
Exemplo n.º 4
0
        public bool CopyTo(AddressDTO destinationAddress, string connString)
        {
            bool result = true;

            try
            {
                destinationAddress.NickName = string.Empty;
                destinationAddress.FirstName = this.FirstName;
                destinationAddress.MiddleInitial = this.MiddleInitial;
                destinationAddress.LastName = this.LastName;
                destinationAddress.Company = this.CompanyName;
                destinationAddress.Line1 = this.StreetLine1;
                destinationAddress.Line2 = this.StreetLine2;
                destinationAddress.Line3 = string.Empty;
                destinationAddress.City = this.City;
                destinationAddress.PostalCode = this.PostalCode;

                Country newCountry = GeographyHelper.TranslateCountry(connString, this.CountryCode);
                destinationAddress.CountryBvin = newCountry.Bvin;
                destinationAddress.CountryName = newCountry.DisplayName;

                string RegionAbbreviation = GeographyHelper.TranslateRegionBvinToAbbreviation(connString, this.StateCode);
                destinationAddress.RegionBvin = RegionAbbreviation;
                destinationAddress.RegionName = RegionAbbreviation;

                destinationAddress.Phone = this.PhoneNumber;
                destinationAddress.Fax = this.FaxNumber;
                destinationAddress.WebSiteUrl = this.WebSiteURL;
                destinationAddress.CountyBvin = string.Empty;
                destinationAddress.CountyName = string.Empty;
                //destinationAddress.Residential = this.Residential;                
            }
            catch
            {
                result = false;
            }

            return result;
        }
Exemplo n.º 5
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");
            }
        }
Exemplo n.º 6
0
 public void FromDto(AddressDTO dto)
 {
     this.StoreId = dto.StoreId;
     this.NickName = dto.NickName ?? string.Empty;
     this.FirstName = dto.FirstName ?? string.Empty;
     this.MiddleInitial = dto.MiddleInitial ?? string.Empty;
     this.LastName = dto.LastName ?? string.Empty;
     this.Company = dto.Company ?? string.Empty;
     this.Line1 = dto.Line1 ?? string.Empty;
     this.Line2 = dto.Line2 ?? string.Empty;
     this.Line3 = dto.Line3 ?? string.Empty;
     this.City = dto.City ?? string.Empty;
     this.RegionName = dto.RegionName ?? string.Empty;
     this.RegionBvin = dto.RegionBvin ?? string.Empty;
     this.PostalCode = dto.PostalCode ?? string.Empty;
     this.CountryName = dto.CountryName ?? string.Empty;
     this.CountryBvin = dto.CountryBvin ?? string.Empty;
     this.CountyBvin = dto.CountyBvin ?? string.Empty;
     this.CountyName = dto.CountyName ?? string.Empty;
     this.Phone = dto.Phone ?? string.Empty;
     this.Fax = dto.Fax ?? string.Empty;
     this.WebSiteUrl = dto.WebSiteUrl ?? string.Empty;
     this.UserBvin = dto.UserBvin ?? string.Empty;
     this.AddressType = (AddressTypes)((int)dto.AddressType);
     this.LastUpdatedUtc = dto.LastUpdatedUtc;
 }
Exemplo n.º 7
0
        //DTO
        public AddressDTO ToDto()
        {
            AddressDTO dto = new AddressDTO();

            dto.StoreId = this.StoreId;
            dto.NickName = this.NickName ?? string.Empty;
            dto.FirstName = this.FirstName ?? string.Empty;
            dto.MiddleInitial = this.MiddleInitial ?? string.Empty;
            dto.LastName = this.LastName ?? string.Empty;
            dto.Company = this.Company ?? string.Empty;
            dto.Line1 = this.Line1 ?? string.Empty;
            dto.Line2 = this.Line2 ?? string.Empty;
            dto.Line3 = this.Line3 ?? string.Empty;
            dto.City = this.City ?? string.Empty;
            dto.RegionName = this.RegionName ?? string.Empty;
            dto.RegionBvin = this.RegionBvin ?? string.Empty;
            dto.PostalCode = this.PostalCode ?? string.Empty;
            dto.CountryName = this.CountryName ?? string.Empty;
            dto.CountryBvin = this.CountryBvin ?? string.Empty;
            dto.CountyBvin = this.CountyBvin ?? string.Empty;
            dto.CountyName = this.CountyName ?? string.Empty;
            dto.Phone = this.Phone ?? string.Empty;
            dto.Fax = this.Fax ?? string.Empty;
            dto.WebSiteUrl = this.WebSiteUrl ?? string.Empty;
            dto.UserBvin = this.UserBvin ?? string.Empty;
            dto.AddressType = (AddressTypesDTO)((int)this.AddressType);
            dto.LastUpdatedUtc = this.LastUpdatedUtc;

            return dto;
        }