Commit 4eb2529e45115e1b4b55f9085c464e70f5d7bdfd

Authored by Utkarsh Singh
1 parent 9331e957

Committing updated code

400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
@@ -40,9 +40,9 @@ namespace AIAHTML5.API.Controllers @@ -40,9 +40,9 @@ namespace AIAHTML5.API.Controllers
40 40
41 //Above code commented to reduce db hitting for same result set 41 //Above code commented to reduce db hitting for same result set
42 // get user details based on credentials provided 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 //check is user authenticated 47 //check is user authenticated
48 bool isUserAuthenticated = AIAHTML5.API.Models.Users.IsUserAuthenticated(credentials, userInfo); 48 bool isUserAuthenticated = AIAHTML5.API.Models.Users.IsUserAuthenticated(credentials, userInfo);
@@ -332,10 +332,14 @@ namespace AIAHTML5.API.Controllers @@ -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 authenticationRepsonse = AIAConstants.USER_NOT_FOUND; 337 authenticationRepsonse = AIAConstants.USER_NOT_FOUND;
338 } 338 }
  339 + else
  340 + {
  341 + authenticationRepsonse = AIAConstants.SQL_CONNECTION_ERROR;
  342 + }
339 343
340 //if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(authenticationRepsonse)!= AIAConstants.SQL_CONNECTION_ERROR) 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,7 +92,7 @@ namespace AIAHTML5.API.Models
92 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); 92 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
93 logger.Debug(" Inside GetUserDetailsByLoginId for LoginId = " + loginId); 93 logger.Debug(" Inside GetUserDetailsByLoginId for LoginId = " + loginId);
94 94
95 - User objUser = new User(); 95 + dynamic objUser = null;
96 DBModel objModel = new DBModel(); 96 DBModel objModel = new DBModel();
97 97
98 try 98 try
@@ -148,6 +148,7 @@ namespace AIAHTML5.API.Models @@ -148,6 +148,7 @@ namespace AIAHTML5.API.Models
148 } 148 }
149 catch (SqlException ex) 149 catch (SqlException ex)
150 { 150 {
  151 + objUser = AIAConstants.SQL_CONNECTION_ERROR;
151 logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); 152 logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
152 } 153 }
153 return objUser; 154 return objUser;
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
@@ -203,11 +203,11 @@ namespace AIAHTML5.API.Models @@ -203,11 +203,11 @@ namespace AIAHTML5.API.Models
203 return isAuthenticatedUser; 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 internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId) 213 internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId)