コード例 #1
0
ファイル: Empleado.cs プロジェクト: gctv01/BD1Project
        public int insertarEmpleado(int ci, string nombre, string apellido, string fechaNac,
                                    string correo, string nivelAca, string profesion, string estCivil, int cantHijos,
                                    string correoEmp, int salarioAsig, string fechaContratado, int sucursal,
                                    string horarioI)
        {
            NpgsqlConnection conn = DAOEmpleado.getInstanceDAO();

            conn.Open();
            int fkgastos = 4;

            String sql = "INSERT INTO \"Empleado\" (\"CI\", \"Nombre\", \"Apellido\", \"FechaNac\", " +
                         " \"Correo\", \"NivelAca\", \"Profesion\", \"EstadoCivil\", \"CantHijos\", \"CorreoEmpresa\", " +
                         " \"SalarioAsig\", \"FechaContratado\", \"FK-GastosE\", \"FK-SucursalEmp\", \"FK-HorarioEmp\") " +
                         " VALUES (" + ci + ",'" + nombre + "','" + apellido + "',TO_DATE('" + fechaNac + "', 'YYYY-MM-DD'), " +
                         " '" + correo + "', '" + nivelAca + "', '" + profesion + "','" + estCivil + "', " + cantHijos + ", " +
                         " '" + correoEmp + "', " + salarioAsig + ", TO_DATE('" + fechaContratado + "', 'YYYY-MM-DD'), " +
                         " " + fkgastos + ", " + sucursal + "," + horarioI + ");";
            NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);

            try
            {
                int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE
                conn.Close();
                return(resp);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
                conn.Close();
                return(0);
            }
        }
コード例 #2
0
ファイル: Empleado.cs プロジェクト: gctv01/BD1Project
        public int registrarAsistencia(int ci, int codZona, string fecha)
        {
            NpgsqlConnection conn = DAOEmpleado.getInstanceDAO();

            conn.Open();
            int fkgastos = 4;

            String sql = "INSERT INTO \"Asistencia\" (\"COD\", \"CIEmpleado\", \"CODZona\", \"Fecha\") " +
                         "VALUES ((SELECT NEXTVAL('\"SQLasistencia\"')),'" + ci + "','" + codZona + "', " +
                         "TO_DATE('" + fecha + "', 'YYYY-MM-DD'));";
            NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);

            try
            {
                int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE
                conn.Close();
                return(resp);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
                conn.Close();
                return(0);
            }
        }
コード例 #3
0
ファイル: Empleado.cs プロジェクト: gctv01/BD1Project
 public static DAOEmpleado getInstance()
 {
     if (DAOEmpleado.c != null)
     {
         return(c);
     }
     else
     {
         c = new DAOEmpleado();
         return(c);
     }
 }