Beispiel #1
0
        public void UpdateTicket(IncidentTicket ticket)
        {
            var collection = database.GetCollection <IncidentTicket>("tickets");
            var filter     = Builders <IncidentTicket> .Filter.Eq("_id", ticket.Id);

            collection.ReplaceOne(filter, ticket);
        }
        public void SubmitTicket(IncidentTicket incidentTicket)
        {
            //----Submits ticket and returns to IncidentTicketViewModel----//
            _incidentTicket.SubmitTicket(_incidentTicket);

            MessageBox.Show("Ticket added.");

            shellViewModel.ActivateItem(new IncidentTicketViewModel(shellViewModel));
        }
        private void RecordIncidentNumberIntoSqliteDb(string incidentNumber, string priority)
        {
            var newIncidentTicket = new IncidentTicket {
                TicketId = incidentNumber, Priority = priority
            };
            var allTickets      = _incidentTicketContext.IncidentTickets.ToList();
            var exsitingTickets = allTickets.Find(x => x.TicketId == newIncidentTicket.TicketId);

            if (exsitingTickets == null)
            {
                _incidentTicketContext.IncidentTickets.Add(newIncidentTicket);
                _incidentTicketContext.SaveChanges();
            }

            Log.Information($"Store incident number:{incidentNumber} to DB.");
        }
        public AddIncidentTicketViewModel(ShellViewModel shellViewModel)
        {
            this.shellViewModel = shellViewModel;
            _incidentTicket     = new IncidentTicket();

            Users = new BindableCollection <User>(new UserDal().GetUsers());

            _ticketType = new BindableCollection <string>();
            _ticketType.Add("Software");
            _ticketType.Add("Hardware");
            _ticketType.Add("Service");

            _ticketDeadlines = new BindableCollection <string>();
            _ticketDeadlines.Add("7 days");
            _ticketDeadlines.Add("14 days");
            _ticketDeadlines.Add("28 days");
            _ticketDeadlines.Add("6 months");

            _ticketPriority = new BindableCollection <string>();
            _ticketPriority.Add("Low");
            _ticketPriority.Add("Medium");
            _ticketPriority.Add("High");
        }
Beispiel #5
0
        public void InsertTicket(IncidentTicket ticket)
        {
            var collection = database.GetCollection <IncidentTicket>("tickets");

            collection.InsertOne(ticket);
        }
        private string FindPossibleSolution()
        {
            string possibleSolution = "";

            if (IncidentTicket.Solution != null || IncidentTicket.Solution == "")
            {
                return(possibleSolution);
            }

            int            mostSameWords       = 0;
            IncidentTicket bestSolution        = new IncidentTicket();
            bool           bestSolutionChanged = false;

            foreach (IncidentTicket incidentTicket in incidentTickets)
            {
                if (incidentTicket.Solution == null || incidentTicket.Solution == "" || IncidentTicket.Equals(incidentTicket))
                {
                    continue;
                }
                if (IncidentTicket.Type == incidentTicket.Type)
                {
                    if (IncidentTicket.Subject.ToUpper() == incidentTicket.Subject.ToUpper() || IncidentTicket.Subject.ToUpper().Contains(incidentTicket.Subject.ToUpper()) || incidentTicket.Subject.ToUpper().Contains(IncidentTicket.Subject.ToUpper()))
                    {
                        int sameWords = 0;

                        if (IncidentTicket.Description != null && IncidentTicket.Description != "" && incidentTicket.Description != null && incidentTicket.Description != "")
                        {
                            string[] descriptionWords = incidentTicket.Description.Split(' ');

                            foreach (string word in descriptionWords)
                            {
                                if (IncidentTicket.Description.ToUpper().Contains(word.ToUpper()))
                                {
                                    sameWords++;
                                }
                            }
                        }

                        if (!bestSolutionChanged && mostSameWords == sameWords)
                        {
                            bestSolution        = incidentTicket;
                            bestSolutionChanged = true;
                        }
                        else if (mostSameWords < sameWords)
                        {
                            bestSolution        = incidentTicket;
                            bestSolutionChanged = true;
                        }
                    }
                }
            }

            if (bestSolutionChanged)
            {
                return(bestSolution.Solution);
            }
            else
            {
                return(possibleSolution);
            }
        }
 public ShowIncidentTicketViewModel(ShellViewModel shellViewModel, IncidentTicket incidentTicket, BindableCollection <IncidentTicket> incidentTickets)
 {
     this.shellViewModel  = shellViewModel;
     IncidentTicket       = incidentTicket;
     this.incidentTickets = incidentTickets;
 }