示例#1
0
        //Update by Account Id
        public static bool UpdateAccountData_byID(int AccountId, string Username, string Password, string Email, int AccessLevel, string Membership, bool isGM, long LastOnlineUtc, int Coins, string Ip, string Settings, bool IsOnline, bool IsBanned, long UnBanDate)
        {
            if (DbQuerys.UserExists(Username))
            {
                Logger.WriteLine(LogState.Exception, "UpdateAccountData Failure: " + Username + ", already Exists, please choose another!");
                return(false);
            }

            using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
            {
                string UpdateAccountQuery = "UPDATE accounts SET Username='******',Password='******',Email='" + Email + "',AccessLevel='" + AccessLevel + "',Membership='" + Membership + "',isGM=" + isGM + ",LastOnlineUtc='" + LastOnlineUtc + "',Coins='" + Coins + "',Ip='" + Ip + "',Settings='" + Settings + "',IsOnline=" + IsOnline + ",IsBanned=" + IsBanned + ",UnBanDate='" + UnBanDate + "' WHERE Id=" + AccountId + ";";
                dbClient.setQuery(UpdateAccountQuery);
                dbClient.addParameter("Username", Username);
                dbClient.addParameter("Password", Password);
                dbClient.addParameter("Email", Email);
                dbClient.addParameter("AccessLevel", AccessLevel);
                dbClient.addParameter("Membership", Membership);
                dbClient.addParameter("isGM", isGM);
                dbClient.addParameter("LastOnlineUtc", LastOnlineUtc);
                dbClient.addParameter("Coins", Coins);
                dbClient.addParameter("Ip", Ip.ToString());
                dbClient.addParameter("Settings", Settings);
                dbClient.addParameter("IsOnline", IsOnline);
                dbClient.addParameter("IsBanned", IsBanned);
                dbClient.addParameter("UnBanDate", UnBanDate);

                dbClient.runQuery();

                Logger.WriteLine(LogState.Info, "Updated AccountId: {0} as {1}.)", AccountId, Username);
                return(true);
            }
        }
示例#2
0
        //Insert New Account Data
        public static bool InsertAccountData(string Username, string Password, string Email, int AccessLevel, string Membership, bool isGM, long LastOnlineUtc, int Coins, string Ip, string Settings, bool IsOnline, bool IsBanned, long UnBanDate, long RegisterDate)
        {
            if (DbQuerys.UserExists(Username))
            {
                Logger.WriteLine(LogState.Exception, "InsertAccount Failure: " + Username + ", already Exists, please choose another!");
                return(false);
            }
            using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
            {
                string AddAccount = "INSERT INTO accounts VALUES(NULL, @Username,@Password,@Email,@AccessLevel,@Membership,@isGM,@LastOnlineUtc,@Coins,@Ip,@Settings,@IsOnline,@IsBanned,@UnBanDate,@RegisterDate)";
                dbClient.setQuery(AddAccount);
                dbClient.addParameter("@Username", Username);
                dbClient.addParameter("@Password", Crypt.StringToMD5(Password));
                dbClient.addParameter("@Email", Email);
                dbClient.addParameter("@AccessLevel", AccessLevel);
                dbClient.addParameter("@Membership", Membership);
                dbClient.addParameter("@isGM", isGM);
                dbClient.addParameter("@LastOnlineUtc", LastOnlineUtc);
                dbClient.addParameter("@Coins", Coins);
                dbClient.addParameter("@Ip", Ip);
                dbClient.addParameter("@Settings", Settings);
                dbClient.addParameter("@IsOnline", IsOnline);
                dbClient.addParameter("@IsBanned", IsBanned);
                dbClient.addParameter("@UnBanDate", UnBanDate);
                dbClient.addParameter("@RegisterDate", RegisterDate);
                dbClient.runQuery();

                Logger.WriteLine(LogState.Info, "Inserted Account: {0} successfully.)", Username);
                return(true);
            }
        }
示例#3
0
 //Set Membership, 20000,20001,.....
 public static bool SetMembership(string Username, int newMembership)
 {
     if (!DbQuerys.UserExists(Username))
     {
         Logger.WriteLine(LogState.Exception, "Error setting Membership! " + Username + ", User does not  Exists!");
         return(false);
     }
     using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
     {
         string SetMembershipQuery = "UPDATE accounts SET Membership='" + newMembership + "' WHERE Username='******';";
         dbClient.setQuery(SetMembershipQuery);
         dbClient.addParameter("Membership", newMembership);
         dbClient.runQuery();
         Logger.WriteLine(LogState.Info, "Set Membership: " + newMembership + " for, " + Username + ".)");
         return(true);
     }
 }
示例#4
0
 //Set New Username, Username,NewUsername
 public static bool SetUsername(string oldUsername, string newUserName)
 {
     if (DbQuerys.UserExists(newUserName))
     {
         Logger.WriteLine(LogState.Exception, "Error setting Username! " + newUserName + ", User already Exists!");
         return(false);
     }
     using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
     {
         string SetUsernameQuery = "UPDATE accounts SET Username='******' WHERE Username='******';";
         dbClient.setQuery(SetUsernameQuery);
         dbClient.addParameter("Username", newUserName);
         dbClient.runQuery();
         Logger.WriteLine(LogState.Info, "Set Username: "******" for, " + oldUsername + ".)");
         return(true);
     }
 }
示例#5
0
 //Set Online Status, Name,bool
 public static bool SetIsOnline(string Username, bool newIsOnline)
 {
     if (!DbQuerys.UserExists(Username))
     {
         Logger.WriteLine(LogState.Exception, "Error setting IsOnline! " + Username + ", User does not  Exists!");
         return(false);
     }
     using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
     {
         string SetIsOnlineQuery = "UPDATE accounts SET IsOnline=" + newIsOnline + " WHERE Username='******';";
         dbClient.setQuery(SetIsOnlineQuery);
         dbClient.addParameter("IsOnline", newIsOnline);
         dbClient.runQuery();
         Logger.WriteLine(LogState.Info, "Set IsOnline: " + newIsOnline + " for, " + Username + ".)");
         return(true);
     }
 }
示例#6
0
 //Set New Password, Username,NewPassword
 public static bool SetPassword(string Username, string newPassword)
 {
     if (!DbQuerys.UserExists(Username))
     {
         Logger.WriteLine(LogState.Exception, "Error setting Password! " + Username + ", User does not  Exists!");
         return(false);
     }
     using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
     {
         newPassword = Crypt.StringToMD5(newPassword);
         string SetPasswordQuery = "UPDATE accounts SET Password='******' WHERE Username='******';";
         dbClient.setQuery(SetPasswordQuery);
         dbClient.addParameter("Password", newPassword);
         dbClient.runQuery();
         Logger.WriteLine(LogState.Info, "Set Password: "******" for, " + Username + ".)");
         return(true);
     }
 }
示例#7
0
        //Set Current Date(Int64)
        public static bool SetLastOnlineUtc(string Username)
        {
            Int64 timeStampNowValue = Convert.ToInt64(DateTime.Now.Ticks);

            if (!DbQuerys.UserExists(Username))
            {
                Logger.WriteLine(LogState.Exception, "Error setting LastOnlineUtc! " + Username + ", User does not  Exists!");
                return(false);
            }
            using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
            {
                string SetLastOnlineUtcQuery = "UPDATE accounts SET LastOnlineUtc='" + timeStampNowValue + "' WHERE Username='******';";
                dbClient.setQuery(SetLastOnlineUtcQuery);
                dbClient.addParameter("LastOnlineUtc", timeStampNowValue);
                dbClient.runQuery();
                Logger.WriteLine(LogState.Info, "Set LastOnlineUtc: " + timeStampNowValue + " for, " + Username + ".)");
                return(true);
            }
        }
示例#8
0
        //Set Ban Status, Name,bool,Date
        public static bool SetBanStatus(string Username, bool newIsBanned, Int64 newUnBanDate)
        {
            Int64 timeStampNowValue = Convert.ToInt64(DateTime.Now.Ticks);

            if (!DbQuerys.UserExists(Username))
            {
                Logger.WriteLine(LogState.Exception, "Error setting SetBanStatus! " + Username + ", User does not  Exists!");
                return(false);
            }
            using (IQueryAdapter dbClient = LoginServer.dbManager.getQueryreactor())
            {
                string SetBanStatusQuery = "UPDATE accounts SET IsBanned=" + newIsBanned + ", UnBanDate='" + newUnBanDate + "' WHERE Username='******';";
                dbClient.setQuery(SetBanStatusQuery);
                dbClient.addParameter("IsBanned", newIsBanned);
                dbClient.addParameter("UnBanDate", newUnBanDate);
                dbClient.runQuery();
                Logger.WriteLine(LogState.Info, "Set isBanned: " + newIsBanned + " till: " + newUnBanDate + " for, " + Username + ".)");
                return(true);
            }
        }