Beispiel #1
0
        public Dipendente getDipendenteById(string id)
        {
            DBConnection c  = new DBConnection();
            DataTable    dt = new DataTable();

            string qry = "SELECT * FROM DIPENDENTI WHERE ID = " + id;

            dt = c.DoQuerySelect(qry);

            if (dt.Rows.Count > 0)
            {
                Dipendente oDipendente = new Dipendente();
                oDipendente.id            = dt.Rows[0]["ID"].ToString().ToUpper();
                oDipendente.nome          = dt.Rows[0]["NOME"].ToString().ToUpper();
                oDipendente.cognome       = dt.Rows[0]["COGNOME"].ToString().ToUpper();
                oDipendente.codiceFiscale = dt.Rows[0]["CODICEFISCALE"].ToString().ToUpper();
                oDipendente.dataNascita   = dt.Rows[0]["DATADINASCITA"].ToString().ToUpper();
                oDipendente.luogoNascita  = dt.Rows[0]["LUOGONASCITA"].ToString().ToUpper();
                oDipendente.nazionalita   = dt.Rows[0]["NAZIONALITA"].ToString().ToUpper();
                oDipendente.matricola     = dt.Rows[0]["NUMEROMATRICOLA"].ToString().ToUpper();
                //oDipendente.abilitato=dt.Rows[0]["ABILITATO"];


                return(oDipendente);
            }
            else
            {
                return(new Dipendente());
            }
        }
Beispiel #2
0
        public void UpdateDipendente(Dipendente oDipendente)
        {
            DBConnection c   = new DBConnection();
            string       qry = string.Format("UPDATE DIPENDENTI SET NOME = '{0}', COGNOME = '{1}' where ID = {2}", oDipendente.nome, oDipendente.cognome, oDipendente.id);

            c.ExecuteNonQuery(qry);
        }
Beispiel #3
0
        public List <Dipendente> GetAllDipendenti()
        {
            DBConnection c  = new DBConnection();
            DataTable    dt = new DataTable();

            string qry = "SELECT * FROM DIPENDENTI WHERE ABILITATO = 1";

            dt = c.DoQuerySelect(qry);

            List <Dipendente> listaDipendenti = new List <Dipendente>();

            foreach (DataRow tr in dt.Rows)
            {
                Dipendente oDipendente = new Dipendente();
                oDipendente.id            = tr["ID"].ToString().ToUpper();
                oDipendente.nome          = tr["NOME"].ToString().ToUpper();
                oDipendente.cognome       = tr["COGNOME"].ToString().ToUpper();
                oDipendente.codiceFiscale = tr["CODICEFISCALE"].ToString().ToUpper();
                oDipendente.dataNascita   = Convert.ToDateTime(tr["DATADINASCITA"]).ToString("dd-MM-yyyy");/* tr["DATADINASCITA"].ToString().ToUpper();*/
                oDipendente.luogoNascita  = tr["LUOGODINASCITA"].ToString().ToUpper();
                oDipendente.nazionalita   = tr["NAZIONALITA"].ToString().ToUpper();
                oDipendente.matricola     = tr["NUMEROMATRICOLA"].ToString().ToUpper();
                //oDipendente.abilitato=tr["ABILITATO"];

                listaDipendenti.Add(oDipendente);
            }
            return(listaDipendenti);
        }
Beispiel #4
0
        public void InsertDipendente(Dipendente oDipendente)
        {
            DBConnection c   = new DBConnection();
            DataTable    dt  = new DataTable();
            string       qry = string.Format("INSERT INTO DIPENDENTI (NOME, COGNOME, CODICEFISCALE, DATADINASCITA, LUOGODINASCITA, NAZIONALITA, NUMEROMATRICOLA, ABILITATO) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}', 1)", oDipendente.nome, oDipendente.cognome, oDipendente.codiceFiscale, oDipendente.dataNascita, oDipendente.luogoNascita, oDipendente.nazionalita, oDipendente.matricola);

            c.ExecuteNonQuery(qry);
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public List <Dipendente> GetAllDeletedUtenti()
        {
            DBConnection c  = new DBConnection();
            DataTable    dt = new DataTable();

            string qry = "SELECT * FROM DIPENDENTI WHERE ABILITATO = 0";

            dt = c.DoQuerySelect(qry);

            List <Dipendente> listaUtenti = new List <Dipendente>();

            foreach (DataRow tr in dt.Rows)
            {
                Dipendente oDipendente = new Dipendente();
                oDipendente.id      = tr["ID"].ToString();
                oDipendente.nome    = tr["NOME"].ToString();
                oDipendente.cognome = tr["COGNOME"].ToString();

                listaUtenti.Add(oDipendente);
            }
            return(listaUtenti);
        }