Example #1
0
        private void Populate()
        {
            TachographMakes = new ObservableCollection <TachographMake>(TachographMakesRepository.GetAll("Models"));
            Technicians     = new ObservableCollection <Technician>(TechnicianRepository.GetAll());

            Technician defaultTechnician = Technicians.FirstOrDefault(technician => technician != null && technician.IsDefault);

            if (defaultTechnician != null)
            {
                Document.Technician = defaultTechnician.Name;
            }
            SelectedCustomerContact = CustomerContacts.FirstOrDefault(c => string.Equals(c.Name, Document.CustomerContact, StringComparison.CurrentCultureIgnoreCase));
        }
Example #2
0
        public ViewResult TechIncident(IncidentViewModel inc)

        {
            var techId     = inc.CurrentIncident.TechnicianID;
            var technician = TechnicianRepository.Get(t => t.TechnicianID == techId).Single();
            var model      = new IncidentViewModel
            {
                ActiveIncident   = inc.ActiveIncident,
                Incidents        = IncidentRepository.Get(orderBy: i => i.OrderBy(ii => ii.Title)).ToList(),
                Technicians      = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers        = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products         = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList(),
                ActiveTechnician = technician.Name
            };

            return(View(model));
        }
Example #3
0
        public ViewResult ListByTech(string activeIncident = "All", string activeTechnician = "All")
        {
            var model = new IncidentViewModel
            {
                //ActiveIncident = activeIncident,
                ActiveTechnician = activeTechnician,
                //Incidents = context.Incidents.OrderBy(i => i.Title).ToList(),
                Technicians = TechnicianRepository.Get(orderBy: technicians => technicians.OrderBy(c => c.Name)).ToList()
            };
            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident != "All")
            {
                query = IncidentRepository.Get(incident => incident.IncidentID.ToString() == activeIncident);
            }
            if (activeTechnician != "All")
            {
                query = IncidentRepository.Get(i => i.Technician.TechnicianID.ToString() == activeTechnician);
            }
            model.Incidents = query.ToList();
            return(View(model));
        }
Example #4
0
        public ViewResult EditIncident(int id)
        {
            Incident activeIncident = IncidentRepository.Get(id);
            var      model          = new IncidentViewModel
            {
                Action          = "EditIncident",
                Technicians     = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers       = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products        = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList(),
                CurrentIncident = IncidentRepository.Get(id)
            };

            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident.IncidentID != 0)
            {
                query = IncidentRepository.Get(i => i.IncidentID == activeIncident.IncidentID);
            }
            model.Incidents       = query.ToList();
            model.CurrentIncident = IncidentRepository.Get(id);

            return(View("EditIncident", model));
        }
Example #5
0
        public ViewResult TechIncident(string activeIncident = "All", string activeTechnician = "All")
        {
            var model = new IncidentViewModel
            {
                ActiveIncident   = activeIncident,
                ActiveTechnician = activeTechnician,
                Incidents        = IncidentRepository.Get(orderBy: i => i.OrderBy(ii => ii.Title)).ToList(),
                Technicians      = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers        = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products         = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList()
            };
            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident != "All")
            {
                query = IncidentRepository.Get(i => i.IncidentID.ToString() == activeIncident);
            }
            if (activeTechnician != "All")
            {
                query = IncidentRepository.Get(i => i.Technician.TechnicianID.ToString() == activeIncident);
            }
            model.Incidents = query.ToList();
            return(View(model));
        }
Example #6
0
 public static ICRUDRepository<Technician> GetTechnicianRepository()
 {
     if (TechnicianRepo == null)
     {
         TechnicianRepo = new TechnicianRepository();
     }
     return TechnicianRepo;
 }