예제 #1
0
        static void Main()
        {
            do
            {
                MenuMain.PrintMenu();

                switch (Lootbox.GetPressedKey())
                {
                case ConsoleKey.NumPad1 or ConsoleKey.D1:
                    //user space
                    MenuUser.Work();
                    break;

                case ConsoleKey.NumPad2 or ConsoleKey.D2:
                    //admin space
                    MenuAdmin.Work();
                    break;

                case ConsoleKey.Escape:
                    Lootbox.SaveData();
                    return;

                default:
                    break;
                }
            } while (true);
        }
예제 #2
0
        void UserMenu(User user)
        {
            MenuUser userChoice = 0;

            Console.Clear();
            Console.WriteLine($"{Convert.ToInt32(MenuUser.ChangeGoals)}. Ändra dina mål");
            Console.WriteLine($"{Convert.ToInt32(MenuUser.ChangeUserInfo)}. Ändra din information");
            Console.WriteLine($"{Convert.ToInt32(MenuUser.Quit)}. Avsluta");
            Console.Write("Ditt val: ");
            int input = error.TryInt();

            userChoice = (MenuUser)input;

            switch (userChoice)
            {
            case MenuUser.ChangeGoals:
                //User.ChangeGoals();
                break;

            case MenuUser.ChangeUserInfo:
                break;

            case MenuUser.Quit:
                break;

            default:
                Console.Clear();
                error.ErrorMessage();
                Console.Write("\nTryck valfri tangent för att fortsätta.");
                Console.ReadKey();
                break;
            }
        }
예제 #3
0
        private void txtPasswordLogin_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar == (int)Keys.Enter)
                {
                    if (txtUserLogin.Text.Trim() == "")
                    {
                        MessageBox.Show("Ingrese el Usuario", "Mensaje al Usuario", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        txtUserLogin.Focus();
                    }

                    else if (txtPasswordLogin.Text.Trim() == "")
                    {
                        MessageBox.Show("Ingrese la Contraseña", "Mensaje al Usuario", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        txtPasswordLogin.Focus();
                    }
                    else
                    {
                        //Verificar Login//
                        SolicitudDAO soliDao    = new SolicitudDAO();
                        var          userAccess = soliDao.ValidarAccesoUser(txtUserLogin.Text, txtPasswordLogin.Text);
                        if (userAccess != null)
                        {
                            VarGlobal.userAccesLogueado = userAccess;
                            if (userAccess.TipoAcceso.Equals("A"))
                            {
                                /*FrmRegistroDocs open = new FrmRegistroDocs();
                                 * open.Show();
                                 * this.Hide();*/
                                /*  MenuAdmin openMenuAdmin = new MenuAdmin();
                                 * openMenuAdmin.Show();
                                 * this.Hide();*/
                            }
                            else if (userAccess.TipoAcceso.Equals("U"))
                            {
                                /*FrmMisTareas openMisTareas = new FrmMisTareas();
                                 * openMisTareas.Show();
                                 * this.Hide();*/
                                MenuUser openMenuUser = new MenuUser();
                                openMenuUser.Show();
                                this.Hide();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Usuario o Clave incorrecta", "Mensaje al Usuario", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "Mensaje al Usuario", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        public async Task <IActionResult> seedItemUsers()
        {
            MenuUser  emil    = _ctx.menuUsers.Where(x => x.Name == "robi").First();
            MenuItems chicken = _ctx.menuItems.Where(y => y.Id == 2).First();
            MenuItems coke    = _ctx.menuItems.Where(y => y.Id == 1).First();

            emil.menuItems.Add(chicken);
            emil.menuItems.Add(chicken);
            emil.menuItems.Add(coke);

            await _ctx.SaveChangesAsync();

            return(Ok(await _ctx.menuUsers.ToListAsync()));
        }
예제 #5
0
    void Update()
    {
        for (int i = 0; i < menuUsers.Length; i++)
        {
            MenuUser menuUser = menuUsers[i];
            User     user     = menuUser.GetUser();

            if (user == null)
            {
                foreach (var inputDevice in inputDevices)
                {
                    if (inputDevice.Value)
                    {
                        continue;
                    }

                    if (InputManager.GetButtonDown(inputDevice.Key, InputButton.Accept))
                    {
                        user = new User(inputDevice.Key, GetOpenColorIndex());

                        menuUser.SetUser(user);

                        colorsUse[user.colorIndex]    = true;
                        gameManager.users[i]          = user;
                        inputDevices[inputDevice.Key] = true;
                        break;
                    }
                }
            }
            else
            {
                if (InputManager.GetButtonDown(user.input, InputButton.Deny))
                {
                    menuUser.RemoveUser();

                    colorsUse[user.colorIndex] = false;
                    gameManager.users[i]       = null;
                    inputDevices[user.input]   = false;
                    continue;
                }

                if (InputManager.GetButtonDown(user.input, InputButton.Start) && (menuUsers.Length > 1 ? GetUserCount() >= 2 : true))
                {
                    menuUtil.StartGame();
                }
            }
        }
    }
예제 #6
0
        public async Task <IActionResult> Shop()
        {
            var users = new MenuUser[]
            {
                new MenuUser
                {
                    Name = "robi",
                },
                new MenuUser
                {
                    Name = "feri",
                }
            };

            _ctx.menuUsers.AddRange(users);
            await _ctx.SaveChangesAsync();

            return(Ok(await _ctx.menuUsers.ToListAsync()));
        }
예제 #7
0
        private void LoadMenuUser()
        {
            MenuUser.Add(new MenuItemViewModel
            {
                Icon     = "ic_home_pf.png",
                PageName = "UserPage",
                Title    = "Página principal",
            });

            MenuUser.Add(new MenuItemViewModel
            {
                Icon     = "ic_ccalidad.png",
                PageName = "QualityPage",
                Title    = "Control de calidad",
            });

            MenuUser.Add(new MenuItemViewModel
            {
                Icon     = "ic_costura.png",
                PageName = "SewingPage",
                Title    = "Costura",
            });

            MenuUser.Add(new MenuItemViewModel
            {
                Icon     = "ic_acabado.png",
                PageName = "FinishesPage",
                Title    = "Acabados",
            });

            MenuUser.Add(new MenuItemViewModel
            {
                Icon     = "ic_csesion.png",
                PageName = "LogoutPage",
                Title    = "Cerrar Sesión",
            });
        }
        public void ExecutActionByUser(User user, MenuUser menuUserSelected)
        {
            switch (menuUserSelected)
            {
            case MenuUser.ReservarPuesto:
                var desklist = deskData.GetAvailableDesks();
                Console.WriteLine("Puestos disponibles");
                foreach (var item in desklist)
                {
                    Console.WriteLine($"{item.Number} -{item.Descriptions}");
                }
                var newReservation = new Reservation();
                Console.WriteLine("Ingrese el número de puesto");
                var deskFound = deskData.FinDesk(Console.ReadLine());

                while (deskFound == null)
                {
                    Console.WriteLine("Escriba el número del puesto");
                    deskFound = deskData.FinDesk(Console.ReadLine());
                }
                newReservation.DeskId = deskFound.DeskId;
                var dateSelected = new DateTime();
                while (dateSelected.Year == 0001)
                {
                    Console.WriteLine("Ingrese la fecha de reserva (dd-mm-yyyy)");
                    DateTime.TryParseExact(Console.ReadLine(), "dd-MM-yyyy", null, DateTimeStyles.None, out dateSelected);
                }
                newReservation.ReservationDate = dateSelected;
                newReservation.UserId          = user.UserId;
                reservationData.CreateReservation(newReservation);

                Console.WriteLine("El puesto ha sido reservado");
                break;

            case MenuUser.CancelarReserva:
                Console.WriteLine("Estas son las reservaciones disponibles");
                var userReservations = reservationData.GetReservationsByUser(user.UserId).ToList();
                var deskUserList     = deskData.GetAvailableDesks().ToList();
                int indexReservation = 1;
                foreach (var item in userReservations)
                {
                    Console.WriteLine($"{indexReservation} - {deskUserList.FirstOrDefault(p => p.DeskId == item.DeskId).Number} - {item.ReservationDate.ToString("dd-MM-yyyy")}");
                    indexReservation++;
                }
                var indexReservationSelected = 0;
                while (indexReservationSelected < 1 || indexReservationSelected > indexReservation)
                {
                    Console.WriteLine("Ingrese el número de la reservacion que desea eliminar");
                    indexReservationSelected = int.Parse(Console.ReadLine());
                }
                var reservationTodelete = userReservations[indexReservationSelected];
                reservationData.CancelReservation(reservationTodelete.ReservationId);
                Console.WriteLine("La reservación ha sido cancelada");
                break;

            case MenuUser.HistorialReservas:
                Console.WriteLine("Opción ver el historial de reserva");


                break;

            case MenuUser.CambiarPassword:
                Console.WriteLine("Opción cambiar contraseña");


                break;
            }
        }
예제 #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Bienvenido al Coworking");
            Console.WriteLine("Seleccione el rol con el que desea ingresar:");
            Console.WriteLine();

            string roleSelected = string.Empty;

            while (roleSelected != "1" && roleSelected != "2")
            {
                Console.WriteLine("1 = Admin, 2 = Usuario");
                roleSelected = Console.ReadLine();
            }

            UserRole userRoleSelected = Enum.Parse <UserRole>(roleSelected);

            //Admin
            if (userRoleSelected == UserRole.Admin)
            {
                //Login before action
                ActiveUser = UserLogicService.LoginUser(true);
                SpinnerManager.Show();

                string menuAdminSelected = String.Empty;
                while (menuAdminSelected != "1" && menuAdminSelected != "2")
                {
                    Console.WriteLine("1 = Administración de puestos, 2 = Administración de usuários");
                    menuAdminSelected = Console.ReadLine();
                }

                if (Enum.Parse <MenuAdmin>(menuAdminSelected) == MenuAdmin.AdministracionPuestos)
                {
                    string menuPuestosSelected = String.Empty;
                    Console.WriteLine("Administración de Puestos");

                    while (menuPuestosSelected != "1" && menuPuestosSelected != "2" &&
                           menuPuestosSelected != "3" && menuPuestosSelected != "4")
                    {
                        Console.WriteLine("1 = Crear, 2 = Editar, 3 = Eliminar, 4 = Bloquear");
                        menuPuestosSelected = Console.ReadLine();
                    }
                    AdminPuestos menuAdminPuestosSelected = Enum.Parse <AdminPuestos>(menuPuestosSelected);

                    DeskLogicService.ExecuteAction(menuAdminPuestosSelected);
                }
                else if (Enum.Parse <MenuAdmin>(menuAdminSelected) == MenuAdmin.AdministracionUsuarios)
                {
                    string menuUsuariosSelected = String.Empty;
                    Console.WriteLine("Administración de Usuarios");
                    //Console.WriteLine("1 = Crear, 2 = Editar, 3 = Eliminar, 4 = Cambiar la Contraseña");

                    while (menuUsuariosSelected != "1" && menuUsuariosSelected != "2" &&
                           menuUsuariosSelected != "3" && menuUsuariosSelected != "4")
                    {
                        Console.WriteLine("1 = Crear, 2 = Editar, 3 = Eliminar, 4 = Cambiar la Contraseña");
                        menuUsuariosSelected = Console.ReadLine();
                    }
                    AdminUser menuAdminUserSelected = Enum.Parse <AdminUser>(menuUsuariosSelected);

                    UserLogicService.ExecuteAction(menuAdminUserSelected);
                }
            }

            //Usuario
            else if (Enum.Parse <UserRole>(roleSelected) == UserRole.User)
            {
                //Login before action
                ActiveUser = UserLogicService.LoginUser(false);


                string menuUsuarioSelected = String.Empty;

                while (menuUsuarioSelected != "1" && menuUsuarioSelected != "2" && menuUsuarioSelected != "3" && menuUsuarioSelected != "4")
                {
                    Console.WriteLine("1 = Reservar puesto, 2 = Cancelar reserva, 3 = Ver el Historial de reservas, 4= Cambiar contraseña");
                    menuUsuarioSelected = Console.ReadLine();
                }

                MenuUser menuUserSelected = Enum.Parse <MenuUser>(menuUsuarioSelected);

                UserLogicService.ExecuteActionByUser(ActiveUser, menuUserSelected);
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            string rolSelected = "";

            Console.WriteLine("Bienvenido al Coworking");
            Console.WriteLine();
            while (rolSelected != "1" && rolSelected != "2")
            {
                Console.WriteLine("1=Admin, 2=Usuario");
                rolSelected = Console.ReadLine();
            }
            if (Enum.Parse <UserRole>(rolSelected) == UserRole.Admin)
            {
                UserLogicService.LoginUser(true);

                string menuAdminSelected = "";
                while (true)
                {
                    while (menuAdminSelected != "1" && menuAdminSelected != "2")
                    {
                        Console.WriteLine("1=Administracion de puestos, 2=Administracion de usuarios");
                        menuAdminSelected = Console.ReadLine();
                    }
                    if (Enum.Parse <MenuAdmin>(menuAdminSelected) == MenuAdmin.AdministracionPuestos)
                    {
                        string menuPuestosSelected = "";
                        while (menuPuestosSelected != "1" &&
                               menuPuestosSelected != "2" &&
                               menuPuestosSelected != "3" &&
                               menuPuestosSelected != "4")
                        {
                            Console.WriteLine("Aministracion de puestos");
                            Console.WriteLine("1=Crear,  2=Editar, 3=Eliminar, 4=Bloquear");
                            menuPuestosSelected = Console.ReadLine();
                        }
                        AdminPuestos menuAdminPuestosSelected = Enum.Parse <AdminPuestos>(menuPuestosSelected);
                        DeskLogicService.ExecuteAction(menuAdminPuestosSelected);
                    }
                    else if (Enum.Parse <MenuAdmin>(menuAdminSelected) == MenuAdmin.AdministracionUsuarios)
                    {
                        string menuUsuariosSelected = "";
                        while (menuUsuariosSelected != "1" &&
                               menuUsuariosSelected != "2" &&
                               menuUsuariosSelected != "3" &&
                               menuUsuariosSelected != "4")
                        {
                            Console.WriteLine("Aministracion de Usuarios");
                            Console.WriteLine("1=Crear,  2=Editar, 3=Eliminar, 4=Cambiar la contraseña");
                            menuUsuariosSelected = Console.ReadLine();
                        }

                        AdminUsers menuAdminUserSelected = Enum.Parse <AdminUsers>(menuUsuariosSelected);
                        UserLogicService.ExcecuteAction(menuAdminUserSelected);
                        // UserLogicService();
                    }

                    menuAdminSelected = "";
                }
            }
            else if (Enum.Parse <UserRole>(rolSelected) == UserRole.User)
            {
                //Login before actions
                ActiveUser = UserLogicService.LoginUser(false);

                while (true)
                {
                    string menuUsuarioSelected = "";

                    while (menuUsuarioSelected != "1" &&
                           menuUsuarioSelected != "2" &&
                           menuUsuarioSelected != "3" &&
                           menuUsuarioSelected != "4")
                    {
                        Console.WriteLine("1=Reservar puesto, 2=Cancelar reserva, 3=Ver el historial de reserva, 4=Cambiar contraseña");
                        menuUsuarioSelected = Console.ReadLine();
                    }

                    MenuUser menuUserSelected = Enum.Parse <MenuUser>(menuUsuarioSelected);

                    menuUsuarioSelected = " ";
                    UserLogicService.ExecutActionByUser(ActiveUser, menuUserSelected);
                }
            }
        }
예제 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name     = SingInLogin.Text;
            string password = SingInPassword.Text;

            if (string.IsNullOrWhiteSpace(SingInLogin.Text) || string.IsNullOrWhiteSpace(SingInPassword.Text))
            {
                if (string.IsNullOrWhiteSpace(SingInLogin.Text))
                {
                    SingInLogin.BackColor = Color.MediumSeaGreen;
                }
                if (string.IsNullOrWhiteSpace(SingInPassword.Text))
                {
                    SingInPassword.BackColor = Color.MediumSeaGreen;
                }
                MessageBox.Show("Fill in the blank space, please");
                SingInLogin.BackColor    = Color.White;
                SingInPassword.BackColor = Color.White;
            }
            else if (SingInLogin.Text.Length <= 4 || SingInLogin.Text.Length >= 10)
            {
                SingInLogin.BackColor = Color.MediumSeaGreen;
                MessageBox.Show("Name has inappropriate length, try again");
                SingInLogin.BackColor = Color.White;
                SingInLogin.Text      = string.Empty;
            }
            else if (SingInPassword.Text.Length < 2 || SingInPassword.Text.Length >= 10)

            {
                SingInPassword.BackColor = Color.MediumSeaGreen;
                MessageBox.Show("Password has inappropriate length, try again");
                SingInPassword.BackColor = Color.White;
                SingInPassword.Text      = string.Empty;
            }
            else
            {
                string nickname;
                int    number;
                int    pass;
                bool   isInt     = int.TryParse(SingInPassword.Text, out number);
                bool   isIntName = int.TryParse(SingInLogin.Text, out number);
                // Данные с полей
                if (isIntName == true || isInt == false)
                {
                    if (isIntName == true)
                    {
                        SingInLogin.BackColor = Color.MediumSeaGreen;
                        MessageBox.Show("Name consists only of numbers, try again");
                        SingInLogin.Text      = string.Empty;
                        SingInLogin.BackColor = Color.White;
                    }
                    else
                    {
                        nickname = SingInLogin.Text;
                    }
                    if (isInt == false)
                    {
                        SingInPassword.BackColor = Color.MediumSeaGreen;
                        MessageBox.Show("Password consists not only of numbers, try again");
                        SingInPassword.Text      = string.Empty;
                        SingInPassword.BackColor = Color.White;
                    }
                    else
                    {
                        pass = Convert.ToInt32(SingInPassword.Text);
                    }
                }
                else
                {
                    nickname = SingInLogin.Text;
                    if (store.users.FirstOrDefault(u => u.Login == name && u.Password == password) != null)
                    {
                        MessageBox.Show($"Hello, {name}!");
                        Form Menu = new MenuUser(ref store);
                        Menu.Left = this.Left;
                        Menu.Top  = this.Top;
                        Menu.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Sorry, such User doesn`t exist...Try again or sign up !");
                    }
                }
            }
        }
예제 #12
0
        public void ExecuteActionByUser(User user, MenuUser menuUserSelected)
        {
            switch (menuUserSelected)
            {
            case MenuUser.ReservarPuesto:
                var deskList = deskData.GetAvailableDesks();
                Console.WriteLine("Puestos disponibles:");
                foreach (var item in deskList)
                {
                    Console.WriteLine($"{item.Number} - {item.Description}");
                }
                var newReservation = new Reservation();

                Console.WriteLine("Ingrese número del puesto");
                var deskFound = deskData.FindDesk(Console.ReadLine());

                while (deskFound == null)
                {
                    Console.WriteLine("Ingrese número del puesto");
                    deskFound = deskData.FindDesk(Console.ReadLine());
                }
                newReservation.DeskId = deskFound.DeskId;

                var dateSelected = new DateTime();

                while (dateSelected.Year == 0001)
                {
                    Console.WriteLine("Ingrese la fecha de reserva (dd-mm-yyyy)");
                    DateTime.TryParseExact(Console.ReadLine(), "dd-MM-yyyy", null, DateTimeStyles.None, out dateSelected);
                }

                newReservation.ReservationDate = dateSelected;
                newReservation.UserId          = user.UserId;
                reservationData.CreateReservation(newReservation);
                Console.WriteLine("Reservación creada!");
                break;

            case MenuUser.CancelarReserva:
                Console.WriteLine("Estas son las reservaciones disponibles");
                var userReservations = reservationData.GetReservationsByUser(user.UserId).ToList();
                var deskUserList     = deskData.GetAvailableDesks().ToList();
                int indexReservation = 1;

                foreach (var item in userReservations)
                {
                    Console.WriteLine($"{indexReservation} - {deskUserList.FirstOrDefault(p => p.DeskId == item.DeskId).Number} - {item.ReservationDate.ToString("dd-MM-yyyy")}");
                    indexReservation++;
                }

                var indexReservationSelected = 0;
                while (indexReservationSelected < 1 || indexReservationSelected > indexReservation)
                {
                    Console.WriteLine("Ingrese el número de la reservación que desea eliminar");
                    indexReservationSelected = int.Parse(Console.ReadLine());
                }

                var reservationToDelete = userReservations[indexReservationSelected];

                reservationData.CancelReservation(reservationToDelete.ReservationId);
                Console.WriteLine("Reservación cancelada.");
                break;

            case MenuUser.HistorialReservas:
                Console.WriteLine("Tus Reservas");
                var historyReservationUser = reservationData.GetReservationsHistoryByUser(user.UserId);
                var deskHistoryList        = deskData.GetAllDesks().ToList();
                foreach (var item in historyReservationUser)
                {
                    Console.ForegroundColor = item.ReservationDate > DateTime.Now ? ConsoleColor.Green : ConsoleColor.DarkGray;
                    Console.WriteLine($"{deskHistoryList.FirstOrDefault(p => p.DeskId == item.DeskId).Number} - {item.ReservationDate.ToString("dd-MM-yyyy")} {(item.ReservationDate > DateTime.Now ? "(Activa)" : "")}");
                    Console.ResetColor();
                }

                break;

            case MenuUser.CambiarPassword:
                Console.WriteLine("Escriba el password");
                user.PassWord = PasswordManager.GetPassWord();
                userData.EditUser(user);
                Console.WriteLine("Password actualizado.");
                break;
            }
        }