public void AddTechInspection(TechInspection techInspection) { using (EfDbContext context = new EfDbContext()) { context.TechInspections.Add(techInspection); context.SaveChanges(); } }
private void ChangeBlocked(TechInspection techInspection) { if (techInspection.Blocked == true & (int)(DateTime.Now - techInspection.Date.AddMinutes(5)).TotalMinutes >= 0) { techInspection.Blocked = false; techInspectionRep.Blocked(techInspection); } }
public void Blocked(TechInspection techInspection) { using (EfDbContext context = new EfDbContext()) { var item = context.TechInspections.Where(x => x.TechInspectionId == techInspection.TechInspectionId).FirstOrDefault(); if (item != null) { item.Blocked = techInspection.Blocked; context.SaveChanges(); } } }
private void AddTechInspection() { DateTime dtNow = DateTime.Now; TechInspection techInspection = new TechInspection { Date = new DateTime(Date.Value.Year, Date.Value.Month, Date.Value.Day, dtNow.Hour, dtNow.Minute, 0), DriverId = SelectedDriver.DriverId, CarId = SelectedCar.CarId, Blocked = true }; techInspectionRep.AddTechInspection(techInspection); }
private bool SaveDataReport(TechInspection techInspection, string status) { var report = reportRep.GetReports(). Where(x => x.TechInspectionId == techInspection.TechInspectionId & x.Status == status).FirstOrDefault(); if (report == null) { techInspection.IsExpired = true; techInspectionRep.ChangeStatus(techInspection); reportRep.AddReport(new Report { TechInspectionId = techInspection.TechInspectionId, Status = status }); return(true); } return(false); }