public Boolean eliminar(Planilla_TO planilla) { try { SqlCommand query = new SqlCommand("UPDATE PLANILLA SET estado_planilla = @estado WHERE id_planilla = @id", conex); query.Parameters.AddWithValue("@id", planilla.Id); query.Parameters.AddWithValue("@estado", planilla.Estado); if (conex.State != ConnectionState.Open) { conex.Open(); } query.ExecuteNonQuery(); return(true); } catch (Exception ex) { return(false); } finally { if (conex.State != System.Data.ConnectionState.Closed) { conex.Close(); } } }
public Boolean agregar(Planilla_TO planilla) { try { SqlCommand query = new SqlCommand("INSERT INTO PLANILLA VALUES(@Id, @Inicio, @Fin, @Total, @Tipo, @Estado)", conex); query.Parameters.AddWithValue("@Id", planilla.Id); query.Parameters.AddWithValue("Inicio", planilla.Fecha_inicio); query.Parameters.AddWithValue("Fin", planilla.Fecha_fin); query.Parameters.AddWithValue("Total", planilla.Total); query.Parameters.AddWithValue("Tipo", planilla.Tipo); query.Parameters.AddWithValue("Estado", planilla.Estado); if (conex.State != ConnectionState.Open) { conex.Open(); } query.ExecuteNonQuery(); return(true); } catch (Exception ex) { return(false); } finally { if (conex.State != ConnectionState.Closed) { conex.Close(); } } }
public Boolean set_total() { Planilla_TO planilla = new Planilla_TO(); planilla.Id = this.Id; planilla.Total = this.Total; return(new Planilla_BD().set_total(planilla)); }
public Boolean eliminar() { Planilla_TO planilla = new Planilla_TO(); planilla.Id = this.Id; planilla.Estado = this.Estado; return(new Planilla_BD().eliminar(planilla)); }
public Planilla_TO bl_to_to() { Planilla_TO planilla = new Planilla_TO(); planilla.Id = this.Id; planilla.Fecha_inicio = this.Fecha_inicio; planilla.Fecha_fin = this.Fecha_fin; planilla.Total = this.Total; planilla.Tipo = this.Tipo; planilla.Estado = this.Estado; return(planilla); }
public Planilla to_to_bl(Planilla_TO to) { Planilla planilla = new Planilla(); planilla.Id = to.Id; planilla.Fecha_inicio = to.Fecha_inicio; planilla.Fecha_fin = to.Fecha_fin; planilla.Total = to.Total; planilla.Tipo = to.Tipo; planilla.Estado = to.Estado; return(planilla); }
public List <Planilla_TO> obtener_lista() { List <Planilla_TO> lista = new List <Planilla_TO>(); Planilla_TO planilla; try { SqlCommand query = new SqlCommand("SELECT * FROM PLANILLA", conex); if (conex.State != ConnectionState.Open) { conex.Open(); } SqlDataReader reader = query.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { planilla = new Planilla_TO(); planilla.Id = reader.GetInt32(0); planilla.Fecha_inicio = reader.GetDateTime(1); planilla.Fecha_fin = reader.GetDateTime(2); planilla.Total = reader.GetDecimal(3); planilla.Tipo = reader.GetInt32(4); planilla.Estado = reader.GetBoolean(5); lista.Add(planilla); } return(lista); } else { return(lista); } } catch (Exception ex) { return(lista); } finally { if (conex.State != ConnectionState.Closed) { conex.Close(); } } }
public Boolean agregar() { Planilla_TO planilla = bl_to_to(); return(new Planilla_BD().agregar(planilla)); }