Ejemplo n.º 1
0
        internal void UpdateUserPass()
        {
            Console.WriteLine("Give a Username: ");
            string Username = Console.ReadLine();

            while (DatabaseConnection.CheckUserList(Username))
            {
                Username = Console.ReadLine();
            }
            DatabaseConnection.UpdateUserPassDB(Username, Password.PasswordInsert());

            Design.ConsoleClear();
        }
Ejemplo n.º 2
0
        internal void DeleteUser()
        {
            Console.WriteLine("What User Do you want to Delete");
            string DeletedUser = Console.ReadLine();

            while (DatabaseConnection.CheckUserList(DeletedUser))
            {
                DeletedUser = Console.ReadLine();
            }

            DatabaseConnection.DeleteUserDB(DeletedUser);

            Design.ConsoleClear();
        }
Ejemplo n.º 3
0
        internal bool GeneralMenu(string LogedUser)
        {
            Design.MiniWelc(LogedUser);

            Console.WriteLine("1. Send Message");
            Console.WriteLine("2. Inbox");
            Console.WriteLine("3. Edit Your Message");
            Console.WriteLine("4. Delete Your Message");
            Console.WriteLine("5. Actions");
            Console.WriteLine("6. Log-Off");

            while (true)
            {
                switch (Console.ReadLine())
                {
                case "1":
                    MessagesActions.SendMessage(LogedUser);
                    Console.Clear();
                    return(true);

                case "2":
                    MessagesActions.ViewMessage(LogedUser);
                    Console.Clear();
                    return(true);

                case "3":
                    MessagesActions.EditMessage(LogedUser);
                    Console.Clear();
                    return(true);

                case "4":
                    MessagesActions.DeleteMessage(LogedUser);
                    Console.Clear();
                    return(true);

                case "5":
                    Console.Clear();
                    LoginSignUP.RoleMenu(LogedUser);
                    return(true);

                case "6":
                    return(false);

                default:
                    Console.WriteLine("Your Input dont match , Choose Again...");
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        internal static void ShowAllUsers()
        {
            var db    = new DatabaseConnection();
            var users = db.SelectAllUsers()
                        .Where(x => x.Deleted == false)
                        .OrderBy(x => x.Role)
                        .ToList();

            foreach (var user in users)
            {
                Console.WriteLine($"{user.Role}: {user.Username}");
            }

            Design.ConsoleClear();
        }
Ejemplo n.º 5
0
        internal static void Login()
        {
            Console.Clear();
            Design.WelcomeMethod();

            string logedUser;

            InsertUsernamePassword(out logedUser);

            var menu = new Menus();

            while (menu.GeneralMenu(logedUser))
            {
            }
        }
Ejemplo n.º 6
0
        internal static void DeleteMessage(string LogedUser)
        {
            if (DatabaseConnection.ViewForZeroMessage(LogedUser) == false)
            {
                DatabaseConnection.ViewMessageWithIdDB(LogedUser);

                Console.Write("Select An ID: ");
                int ID;
                CheckID(LogedUser, out ID);

                DatabaseConnection.DeleteMessageDB(ID);
            }

            Design.ConsoleClear();
        }
Ejemplo n.º 7
0
        internal static void ViewMessage()
        {
            Console.Clear();

            Console.WriteLine("Select A User: "******"Select Again:");
                user = Console.ReadLine();
            }

            DatabaseConnection.ViewMessageWithIdDB(user);

            Design.ConsoleClear();
        }
Ejemplo n.º 8
0
        internal static void SendMessageDB(string UserMessage, string Sender, string Receiver)
        {
            using (SqlConnection dbcon = new SqlConnection(connectionstring))
            {
                var NewQuerry = dbcon.Execute("insert into Messages values(@Date,@Sender, @Receiver, @UserMessage, @Deleted)",
                                              new
                {
                    Date        = DateTime.Now,
                    Sender      = Sender,
                    Receiver    = Receiver,
                    UserMessage = UserMessage,
                    Deleted     = 0,
                });
            }

            TxtAccess.FileCreation(Sender, Receiver, UserMessage);

            Console.WriteLine("\nYour Message Send Successfully");

            Design.ConsoleClear();
        }
Ejemplo n.º 9
0
        internal static void SignUp()
        {
            Console.Clear();
            Design.WelcomeMethod();

            Console.WriteLine("Give me a username");

            string name = Console.ReadLine();

            while (DatabaseConnection.CheckAvailableName(name))
            {
                Console.WriteLine("Give me Another Username \nor Type (e) to Restart the App");
                name = Console.ReadLine();
                if (name == "e")
                {
                    Console.Clear();
                    return;
                }
            }
            DatabaseConnection.CreateUserDB(name, Password.PasswordInsert());
        }
Ejemplo n.º 10
0
        internal bool ModActionsMenu(string LogedUser)
        {
            Console.Clear();
            Design.ModDesign();

            Console.WriteLine("1.  View  --> A User's Messages");
            Console.WriteLine("2.  Edit  --> A User's Messages");
            Console.WriteLine("3. Delete --> A User's Messages");
            Console.WriteLine("4. Return ");

            while (true)
            {
                switch (Console.ReadLine())
                {
                case "1":
                    MessagesActions.ViewMessage();
                    Console.Clear();
                    return(true);

                case "2":
                    MessagesActions.EditMessage();
                    Console.Clear();
                    return(true);

                case "3":
                    MessagesActions.DeleteMessage();
                    Console.Clear();
                    return(true);

                case "4":
                    Console.Clear();
                    return(false);

                default:
                    Console.WriteLine("Your Input dont match , Choose Again...");
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        internal static void EditMessage(string LogedUser)
        {
            if (DatabaseConnection.ViewForZeroMessage(LogedUser) == false)
            {
                DatabaseConnection.ViewMessageWithIdDB(LogedUser);

                Console.Write("Select An ID: ");
                int ID;
                CheckID(LogedUser, out ID);

                Console.WriteLine("Edit Message: ");
                string Message = Console.ReadLine();
                while (Message.Length > 250)
                {
                    Console.WriteLine("Your Message must Under 250 Character. Try Again ...");
                    Message = Console.ReadLine();
                }

                DatabaseConnection.EditMessageDB(ID, Message);
            }

            Design.ConsoleClear();
        }
Ejemplo n.º 12
0
        internal static void RoleMenu(string logedUser)
        {
            if (DatabaseConnection.CheckUserRole(logedUser) == "Admin")
            {
                var menu = new Menus();
                while (menu.AdminActionsMenu(logedUser))
                {
                }
            }
            else if (DatabaseConnection.CheckUserRole(logedUser) == "Mod")
            {
                var menu = new Menus();
                while (menu.ModActionsMenu(logedUser))
                {
                }
            }
            else if (DatabaseConnection.CheckUserRole(logedUser) == "Loyal")
            {
                var menu = new Menus();
                while (menu.LoyalActionsMenu(logedUser))
                {
                }
            }
            else if (DatabaseConnection.CheckUserRole(logedUser) == "Friend")
            {
                var menu = new Menus();
                while (menu.FriendActionsMenu(logedUser))
                {
                }
            }
            else //if (DatabaseConnection.CheckUserRole(logedUser) == "Guest")
            {
                Console.WriteLine("Your Role is Guest ... You dont have any Role Action's");

                Design.ConsoleClear();
            }
        }
Ejemplo n.º 13
0
        internal void UpdateUserRole()
        {
            Console.WriteLine("Which User do you want to Change his/her Role");
            String Username = Console.ReadLine();

            while (DatabaseConnection.CheckUserList(Username))
            {
                Username = Console.ReadLine();
            }

            Console.WriteLine("Select A Role:");
            Console.WriteLine("Admin - Mod - Loyal - Friend - Guest");
            String UserRole = Console.ReadLine();

            while (UserRole != "Admin" && UserRole != "Mod" && UserRole != "Loyal" && UserRole != "Friend" && UserRole != "Guest")
            {
                Console.WriteLine("Wrong Role. Try Again");
                UserRole = Console.ReadLine();
            }

            DatabaseConnection.UpdateUserRoleDB(Username, UserRole);

            Design.ConsoleClear();
        }
Ejemplo n.º 14
0
        internal static void EditMessage()
        {
            Console.Clear();
            string user;

            ViewMessageWithId(out user);

            Console.Write("Select An ID: ");
            int ID;

            CheckID(user, out ID);

            Console.WriteLine("Edit Message: ");
            string Message = Console.ReadLine();

            while (Message.Length > 250)
            {
                Console.WriteLine("Your Message must Under 250 Character. Try Again ...");
                Message = Console.ReadLine();
            }

            DatabaseConnection.EditMessageDB(ID, Message);
            Design.ConsoleClear();
        }
Ejemplo n.º 15
0
        internal static void ViewMessage(string LogedUser)
        {
            DatabaseConnection.ViewMessageDB(LogedUser);

            Design.ConsoleClear();
        }