Пример #1
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);
        }
        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 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 add to | CLICK --stop for stop type OR exit for exit option-- EXIT");
                groupName = _containerInterfaces.SystemInput.StringInput();
            }

            var body = new GroupChatMessageModel
            {
                RequestType = MessageType.ExitChat,
                lsUsers     = new List <string>()
                {
                    _clientname
                },
                GroupName = groupName
            };

            _serverHandler.UpdateChat(body);
        }
Пример #4
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();
            }

            var body = new GroupChatMessageModel
            {
                RequestType = "ExitChat",
                lsUsers     = new List <string>()
                {
                    _clientname
                },
                GroupName = groupName
            };

            _serverHandler.UpdateChat(body);
        }
Пример #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);
        }
Пример #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);
        }