Exemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the MsCustomer EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMsCustomer(MsCustomer msCustomer)
 {
     base.AddObject("MsCustomer", msCustomer);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new MsCustomer object.
 /// </summary>
 /// <param name="customerID">Initial value of the CustomerID property.</param>
 /// <param name="customerName">Initial value of the CustomerName property.</param>
 /// <param name="customerTitle">Initial value of the CustomerTitle property.</param>
 /// <param name="customerContactNumber">Initial value of the CustomerContactNumber property.</param>
 /// <param name="customerEmail">Initial value of the CustomerEmail property.</param>
 /// <param name="customerCountry">Initial value of the CustomerCountry property.</param>
 /// <param name="customerCity">Initial value of the CustomerCity property.</param>
 /// <param name="customerZip">Initial value of the CustomerZip property.</param>
 /// <param name="customerAddress">Initial value of the CustomerAddress property.</param>
 public static MsCustomer CreateMsCustomer(global::System.String customerID, global::System.String customerName, global::System.Int32 customerTitle, global::System.String customerContactNumber, global::System.String customerEmail, global::System.String customerCountry, global::System.String customerCity, global::System.String customerZip, global::System.String customerAddress)
 {
     MsCustomer msCustomer = new MsCustomer();
     msCustomer.CustomerID = customerID;
     msCustomer.CustomerName = customerName;
     msCustomer.CustomerTitle = customerTitle;
     msCustomer.CustomerContactNumber = customerContactNumber;
     msCustomer.CustomerEmail = customerEmail;
     msCustomer.CustomerCountry = customerCountry;
     msCustomer.CustomerCity = customerCity;
     msCustomer.CustomerZip = customerZip;
     msCustomer.CustomerAddress = customerAddress;
     return msCustomer;
 }
 private void btnRecordc_Click(object sender, EventArgs e)
 {
     //when button record for customer is clicked, validate all the fields according to the project case
     if (txtNamec.Text.Equals(""))
         lblError.Text = "CustomerName must not be empty";
     else if (!checkNameCust())
         lblError.Text = "CustomerName can only accept alphabet";
     else if (txtNamec.Text.Length > 50)
         lblError.Text = "Max CustomerName length is 50 characters";
     else if (cmbTitlec.SelectedIndex < 0)
         lblError.Text = "Select customer title";
     else if (txtContactc.Text.Equals(""))
         lblError.Text = "CustomerContact must not be empty";
     else if (!checkContactCust())
         lblError.Text = "CustomerContact must only number or '+' as first character";
     else if (txtContactc.Text.Length > 20)
         lblError.Text = "Max CustomerContact length is 20 characters";
     else if (txtEmail.Text.Equals(""))
         lblError.Text = "Email must not be empty";
     else if (!checkEmail())
         lblError.Text = "Wrong email format";
     else if (txtEmail.Text.Length > 50)
         lblError.Text = "Max email length is 50 characters";
     else if (txtCountryc.Text.Equals(""))
         lblError.Text = "CustomerCountry must not be empty";
     else if (txtCountryc.Text.Length > 50)
         lblError.Text = "Max CustomerCountry length is 50 characters";
     else if (txtCityc.Text.Equals(""))
         lblError.Text = "CustomerCity must not be empty";
     else if (txtCityc.Text.Length > 50)
         lblError.Text = "Max CustomerCity length is 50 characters";
     else if (txtZipc.Text.Equals(""))
         lblError.Text = "CustomerZip code must not be empty";
     else if (txtZipc.Text.Length > 15)
         lblError.Text = "Max CustomerZip length is 15 digits";
     else if (!checkZipCust())
         lblError.Text = "CustomerZip can only accept numeric";
     else if (!txtAddrc.Text.StartsWith("Street"))
         lblError.Text = "CustomerAddress must be started with 'Street'";
     else
     {
         MessageBox.Show("Customer Data is successfully recorded");
         newCustomer = new MsCustomer();
         newCustomer.CustomerID = newcid;
         newCustomer.CustomerName = txtNamec.Text;
         newCustomer.CustomerAddress = txtAddrc.Text;
         newCustomer.CustomerCity = txtCityc.Text;
         newCustomer.CustomerContactNumber = txtContactc.Text;
         newCustomer.CustomerCountry = txtCountryc.Text;
         newCustomer.CustomerEmail = txtEmail.Text;
         newCustomer.CustomerTitle = cmbTitlec.SelectedIndex + 1;
         newCustomer.CustomerZip = txtZipc.Text;
     }
 }