예제 #1
0
        public List <Camion> obtenerCamiones()
        {
            List <Camion> lstCamion = new List <Camion>();
            DataTable     dtcamion  = new DataTable();

            dtcamion = BaseHelper.ejecutarSelect("spselectcamion", CommandType.StoredProcedure);
            for (int i = 0; i < dtcamion.Rows.Count; i++)
            {
                Camion camTemp = new Camion();
                camTemp.IdCamion    = int.Parse(dtcamion.Rows[i]["idcamion"].ToString());
                camTemp.Descripcion = dtcamion.Rows[i]["descripcion"].ToString();
                camTemp.Placa       = dtcamion.Rows[i]["placa"].ToString();
                camTemp.Marca       = dtcamion.Rows[i]["marca"].ToString();
                camTemp.Modelo      = dtcamion.Rows[i]["modelo"].ToString();
                lstCamion.Add(camTemp);
            }
            return(lstCamion);
        }
예제 #2
0
        public Camion obtenerCamion(int IdCamion)
        {
            Camion              camion;
            DataTable           dtcamion   = new DataTable();
            List <SqlParameter> parametros = new List <SqlParameter>();

            parametros.Add(new SqlParameter("@idcamion", IdCamion));
            dtcamion = BaseHelper.ejecutarSelect("spcamionConsultarPorID", CommandType.StoredProcedure, parametros);
            if (dtcamion.Rows.Count > 0)
            {
                camion             = new Camion();
                camion.IdCamion    = int.Parse(dtcamion.Rows[0]["idcamion"].ToString());
                camion.Descripcion = dtcamion.Rows[0]["descripcion"].ToString();
                camion.Placa       = dtcamion.Rows[0]["placa"].ToString();
                camion.Marca       = dtcamion.Rows[0]["marca"].ToString();
                camion.Modelo      = dtcamion.Rows[0]["modelo"].ToString();
                return(camion);
            }
            else
            {
                return(null);
            }
        }