Exemplo n.º 1
0
 public void AddTechInspection(TechInspection techInspection)
 {
     using (EfDbContext context = new EfDbContext())
     {
         context.TechInspections.Add(techInspection);
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 private void ChangeBlocked(TechInspection techInspection)
 {
     if (techInspection.Blocked == true & (int)(DateTime.Now - techInspection.Date.AddMinutes(5)).TotalMinutes >= 0)
     {
         techInspection.Blocked = false;
         techInspectionRep.Blocked(techInspection);
     }
 }
Exemplo n.º 3
0
 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();
         }
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }