예제 #1
0
        private void elencoLibri(char from)
        {
            clsLibro l = new clsLibro("Biblioteca.mdf");

            if (from == 'L')
            {
                tabellaLibri = l.lista(' ');
            }
            else if (chkAggiungiAnnullati.Checked == true)
            {
                tabellaLibri = l.lista('A');
            }
            else
            {
                tabellaLibri = l.lista(' ');
            }


            dgvElenco.DataSource = tabellaLibri;

            cmbLibri.DataSource    = tabellaLibri;
            cmbLibri.DisplayMember = "TitoloLibro";
            cmbLibri.ValueMember   = "CodLibro";
            cmbLibri.SelectedIndex = -1;

            l.dispose();
            annulla();
        }
예제 #2
0
        private void btnAggiungi_Click(object sender, EventArgs e)
        {
            grpElenco.Enabled   = false;
            grpGestione.Enabled = true;


            clsPrestito p = new clsPrestito("Biblioteca.mdf");

            lblCodice.Text = "Codice: " + (p.getNuovoCodice()).ToString();

            //caricaComboBox('L');

            clsLettore lett  = new clsLettore("Biblioteca.mdf");
            clsLibro   libro = new clsLibro("Biblioteca.mdf");

            libri   = libro.disponibili();
            lettori = lett.lista(' ');

            cmbLettore.DataSource    = lettori;
            cmbLettore.DisplayMember = "CognomeLettore";
            cmbLettore.ValueMember   = "CodLettore";
            cmbLettore.SelectedIndex = -1;


            cmbLibro.DataSource    = libri;
            cmbLibro.DisplayMember = "TitoloLibro";
            cmbLibro.ValueMember   = "CodLibro";
            cmbLibro.SelectedIndex = -1;

            selezionaLibro = true;

            libro.dispose();
            lett.dispose();
            p.dispose();
        }
예제 #3
0
        private void btnConferma_Click(object sender, EventArgs e)
        {
            if (controlloInput())
            {
                clsLibro l = acquisiciLibro();

                if (btnConferma.Text == "Modifica")
                {
                    l.modifica();
                    selezionaLibro = false;
                    if (chkAggiungiAnnullati.Checked == true)
                    {
                        elencoLibri('K');
                    }
                    else
                    {
                        elencoLibri('L');
                    }
                    selezionaLibro = true;
                }
                else
                {
                    l.aggiungi();
                    selezionaLibro = false;
                    elencoLibri('L');
                    selezionaLibro = true;
                }

                l.dispose();
            }
        }
예제 #4
0
        private void cmbLibri_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbLibri.SelectedIndex != -1 && selezionaLibro)
            {
                clsLibro libro = new clsLibro("Biblioteca.mdf");

                libro.codice = Convert.ToInt32(cmbLibri.SelectedValue);

                libro.getDati();

                lblAutore.Text = libro.autore;
                lblGenere.Text = libro.codGenere.ToString();
                lblTitolo.Text = libro.titolo;

                clsGenere g = new clsGenere("Biblioteca.mdf");

                g.codice = libro.codGenere;
                g.getDati();
                lblGenere.Text = g.nome;

                g.dispose();

                ptbCopertina.ImageLocation = @"IMG\\" + libro.immagine;

                libro.dispose();

                cmbLettori.SelectedIndex = -1;
            }
        }
예제 #5
0
        private void btnAggiungi_Click(object sender, EventArgs e)
        {
            grpElenco.Enabled   = false;
            grpGestione.Enabled = true;
            clsLibro l = new clsLibro("Biblioteca.mdf");

            lblCodice.Text = "Codice: " + l.getNuovoCodice();
            l.dispose();
        }
예제 #6
0
        private void cmbPrestiti_SelectedIndexChanged(object sender, EventArgs e)
        {
            //MessageBox.Show(tabellaPrestiti.Rows.ToString());
            if (selezionaPrestito && cmbPrestiti.SelectedIndex != -1 && cmbPrestiti.ValueMember != "")
            {
                grpElenco.Enabled   = false;
                grpGestione.Enabled = true;

                selezionaLibro = true;

                btnConferma.Text = "Modifica";

                chkAnnullaValditita.Enabled = true;

                clsPrestito p = new clsPrestito("Biblioteca.mdf");


                p.codice = Convert.ToInt32(cmbPrestiti.SelectedValue);
                p.getDati();

                caricaComboBox('k');

                if (p.validita == 'A')
                {
                    chkAnnullaValditita.Checked = true;
                }

                dtpPrestito.Value        = p.dataPrestito;
                cmbLettore.SelectedValue = p.codLettore;
                cmbLibro.SelectedValue   = p.codLibro;
                lblCodice.Text           = "Codice: " + p.codice;

                clsLibro l = new clsLibro("Biblioteca.mdf");

                l.codice = p.codLibro;
                l.getDati();
                pctCopertina.ImageLocation = @"IMG\\" + l.immagine;

                l.dispose();

                if (p.dataRest != DateTime.MinValue)
                {
                    dtpRestituzione.Value   = p.dataRest;
                    chkRestituito.Checked   = true;
                    dtpRestituzione.Enabled = true;
                }
                else
                {
                    chkRestituito.Checked = false;
                    chkRestituito.Enabled = true;
                }
                p.dispose();
            }
        }
예제 #7
0
        private void prestitiRecenti()
        {
            clsLibro l = new clsLibro("Biblioteca.mdf");

            tabellaPrestati = l.prestati();

            dgvPrestati.DataSource = tabellaPrestati;

            cmbPrestatiNONVISIBILE.DataSource    = tabellaPrestati;
            cmbPrestatiNONVISIBILE.ValueMember   = "CodLibro";
            cmbPrestatiNONVISIBILE.DisplayMember = "CodLibro";
            cmbPrestatiNONVISIBILE.SelectedIndex = -1;

            l.dispose();
        }
예제 #8
0
        private void cmbLibro_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbLibro.SelectedIndex != -1 && selezionaLibro)
            {
                clsLibro l = new clsLibro("Biblioteca.mdf");

                //MessageBox.Show(cmbLibro.SelectedValue.ToString());

                l.codice = Convert.ToInt32(cmbLibro.SelectedValue);
                l.getDati();
                pctCopertina.ImageLocation = @"IMG\\" + l.immagine;

                l.dispose();
            }
        }
예제 #9
0
        private void prestitiRecenti()
        {
            clsLibro l = new clsLibro("Biblioteca.mdf");

            tabellaPrestati = l.prestati();

            globals.DATAGRID.DataSource = tabellaPrestati;

            globals.COMBO.DataSource    = tabellaPrestati;
            globals.COMBO.ValueMember   = "CodLibro";
            globals.COMBO.DisplayMember = "CodLibro";
            globals.COMBO.SelectedIndex = -1;

            l.dispose();
        }
예제 #10
0
        private void cmbLibri_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbLibri.SelectedIndex != -1 && selezionaLibro)
            {
                clsLibro l = new clsLibro("Biblioteca.mdf");

                l.codice = Convert.ToInt32(cmbLibri.SelectedValue);
                l.getDati();
                lblCodice.Text = "Codice: " + l.codice;
                txtAutore.Text = l.autore;
                txtTitolo.Text = l.titolo;
                txtISBN.Text   = l.codISBNL;
                nmbAnno.Value  = Convert.ToDecimal(l.anno);
                if (l.validita == 'A')
                {
                    chkAnnullaValditita.Checked = true;
                }
                cmbGenere.SelectedValue    = l.codGenere;
                pctCopertina.ImageLocation = @"IMG\" + l.immagine;
                if (l.prestato == 'P')
                {
                    lblPrestito.Text = "Libro dato in prestito";
                }

                chkAnnullaValditita.Enabled = true;

                /*
                 * clsGenere g = new clsGenere("Biblioteca.mdf");
                 *
                 * g.codice = l.codGenere;
                 * g.getDati();
                 * cmbGenere.SelectedValue = g.codice;
                 *
                 * g.dispose();
                 */

                grpElenco.Enabled   = false;
                grpGestione.Enabled = true;
                btnConferma.Text    = "Modifica";

                l.dispose();
            }
        }
예제 #11
0
        private void btnConferma_Click_1(object sender, EventArgs e)
        {
            if (controllo())
            {
                clsPrestito p = acquisisciDati();
                clsLibro    l = new clsLibro("Biblioteca.mdf");
                l.codice = Convert.ToInt32(cmbLibro.SelectedValue);
                if (btnConferma.Text == "Aggiungi")
                {
                    if (p.aggiungi())
                    {
                        l.aggiornaPrestito('P');
                        selezionaPrestito = false;
                        elencoPrestiti('L');
                        selezionaPrestito = false;
                    }
                }
                else
                {
                    if (p.modifica())
                    {
                        if (chkRestituito.Checked == true)
                        {
                            l.aggiornaPrestito(' ');
                        }
                        else
                        {
                            l.aggiornaPrestito('P');
                        }

                        selezionaPrestito = false;
                        elencoPrestiti('K');
                        selezionaPrestito = false;
                    }
                }

                p.dispose();
                l.dispose();
                annulla();
                prestitiRecenti();
            }
        }
예제 #12
0
        private clsLibro acquisiciLibro()
        {
            clsLibro l = new clsLibro("Biblioteca.mdf");

            l.anno      = Convert.ToInt32(nmbAnno.Value);
            l.autore    = txtAutore.Text;
            l.titolo    = txtTitolo.Text;
            l.codISBNL  = txtISBN.Text;
            l.codGenere = Convert.ToInt32(cmbGenere.SelectedValue);
            //MessageBox.Show((pctCopertina.ImageLocation).Split('\\')[1]);
            l.immagine = (pctCopertina.ImageLocation).Split('\\')[1];
            l.codice   = Convert.ToInt32(lblCodice.Text.Substring(7));
            if (chkAnnullaValditita.Checked == true)
            {
                l.validita = 'A';
            }
            else
            {
                l.validita = ' ';
            }

            return(l);
        }
예제 #13
0
        private void cmbPrestatiNONVISIBILE_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbPrestatiNONVISIBILE.SelectedIndex != -1 && !firstRun)
            {
                clsLibro libro = new clsLibro("Biblioteca.mdf");

                libro.codice = Convert.ToInt32(cmbPrestatiNONVISIBILE.SelectedValue);

                libro.getDati();

                lblAutore.Text = libro.autore;
                lblGenere.Text = libro.codGenere.ToString();
                lblTitolo.Text = libro.titolo;

                clsGenere g = new clsGenere("Biblioteca.mdf");

                g.codice = libro.codGenere;
                g.getDati();
                lblGenere.Text = g.nome;

                g.dispose();

                clsPrestito p = new clsPrestito("Biblioteca.mdf");

                p.codLibro = libro.codice;
                p.getPrestitoFromLibro();
                lblDataPrestito.Text = p.dataPrestito.ToShortDateString();

                p.dispose();


                ptbCopertina.ImageLocation = @"IMG\\" + libro.immagine;

                libro.dispose();
            }
        }
예제 #14
0
        private void caricaComboBox(char from)
        {
            clsGenere g = new clsGenere("Biblioteca.mdf");

            generi = g.lista('A');

            cmbGenere.DataSource    = generi;
            cmbGenere.ValueMember   = "CodGenere";
            cmbGenere.DisplayMember = "NomeGenere";
            cmbGenere.SelectedIndex = -1;
            cmbGenere.Enabled       = false;

            g.dispose();

            clsLibro   libro = new clsLibro("Biblioteca.mdf");
            clsLettore lett  = new clsLettore("Biblioteca.mdf");



            libri   = libro.lista('A');
            lettori = lett.lista('A');

            cmbLibro.DataSource    = libri;
            cmbLibro.ValueMember   = "CodLibro";
            cmbLibro.DisplayMember = "TitoloLibro";
            cmbLibro.SelectedIndex = -1;

            cmbLettore.DataSource    = lettori;
            cmbLettore.ValueMember   = "CodLettore";
            cmbLettore.DisplayMember = "CognomeLettore";
            cmbLettore.SelectedIndex = -1;


            lett.dispose();
            libro.dispose();
        }