public static void SaveEmpresaColectivo(ref EmpresaColectivoDTO EmpresaColectivo) { SqlCommand command; if (EmpresaColectivo.IsNew) { command = GetDbSprocCommand("usp_EmpresaColectivo_Insert"); command.Parameters.Add(CreateOutputParameter("@idEmpresaColectivo", SqlDbType.Int)); } else { command = GetDbSprocCommand("usp_EmpresaColectivo_Update"); command.Parameters.Add(CreateParameter("@idEmpresaColectivo", EmpresaColectivo.idEmpresaColectivoDTO)); } command.Parameters.Add(CreateParameter("@nombre", EmpresaColectivo.nombreDTO, 50)); command.Parameters.Add((CreateParameter("@telefono", EmpresaColectivo.telefonoDTO, 13))); command.Parameters.Add((CreateParameter("@paginaWeb", EmpresaColectivo.paginaWebDTO, 50))); // Run the command. command.Connection.Open(); command.ExecuteNonQuery(); command.Connection.Close(); // If this is a new record, let's set the ID so the object // will have it. if (EmpresaColectivo.IsNew) { EmpresaColectivo.idEmpresaColectivoDTO = (int)command.Parameters["@idEmpresaColectivo"].Value; } }
internal override DTOBase PopulateDTO(SqlDataReader reader) { EmpresaColectivoDTO empresaColectivosDTO = new EmpresaColectivoDTO(); //idEmpresaColectivos if (!reader.IsDBNull(Ord_idEmpresaColectivos)) { empresaColectivosDTO.idEmpresaColectivoDTO = reader.GetInt32(Ord_idEmpresaColectivos); } //nombre if (!reader.IsDBNull(Ord_nombre)) { empresaColectivosDTO.nombreDTO = reader.GetString(Ord_nombre); } //telefono if (!reader.IsDBNull(Ord_telefono)) { empresaColectivosDTO.telefonoDTO = reader.GetString(Ord_telefono); } //paginaWeb if (!reader.IsDBNull(Ord_paginaWeb)) { empresaColectivosDTO.paginaWebDTO = reader.GetString(Ord_paginaWeb); } return(empresaColectivosDTO); }