예제 #1
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;
        }
    }