public Address SaveAddress(Address address)
        {
            if (this.GetAddress(address.Guid) == null)
            {
                // insert
                string sql = @"Insert Into VintageRabbit.Addresses (Guid, MemberGuid, FirstName, LastName, Email, CompanyName, Line1, SuburbCity, Postcode, State, Type, PhoneNumber, DateCreated, DateLastModified) Values
                            (@Guid, @MemberGuid, @FirstName, @LastName, @Email, @CompanyName, @Line1, @SuburbCity, @Postcode, @State, @Type, @PhoneNumber, @DateCreated, @DateLastModified)";

                using (SqlConnection connection = new SqlConnection(this._connectionString))
                {
                    connection.Execute(sql, new
                    {
                        Guid = address.Guid,
                        MemberGuid = address.MemberGuid,
                        FirstName = address.FirstName,
                        LastName = address.LastName,
                        Email = address.Email,
                        CompanyName = address.CompanyName,
                        Line1 = address.Line1,
                        SuburbCity = address.SuburbCity,
                        Postcode = address.Postcode,
                        State = address.State.ToString(),
                        Type = address.Type.ToString(),
                        PhoneNumber = address.PhoneNumber,
                        DateCreated = DateTime.Now,
                        DateLastModified = DateTime.Now

                    });
                }
            }
            else
            {
                //update
                string sql = @"Update VintageRabbit.Addresses Set
                                MemberGuid = @MemberGuid, FirstName = @FirstName, LastName = @LastName, Email = @Email,  CompanyName = @CompanyName, Line1 = @Line1, SuburbCity = @SuburbCity,
                                Postcode = @Postcode, State = @State, Type = @Type, PhoneNumber = @PhoneNumber, DateLastModified = @DateLastModified Where Guid = @Guid";

                using (SqlConnection connection = new SqlConnection(this._connectionString))
                {
                    connection.Execute(sql, new
                    {
                        Guid = address.Guid,
                        MemberGuid = address.MemberGuid,
                        FirstName = address.FirstName,
                        LastName = address.LastName,
                        Email = address.Email,
                        CompanyName = address.CompanyName,
                        Line1 = address.Line1,
                        SuburbCity = address.SuburbCity,
                        Postcode = address.Postcode,
                        State = address.State.ToString(),
                        Type = address.Type.ToString(),
                        PhoneNumber = address.PhoneNumber,
                        DateLastModified = DateTime.Now
                    });
                }
            }

            return address;
        }
        public Address SaveShippingAddress(Member member, AddressViewModel viewModel)
        {
            Guid addressId = viewModel.Guid;

            Address address = new Address(member.Guid, AddressType.Shipping, addressId, viewModel.Address, viewModel.SuburbCity, viewModel.State, viewModel.Postcode.Value, viewModel.FirstName, viewModel.LastName, null, null, viewModel.CompanyName);

            this._commandDispatcher.Dispatch<SaveAddressCommand>(new SaveAddressCommand(address));

            return address;
        }
        public Address SaveDeliveryAddress(Member member, AddressViewModel viewModel, string phoneNumber)
        {
            Guid addressId = viewModel.Guid;

            Address address = new Address(member.Guid, AddressType.Delivery, addressId, viewModel.Address, viewModel.SuburbCity, viewModel.State, viewModel.Postcode.Value, viewModel.FirstName, viewModel.LastName, null, phoneNumber, viewModel.CompanyName);

            this._commandDispatcher.Dispatch<SaveAddressCommand>(new SaveAddressCommand(address));

            return address;
        }
        public BillingAddressViewModel(Member member, Order order, Address address)
            : base(address)
        {
            if (address != null && !string.IsNullOrEmpty(address.Email))
            {
                this.Email = address.Email;
            }
            else
            {
                this.Email = member.Email;
            }

            this.OrderContainsBuyItems = order.ContainsBuyProducts() && !order.ContainsHireProducts() && !order.ContainsTheme();
        }
 public AddressViewModel(Address address)
     : this()
 {
     if (address != null)
     {
         this.Guid = address.Guid;
         this.FirstName = address.FirstName;
         this.LastName = address.LastName;
         this.CompanyName = address.CompanyName;
         this.Address = address.Line1;
         this.SuburbCity = address.SuburbCity;
         this.Postcode = address.Postcode;
         this.State = address.State;
     }
 }
        public PartyHireInformationViewModel(Address address, Order order, Vintage.Rabbit.Parties.Entities.Party party)
            : base(address)
        {
            this.DeliveryCost = Constants.HireDeliveryCost.ToString("C0");

            this.IsDelivery = order.Items.Any(o => o.Product.Type == ProductType.Delivery && o.Product.Title == "Pickup Hire Delivery") ||
                              order.Items.Any(o => o.Product.Type == ProductType.Delivery && o.Product.Title == "Dropoff Hire Delivery");

            if(party != null)
            {
                this.PartyDate = party.PartyDate;
            }

            if (address != null)
            {
                this.PhoneNumber = address.PhoneNumber;
            }
        }
Example #7
0
 internal void AddShippingAddress(Address address)
 {
     this.ShippingAddresses.Add(address);
 }
Example #8
0
 internal void AddBillingAddress(Address address)
 {
     this.BillingAddresses.Add(address);
 }
 public BillingAddressViewModel(Address address)
     : base(address)
 {
     this.Email = address.Email;
 }
Example #10
0
 internal void AddShippingAddress(Address address)
 {
     this.ShippingAddressId = address.Guid;
 }
Example #11
0
 internal void AddDeliveryAddress(Address address)
 {
     this.DeliveryAddressId = address.Guid;
 }
Example #12
0
 internal void AddBillingAddress(Address address)
 {
     this.BillingAddressId = address.Guid;
 }
 public DeliveryAddressViewModel(Address address)
     : base(address)
 {
     this.PhoneNumber = address.PhoneNumber;
 }
 public AddressAddedMessage(Address address)
 {
     this.Address = address;
 }