public static TimeBinding CreateTimeBinding(int id, int stepId, Step step, DateTime time, int day, int month, int year) { var set = DAL.SqlRepository.DBContext.GetDbSet<TimeBinding>(); var tb = new TimeBinding(); tb.Id = id; tb.StepId = stepId; tb.Step = step; tb.Time = time; tb.Day = day; tb.Month = month; tb.Year = year; set.Add(tb); DAL.SqlRepository.Save(); return tb; }
public static void DeleteTimeBinding(TimeBinding timeBinding) { var set = DAL.SqlRepository.TimeBindings; var tb = set.Find(timeBinding.Id); if (tb != null) { set.Remove(timeBinding); DAL.SqlRepository.DBContext.SaveChanges(); } }
protected bool Equals(TimeBinding other) { return Id == other.Id && StepId == other.StepId && Equals(Step, other.Step) && Time.Equals(other.Time) && Day == other.Day && Month == other.Month && Year == other.Year; }
public int CompareTo(TimeBinding toCompare) { DateTime first = new DateTime(Year,Month,Day,Time.Hour,Time.Minute,0); DateTime second = new DateTime(toCompare.Year, toCompare.Month, toCompare.Day, toCompare.Time.Hour, toCompare.Time.Minute, 0); return first.CompareTo(second); }