Exemplo n.º 1
0
        private void signUpButton_Click(object sender, EventArgs e)
        {
            if (nameTxtBox.Text == "" || idTxtBox.Text == "" || addressTxtBox.Text == "" || phoneTxtBox.Text == "")
            {
                MessageBox.Show("please fill mandatory fields");
            }
            else
            {
                try
                {
                    // strSQL = " INSERT INTO tblCustomer (CustomerId, FullName, Address, PhoneNum, Email) VALUES ("+Int32.Parse(idTxtBox.Text)+","+"'"+nameTxtBox.Text+"'"+","+"'"+ addressTxtBox.Text+"'"+"," +Int32.Parse(phoneTxtBox.Text)+"," +"'"+emailTxtBox.Text+"'"+")";
                    //ClientDA sqlCmd = new ClientDA(strSQL);

                    Client objectClient = new Client(idTxtBox.Text,
                                                     nameTxtBox.Text, addressTxtBox.Text,
                                                     Int32.Parse(phoneTxtBox.Text), emailTxtBox.Text);
                    ClientDA.insertEntity(objectClient);
                    MessageBox.Show("Registration is successfull");
                    this.Hide();
                    Card card = new Card(objectClient);
                    card.ShowDialog();
                    Clear();
                }
                catch (Exception)
                {
                    MessageBox.Show("Please make sure you entered an appropirate values");
                }
            }
        }