Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Customer newCus = new Customer();
            newCus.CustomerID = -1;
            newCus.CompanyName = this.txtCompName.Text;
            newCus.Contactname = this.txtContName.Text;
            newCus.ContactTitle = this.txtContTitle.Text;
            newCus.Address = this.txtAddr.Text;
            newCus.City = this.txtCity.Text;
            newCus.Region = this.txtRegion.Text;
            newCus.Postalcode = this.txtPos.Text;
            newCus.Country = this.cbCountry.Text;
            newCus.Phone = this.txtPhone.Text;
            newCus.Fax = this.txtFax.Text;

            int check = newCus.isValid();
            if (check < 0)
            {
                MessageBox.Show(newCus.getErrorMessage(check));
            }
            else
            {
                this.dataModel.insertNewRow(newCus);
                MessageBox.Show("Completed");
                clearAll();
            }
        }