Пример #1
0
        //GET : Rooms
        public ActionResult ListRooms(int?page, string searchString, string deleted)
        {
            List <DataAccessLayer.Entities.Room> roomContextList = RoomUtils.GetAllRooms();
            List <Room> roomList = Mappings.MappingDtos.EntityRoomToModelRoomAsList(roomContextList);

            if (!String.IsNullOrEmpty(searchString))
            {
                roomList = roomList.Where(s => s.Name.ToLower().Contains(searchString.ToLower())).ToList();
            }
            return(View(roomList.ToPagedList(page ?? 1, pageSize: 20)));
        }
Пример #2
0
        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"));
            }
        }
 public ActionResult Enter(Ticket ticket)
 {
     return(View(new RoomTicket {
         Rooms = MappingDtos.EntityRoomToModelRoomAsList(RoomUtils.GetAllRooms()), Ticket = ticket
     }));
 }