Exemplo n.º 1
0
 public void SetTimeRates(RateTimeControl.TimeNode[] timeRates)
 {
     _timeSchedule = timeRates;
     DbOpenHelper.SaveTimeSchedule(timeRates);
 }
Exemplo n.º 2
0
 public static void SaveTimeSchedule(RateTimeControl.TimeNode[] timeSchedule)
 {
     var insertPref = "insert into " + DbOpenHelper.TableTimeSchedule + " " + "(" +
             DbOpenHelper.ColumnDaysNumber + "," + DbOpenHelper.ColumnHours + "," +
             DbOpenHelper.ColumnMinutes + "," + DbOpenHelper.ColumnSeconds + "," +
             DbOpenHelper.ColumnEveryday + "," + DbOpenHelper.ColumnRateNumber +
         ") " + "values ";
     var queries = timeSchedule.Select(scheduleElem => insertPref + "(" +
             scheduleElem.dayNum + "," + scheduleElem.hours + "," +
             scheduleElem.minutes + "," + scheduleElem.seconds + "," +
             (scheduleElem.everyDay?1:0) + "," + scheduleElem.rateNum +
         ");").ToList();
     queries.Insert(0, "delete from " + DbOpenHelper.TableTimeSchedule + ";");
     DbOpenHelper.ExecuteSql(queries.ToArray());
 }
Exemplo n.º 3
0
 private bool CompareTimes(RateTimeControl.TimeNode[] ts1, RateTimeControl.TimeNode[] ts2)
 {
     if (ts1.Length != ts2.Length)
         return false;
     foreach (var t1 in ts1)
     {
         bool exists = false;
         foreach (var t2 in ts2)
         {
             if (t1.Equal(t2))
             {
                 exists = true;
                 break;
             }
         }
         if (!exists)
             return false;
     }
     return true;
 }