Ejemplo n.º 1
0
        public List <ORAPersonaleVVF> GetByCodSede(string codiceSede)
        {
            var context        = new DBContext();
            var infoCon        = context.GetConnectionFromCodiceSede(codiceSede);
            var listaPersonale = new List <ORAPersonaleVVF>();

            OracleConnection conn = new OracleConnection(infoCon.ConnectionString);

            conn.Open();
            OracleCommand cmd = new OracleCommand
            {
                Connection  = conn,
                CommandText = "SELECT NVL(COGNOME,' '), NVL(NOME,' '), NVL(MATDIP,0), NVL(COD_DISTACCAMENTO,0) FROM SALAOPER.PERSONALE p"
            };

            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                var personaSingola = new ORAPersonaleVVF
                {
                    CodFiscale = dr.GetString(2),
                    Nominativo = $"{dr.GetString(1)}.{dr.GetString(0)}",
                    Sede       = $"{codiceSede}.{dr.GetInt32(3).ToString()}"
                };

                listaPersonale.Add(personaSingola);
            }

            return(listaPersonale);
        }
Ejemplo n.º 2
0
        public ORAPersonaleVVF GetByCF(string codiceSede, string codiceFiscale)
        {
            var context = new DBContext();
            var infoCon = context.GetConnectionFromCodiceSede(codiceSede);

            OracleConnection conn = new OracleConnection(infoCon.ConnectionString);

            conn.Open();
            OracleCommand cmd = new OracleCommand
            {
                Connection  = conn,
                CommandText = "SELECT NVL(COGNOME,' '), NVL(NOME,' '), NVL(MATDIP,0), NVL(COD_DISTACCAMENTO,0) FROM SALAOPER.PERSONALE p WHERE MATDIP = :COD_FISC"
            };

            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add(new OracleParameter("COD_FISC", codiceFiscale));
            OracleDataReader dr = cmd.ExecuteReader();
            var personaSingola  = new ORAPersonaleVVF();

            while (dr.Read())
            {
                personaSingola.CodFiscale = dr.GetString(2);
                personaSingola.Nominativo = $"{dr.GetString(1)}.{dr.GetString(0)}";
                personaSingola.Sede       = $"{codiceSede}.{dr.GetInt32(3).ToString()}";
            }

            return(personaSingola);
        }
Ejemplo n.º 3
0
 public static PersonaleVVF Map(ORAPersonaleVVF persona)
 {
     return(new PersonaleVVF
     {
         CodFiscale = persona.CodFiscale,
         Nominativo = persona.Nominativo,
         CodSede = persona.Sede
     });
 }