示例#1
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (checkAdd())
            {
                //Assign New CustomerInfo
                supplierInfo.SupplierID   = int.Parse(txtSupplierID.Text);
                supplierInfo.SupplierName = txtName.Text;
                supplierInfo.Contact      = txtContact.Text;
                supplierInfo.PhoneNumber  = txtPhoneNumber.Text;
                supplierInfo.Fax          = txtFax.Text;
                supplierInfo.Address      = txtAddress.Text;
                supplierInfo.AreaID       = int.Parse(cbbArea.SelectedValue.ToString());
                supplierInfo.Position     = txtPosition.Text;

                //Add new Customer
                supplierBUS.AddNewSupplier(supplierInfo);
                MessageBox.Show("Create Successful!!!", "Succes", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Close();
            }
            else
            {
                if (txtSupplierID.Text == "")
                {
                    MessageBox.Show("Supplier ID can't be blank!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (cbbArea.Text == "")
                {
                    MessageBox.Show("Area can't be blank!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (txtName.Text == "")
                {
                    MessageBox.Show("Supplier Name can't be blank!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }