Ejemplo n.º 1
0
        public void Input()
        {
            ServiseAdmin  Sa  = new ServiseAdmin();
            Administrator adm = new Administrator();

            adm.Admin_Name     = "Admin";
            adm.Admin_Password = "******";
            Console.WriteLine("----Welcome----");
            Sa.AdminAdd(adm);
            {
                Console.WriteLine("(1)Registration\n(2)Log In");
                int a = int.Parse(Console.ReadLine());
                switch (a)
                {
                case 1:
                {
                    Readers_Details user = new Readers_Details();
                    Console.Write("Please enter Login: "******"Please enter Password: "******"Please enter Adress: ");
                    user.Adress = Console.ReadLine();
                    Console.Write("Please enter Phone: ");
                    user.Contact = Console.ReadLine();
                    Console.Write("Please enter E-Mail: ");
                    user.E_Mail = Console.ReadLine();
                    Sa.UserAdd(user);
                }
                break;

                case 2:
                {
                    Console.Write("Please enter Your Login: "******"Please enter Your Password: "******"Не верно введен login or password");
                        }
                        Environment.Exit(0);
                    }
                }
                break;
                }
            }
        }
Ejemplo n.º 2
0
        private void AdminMenu(string login)
        {
            ServiseAdmin Sa = new ServiseAdmin();
            UserService  Us = new UserService();

            Console.WriteLine("----Menu Administratora----");
            Console.WriteLine("(1)Search book\n(2)Add Book\n(3)Change Password\n ");
            Console.WriteLine("--Обслуживание пользователей--");
            Console.WriteLine("(4)Add User\n(5)Update User: "******"--Security--");
            Console.WriteLine("(6)Список Блокированных пользователей\n(7)Блокировать пользователя\n(8)Сбросить пароль пользователю");
            Console.Write("Выберите пункт меню: ");
            int a = int.Parse(Console.ReadLine());

            switch (a)
            {
            case 1:
            {
                BookDetails bd = new BookDetails();
                Console.Clear();
                Console.Write("Enter name book: ");
                string nameBook = Console.ReadLine();
                bd = Sa.SearchBook(nameBook);
                Console.WriteLine(bd.Name, bd.S_No, bd.Author_Name, bd.PublichDate);
            }
            break;

            case 2:
            {
                Console.Clear();
                BookDetails book = new BookDetails();
                Console.Write("Please enter Name Book: ");
                book.Name = Console.ReadLine();
                Console.Write("Please enter Author: ");
                book.Author_Name = Console.ReadLine();
                Console.Write("Please enter Serial Number: ");
                book.S_No = int.Parse(Console.ReadLine());
                Console.Write("Please Enter type: ");
                book.Type = Console.ReadLine();
                Console.Write("Please enter code book: ");
                book.Code = int.Parse(Console.ReadLine());
                Console.Write("Please enter publish date in format dd:mm:gggg : ");
                string   datePub = Console.ReadLine();
                DateTime dt      = new DateTime();
                DateTime.TryParse(datePub, out dt);
                book.PublichDate = dt;
                Console.Write("Please enter edition books: ");
                book.Edition = int.Parse(Console.ReadLine());
                Console.Write("Please enter status: ");
                book.Status = Console.ReadLine();
                Sa.BookAdd(book);
            }
            break;

            case 3:
            {
                Console.Clear();
                Console.Write("Please enter old password: "******"Please enter new password: "******"Please repeat enter new password: "******"Please enter Login: "******"Please enter Password: "******"Please enter Adress: ");
                user.Adress = Console.ReadLine();
                Console.Write("Please enter Phone: ");
                user.Contact = Console.ReadLine();
                Console.Write("Please enter E-Mail: ");
                user.E_Mail = Console.ReadLine();
                Sa.UserAdd(user);
            }
            break;

            case 5:
            {
                Console.Clear();
                Console.Write("Введите имя пользователя:  ");
                string name = Console.ReadLine();
                Console.WriteLine("Какой параметр хотите изменить");
                Console.WriteLine("(1)Adress\n(2)Phone(3)E-Mail");
                int b = int.Parse(Console.ReadLine());
                switch (b)
                {
                case 1:
                {
                    Console.Clear();
                    Console.WriteLine("Please enter new adress: ");
                    string adress = Console.ReadLine();
                    Sa.UserUpdate(name, "Adress", adress);
                }
                break;

                case 2:
                {
                    Console.Clear();
                    Console.WriteLine("Please enter new Phone: ");
                    string phone = Console.ReadLine();
                    Sa.UserUpdate(name, "Phone", phone);
                }
                break;

                case 3:
                {
                    Console.Clear();

                    Console.WriteLine("Please Enter new E-Mail");
                    string email = Console.ReadLine();
                    Sa.UserUpdate(name, "E-Mail", email);
                }
                break;
                }
            }
            break;

            case 6:
            {
                Console.Clear();
                //вызов метода списка блокированных пользователей
                List <Readers_Details> BlockUsers = Sa.ListBlockUser();
                foreach (Readers_Details res in BlockUsers)
                {
                    Console.WriteLine(res.Name, "\n", res.Contact, "\n", res.E_Mail, "\n\n");
                }
            }
            break;

            case 7:
            {
                Console.Clear();
                Console.WriteLine("Please enter login user:"******"Please enter login user:");
                string logIn = Console.ReadLine();
                //вызов метода сброса пароля
                Sa.ResetPassUser(logIn);
            }
            break;
            }
        }