public PetitionsSigned HasSigned(PetitionsSigned petition) //no se usa { //try //{ // connection.Open(); // var cmd = connection.CreateCommand() as SqlCommand; // cmd.CommandType = CommandType.StoredProcedure; // cmd.CommandText = "Earthwatcher_HasSigned"; // cmd.Parameters.Add(new SqlParameter("@earthwatcherId", petition.Earthwatcher)); // cmd.Parameters.Add(new SqlParameter("@petitionId", petition.PetitionId)); // var reader = cmd.ExecuteReader(); // var hasResult = reader.Read(); // if (hasResult) // { // petition.Signed = reader.GetBoolean(2); //Devuelve T/F si firmo o no la peticion // return petition; // } return null; //Devuelve null si no existe en la tabla para esa peticion //} //catch (Exception ex) //{ // throw ex; //} //finally //{ // connection.Close(); //} }
public void SavePetitionSigned(PetitionsSigned petition) //No se usa { //if (petition.Signed != null && petition.PetitionId != 0 && !string.IsNullOrEmpty(petition.Earthwatcher)) //{ // try // { // connection.Open(); // var cmd = connection.CreateCommand() as SqlCommand; // cmd.CommandType = CommandType.StoredProcedure; // cmd.CommandText = "Earthwatcher_SavePetition"; // cmd.Parameters.Add(new SqlParameter("@earthwatcherId", petition.Earthwatcher)); // cmd.Parameters.Add(new SqlParameter("@petitionId", petition.PetitionId)); // cmd.Parameters.Add(new SqlParameter("@signed", petition.Signed)); // cmd.ExecuteNonQuery(); // } // catch (Exception ex) // { // throw ex; // } // finally // { // connection.Close(); // } //} }