Commit 4eb2529e45115e1b4b55f9085c464e70f5d7bdfd
1 parent
9331e957
Committing updated code
Showing
3 changed files
with
12 additions
and
7 deletions
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -40,9 +40,9 @@ namespace AIAHTML5.API.Controllers |
40 | 40 | |
41 | 41 | //Above code commented to reduce db hitting for same result set |
42 | 42 | // get user details based on credentials provided |
43 | - User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); | |
43 | + dynamic userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); | |
44 | 44 | |
45 | - if (userInfo != null) | |
45 | + if (userInfo != null && Convert.ToString(userInfo) != AIAConstants.SQL_CONNECTION_ERROR) | |
46 | 46 | { |
47 | 47 | //check is user authenticated |
48 | 48 | bool isUserAuthenticated = AIAHTML5.API.Models.Users.IsUserAuthenticated(credentials, userInfo); |
... | ... | @@ -332,10 +332,14 @@ namespace AIAHTML5.API.Controllers |
332 | 332 | //} |
333 | 333 | } |
334 | 334 | } |
335 | - else | |
335 | + else if (Convert.ToString(userInfo) != AIAConstants.SQL_CONNECTION_ERROR) | |
336 | 336 | { |
337 | 337 | authenticationRepsonse = AIAConstants.USER_NOT_FOUND; |
338 | 338 | } |
339 | + else | |
340 | + { | |
341 | + authenticationRepsonse = AIAConstants.SQL_CONNECTION_ERROR; | |
342 | + } | |
339 | 343 | |
340 | 344 | //if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(authenticationRepsonse)!= AIAConstants.SQL_CONNECTION_ERROR) |
341 | 345 | //{ | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -92,7 +92,7 @@ namespace AIAHTML5.API.Models |
92 | 92 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
93 | 93 | logger.Debug(" Inside GetUserDetailsByLoginId for LoginId = " + loginId); |
94 | 94 | |
95 | - User objUser = new User(); | |
95 | + dynamic objUser = null; | |
96 | 96 | DBModel objModel = new DBModel(); |
97 | 97 | |
98 | 98 | try |
... | ... | @@ -148,6 +148,7 @@ namespace AIAHTML5.API.Models |
148 | 148 | } |
149 | 149 | catch (SqlException ex) |
150 | 150 | { |
151 | + objUser = AIAConstants.SQL_CONNECTION_ERROR; | |
151 | 152 | logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
152 | 153 | } |
153 | 154 | return objUser; | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -203,11 +203,11 @@ namespace AIAHTML5.API.Models |
203 | 203 | return isAuthenticatedUser; |
204 | 204 | } |
205 | 205 | |
206 | - internal static User getUserDetails(Newtonsoft.Json.Linq.JObject credentials) | |
206 | + internal static dynamic getUserDetails(Newtonsoft.Json.Linq.JObject credentials) | |
207 | 207 | { |
208 | - User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
208 | + dynamic userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
209 | 209 | |
210 | - return user; | |
210 | + return userDetails; | |
211 | 211 | } |
212 | 212 | |
213 | 213 | internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId) | ... | ... |