public static GithubProfile FromId(IfyContext context, int userId) { try{ GithubProfile result = new GithubProfile(context, userId); result.Load(); return(result); }catch (Exception e) { context.LogError(typeof(Terradue.Github.GithubProfile), String.Format("{0} : {1}", e.Message, e.StackTrace)); throw new Exception("Github account does not exist for the user."); } }
public static GithubProfile FromUsername(IfyContext context, string name) { GithubProfile result = new GithubProfile(context, name); //result.Load(); string sql = String.Format("SELECT id, token, email FROM usr_github WHERE username='******';", name); IDbConnection dbConnection = context.GetDbConnection(); IDataReader reader = context.GetQueryResult(sql, dbConnection); if (reader.Read()) { result.Id = reader.GetInt32(0); result.Token = reader.GetString(1); result.Email = reader.GetString(2); } context.CloseQueryResult(reader, dbConnection); return(result); }