public ActionResult SaveToXls(string what)
        {
            DataTable dt     = null;
            bool      result = false;

            switch (what)
            {
            case "Client":
                List <DataAccessLayer.Entities.Client> layerClientList = ClientUtils.GetAllClients();
                List <Client> clientList = Mappings.MappingDtos.EntityClientToModelClientAsList(layerClientList);
                dt     = DataToExcel.ConvertToDataTable(clientList);
                result = DataToExcel.FlushToExcel <Client>(dt);
                break;

            case "Employee":
                List <DataAccessLayer.Entities.Employee> layerEmplyeeList = EmployeeUtils.GetAllEmplyees();
                List <Employee> employeeList = Mappings.MappingDtos.EntityEmployeeToModelEmployeeAsList(layerEmplyeeList);
                dt     = DataToExcel.ConvertToDataTable(employeeList);
                result = DataToExcel.FlushToExcel <Employee>(dt);
                break;

            case "Event":
                List <DataAccessLayer.Entities.Event> layerEventList = EventUtils.GetAllEvents();
                List <Event> eventList = Mappings.MappingDtos.EntityEventToModelEventList(layerEventList);
                dt     = DataToExcel.ConvertToDataTable(eventList);
                result = DataToExcel.FlushToExcel <Event>(dt);
                break;

            case "Room":
                List <DataAccessLayer.Entities.Room> layerRoomList = RoomUtils.GetAllRooms();
                List <Room> roomList = Mappings.MappingDtos.EntityRoomToModelRoomAsList(layerRoomList);
                dt     = DataToExcel.ConvertToDataTable(roomList);
                result = DataToExcel.FlushToExcel <Room>(dt);
                break;

            case "Ticket":
                List <DataAccessLayer.Entities.Ticket> layerTicketList = TicketUtils.GetAllTickets();
                List <Ticket> ticketList = Mappings.MappingDtos.EntityTicketLIstToModelTicketAsList(layerTicketList);
                dt     = DataToExcel.ConvertToDataTable(ticketList);
                result = DataToExcel.FlushToExcel <Ticket>(dt);
                break;

            case "Type":
                List <DataAccessLayer.Entities.TicketType> layerTypeList = TicketTypeUtils.GetAllTicketTypes();
                List <TicketType> typeList = Mappings.MappingDtos.EntityTicketLIstToModelTicketTypeAsList(layerTypeList);
                dt     = DataToExcel.ConvertToDataTable(typeList);
                result = DataToExcel.FlushToExcel <TicketType>(dt);
                break;

            default:
                break;
            }

            if (result)
            {
                return(RedirectToAction("ListEmployees"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
        //GET : Tickets
        public ActionResult ListTickets(int?page, string searchString, bool active = false, bool inactive = false, string category = "")
        {
            List <DataAccessLayer.Entities.Ticket> ticketContextList = TicketUtils.GetAllTickets();
            List <Ticket>     ticketList = Mappings.MappingDtos.EntityTicketLIstToModelTicketAsList(ticketContextList);
            List <TicketType> type       = Mappings.MappingDtos.EntityTicketLIstToModelTicketTypeAsList(TicketTypeUtils.GetAllTicketTypes());

            ViewBag.tklist = type;
            if (active && inactive && String.IsNullOrEmpty(category))
            {
                if (!String.IsNullOrEmpty(searchString))
                {
                    ticketList = ticketList.Where(s => s.TicketName.ToLower().Contains(searchString.ToLower())).ToList();
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(searchString))
                {
                    ticketList = ticketList.Where(s => s.TicketName.ToLower().Contains(searchString.ToLower())).ToList();
                }
                if (!String.IsNullOrEmpty(category))
                {
                    ticketList = ticketList.Where(s => s.TicketName == category).ToList();
                }
                if (active)
                {
                    List <Ticket> tic = new List <Ticket>();
                    foreach (var ticket in ticketList)
                    {
                        var ticketType = TicketTypeUtils.GetTicketTypeByTypeName(ticket.TicketName);
                        var date       = ticket.StartDate;
                        if (ticketType.DayNum != 0 && ticketType.OccasionNum != 0)
                        {
                            if (ticketType.DayNum - ticket.LoginsNum > 0)
                            {
                                tic.Add(ticket);
                            }
                        }

                        if (ticketType.DayNum != 0 && date.AddDays(ticketType.DayNum) > DateTime.Now)
                        {
                            if (ticketType.DayNum - ticket.LoginsNum > 0)
                            {
                                tic.Add(ticket);
                            }
                        }
                        if (ticketType.OccasionNum != 0)
                        {
                            if (ticketType.OccasionNum - ticket.LoginsNum > 0)
                            {
                                tic.Add(ticket);
                            }
                        }
                    }

                    ticketList = tic;
                }
                if (inactive)
                {
                    List <Ticket> tic = new List <Ticket>();
                    foreach (var ticket in ticketList)
                    {
                        var ticketType = TicketTypeUtils.GetTicketTypeByTypeName(ticket.TicketName);
                        var date       = ticket.StartDate;
                        if (ticketType.DayNum != 0 && ticketType.OccasionNum != 0)
                        {
                            if (ticketType.DayNum - ticket.LoginsNum < 0)
                            {
                                tic.Add(ticket);
                            }
                        }

                        if (ticketType.DayNum != 0 && date.AddDays(ticketType.DayNum) < DateTime.Now)
                        {
                            if (ticketType.DayNum - ticket.LoginsNum < 0)
                            {
                                tic.Add(ticket);
                            }
                        }
                        if (ticketType.OccasionNum != 0)
                        {
                            if (ticketType.OccasionNum - ticket.LoginsNum < 0)
                            {
                                tic.Add(ticket);
                            }
                        }
                    }

                    ticketList = tic;
                }
            }
            return(View(ticketList.ToPagedList(page ?? 1, pageSize: 20)));
        }