コード例 #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);
 }