Ejemplo n.º 1
0
        public List <UserGroupForListDto> GetUserGroups(string dawgtag)
        {
            //Method Level Variable Declarations
            List <Exception> excepts = new List <Exception>();

            GuacamoleDatabaseGetter getter = new GuacamoleDatabaseGetter();

            return(getter.GetUserGroupInfo(dawgtag, ref excepts));
        }
Ejemplo n.º 2
0
        public List <ConnectionForListDto> GetAllConnections()
        {
            //Method Level Variable Declarations
            List <Exception> excepts = new List <Exception>();

            GuacamoleDatabaseGetter getter = new GuacamoleDatabaseGetter();

            return(getter.GetAllConnectionInfo(ref excepts));
        }
Ejemplo n.º 3
0
        public GroupForListDto GetConnectionGroupsFromId(int id)
        {
            //Method Level Variable Declarations
            List <Exception> excepts = new List <Exception>();

            GuacamoleDatabaseGetter getter = new GuacamoleDatabaseGetter();
            GroupForListDto         dto    = new GroupForListDto();

            dto             = getter.GetAllConnectionGroupInfo(id, ref excepts);
            dto.Connections = getter.GetAllGroupConnections(dto.Id, ref excepts);
            dto.Users       = getter.GetAllConnectionGroupUsers(dto.Id, ref excepts);
            return(dto);
        }
Ejemplo n.º 4
0
        public List <GroupForListDto> GetConnectionGroups(string dawgtag)
        {
            //Method Level Variable Declarations
            List <Exception> excepts = new List <Exception>();

            GuacamoleDatabaseGetter getter    = new GuacamoleDatabaseGetter();
            List <GroupForListDto>  groupList = getter.GetConnectionGroupInfo(dawgtag, ref excepts);

            foreach (GroupForListDto dto in groupList)
            {
                dto.Connections = getter.GetAllGroupConnections(dto.Id, ref excepts);
            }

            return(groupList);
        }
Ejemplo n.º 5
0
        public ActionResult CreateGroup(GroupForCreationDto groupForCreationDto)
        {
            //Method Level Variable Declarations
            List <Exception> excepts = new List <Exception>();

            //Check if the group inupt parameters are valid
            using (Validator checker = new Validator())
            {
                checker.ValidateGroupName(groupForCreationDto.Name, ref excepts);
                checker.ValidateVmTotal(groupForCreationDto.Max, ref excepts);
            }

            if (excepts.Count != 0)
            {
                var message = HandleErrors(excepts);
                return(Ok(null));
            }

            //Format connection group type
            using (Formatter styler = new Formatter())
            {
                groupForCreationDto.Type = styler.FormatName(groupForCreationDto.Type);
            }

            //Get affinity bool
            string affinityBool = "0";

            if (groupForCreationDto.Affinity)
            {
                affinityBool = "1";
            }

            //Create connection group
            GuacamoleDatabaseInserter inserter = new GuacamoleDatabaseInserter();

            if (!inserter.InsertConnectionGroup(groupForCreationDto.Name, groupForCreationDto.Type, groupForCreationDto.Max, affinityBool, ref excepts))
            {
                var message = HandleErrors(excepts);
                return(Ok(null));
            }

            //Get the newly created group id
            GuacamoleDatabaseGetter getter = new GuacamoleDatabaseGetter();

            groupForCreationDto.Id = getter.GetConnectionGroupId(groupForCreationDto.Name, ref excepts);
            return(Ok(groupForCreationDto));
        }