예제 #1
0
        public static void AddDateControl(double price, DateTime initialDateControl, DateTime finalDateControl)
        {
            ValidityDateControl validityDateControl = new ValidityDateControl(price, initialDateControl, finalDateControl);

            ValidityDateControlModel.Insert(validityDateControl);
            listDates.Add(validityDateControl);
        }
예제 #2
0
 public static void UpdateDateControl(ValidityDateControl dateControl)
 {
     if (dateControl.ID == 0)
     {
         throw new NotFoundIDEntity("Para atualizar um objeto precisa da sua chave primaria");
     }
     ValidityDateControlModel.Update(dateControl);
     UpdateListDatesFromDB();
 }
예제 #3
0
 public static void DeleteDateControlById(int id)
 {
     try
     {
         ValidityDateControl dateControl = listDates.Where((ValidityDateControl vdc) => { return(id == vdc.ID); }).First();
         listDates.Remove(dateControl);
         ValidityDateControlModel.Delete(dateControl);
     }
     catch (InvalidOperationException e)
     {
         throw new NotFoundIDEntity("Não encontrou o item para excluir");
     }
 }
예제 #4
0
 public static void AddDateControl(ValidityDateControl dateControl)
 {
     AddDateControl(dateControl.HourPrice, dateControl.InitialDate, dateControl.FinalDate);
 }
예제 #5
0
 public bool IsSameDate(ValidityDateControl other)
 {
     return(HourPrice == other.HourPrice &&
            DateTime.Compare(InitialDate, other.InitialDate) == 0 &&
            DateTime.Compare(FinalDate, other.FinalDate) == 0);
 }