public reporteConsumoCombustible(reportCombustible Report) 
 {
     this.Report = Report;
     this.horasTrabajo = this.obtenerHorasTrabajo();
     this.kilometrosTrabajo = this.obtenerKilometrosTrabajo();
     if (this.horasTrabajo == 0)
     {
         this.rendimientoLitrosHora = 0;
     }
     else
     {
         this.rendimientoLitrosHora = this.Report.litros / this.horasTrabajo;
     }
     this.rendimientoKilometrosLitro = this.kilometrosTrabajo / this.Report.litros;
 }
 public reporteConsumoCombustible(reportCombustible Report)
 {
     this.Report            = Report;
     this.horasTrabajo      = this.obtenerHorasTrabajo();
     this.kilometrosTrabajo = this.obtenerKilometrosTrabajo();
     if (this.horasTrabajo == 0)
     {
         this.rendimientoLitrosHora = 0;
     }
     else
     {
         this.rendimientoLitrosHora = this.Report.litros / this.horasTrabajo;
     }
     this.rendimientoKilometrosLitro = this.kilometrosTrabajo / this.Report.litros;
 }
Exemple #3
0
        public static reportCombustible obtenerUltimo(int idEquipo)
        {
            reportCombustible retorno = new reportCombustible();
            SqlConnection     con     = conexion.crearConexion();

            con.Open();

            using (SqlCommand command = new SqlCommand("SELECT TOP 1 ID FROM reportCombustible "
                                                       + "WHERE equiposID_ID=@equiposID ORDER BY fechaHora DESC", con))
            {
                command.Parameters.Add("@equiposID", SqlDbType.Int).Value = idEquipo;
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        retorno = new Context().ReportsCombustible.Find(int.Parse(reader[0].ToString()));
                    }
                }
            }

            con.Close();
            return(retorno);
        }
        public static reportCombustible obtenerUltimo(int idEquipo)
        {
            reportCombustible retorno = new reportCombustible();
            SqlConnection con = conexion.crearConexion();
            con.Open();

            using (SqlCommand command = new SqlCommand("SELECT TOP 1 ID FROM reportCombustible "
                + "WHERE equiposID_ID=@equiposID ORDER BY fechaHora DESC", con))
            {
                command.Parameters.Add("@equiposID", SqlDbType.Int).Value = idEquipo;
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        retorno = new Context().ReportsCombustible.Find(int.Parse(reader[0].ToString()));
                    }
                }
            }

            con.Close();
            return retorno;
        }