public static void AddDateControl(double price, DateTime initialDateControl, DateTime finalDateControl) { ValidityDateControl validityDateControl = new ValidityDateControl(price, initialDateControl, finalDateControl); ValidityDateControlModel.Insert(validityDateControl); listDates.Add(validityDateControl); }
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(); }
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"); } }
public static void AddDateControl(ValidityDateControl dateControl) { AddDateControl(dateControl.HourPrice, dateControl.InitialDate, dateControl.FinalDate); }
public bool IsSameDate(ValidityDateControl other) { return(HourPrice == other.HourPrice && DateTime.Compare(InitialDate, other.InitialDate) == 0 && DateTime.Compare(FinalDate, other.FinalDate) == 0); }