public void Eliminar(ControlLaboral controlLaboral) { StringBuilder sb = new StringBuilder(); sb.Append("UPDATE ControlLaboral SET inactivo=1 "); sb.Append("WHERE id = @id"); string cmdText = sb.ToString(); List<IDbDataParameter> pars = new List<IDbDataParameter>(); pars.Add(dbManager.CrearParametro("@id", controlLaboral.Id)); dbManager.ExecuteNonQuery(CommandType.Text, cmdText, pars); }
public long Alta(ControlLaboral controlLaboral) { StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO ControlLaboral (fecha) VALUES (@fecha)"); //LOOPEAR EN TODOS LAS ASISTENCIAS DEL CONTROL LABORAL //UPDATE Asistencia SET id_ControlLaboral = @id_ControlLaboral WHERE id = @idControlLaboral //LOOPEAR EN TODOS LAS AUSENCIAS DEL CONTROL LABORAL //UPDATE Ausencia SET id_ControlLaboral = @id_ControlLaboral WHERE id = @idControlLaboral string cmdText = sb.ToString(); //TODO List<IDbDataParameter> pars = new List<IDbDataParameter>(); pars.Add(dbManager.CrearParametro("@fecha", controlLaboral.Fecha)); dbManager.ExecuteNonQuery(CommandType.Text, cmdText, pars); controlLaboral.Id = dbManager.GetIdentity(); return controlLaboral.Id; }
private ControlLaboral ConstruirControlLaboral(IDataReader reader) { ControlLaboral controlLaboral = new ControlLaboral(); controlLaboral.Id = reader.GetInt32(0); controlLaboral.Fecha = reader.GetDateTime(1); //TODO Llamar al metodo ListarAsistenciasDelControlLaboral(controlLaboral.Id) y SETEARLE LAS ASISTENCIAS al ControlLaboral //Lo mismo con ausencias... PERO LO DEJAMOS PARA LA CAPA DE SERVICIOS O MAS ARRIBA... NO SE LEVANTA EN CASCADA. return controlLaboral; }
public void Modificar(ControlLaboral controlLaboral) { StringBuilder sb = new StringBuilder(); sb.Append("UPDATE ControlLaboral SET fecha = @fecha"); sb.Append("WHERE id = @id"); string cmdText = sb.ToString(); List<IDbDataParameter> pars = new List<IDbDataParameter>(); pars.Add(dbManager.CrearParametro("@fecha", controlLaboral.Fecha)); //TODO aca tengo dudas. andres. dbManager.ExecuteNonQuery(CommandType.Text, cmdText, pars); }