void LoginGamersfirst() { string token = web.Param("token"); // get id from auth ticket GamerstirstApi api = new GamerstirstApi(); Dictionary <string, string> dict = api.AuthenticateWithToken(token); if (dict == null || dict["Result"] == null || dict["Result"] != "0") { // auth failed Response.Write("WO_5"); Response.Write(api.lastData_); return; } string g1Id = dict["AccountId"]; string g1PayCode = dict["PremiumCode"]; string g1UserName = dict["Username"]; // try to login user based on his Gamersfirst ID SqlCommand sqcmd = new SqlCommand(); sqcmd.CommandType = CommandType.StoredProcedure; sqcmd.CommandText = "WO_G1Login"; sqcmd.Parameters.AddWithValue("@in_IP", LastIP); sqcmd.Parameters.AddWithValue("@in_G1ID", g1Id); if (!CallWOApi(sqcmd)) { return; } reader.Read(); int CustomerID = getInt("CustomerID");; int AccountStatus = getInt("AccountStatus"); int SessionID = getInt("SessionID"); Response.Write("WO_0"); Response.Write(string.Format("{0} {1} {2} {3} {4} :{5}", CustomerID, SessionID, AccountStatus, g1Id, g1PayCode, g1UserName)); return; }
string DetectAccountClassification(string g1Id) { try { GamerstirstApi api = new GamerstirstApi(); Dictionary <string, string> dict = api.GetAccountClassification(g1Id); if (dict == null || dict["Result"] == null) { return("WR_API_FAIL"); } if (dict["Result"] != "0") { return("WR_NONE"); } string Classification = dict["Classification"]; return(Classification); } catch { // this call can fail and we can live with it return("WR_HTTP_FAIL"); } }