private void buttonComanda_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(connString); OleDbCommand comanda = new OleDbCommand(); comanda.Connection = conn; Regex regex = new Regex("^[a-zA-Z]+$"); //bool hasOnlyAlpha = regex.IsMatch(myTextBox.Text); && regex.IsMatch(tbNume.Text if (tbNume.Text == "") { errorProvider1.SetError(tbNume, "Introduceti numele"); } else if (tbPrenume.Text == "") { errorProvider1.Clear(); errorProvider1.SetError(tbPrenume, "Introduceti prenumele)"); } else if (tbTelefon.Text == "") { errorProvider1.Clear(); errorProvider1.SetError(tbTelefon, "Introduceti telefonul "); } else { errorProvider1.Clear(); try { int idMaxClient = getMaxIdFromDbTable("clienti"); int idMaxComanda = getMaxIdFromDbTable("inchirieri"); string nume = tbNume.Text; string prenume = tbPrenume.Text; string adresa = tbAdresa.Text; string telefon = tbTelefon.Text; string sex = cbSex.SelectedItem.ToString(); int varsta = Convert.ToInt32(tbVarsta.Text); string username = tbUsername.Text; string password = tbPassword.Text; int idFilm = Filme.findMovieIdByName(connString, cbFilm.SelectedItem.ToString()); DateTime data = Convert.ToDateTime(dateTimePicker.Text); client = new Clienti(idMaxClient, nume, prenume, adresa, telefon, sex, varsta, username, password); client.save(connString); Inchirieri inchiriere = new Inchirieri(idMaxComanda, data, idFilm, idMaxClient); inchiriere.save(connString); MessageBox.Show("Succes"); this.Hide(); afisareFilme form = new afisareFilme(); form.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.Close(); } } }
public object Clone() { Filme f = (Filme)this.MemberwiseClone(); return(f); }