-
Notifications
You must be signed in to change notification settings - Fork 0
/
AjoutSerie.cs
51 lines (48 loc) · 1.71 KB
/
AjoutSerie.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Main_project_VERON_MERLIN
{
public partial class AjoutSerie : Form
{
private ConnexionOracle bdd;
public AjoutSerie()
{
InitializeComponent();
bdd = new ConnexionOracle();
}
private void ajouterSerie_Click(object sender, EventArgs e)
{
errorNom.Visible = false;
if (nomSerie.Text != string.Empty)
{
nomSerie.Text = nomSerie.Text.Replace("'", "''");
string commande = string.Format("SELECT * FROM PROJET_IHM_SERIE WHERE NOM='{0}'", nomSerie.Text);
DataSet ds = bdd.Select(commande);
if (ds.Tables["Data"].Rows.Count != 0)
{
Trace.WriteLine("-- Ajout Série : erreur - nom déjà utilisé");
errorNom.Visible = true;
}
else
{
if (etatSerie.SelectedIndex != -1)
{
synopsisSerie.Text = synopsisSerie.Text.Replace("'", "''");
commande = string.Format("INSERT INTO PROJET_IHM_SERIE VALUES('{0}', '{1}', '{2}', {3})", nomSerie.Text, synopsisSerie.Text, etatSerie.SelectedItem.ToString(), nbSaison.Value);
bdd.Insert(commande);
Trace.WriteLine("-- Ajout série réussi");
this.Dispose();
}
}
}
}
}
}