diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index f077e3c..eabac69 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -40,9 +40,9 @@ namespace AIAHTML5.API.Controllers //Above code commented to reduce db hitting for same result set // get user details based on credentials provided - User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); + dynamic userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); - if (userInfo != null) + if (userInfo != null && Convert.ToString(userInfo) != AIAConstants.SQL_CONNECTION_ERROR) { //check is user authenticated bool isUserAuthenticated = AIAHTML5.API.Models.Users.IsUserAuthenticated(credentials, userInfo); @@ -332,10 +332,14 @@ namespace AIAHTML5.API.Controllers //} } } - else + else if (Convert.ToString(userInfo) != AIAConstants.SQL_CONNECTION_ERROR) { authenticationRepsonse = AIAConstants.USER_NOT_FOUND; } + else + { + authenticationRepsonse = AIAConstants.SQL_CONNECTION_ERROR; + } //if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(authenticationRepsonse)!= AIAConstants.SQL_CONNECTION_ERROR) //{ diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index b8eef73..94d3dd2 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -92,7 +92,7 @@ namespace AIAHTML5.API.Models ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug(" Inside GetUserDetailsByLoginId for LoginId = " + loginId); - User objUser = new User(); + dynamic objUser = null; DBModel objModel = new DBModel(); try @@ -148,6 +148,7 @@ namespace AIAHTML5.API.Models } catch (SqlException ex) { + objUser = AIAConstants.SQL_CONNECTION_ERROR; logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); } return objUser; diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 943ce1f..850f858 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -203,11 +203,11 @@ namespace AIAHTML5.API.Models return isAuthenticatedUser; } - internal static User getUserDetails(Newtonsoft.Json.Linq.JObject credentials) + internal static dynamic getUserDetails(Newtonsoft.Json.Linq.JObject credentials) { - User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); + dynamic userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); - return user; + return userDetails; } internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId)