Esempio n. 1
0
        private void ConfirmOrder_Click(object sender, RoutedEventArgs e)
        {
            ContactAddresses address = null;

            if (ContactInfoObject == null)
            {
                ContactInfoObject           = new ContactInfo();
                ContactInfoObject.Title     = (String)((ComboBoxItem)txtTitle.SelectedValue).Content;
                ContactInfoObject.FirstName = txtFirstName.Text;
                ContactInfoObject.LastName  = txtLastName.Text;
                ContactInfoObject.Telephone = txtPhone.Text;
                ContactInfoObject.Mobile    = String.Empty;
                ContactInfoObject.Email     = txtEmail.Text;
                address               = new ContactAddresses();
                address.Address       = txtAddress.Text;
                address.AddressTypeId = 3;
                address.City          = txtCity.Text;
                address.State         = txtState.Text;
                address.Zip           = txtZipCode.Text;
                address.Country       = "United States";
                ContactInfoObject.ContactAddressList = new List <ContactAddresses>();
                ContactInfoObject.ContactAddressList.Add(address);
                Int64 result1 = _contactInfoManager.AddContactInfo(ContactInfoObject, 3);
                if (result1 > 0)
                {
                    ContactInfoObject.ContactInfoId = result1;
                }
            }
        }
Esempio n. 2
0
 private void SearchByEmail()
 {
     if (!String.IsNullOrEmpty(txtEmail.Text))
     {
         ContactInfoObject = _contactInfoManager.GetContactInfoByEmailOrPhone(true, txtEmail.Text);
         if (ContactInfoObject != null)
         {
             txtFirstName.Text      = ContactInfoObject.FirstName;
             txtLastName.Text       = ContactInfoObject.LastName;
             txtPhone.Text          = ContactInfoObject.Telephone;
             txtTitle.SelectedValue = ContactInfoObject.Title;
             ContactAddresses address = Utility.XmlToObject <ContactAddresses>(ContactInfoObject.ContactAddressXml);
             if (address != null && !String.IsNullOrEmpty(address.City))
             {
                 txtAddress.Text = address.Address;
                 txtCity.Text    = address.City;
                 txtState.Text   = address.State;
                 txtZipCode.Text = address.Zip;
             }
             ContactInfoObject.ContactAddressList = new List <ContactAddresses>();
             ContactInfoObject.ContactAddressList.Add(address);
         }
         else
         {
             txtFirstName.Text = txtLastName.Text = txtEmail.Text = txtAddress.Text = txtCity.Text = txtState.Text = txtZipCode.Text = String.Empty;
         }
     }
 }
Esempio n. 3
0
        private void AddAddress()
        {
            if (AddAddressPhoneEmailInteractioNRequest != null)
            {
                var countries = CountryRepository.Countries.Expand(c => c.Regions).ToArray();

                var parameters = new List <KeyValuePair <string, object> >
                {
                    new KeyValuePair <string, object>("item", new Address()),
                    new KeyValuePair <string, object>("countries", countries)
                };

                var itemVm = _addressVmFactory.GetViewModelInstance(parameters.ToArray());

                var confirmation = new ConditionalConfirmation {
                    Title = "Enter address details".Localize(), Content = itemVm
                };

                AddAddressPhoneEmailInteractioNRequest.Raise(confirmation,
                                                             (x) =>
                {
                    if (x.Confirmed)
                    {
                        var itemToAdd =
                            (x.Content as IAddressDialogViewModel)
                            .InnerItem;
                        itemToAdd.MemberId = InnerItem.MemberId;

                        ContactAddresses.Add(itemToAdd);
                    }
                });
            }
        }
Esempio n. 4
0
 private void RemoveAddress(Address item)
 {
     if (ContactAddresses != null)
     {
         ContactAddresses.Remove(item);
     }
 }
Esempio n. 5
0
    protected void SaveDetail_Click(object sender, EventArgs e)
    {
        ContactAddresses contactAddress = new ContactAddresses();

        contactAddress.Address       = txtAddress.Text;
        contactAddress.City          = txtCity.Text;
        contactAddress.State         = txtState.Text;
        contactAddress.Zip           = txtZipCode.Text;
        contactAddress.ContactInfoId = (Int64)ViewState["ContactInfoId"];

        BusinessEntities.ContactInfo contactInfo = new BusinessEntities.ContactInfo();
        contactInfo.FirstName          = txtFirstName.Text;
        contactInfo.LastName           = txtLastName.Text;
        contactInfo.Email              = txtEmail.Text;
        contactInfo.Telephone          = txtTelephone.Text;
        contactInfo.Mobile             = txtMobile.Text;
        contactInfo.ContactInfoId      = (Int64)ViewState["ContactInfoId"];
        contactInfo.ContactAddressList = new List <ContactAddresses>();
        contactInfo.ContactAddressList.Add(contactAddress);

        Int32 result = contactInfoManager.UpdateContactInfo(contactInfo);

        if (result > 0)
        {
            txtMessage.Text      = "Your personal information has been updated successfully.";
            txtMessage.ForeColor = Color.Green;
        }
    }
Esempio n. 6
0
        private void MakeBillingAddress(Address item)
        {
            foreach (var addressItem in ContactAddresses.Where(addressItem => addressItem.Type == AddressType.Billing.ToString()))
            {
                addressItem.Type = null;
            }

            item.Type = AddressType.Billing.ToString();
            _parentViewModel.IsModified = true;
        }
 private void CreateContactAddress(Guid contactId)
 {
     ContactAddresses.Add(
         new ContactAddress
     {
         Id         = _faker.Random.Guid(),
         Address    = _faker.Address.FullAddress(),
         PostalCode = _faker.Address.ZipCode(),
         Country    = "Belgium",
         ContactId  = contactId
     });
 }
Esempio n. 8
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            ContactAddresses address = null;

            if (ContactInfoObject == null)
            {
                ContactInfoObject           = new ContactInfo();
                ContactInfoObject.Title     = (String)((ComboBoxItem)txtTitle.SelectedValue).Content;
                ContactInfoObject.FirstName = txtFirstName.Text;
                ContactInfoObject.LastName  = txtLastName.Text;
                ContactInfoObject.Telephone = txtPhone.Text;
                ContactInfoObject.Mobile    = String.Empty;
                ContactInfoObject.Email     = txtEmail.Text;
                address               = new ContactAddresses();
                address.Address       = txtAddress.Text;
                address.AddressTypeId = 3;
                address.City          = txtCity.Text;
                address.State         = txtState.Text;
                address.Zip           = txtZipCode.Text;
                address.Country       = "United States";
                ContactInfoObject.ContactAddressList = new List <ContactAddresses>();
                ContactInfoObject.ContactAddressList.Add(address);
                Int64 result1 = _contactInfoManager.AddContactInfo(ContactInfoObject, 3);
                if (result1 > 0)
                {
                    ContactInfoObject.ContactInfoId = result1;
                }
            }
            if (txtOnlinePayment.IsChecked.Value)
            {
                UserOrder.PaymentMethod = PaymentType.OnlinePayment;
            }
            else
            {
                UserOrder.PaymentMethod = PaymentType.CashPayment;
            }

            UserOrder.CustomerEmail     = ContactInfoObject.Email;
            UserOrder.CustomerTelephone = ContactInfoObject.Telephone;
            UserOrder.CustomerMobile    = ContactInfoObject.Mobile;
            if (address == null)
            {
                address = Utility.XmlToObject <ContactAddresses>(ContactInfoObject.ContactAddressXml);
            }
            ;
            UserOrder.DeliveryAddress = address.Address + " " + address.City + " " + address.Zip + " " + address.State;

            ((MainWindow)this.Owner).ContactInfoObject = this.ContactInfoObject;
            this.Close();
        }
Esempio n. 9
0
        private void EditAddress(Address item)
        {
            if (AddAddressPhoneEmailInteractioNRequest != null)
            {
                var addressToEdit = item.DeepClone(_entityFactory as IKnownSerializationTypes);
                var countries     = CountryRepository.Countries.Expand(c => c.Regions).ToArray();

                var parameters = new List <KeyValuePair <string, object> >
                {
                    new KeyValuePair <string, object>("item", addressToEdit),
                    new KeyValuePair <string, object>("countries", countries)
                };

                var itemVm = _addressVmFactory.GetViewModelInstance(parameters.ToArray());

                var confirmation = new ConditionalConfirmation {
                    Title = "Enter address details".Localize(), Content = itemVm
                };

                AddAddressPhoneEmailInteractioNRequest.Raise(confirmation,
                                                             (x) =>
                {
                    if (x.Confirmed)
                    {
                        var itemToUpdate =
                            (x.Content as IAddressDialogViewModel).InnerItem;

                        var itemFromInnerItem =
                            ContactAddresses.SingleOrDefault(
                                a => a.AddressId == itemToUpdate.AddressId);

                        if (itemFromInnerItem != null)
                        {
                            itemFromInnerItem.InjectFrom(itemToUpdate);
                            _parentViewModel.IsModified = true;
                        }
                    }
                });
            }
        }