Beispiel #1
0
        public bool UpdateTicketSolved(User userItem, Ticket ticketItem)
        {
            using (var db = new TechnicalSupportEntities())
            {
                try
                {
                    var SelectedTicket = (from ticket in db.Ticket
                                          where ticket.TicketID == ticketItem.TicketID
                                          select ticket).FirstOrDefault();

                    SelectedTicket.Solved   = true;
                    SelectedTicket.SolvedBy = userItem.UserName;

                    if (db.SaveChanges() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch
                {
                    return(false);
                }
            }
        }
Beispiel #2
0
 public ObservableCollection <Ticket> SelectMostTicketSolvedUsers()
 {
     using (var db = new TechnicalSupportEntities())
     {
         return(null);
     }
 }
Beispiel #3
0
        public ObservableCollection <DataAccessLayer.Models.MostTicketSolvedUser> SelectMostTicketSolvedUsers()
        {
            var returnCollelction = new ObservableCollection <DataAccessLayer.Models.MostTicketSolvedUser>();

            using (var db = new TechnicalSupportEntities())
            {
                var users = from ticket in db.Ticket
                            where ticket.Solved == true && ticket.SolvedBy != null
                            group ticket by ticket.SolvedBy into usr
                            orderby usr.Count() descending
                            select new { UserName = usr.Key, TotalTickets = usr.Count() };



                foreach (var item in users)
                {
                    returnCollelction.Add(new Models.MostTicketSolvedUser()
                    {
                        UserName           = item.UserName,
                        TotalSolvedTickets = item.TotalTickets
                    });
                }

                return(returnCollelction);
            }
        }
Beispiel #4
0
        public ObservableCollection <DataAccessLayer.Ticket> SelectAll()
        {
            using (var db = new TechnicalSupportEntities())
            {
                var Tickets = from tickets in db.Ticket
                              select tickets;

                return(new ObservableCollection <Ticket>(Tickets));
            }
        }
Beispiel #5
0
        public User UserAuthentication(User item)
        {
            using (var db = new TechnicalSupportEntities())
            {
                var result = db.User.Where(x => x.UserName == item.UserName && x.UserPassword == item.UserPassword).FirstOrDefault();

                if (result != null)
                {
                    return(result);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #6
0
        public bool InsertNew(Ticket item)
        {
            using (var db = new TechnicalSupportEntities())
            {
                item.Solved      = false;
                item.TimeCreated = DateTime.Now;

                db.Ticket.Add(item);

                if (db.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }