public ActionResult Login(FormCollection collection)
        {
            var room        = collection.Get("room");
            var type        = Int32.Parse(collection.Get("type"));
            var ticketId    = Int32.Parse(collection.Get("ticketId"));
            var ticketOvner = collection.Get("ticketOvner");
            var modelEvent  = new Event {
                RoomName = room, EmployeeName = Session["LoginedUser"].ToString(), ClientName = ticketOvner, Date = DateTime.Now, TicketId = ticketId, Type = Convert.ToBoolean(type)
            };
            var tmp = MappingDtos.ModelEventToEntityEvent(modelEvent);

            if (EventUtils.InsertEvent(tmp))
            {
                TicketUtils.EventTriggerUpdate(ticketId);
                //         List<Ticket> tickets = new List<Ticket>();
                Ticket tick = new Ticket();
                tick = MappingDtos.EntityTicketToModelTicket(TicketUtils.GetTicketById(ticketId));

                /*          tickets.Add(tick);
                 *        Client client = new Client();
                 *        client = MappingDtos.EntityClientToModelClient(tmp.Card);
                 */
                return(RedirectToAction("SuccessEnter", "Employee", tick));
            }
            else
            {
                return(RedirectToAction("EmployeeError", "Employee", new { @errorMsg = "Nem sikeres belepes" }));
            }
        }
        public ActionResult BuyingTicket(FormCollection collection)
        {
            int Id   = Int32.Parse(collection.Get("Id"));
            int Type = Int32.Parse(collection.Get("TicketTypeId"));

            if (MappingDtos.EntityClientToModelClient(ClientUtils.GetClientById(Id)) != null)
            {
                Session["TicType"] = Type.ToString();
                return(RedirectToAction("TicketsList", "Employee", MappingDtos.EntityClientToModelClient(ClientUtils.GetClientById(Id))));
            }
            else
            {
                return(RedirectToAction("EmployeeError", "Employee", new { @errorMsg = "Nincs ilyen Id-vel rendelkezo kliens!" }));
            }
        }
        public ActionResult AddTicket(FormCollection collection)
        {
            var ClientId       = Int32.Parse(collection.Get("ClientId"));
            var InsertedDate   = DateTime.Parse(collection.Get("InsertedDate"));
            var SelectedTypeId = Int32.Parse(collection.Get("SelectedType"));
            var StartDate      = DateTime.Parse(collection.Get("StartDate"));

            if (TicketUtils.InsertTicket(ClientId, Session["LoginedUser"].ToString(), SelectedTypeId, InsertedDate, StartDate))
            {
                return(RedirectToAction("TicketsList", "Employee", MappingDtos.EntityClientToModelClient(ClientUtils.GetClientById(ClientId))));
            }
            else
            {
                return(RedirectToAction("EmployeeError", "Employee", new { @errorMsg = "Nem sikeres beszuras" }));
            }
        }
        // GET: Admin
        public ActionResult Index()
        {
            if ((Session["LoginedUser"] ?? "").ToString() == "Admin")
            {
                var statistics = new StatisticsModel
                {
                    EventsMonthNumbNow      = StatisticsUtils.GetEventsNumberOfMonth(DateTime.Now),
                    EventsYearNumbNow       = StatisticsUtils.GetEventsNumberOfYear(DateTime.Now),
                    TicketsNumberOfMonthNow = StatisticsUtils.GetTicketsNumberOfMonth(DateTime.Now),
                    TicketsNumberOfYearNow  = StatisticsUtils.GetTicketsNumberOfYear(DateTime.Now),
                    IncomeOfTheMonthNow     = StatisticsUtils.GetIncomeOfTheMonth(DateTime.Now),
                    IncomeOfTheYearNow      = StatisticsUtils.GetIncomeOfTheYear(DateTime.Now),
                    PerformanceEverMap      = MappingDtos.EntityEmployeeToModelEmployeeAsDictionary(StatisticsUtils.GetAllEmployeesPerformanceEver()),
                    PerformanceMapNow       = MappingDtos.EntityEmployeeToModelEmployeeAsDictionary(StatisticsUtils.GetAllEmployeesPerformanceByMonth(DateTime.Now))
                };

                return(View(statistics));
            }
            return(RedirectToAction("LoginError", "Login"));
        }
 public ActionResult TicketsList(Client client)
 {
     if (Session["TicType"] != null)
     {
         List <TicketType> SelectType = new List <TicketType>();
         SelectType.Add(MappingDtos.EntityTicketTypeToModelTicketType(TicketTypeUtils.GetTicketById(Int32.Parse(Session["TicType"].ToString()))));
         Session["TicType"] = null;
         var data = MappingDtos.EntityTicketLIstToModelTicketAsList(TicketUtils.GetListOfTicketByClientId(client.Id));
         return(View(new TicketsClient {
             Client = client, Tickets = data, Types = SelectType
         }));
     }
     else
     {
         var data = MappingDtos.EntityTicketLIstToModelTicketAsList(TicketUtils.GetListOfTicketByClientId(client.Id));
         return(View(new TicketsClient {
             Client = client, Tickets = data, Types = MappingDtos.EntityTicketLIstToModelTicketTypeAsList(TicketTypeUtils.GetAllTicketTypes())
         }));
     }
 }
        public ActionResult Insert(Client user, HttpPostedFileBase file)
        {
            if (file.ContentLength > 0)
            {
                // code for saving the image file to a physical location.
                var fileName = Path.GetFileName(file.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/Images"), fileName);
                file.SaveAs(path);
                user.ImagePath = "~/Content/Images/" + fileName;
            }
            user.InserterName = Session["LoginedUser"].ToString();

            if (ClientUtils.InsertClient(MappingDtos.ModelClientToEntityClient(user)))
            {
                return(RedirectToAction("TicketsList", "Employee", ClientUtils.GetClientByParameters(MappingDtos.ModelClientToEntityClient(user))));
            }
            else
            {
                return(RedirectToAction("EmployeeError", "Employee", new { @errorMsg = "Nem sikeres beszuras" }));
            }
        }
        // GET: Employee/TicketTypeLists
        public ActionResult TicketTypesList()
        {
            var data = MappingDtos.EntityTicketLIstToModelTicketTypeAsList(TicketTypeUtils.GetAllTicketTypes());

            return(View(data));
        }
 public ActionResult Enter(Ticket ticket)
 {
     return(View(new RoomTicket {
         Rooms = MappingDtos.EntityRoomToModelRoomAsList(RoomUtils.GetAllRooms()), Ticket = ticket
     }));
 }