public bool InserirBL(Reservas instancia) { /*criar as regras de negocio*/ ReservasDA varDA = new ReservasDA(); return varDA.InserirDA(instancia); }
public bool ExcluirDA(Reservas instancia) { SqlParameter[] paramsToSP = new SqlParameter[1]; paramsToSP[0] = new SqlParameter("@id", instancia.Id); try { return (SqlHelper.ExecuteNonQuery( ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.StoredProcedure, "stp_delete_Reservas", paramsToSP) > 0); } catch (Exception e) { return false; } }
public bool InserirDA(Reservas instancia) { SqlParameter[] paramsToSP = new SqlParameter[4]; paramsToSP[0] = new SqlParameter("@pessoaId", instancia.PessoaId); paramsToSP[1] = new SqlParameter("@exemplarId", instancia.ExemplarId); paramsToSP[2] = new SqlParameter("@dataInicio", instancia.DataInicio); paramsToSP[0] = new SqlParameter("@dataFim", instancia.DataFim); try { return (SqlHelper.ExecuteNonQuery( ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.StoredProcedure, "stp_insert_Reservas", paramsToSP) > 0); } catch (Exception e) { return false; } }
private List<Reservas> CarregarObjReservas(SqlDataReader dr) { List<Reservas> reservas = new List<Reservas>(); while (dr.Read()) { Reservas reserva = new Reservas(); reserva.Id = int.Parse(dr["ID"].ToString()); reserva.PessoaId = int.Parse(dr["PESSOAID"].ToString()); reserva.ExemplarId = int.Parse(dr["EXEMPLARID"].ToString()); reserva.DataInicio = Convert.ToDateTime(dr["DATAINICIO"].ToString()); reserva.DataFim = Convert.ToDateTime(dr["DATAFIM"].ToString()); reservas.Add(reserva); } return reservas; }