Beispiel #1
0
        public plantillaeva ObtenerPlantillaByID(int evaidplantilla)
        {
            Datoplantillaeva DatPlant = new Datoplantillaeva();

            plantillaeva plantilla = new plantillaeva();
            plantilla = (from l in DatPlant.select_All_Plantilla()
                         where l.evaidplantilla == evaidplantilla
                   select l
            ).FirstOrDefault();

            return plantilla;
            // return DatAut.select_AutosbyId(IDAuto);
        }
Beispiel #2
0
        public plantillaeva select_AutosbyId(int evaidplantilla)
        {
            plantillaeva ObjPlantilla = new plantillaeva();
            string StoredProcedure = "ObtenerPlantillaByID";

            using (DbConnection con = dpf.CreateConnection())
            {
                con.ConnectionString = constr;
                using (DbCommand cmd = dpf.CreateCommand())
                {
                    cmd.Connection = con;
                    cmd.CommandText = StoredProcedure;
                    cmd.CommandType = CommandType.StoredProcedure;
                    DbParameter param = cmd.CreateParameter();
                    param.DbType = DbType.Int32;
                    param.ParameterName = "evaidplantilla";
                    param.Value = evaidplantilla;
                    cmd.Parameters.Add(param);
                    con.Open();
                    using (DbDataReader dr = cmd.ExecuteReader())
                    {
                        if (dr.Read())
                        {
                            ObjPlantilla = new plantillaeva(evaidplantilla,
                                (string)dr["eva_nombre_plant"],
                                (string)dr["eva_vigencia_plant"]);
                        }
                    }
                }
            }
            return ObjPlantilla;
        }