public List <Vraag> GetQuestionsFromInspector(int inspectorID, int jobID)
        {
            List <Vraag> filteredQuestions = new List <Vraag>();

            List <Vraag> unfilteredQuestions = new List <Vraag>();

            using (FestispecContext context = new FestispecContext())
            {
                unfilteredQuestions = context.Antwoorden.Where(x => x.InspecteurID == inspectorID).Select(x => x.Vraag).Include(x => x.Antwoorden).Include(x => x.VraagMogelijkAntwoord).ToList();
            }

            foreach (Vraag vraag in unfilteredQuestions)
            {
                if (filteredQuestions.Count(x => x.VraagID == vraag.VraagID) == 0)
                {
                    using (FestispecContext context = new FestispecContext())
                    {
                        if (context.Inspectieformulier.Where(x => x.InspectieformulierID == vraag.InspectieFormulierID && x.OpdrachtID == jobID).Count() > 0)
                        {
                            filteredQuestions.Add(vraag);
                        }
                    }
                }
            }

            return(filteredQuestions);
        }
 public EmployeeService(FestispecContext db, IAuthenticationService authenticationService, ISyncService <Employee> employeeSyncService, IAddressService addressService)
 {
     _db = db;
     _authenticationService = authenticationService;
     _employeeSyncService   = employeeSyncService;
     _addressService        = addressService;
 }
Пример #3
0
 public List <Klant> GetCustomers()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Klant.Include("Contactpersoon").ToList());
     }
 }
 public List <Status> GetAllStatus()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Status.ToList());
     }
 }
Пример #5
0
 public List <Opdracht> GetOpdrachten()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Opdracht.Include(c => c.Klant).Include(c => c.Offerte).ToList());
     }
 }
 public List <Inspectieformulier> GetAllInspectieFormulieren()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Inspectieformulier.ToList());
     }
 }
 public Opdracht GetJob(int jobId)
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Opdracht.Include(j => j.Klant).FirstOrDefault(j => j.OpdrachtID == jobId));
     }
 }
Пример #8
0
 public List <Account> GetUsers()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Account.ToList());
     }
 }
Пример #9
0
 public Availability GetUnavailabilityForDay(int employeeId, DateTime date)
 {
     return(_db.Availabilities.FirstOrDefault(
                a => a.Employee.Id == employeeId &&
                FestispecContext.TruncateTime(a.StartTime) == FestispecContext.TruncateTime(date) &&
                a.EventTitle == "Niet beschikbaar"));
 }
 public List <Offerte> GetQuotations()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Offerte.Include(o => o.Opdracht.Klant).ToList());
     }
 }
Пример #11
0
 public List <Offerte> GetOffertes()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Offerte.ToList());
     }
 }
Пример #12
0
 public List <InspectieformulierVragenlijstCombinatie> GetVragenlijstCombinaties(int InspectieformulierID)
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.InspectieformulierVragenlijstCombinatie.Where(v => v.InspectieformulierID == InspectieformulierID).ToList());
     }
 }
 public List <Inspectieformulier> GetInspectieformulier(int opdrachtID)
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Inspectieformulier.Where(i => i.OpdrachtID == opdrachtID).ToList());
     }
 }
        internal void Init()
        {
            _Context = new FestispecContext();
            if (QuestionnaireId != -1)
            {
                Questionnaire = _Context.Questionnaires
                                .Include(nameof(Questionnaire.QuestionList))
                                .Where(q => q.Id == QuestionnaireId)
                                .ToList()
                                .Select(q => new QuestionnaireVM(q))
                                .FirstOrDefault();
                CanExecuteChanged();
            }
            else
            {
                Questionnaire = new QuestionnaireVM(new Questionnaire());
                _Context.Questionnaires.Add(Questionnaire.ToModel);
                Answers = new ObservableCollection <AnswerVM>();
                CanExecuteChanged();
            }

            var questiontypes = _Context.QuestionTypes
                                .ToList()
                                .Select(c => new QuestionTypeVM(c));

            QuestionTypes = new ObservableCollection <QuestionTypeVM>(questiontypes);
        }
Пример #15
0
 public List <Opdracht> GetJobs()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Opdracht.ToList());
     }
 }
Пример #16
0
 public List <Rol> GetRols()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Rol.ToList());
     }
 }
Пример #17
0
 public List <Opdracht> GetOpdrachtenWithQuotations()
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Opdracht.Include("Offerte").ToList());
     }
 }
 public List <Inspectieformulier> GetInspectieformulier(int OpdrachtID)
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Inspectieformulier.Include("Vraag").Include("Vraag.VraagMogelijkAntwoord").Where(i => i.OpdrachtID == OpdrachtID).ToList());
     }
 }
 public Opdracht GetJob(int jobID)
 {
     using (FestispecContext context = new FestispecContext())
     {
         return(context.Opdracht.Include("Klant").Where(i => i.OpdrachtID == jobID).FirstOrDefault());
     }
 }
Пример #20
0
 public bool Register(Account account)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.Account.Add(account);
         return(context.SaveChanges() > 1);
     }
 }
 public void CreateInspectieFormulier(Inspectieformulier inspec)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.Inspectieformulier.Add(inspec);
         context.SaveChanges();
     }
 }
Пример #22
0
 public void RemoveVraagFromInspectieFormulier(InspectieformulierVragenlijstCombinatie voc)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.InspectieformulierVragenlijstCombinatie.Remove(voc);
         context.SaveChanges();
     }
 }
Пример #23
0
 public void AddVraagToInspectieFormulier(InspectieformulierVragenlijstCombinatie voc)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.InspectieformulierVragenlijstCombinatie.Add(voc);
         context.SaveChanges();
     }
 }
 public void AddPossibleAnwser(VraagMogelijkAntwoord pos)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.VraagMogelijkAntwoord.Add(pos);
         context.SaveChanges();
     }
 }
 public void AddQuestionToInspectionForm(Vraag question)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.Vraag.Add(question);
         context.SaveChanges();
     }
 }
 internal void AddPossibleAnswers(List <VraagMogelijkAntwoord> newPosAnswers)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.VraagMogelijkAntwoord.AddRange(newPosAnswers);
         context.SaveChanges();
     }
 }
 public void UpdateTemplate(RapportTemplate template)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.RapportTemplate.Where(x => x.TemplateID == template.TemplateID).FirstOrDefault().TemplateText = template.TemplateText;
         context.SaveChanges();
     }
 }
 public void DeleteQuestion(Vraag question)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.Vraag.Remove(question);
         context.SaveChanges();
     }
 }
 public void CreateTemplate(RapportTemplate template)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.RapportTemplate.Add(template);
         context.SaveChanges();
     }
 }
 public void UpdateRapportage(int jobID, string report)
 {
     using (FestispecContext context = new FestispecContext())
     {
         context.Opdracht.Where(x => x.OpdrachtID == jobID).FirstOrDefault().Rapportage = report;
         context.SaveChanges();
     }
 }