/// <summary> /// Get by email /// </summary> /// <param name="email"></param> /// <param name="connectionString"></param> /// <returns></returns> public static BasePrincipal GetByEmail(string email, string connectionString) { TopRockUser _u = new TopRockUser(connectionString); _u.PopulateByEmail(email); if (_u.ID != null) { BasePrincipal _bp = new BasePrincipal(_u); return _bp; } return null; }
/// <summary> /// Get User Principal by ID /// </summary> /// <param name="userId"></param> /// <param name="connectionString"></param> /// <returns></returns> public static BasePrincipal GetByUserID(Int32 userId, string connectionString) { TopRockUser _u = new TopRockUser(connectionString); _u.LitePopulate(userId); if (_u.ID != null) { BasePrincipal _bp = new BasePrincipal(_u); return _bp; } return null; }
/// <summary> /// User Login /// </summary> /// <param name="inUserName"></param> /// <param name="inPassword"></param> /// <param name="inConnString"></param> /// <returns></returns> public static BasePrincipal LoginUser(String inUserName, string inPassword, string inConnString) { TopRockUser _u = new TopRockUser(inConnString); _u.PopulateByLogin(inUserName, inPassword); if (_u.ID != null) { BasePrincipal _bp = new BasePrincipal(_u); return _bp; } return null; }
/// <summary> /// Get User IPrincipal from Session /// </summary> /// <returns></returns> public static BasePrincipal GetFromSession() { if (HttpContext.Current != null) { BasePrincipal _member = new BasePrincipal(); _member = (BasePrincipal)HttpContext.Current.Session[SESSIONNAME]; return _member; } return null; }