Example #1
0
        //string cognome, string nome, char validita
        public bool aggiungi()
        {
            bool esito = false;

            if (verifica())
            {
                // int codice = getNuovoCodice();

                sql = "INSERT INTO Offerte " +
                      "( DesOfferta, ScontoOfferta, ValOfferta) " +
                      "VALUES(" + "'" + _descrizione + "'," +
                      "'" + _sconto + "'," +
                      "'" + _validita + "')";

                try
                {
                    sqlOfferta.eseguiNonQuery(sql, CommandType.Text);
                    esito = true;
                    MessageBox.Show("Offerta inserito con successo.");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Attenzione!! [aggiungi]" + e.Message);
                }
            }
            else
            {
                MessageBox.Show("Offerta già presente.");
            }

            return(esito);
        }
        public bool aggiungi()
        {
            bool esito = false;


            // int codice = getNuovoCodice();

            sql = "INSERT INTO Scrive " +
                  "( IdLibScrive, IdAutScrive, ValScrive) " +
                  "VALUES(" + "'" + _codLibro + "'," +
                  "'" + _codAutore + "'," +
                  "' ')";

            try
            {
                sqlScrive.eseguiNonQuery(sql, CommandType.Text);
                esito = true;
                //MessageBox.Show("Offerta inserito con successo.");
            }
            catch (Exception e)
            {
                MessageBox.Show("Attenzione!! [scrive.aggiungi]" + e.Message);
            }


            return(esito);
        }
        //string cognome, string nome, char validita
        public bool aggiungi()
        {
            bool esito = false;

            if (verifica())
            {
                // int codice = getNuovoCodice();

                sql = "INSERT INTO Editori " +
                      "( NomeEditore, ValEditore) " +
                      "VALUES(" + "'" + _nome + "'," +
                      "'" + _validita + "')";

                try
                {
                    sqlEditori.eseguiNonQuery(sql, CommandType.Text);
                    esito = true;
                    MessageBox.Show("Editore inserito con successo.");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Attenzione!! [aggiungi]" + e.Message);
                }
            }
            else
            {
                MessageBox.Show("Editore già presente.");
            }

            return(esito);
        }
Example #4
0
        //string cognome, string nome, char validita
        public bool aggiungi()
        {
            bool esito = false;

            if (verifica())
            {
                // int codice = getNuovoCodice();

                sql = "INSERT INTO Reparti " +
                      "( CodReparto, DesReparto, ValReparto) " +
                      "VALUES(" + "'" + _codReparto + "'," +
                      "'" + _descrizione + "'," +
                      "'" + _validita + "')";

                try
                {
                    sqlReparti.eseguiNonQuery(sql, CommandType.Text);
                    esito = true;
                    MessageBox.Show("Reparto inserito con successo.");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Attenzione!! [aggiungi]" + e.Message);
                }
            }
            else
            {
                MessageBox.Show("Reparto già presente.");
            }

            return(esito);
        }
        //string cognome, string nome, char validita
        public bool aggiungi()
        {
            bool esito = false;

            if (verifica())
            {
                // int codice = getNuovoCodice();

                sql = "INSERT INTO Autori " +
                      "( CognAutore, FotoAutore, DatNasAutore, DesAutore, NomeAutore, ValAutore) " +
                      "VALUES(" + "'" + _cognome + "'," +
                      "'" + _imgAutore + "'," +
                      "'" + _dataNascita.ToString("MM/dd/yyyy") + "'," +
                      "'" + _descrizione + "'," +
                      "'" + _nome + "'," +
                      "'" + _valAutore + "')";

                try
                {
                    sqlAutori.eseguiNonQuery(sql, CommandType.Text);
                    esito = true;
                    MessageBox.Show("Autore inserito con successo.");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Attenzione!! [aggiungi]" + e.Message);
                }
            }
            else
            {
                MessageBox.Show("Autore già presente.");
            }

            return(esito);
        }
        //string cognome, string nome, char validita
        public bool aggiungi(int [] autori)
        {
            bool esito = false;

            if (verifica())
            {
                // int codice = getNuovoCodice();

                sql = "INSERT INTO Libri " +
                      "( TitoloLibro, ImgLibro, DataLibro, IdOffLibro, CodRepLibro, IdEdiLibro, PrezzoLibro, ValLibro) " +
                      "VALUES(" + "'" + _titolo + "'," +
                      "'" + _imgLibro + "'," +
                      "'" + _dataPubblicazione.ToString("MM/dd/yyyy") + "'," +
                      "'" + _codOfferta + "'," +
                      "'" + _codReparto + "'," +
                      "'" + _codEditore + "'," +
                      "" + _prezzo + "," +
                      "'" + _valLibro + "')";

                try
                {
                    sqlLibri.eseguiNonQuery(sql, CommandType.Text);
                    esito = true;
                    MessageBox.Show("Libro inserito con successo.");

                    clsScrive s = new clsScrive("CatalogoLibri.mdf");
                    s.codLibro = getNuovoCodice() - 1;

                    for (int i = 0; i < autori.Length; i++)
                    {
                        s.codAutore = autori[i];
                        s.aggiungi();
                    }
                    s.dispose();
                }
                catch (Exception e)
                {
                    MessageBox.Show("Attenzione!! [aggiungi]" + e.Message);
                }
            }
            else
            {
                MessageBox.Show("Libro già presente.");
            }

            return(esito);
        }