Ejemplo n.º 1
0
        /// <summary>
        /// Rigenera la tabella dei Dipendenti
        /// </summary>
        private void ReloadTable()
        {
            TBLdipendenti.Rows.Clear();
            List <Dipendente> listaDipendente = new List <Dipendente>();
            DipendenteDAO     oDipendenteDao  = new DipendenteDAO();

            listaDipendente = oDipendenteDao.GetAllDipendenti();
            foreach (Dipendente d in listaDipendente)
            {
                TableCell tc1 = new TableCell();
                TableCell tc2 = new TableCell();
                TableCell tc3 = new TableCell();
                TableCell tc4 = new TableCell();
                TableCell tc5 = new TableCell();
                TableCell tc6 = new TableCell();
                TableCell tc7 = new TableCell();

                tc1.Text = d.nome;
                tc2.Text = d.cognome;
                tc3.Text = d.codiceFiscale;
                tc4.Text = d.dataNascita;
                tc5.Text = d.luogoNascita;
                tc6.Text = d.nazionalita;
                tc7.Text = d.matricola;

                //Button oUpdateButton = new Button();
                //oUpdateButton.CssClass = "btn btn-sm btn-warning ombraPulsante";
                //oUpdateButton.Text = "Modifica";
                //oUpdateButton.Attributes["id_Dipendente"] = d.id;
                //oUpdateButton.Click += new EventHandler(ModificaDipendente);
                //tc3.Controls.Add(oUpdateButton);

                //Button oDeleteButton = new Button();
                //oDeleteButton.CssClass = "btn btn-sm btn-danger ombraPulsante";
                //oDeleteButton.Text = "Elimina";
                //oDeleteButton.Attributes["id_Dipendente"] = d.id;
                //oDeleteButton.Click += new EventHandler(CancellaDipendente);
                ////oDeleteButton.Click += CancellaDipendente;
                //tc4.Controls.Add(oDeleteButton);

                TableRow tr = new TableRow();
                tr.Cells.Add(tc1);
                tr.Cells.Add(tc2);
                tr.Cells.Add(tc3);
                tr.Cells.Add(tc4);
                tr.Cells.Add(tc5);
                tr.Cells.Add(tc6);
                tr.Cells.Add(tc7);

                TBLdipendenti.Rows.Add(tr);
            }
        }
Ejemplo n.º 2
0
        protected void BTNaggiungi_Click(object sender, EventArgs e)
        {
            Dipendente oDipendente = new Dipendente();

            oDipendente.nome          = TXTnomeDipendente.Text;
            oDipendente.cognome       = TXTcognomeDipendente.Text;
            oDipendente.matricola     = Guid.NewGuid().ToString("N").Substring(10, 10);
            oDipendente.codiceFiscale = TXTcodiceFiscale.Text;
            oDipendente.dataNascita   = TXTdataDiNascita.Text;
            oDipendente.luogoNascita  = TXTluogoDiNascita.Text;
            oDipendente.nazionalita   = TXTnazionalita.Text;

            DipendenteDAO oDipendenteDao = new DipendenteDAO();

            oDipendenteDao.InsertDipendente(oDipendente);
            FormClear();
        }