//Method ToString public override string ToString() { string row = Hour.ToString() + ":" + Minute.ToString("D2") + " (" + AlarmHour.ToString() + ":" + AlarmMinute.ToString("D2") + ")"; return(row); }
private void btnEnviarSirenesSemanais_Click(object sender, EventArgs e) { try { List <AlarmHour> alarmsDomingo = new List <AlarmHour>(); List <AlarmHour> alarmsSegunda = new List <AlarmHour>(); List <AlarmHour> alarmsTerca = new List <AlarmHour>(); List <AlarmHour> alarmsQuarta = new List <AlarmHour>(); List <AlarmHour> alarmsQuinta = new List <AlarmHour>(); List <AlarmHour> alarmsSexta = new List <AlarmHour>(); List <AlarmHour> alarmsSabado = new List <AlarmHour>(); InstanciaWatchComm(); this._watchComm.OpenConnection(); foreach (DataRow dr in dsSDKBioLite.dtSireneSemanal.Rows) { AlarmHour alarm = new AlarmHour(); alarm.Hour = Int32.Parse(dr["Hora"].ToString()); alarm.Minute = Int32.Parse(dr["Minuto"].ToString()); if (dr["Dia"].ToString() == "Domingo") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Segunda") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Terça") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Quarta") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Quinta") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Sexta") { alarmsDomingo.Add(alarm); } if (dr["Dia"].ToString() == "Sabado") { alarmsDomingo.Add(alarm); } } if (alarmsDomingo.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsDomingo.ToArray(), AlarmHour.EWeekDay.Friday); } if (alarmsSegunda.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsSegunda.ToArray(), AlarmHour.EWeekDay.Monday); } if (alarmsTerca.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsTerca.ToArray(), AlarmHour.EWeekDay.Saturday); } if (alarmsQuarta.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsQuarta.ToArray(), AlarmHour.EWeekDay.Sunday); } if (alarmsQuinta.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsQuinta.ToArray(), AlarmHour.EWeekDay.Thursday); } if (alarmsSexta.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsSexta.ToArray(), AlarmHour.EWeekDay.Tuesday); } if (alarmsSabado.Count > 0) { this._watchComm.SetBioLiteWeeklyAlarm(alarmsSabado.ToArray(), AlarmHour.EWeekDay.Wednesday); } ComandoRecepcionadoComSucesso(); } catch (Exception ex) { this._watchComm.CloseConnection(); MessageBox.Show(ex.Message, "Erro"); } }