private void buttonFilme_Click(object sender, EventArgs e) { afisareFilme form = new afisareFilme(); this.Hide(); form.ShowDialog(); }
private void buttonAdaugaRecenzie_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(connString); OleDbCommand comanda = new OleDbCommand(); comanda.Connection = conn; try { conn.Open(); comanda.CommandText = "Select MAX(id) FROM recenzii"; int id = Convert.ToInt32(comanda.ExecuteScalar()); int nota = Convert.ToInt32(cbNota.SelectedItem.ToString()); string descriere = tbDescriere.Text; Recenzie rec = new Recenzie(id, nota, descriere, idFilm); rec.save(connString); MessageBox.Show("Succes"); afisareFilme form = new afisareFilme(); this.Hide(); form.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.Close(); } }
private void button1_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(connString); OleDbCommand comanda = new OleDbCommand(); comanda.Connection = conn; if (tbDenumire.Text == "") { errorProvider1.SetError(tbDenumire, "Introduceti denumire"); } else if (tbDurata.Text == "") { errorProvider1.Clear(); errorProvider1.SetError(tbDurata, "Introduceti durata (min)"); } else if (tbPret.Text == "") { errorProvider1.Clear(); errorProvider1.SetError(tbPret, "Introduceti pretul"); } else { errorProvider1.Clear(); try { conn.Open(); comanda.CommandText = "Select MAX(id) FROM filme"; int id = Convert.ToInt32(comanda.ExecuteScalar()); string denumire = tbDenumire.Text; int idCategorie = Categorie.getCategoryIdByName(connString, cbCategorie.SelectedItem.ToString()); DateTime data = Convert.ToDateTime(dateTimePicker.Text); double durata = Convert.ToDouble(tbDurata.Text); float pret = (float)Convert.ToDouble(tbPret.Text); Filme film = new Filme(id, denumire, idCategorie, data, durata, pret, imgPath); film.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(); } } }
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(); } } }