Пример #1
0
        private void btnCAdd_Click_1(object sender, RoutedEventArgs e)
        {
            CompanyBuyer cb = new CompanyBuyer();
            cb.Country = (Country)comBoxCCountry.SelectedItem;

            cb.City = txtCCity.Text;
            cb.Address = txtCAddress.Text;
            cb.ZipCode = txtCZipCode.Text;
            cb.Name = txtCName.Text;
            cb.Fax = txtCFax.Text;
            cb.Email = txtCEmail.Text;
            cb.TelephoneNo = txtCTelephoneNo.Text;
            cb.ShortName = txtCShortTag.Text;
            model.AddToBuyers(cb);
            Validation v = new Validation();

            if (v.ValidateTextField(txtCName.Text))
            {

                if (v.ValidateEmail(txtCEmail.Text))
                {
                    model.AddToBuyers(cb);
                    model.SaveChanges();
                    MessageBox.Show("Successfully added to database", "Added the company");

                }

                else
                    MessageBox.Show("Email is in Invalide formate", "Error");

            }
            else
            {
                MessageBox.Show("Need to enter details in required fields", "Error");

            }
        }
Пример #2
0
 /// <summary>
 /// Create a new CompanyBuyer object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="countryId">Initial value of the CountryId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="city">Initial value of the City property.</param>
 /// <param name="zipCode">Initial value of the ZipCode property.</param>
 /// <param name="fax">Initial value of the Fax property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 /// <param name="telephoneNo">Initial value of the TelephoneNo property.</param>
 /// <param name="shortName">Initial value of the ShortName property.</param>
 public static CompanyBuyer CreateCompanyBuyer(global::System.Int32 id, global::System.Int32 countryId, global::System.String name, global::System.String city, global::System.String zipCode, global::System.String fax, global::System.String email, global::System.String address, global::System.String telephoneNo, global::System.String shortName)
 {
     CompanyBuyer companyBuyer = new CompanyBuyer();
     companyBuyer.Id = id;
     companyBuyer.CountryId = countryId;
     companyBuyer.Name = name;
     companyBuyer.City = city;
     companyBuyer.ZipCode = zipCode;
     companyBuyer.Fax = fax;
     companyBuyer.Email = email;
     companyBuyer.Address = address;
     companyBuyer.TelephoneNo = telephoneNo;
     companyBuyer.ShortName = shortName;
     return companyBuyer;
 }