Ejemplo n.º 1
0
        public static int CheckForAvailabilityGID()
        {
            int retint = 0;

            using (var dbCon = new MySQLDatabaseConnection(System.Net.IPAddress.Parse("127.0.0.1"), "exceeddb"))
            {
                dbCon.Username = "******";
                dbCon.Password = "******";
                dbCon.Connect();

                string   command = "SELECT `groupid` FROM `groupDB`";
                string[] gather  = dbCon.GetListCollumnValue(command, "groupid");

                if (gather.Length != 0)
                {
                    List <string> check = new List <string>(gather);
                    for (int i = 0; i < gather.Length; i++)
                    {
                        if (!check.Contains(retint.ToString()))
                        {
                            break;
                        }
                        else
                        {
                            retint++;
                        }
                    }
                }
                command = string.Empty;
                dbCon.Close();
            }
            return(retint);
        }
Ejemplo n.º 2
0
        public static void RemoveUserInEveryGroup(string username)
        {
            string[] groupstack = new string[0];
            using (var dbCon = new MySQLDatabaseConnection(System.Net.IPAddress.Parse("127.0.0.1"), "exceeddb"))
            {
                dbCon.Username = "******";
                dbCon.Password = "******";
                dbCon.Connect();

                string command = "SELECT `groupname` FROM `groupDB`";
                groupstack = dbCon.GetListCollumnValue(command, "groupname");

                command = string.Empty;
                dbCon.Close();
            }

            if (groupstack.Length == 0)
            {
                return;
            }

            foreach (string group in groupstack)
            {
                try
                {
                    MySQLAccountParsing.RemoveUserFromGroup(username, group);
                }
                catch (Exception ex)
                {
                    if (!(ex is MissingMemberException))
                    {
                        throw;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }