public void Operation()
        {
            _containerInterfaces.SystemOutput.Print("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            _containerInterfaces.SystemOutput.Print(allConnectedUser);

            _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him");
            string name = _containerInterfaces.SystemInput.StringInput();

            if (name == _clientname)
            {
                _containerInterfaces.SystemOutput.Print($"You cannot create private chat with yourself");
                return;
            }

            if (!allConnectedUser.Contains(name))
            {
                _containerInterfaces.SystemOutput.Print($"The user {name} is not in user list");
                return;
            }

            var body = new PrivateChatMessageModel
            {
                RequestType = MessageType.PrivateCreationChat,
                lsUsers     = new List <string>()
                {
                    name
                }
            };

            _serverHandler.CreateChat(body);
        }
        public void Operation()
        {
            Console.WriteLine("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            Console.WriteLine(allConnectedUser);

            Console.WriteLine("Please enter the name you want to open chat with him");
            string name = Console.ReadLine();

            if (name == _clientname)
            {
                Console.WriteLine($"You cannot create private chat with yourself");
                return;
            }

            if (!allConnectedUser.Contains(name))
            {
                Console.WriteLine($"The user {name} is not in user list");
                return;
            }

            var body = new PrivateChatMessageModel
            {
                RequestType = "PrivateCreationChat",
                lsUsers     = new List <string>()
                {
                    name
                }
            };

            _serverHandler.CreateChat(body);
        }
Exemple #3
0
        public void Operation()
        {
            _containerInterfaces.SystemOutput.Print("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            _containerInterfaces.SystemOutput.Print(allConnectedUser);

            _containerInterfaces.SystemOutput.Print("Please enter the name Of the group you want to open");
            string groupName = _containerInterfaces.SystemInput.StringInput();


            _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
            string name = _containerInterfaces.SystemInput.StringInput();


            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames);
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                _containerInterfaces.SystemOutput.Print("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
                name = _containerInterfaces.SystemInput.StringInput();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = MessageType.GroupCreationChat,
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.CreateChat(body);
        }
        public void Operation()
        {
            Console.WriteLine("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            Console.WriteLine(allConnectedUser);

            Console.WriteLine("Please enter the name Of the group you want to open");
            string groupName = Console.ReadLine();


            Console.WriteLine("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
            string name = Console.ReadLine();


            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames);
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                Console.WriteLine("Please enter the name you want to open chat with him | CLICK --stop-- EXIT");
                name = Console.ReadLine();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = "GroupCreationChat",
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.CreateChat(body);
        }
Exemple #5
0
        public void Operation()
        {
            Console.WriteLine("All chats group chats");
            List <ChatMessageModel> allChats = _serverHandler.GetAllChatGroupModels();

            Console.WriteLine(GetChatsResponse(allChats));


            Console.WriteLine("Please enter the group name you want to remove to | CLICK --stop for stop type OR exit for exit option-- EXIT");
            string groupName = Console.ReadLine();

            while (groupName != "stop")
            {
                if (groupName == "exit")
                {
                    return;
                }
                if (IsvalidateGroupName(groupName, allChats))
                {
                    break;
                }
                Console.WriteLine("Please enter the group name you want to add to | CLICK --stop for stop type OR exit for exit option-- EXIT");
                groupName = Console.ReadLine();
            }

            Console.WriteLine("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            Console.WriteLine(allConnectedUser);


            Console.WriteLine("Please enter which user you want to remove to chat | CLICK --stop for stop type OR exit for exit option-- EXIT");
            string name = Console.ReadLine();

            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                if (name == "exit")
                {
                    return;
                }
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames, allChats.First(c => c.GroupName == groupName));
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                Console.WriteLine("Please enter which user you want to remove to chat | CLICK --stop for stop type OR exit for exit option-- EXIT");
                name = Console.ReadLine();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = "RemoveUserToChat",
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.UpdateChat(body);
        }
Exemple #6
0
        public void Operation()
        {
            _containerInterfaces.SystemOutput.Print("All chats group chats");
            List <ChatMessageModel> allChats = _serverHandler.GetAllChatGroupModels();

            _containerInterfaces.SystemOutput.Print(ChatUtils.GetChatsResponse(allChats));


            _containerInterfaces.SystemOutput.Print("Please enter the group name you want to remove permission to | CLICK --stop for stop type OR exit for exit option-- EXIT");
            string groupName = _containerInterfaces.SystemInput.StringInput();

            while (groupName != "stop")
            {
                if (groupName == "exit")
                {
                    return;
                }
                if (allChats.Any(c => c.GroupName == groupName))
                {
                    break;
                }
                _containerInterfaces.SystemOutput.Print("Please enter the group name you want to remove permission to | CLICK --stop for stop type OR exit for exit option-- EXIT");
                groupName = _containerInterfaces.SystemInput.StringInput();
            }

            _containerInterfaces.SystemOutput.Print("All connected users");
            string allConnectedUser = _serverHandler.GetAllUserConnected();

            _containerInterfaces.SystemOutput.Print(allConnectedUser);


            _containerInterfaces.SystemOutput.Print("Please enter the group name you want to remove admin permission to | CLICK --stop for stop type OR exit for exit option-- EXIT");
            string name = _containerInterfaces.SystemInput.StringInput();

            List <string> userNames = new List <string>();

            while (name != "stop")
            {
                if (name == "exit")
                {
                    return;
                }
                bool IsNameValidate = ValidateName(allConnectedUser, name, userNames, allChats.First(c => c.GroupName == groupName));
                if (IsNameValidate)
                {
                    userNames.Add(name);
                }
                _containerInterfaces.SystemOutput.Print("Please enter the group name you want to remove admin permission to | CLICK --stop for stop type OR exit for exit option-- EXIT");
                name = _containerInterfaces.SystemInput.StringInput();
            }


            var body = new GroupChatMessageModel
            {
                RequestType = MessageType.RemoveAdminPermissions,
                lsUsers     = userNames,
                GroupName   = groupName
            };

            _serverHandler.UpdateChat(body);
        }