public static TimeRule CreateTimeRule(bool isPeriodic, int scheduleId, Schedule schedule) { var set = DAL.SqlRepository.DBContext.GetDbSet<TimeRule>(); var tr = new TimeRule { IsPeriodic = isPeriodic, ScheduleId = scheduleId, Schedule = schedule, IsUserApproved = schedule.IsPios() }; set.Add(tr); DAL.SqlRepository.Save(); return tr; }
protected bool Equals(Schedule other) { return Id == other.Id && MondayIntervalId == other.MondayIntervalId && Equals(MondayInterval, other.MondayInterval) && TuesdayIntervalId == other.TuesdayIntervalId && Equals(TuesdayInterval, other.TuesdayInterval) && WednesdayIntervalId == other.WednesdayIntervalId && Equals(WednesdayInterval, other.WednesdayInterval) && ThursdayIntervalId == other.ThursdayIntervalId && Equals(ThursdayInterval, other.ThursdayInterval) && FridayIntervalId == other.FridayIntervalId && Equals(FridayInterval, other.FridayInterval) && SaturdayIntervalId == other.SaturdayIntervalId && Equals(SaturdayInterval, other.SaturdayInterval) && SundayIntervalId == other.SundayIntervalId && Equals(SundayInterval, other.SundayInterval) && other.Name.Equals(Name); }
public static void DeleteSchedule(Schedule schedule) { var item = DAL.SqlRepository.Schedules.Find(schedule.Id); if (item != null) { DAL.SqlRepository.Schedules.Remove(item); DAL.SqlRepository.Save(); } }