public static Alarma GetAlarmaByID(int idAlarma) { if (idAlarma <= 0) { throw new ArgumentException("Id de alarma es nula"); } DAL.AlarmaDSTableAdapters.AlarmaTableAdapter adapter = new DAL.AlarmaDSTableAdapters.AlarmaTableAdapter(); AlarmaDS.AlarmaDataTable table = adapter.GetAlarmaById(idAlarma); if (table.Rows.Count == 0) { throw new ArgumentException("Vacio o tal vez no existe"); } Alarma alarma = GetAlarmaFromRow(table[0]); return(alarma); }
public static Alarma GetAlarmaByCodigo(String codigo) { if (String.IsNullOrEmpty(codigo)) { throw new ArgumentException("Codigo Vacio"); } DAL.AlarmaDSTableAdapters.AlarmaTableAdapter adapter = new DAL.AlarmaDSTableAdapters.AlarmaTableAdapter(); AlarmaDS.AlarmaDataTable table = adapter.GetAlarmaByCodigo(codigo); if (table.Rows.Count == 0) { throw new ArgumentException("Vacio o tal vez no existe"); } Alarma alarma = GetAlarmaFromRow(table[0]); return(alarma); }
public static List <Alarma> GetAlarmaByIdUsuario(int idUsuario) { if (idUsuario <= 0) { throw new ArgumentException("Id de usuario o usuario es nula"); } DAL.AlarmaDSTableAdapters.AlarmaTableAdapter adapter = new DAL.AlarmaDSTableAdapters.AlarmaTableAdapter(); AlarmaDS.AlarmaDataTable table = adapter.GetAlarmaByUsuarioId(idUsuario); List <Alarma> alarmas = new List <Alarma>(); foreach (AlarmaDS.AlarmaRow row in table) { Alarma alarma = GetAlarmaFromRow(row); alarmas.Add(alarma); } return(alarmas); }