Commit 24f2da39827c7486a880779283a845262d8d541c
1 parent
4eb2529e
Committing updated files
Showing
2 changed files
with
328 additions
and
56 deletions
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... | ... | @@ -48,6 +48,7 @@ namespace AIAHTML5.API.Models |
48 | 48 | catch (SqlException ex) |
49 | 49 | { |
50 | 50 | logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
51 | + throw; | |
51 | 52 | } |
52 | 53 | return ds; |
53 | 54 | } |
... | ... | @@ -83,6 +84,7 @@ namespace AIAHTML5.API.Models |
83 | 84 | catch (SqlException ex) |
84 | 85 | { |
85 | 86 | logger.Fatal("Exception in GetAllModules , Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
87 | + throw; | |
86 | 88 | } |
87 | 89 | return arrUserModules; |
88 | 90 | } |
... | ... | @@ -147,9 +149,9 @@ namespace AIAHTML5.API.Models |
147 | 149 | } |
148 | 150 | } |
149 | 151 | catch (SqlException ex) |
150 | - { | |
151 | - objUser = AIAConstants.SQL_CONNECTION_ERROR; | |
152 | + { | |
152 | 153 | logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
154 | + throw; | |
153 | 155 | } |
154 | 156 | return objUser; |
155 | 157 | } |
... | ... | @@ -193,6 +195,7 @@ namespace AIAHTML5.API.Models |
193 | 195 | catch (SqlException ex) |
194 | 196 | { |
195 | 197 | logger.Fatal("Exception in GetUserLicenseDetailByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
198 | + throw; | |
196 | 199 | } |
197 | 200 | |
198 | 201 | return hash; |
... | ... | @@ -248,6 +251,7 @@ namespace AIAHTML5.API.Models |
248 | 251 | catch (SqlException ex) |
249 | 252 | { |
250 | 253 | logger.Fatal("Exception in GetUserModulesByLicenseId for LicenseId = " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
254 | + throw; | |
251 | 255 | } |
252 | 256 | |
253 | 257 | return userModulelist; |
... | ... | @@ -358,6 +362,7 @@ namespace AIAHTML5.API.Models |
358 | 362 | catch (SqlException ex) |
359 | 363 | { |
360 | 364 | logger.Fatal("Exception in GetUserDetailsByEmailId for emailId = " + emailId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
365 | + throw; | |
361 | 366 | } |
362 | 367 | |
363 | 368 | return objUser; |
... | ... | @@ -388,6 +393,7 @@ namespace AIAHTML5.API.Models |
388 | 393 | { |
389 | 394 | conn.Close(); |
390 | 395 | logger.Fatal("Exception in UpdateUserPassword for LoginId: " + loginId + ", EmailId: " + emailId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
396 | + throw; | |
391 | 397 | } |
392 | 398 | finally |
393 | 399 | { |
... | ... | @@ -555,6 +561,7 @@ namespace AIAHTML5.API.Models |
555 | 561 | catch (SqlException ex) |
556 | 562 | { |
557 | 563 | logger.Fatal("Exception in UpdateLicenseTermStatus for AccountNumber =" + accountNumber + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
564 | + throw; | |
558 | 565 | } |
559 | 566 | return result; |
560 | 567 | } |
... | ... | @@ -591,6 +598,7 @@ namespace AIAHTML5.API.Models |
591 | 598 | catch (SqlException ex) |
592 | 599 | { |
593 | 600 | logger.Fatal("Exception in GetTermsOfServiceText, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
601 | + throw; | |
594 | 602 | } |
595 | 603 | |
596 | 604 | return arrTermsOfService; |
... | ... | @@ -618,6 +626,7 @@ namespace AIAHTML5.API.Models |
618 | 626 | { |
619 | 627 | conn.Close(); |
620 | 628 | logger.Fatal("Exception in InsertLoginDetails for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); |
629 | + throw; | |
621 | 630 | } |
622 | 631 | finally |
623 | 632 | { |
... | ... | @@ -649,6 +658,7 @@ namespace AIAHTML5.API.Models |
649 | 658 | { |
650 | 659 | conn.Close(); |
651 | 660 | logger.Fatal("Exception in InsertIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
661 | + throw; | |
652 | 662 | } |
653 | 663 | finally |
654 | 664 | { |
... | ... | @@ -695,6 +705,7 @@ namespace AIAHTML5.API.Models |
695 | 705 | catch (SqlException ex) |
696 | 706 | { |
697 | 707 | logger.Fatal("Exception in GetIncorrectLoginAttempts for UserId = " + userId + " Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
708 | + throw; | |
698 | 709 | } |
699 | 710 | return count; |
700 | 711 | } |
... | ... | @@ -721,6 +732,7 @@ namespace AIAHTML5.API.Models |
721 | 732 | { |
722 | 733 | conn.Close(); |
723 | 734 | logger.Fatal("Exception in UpdateIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); |
735 | + throw; | |
724 | 736 | } |
725 | 737 | finally |
726 | 738 | { |
... | ... | @@ -751,6 +763,7 @@ namespace AIAHTML5.API.Models |
751 | 763 | { |
752 | 764 | conn.Close(); |
753 | 765 | logger.Fatal("Exception in DeleteIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
766 | + throw; | |
754 | 767 | } |
755 | 768 | finally |
756 | 769 | { |
... | ... | @@ -793,6 +806,7 @@ namespace AIAHTML5.API.Models |
793 | 806 | catch (SqlException ex) |
794 | 807 | { |
795 | 808 | logger.Fatal("Exception in GetLoginFailureCauses, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
809 | + throw; | |
796 | 810 | } |
797 | 811 | return failureCauseList; |
798 | 812 | } |
... | ... | @@ -824,6 +838,7 @@ namespace AIAHTML5.API.Models |
824 | 838 | { |
825 | 839 | conn.Close(); |
826 | 840 | logger.Fatal("Exception in InsertUserLoginLog for AccountNumber= " + accountNumber + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
841 | + throw; | |
827 | 842 | } |
828 | 843 | finally |
829 | 844 | { |
... | ... | @@ -874,6 +889,7 @@ namespace AIAHTML5.API.Models |
874 | 889 | catch (SqlException ex) |
875 | 890 | { |
876 | 891 | logger.Fatal("Exception in GetBlockedUserByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
892 | + throw; | |
877 | 893 | } |
878 | 894 | return blockedUser; |
879 | 895 | } |
... | ... | @@ -925,6 +941,7 @@ namespace AIAHTML5.API.Models |
925 | 941 | catch (SqlException ex) |
926 | 942 | { |
927 | 943 | logger.Fatal("Exception in GetBlockedAdminUsers for UserTypeId= " + userTypeId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
944 | + throw; | |
928 | 945 | } |
929 | 946 | return blockedUsersList; |
930 | 947 | } |
... | ... | @@ -960,6 +977,7 @@ namespace AIAHTML5.API.Models |
960 | 977 | catch (SqlException ex) |
961 | 978 | { |
962 | 979 | logger.Fatal("Exception in ValidateUserAuthenticity for Username = " + username + ", Password: " + password + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); |
980 | + throw; | |
963 | 981 | } |
964 | 982 | |
965 | 983 | return result; | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -205,41 +205,94 @@ namespace AIAHTML5.API.Models |
205 | 205 | |
206 | 206 | internal static dynamic getUserDetails(Newtonsoft.Json.Linq.JObject credentials) |
207 | 207 | { |
208 | - dynamic userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
208 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
209 | + logger.Debug("inside getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); | |
210 | + dynamic userDetails = null; | |
211 | + | |
212 | + try | |
213 | + { | |
214 | + userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
215 | + } | |
216 | + catch (Exception e) | |
217 | + { | |
218 | + | |
219 | + logger.Fatal("Exception in getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
220 | + | |
221 | + ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
222 | + string mailSubject = "SQL Exception intimation mail"; | |
223 | + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
224 | + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
225 | + | |
226 | + userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
227 | + } | |
209 | 228 | |
210 | 229 | return userDetails; |
211 | 230 | } |
212 | 231 | |
213 | 232 | internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId) |
214 | 233 | { |
234 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
235 | + logger.Debug("inside getLicenseIdForThisUser for UserId =" + userId); | |
236 | + | |
215 | 237 | //assigning below variable to avoid compiler error for unassignd out params |
216 | 238 | licenseId = 0; |
217 | - editionId = 0; | |
239 | + editionId = 0; | |
240 | + | |
241 | + try | |
242 | + { | |
218 | 243 | |
219 | - ArrayList arrLicense = new ArrayList(); | |
220 | - DBModel objModel = new DBModel(); | |
221 | - Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); | |
244 | + DBModel objModel = new DBModel(); | |
245 | + Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); | |
246 | + | |
247 | + if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) | |
248 | + licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); | |
249 | + | |
250 | + if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) | |
251 | + editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); | |
252 | + //foreach (DictionaryEntry de in licenseEditionHash) | |
253 | + //{ | |
254 | + // if (de.Key.ToString() == AIAConstants.LICENSE_KEY_ID) | |
255 | + // licenseId = Convert.ToInt32(de.Value); | |
256 | + // if (de.Key.ToString() == AIAConstants.EDITION_KEY_ID) | |
257 | + // editionId = Convert.ToInt32(de.Value); | |
258 | + //} | |
259 | + } | |
260 | + catch (Exception e) | |
261 | + { | |
262 | + logger.Fatal("Exception in getLicenseIdForThisUser for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
222 | 263 | |
223 | - if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) | |
224 | - licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); | |
264 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
265 | + //string mailSubject = "SQL Exception intimation mail"; | |
266 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
267 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
225 | 268 | |
226 | - if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) | |
227 | - editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); | |
228 | - //foreach (DictionaryEntry de in licenseEditionHash) | |
229 | - //{ | |
230 | - // if (de.Key.ToString() == AIAConstants.LICENSE_KEY_ID) | |
231 | - // licenseId = Convert.ToInt32(de.Value); | |
232 | - // if (de.Key.ToString() == AIAConstants.EDITION_KEY_ID) | |
233 | - // editionId = Convert.ToInt32(de.Value); | |
234 | - //} | |
269 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
270 | + } | |
235 | 271 | } |
236 | 272 | |
237 | 273 | internal static int insertLoginDetails(int userId) |
238 | 274 | { |
275 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
276 | + logger.Debug("inside insertLoginDetails for UserId =" + userId); | |
277 | + | |
239 | 278 | int result = 0; |
240 | - DBModel objModel = new DBModel(); | |
279 | + try | |
280 | + { | |
281 | + DBModel objModel = new DBModel(); | |
241 | 282 | |
242 | - result = objModel.InsertLoginDetails(userId); | |
283 | + result = objModel.InsertLoginDetails(userId); | |
284 | + } | |
285 | + catch (Exception e) | |
286 | + { | |
287 | + logger.Fatal("Exception in insertLoginDetails for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
288 | + | |
289 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
290 | + //string mailSubject = "SQL Exception intimation mail"; | |
291 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
292 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
293 | + | |
294 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
295 | + } | |
243 | 296 | |
244 | 297 | return result; |
245 | 298 | } |
... | ... | @@ -275,45 +328,117 @@ namespace AIAHTML5.API.Models |
275 | 328 | |
276 | 329 | internal static ArrayList getModuleListByLicenseId(int licenseId) |
277 | 330 | { |
278 | - DBModel objModel = new DBModel(); | |
279 | - ArrayList licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); | |
331 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
332 | + logger.Debug("inside getModuleListByLicenseId for LicenseId =" + licenseId); | |
333 | + | |
334 | + ArrayList licensedModulesList = new ArrayList(); | |
335 | + | |
336 | + try | |
337 | + { | |
338 | + | |
339 | + DBModel objModel = new DBModel(); | |
340 | + licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); | |
341 | + } | |
342 | + catch (Exception e) | |
343 | + { | |
344 | + logger.Fatal("Exception in getModuleListByLicenseId for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
345 | + | |
346 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
347 | + //string mailSubject = "SQL Exception intimation mail"; | |
348 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
349 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
350 | + | |
351 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
352 | + } | |
280 | 353 | |
281 | 354 | return licensedModulesList; |
282 | 355 | } |
283 | 356 | |
284 | 357 | internal static int deletePastWrongAttempts(int userId) |
285 | 358 | { |
359 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
360 | + logger.Debug("inside deletePastWrongAttempts for UserId =" + userId); | |
361 | + | |
286 | 362 | int result = 0; |
287 | - DBModel objModel = new DBModel(); | |
288 | 363 | |
289 | - result = objModel.DeleteIncorrectLoginAttempts(userId); | |
364 | + try | |
365 | + { | |
366 | + DBModel objModel = new DBModel(); | |
367 | + | |
368 | + result = objModel.DeleteIncorrectLoginAttempts(userId); | |
369 | + } | |
370 | + catch (Exception e) | |
371 | + { | |
372 | + logger.Fatal("Exception in deletePastWrongAttempts for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
290 | 373 | |
374 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
375 | + //string mailSubject = "SQL Exception intimation mail"; | |
376 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
377 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
378 | + | |
379 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
380 | + } | |
291 | 381 | return result; |
292 | 382 | } |
293 | 383 | |
294 | 384 | internal static int checkNoOfWrongAttempts(int userId) |
295 | 385 | { |
386 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
387 | + logger.Debug("inside checkNoOfWrongAttempts for UserId =" + userId); | |
388 | + | |
296 | 389 | int result = 0; |
297 | - DBModel objModel = new DBModel(); | |
298 | 390 | |
299 | - result = objModel.GetIncorrectLoginAttempts(userId); | |
391 | + try | |
392 | + { | |
393 | + DBModel objModel = new DBModel(); | |
394 | + | |
395 | + result = objModel.GetIncorrectLoginAttempts(userId); | |
396 | + } | |
397 | + catch (Exception e) | |
398 | + { | |
399 | + logger.Fatal("Exception in checkNoOfWrongAttempts for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
300 | 400 | |
401 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
402 | + //string mailSubject = "SQL Exception intimation mail"; | |
403 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
404 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
405 | + | |
406 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
407 | + } | |
301 | 408 | return result; |
302 | 409 | } |
303 | 410 | |
304 | 411 | internal static int saveWrongAttemptofUser(int userId) |
305 | 412 | { |
306 | - int wrongAttemptCount = Users.checkNoOfWrongAttempts(userId); | |
413 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
414 | + logger.Debug("inside saveWrongAttemptofUser for UserId =" + userId); | |
307 | 415 | int result = 0; |
308 | - DBModel objModel = new DBModel(); | |
309 | 416 | |
310 | - if (wrongAttemptCount < 1) | |
417 | + try | |
311 | 418 | { |
312 | - result = objModel.InsertIncorrectLoginAttempts(userId); | |
419 | + int wrongAttemptCount = Users.checkNoOfWrongAttempts(userId); | |
420 | + | |
421 | + DBModel objModel = new DBModel(); | |
422 | + | |
423 | + if (wrongAttemptCount < 1) | |
424 | + { | |
425 | + result = objModel.InsertIncorrectLoginAttempts(userId); | |
426 | + } | |
427 | + else | |
428 | + { | |
429 | + result = objModel.UpdateIncorrectLoginAttempts(userId); | |
430 | + } | |
313 | 431 | } |
314 | - else | |
432 | + catch (Exception e) | |
315 | 433 | { |
316 | - result = objModel.UpdateIncorrectLoginAttempts(userId); | |
434 | + logger.Fatal("Exception in saveWrongAttemptofUser for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
435 | + | |
436 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
437 | + //string mailSubject = "SQL Exception intimation mail"; | |
438 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
439 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
440 | + | |
441 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
317 | 442 | } |
318 | 443 | |
319 | 444 | return result; |
... | ... | @@ -321,28 +446,83 @@ namespace AIAHTML5.API.Models |
321 | 446 | |
322 | 447 | internal static bool isLicenseActive(int licenseId) |
323 | 448 | { |
324 | - DBModel objModel = new DBModel(); | |
325 | - License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
449 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
450 | + logger.Debug("inside isLicenseActive for LicenseId =" + licenseId); | |
451 | + bool result = false; | |
326 | 452 | |
327 | - if (userLicense.IsActive) | |
328 | - return true; | |
329 | - else | |
330 | - return false; | |
453 | + try | |
454 | + { | |
455 | + DBModel objModel = new DBModel(); | |
456 | + License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
457 | + | |
458 | + | |
459 | + if (userLicense.IsActive) | |
460 | + result = true; | |
461 | + else | |
462 | + result = false; | |
463 | + } | |
464 | + catch (Exception e) | |
465 | + { | |
466 | + logger.Fatal("Exception in isLicenseActive for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
467 | + | |
468 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
469 | + //string mailSubject = "SQL Exception intimation mail"; | |
470 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
471 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
472 | + | |
473 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
474 | + } | |
475 | + return result; | |
331 | 476 | } |
332 | 477 | |
333 | 478 | internal static License getLicenseDetails(int licenseId) |
334 | 479 | { |
335 | - DBModel objModel = new DBModel(); | |
336 | - License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
480 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
481 | + logger.Debug("inside getLicenseDetails for LicenseId =" + licenseId); | |
482 | + | |
483 | + License userLicense = null; | |
337 | 484 | |
485 | + try | |
486 | + { | |
487 | + DBModel objModel = new DBModel(); | |
488 | + userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
489 | + } | |
490 | + catch (Exception e) | |
491 | + { | |
492 | + logger.Fatal("Exception in getLicenseDetails for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
493 | + | |
494 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
495 | + //string mailSubject = "SQL Exception intimation mail"; | |
496 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
497 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
498 | + | |
499 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
500 | + } | |
338 | 501 | return userLicense; |
339 | 502 | } |
340 | 503 | |
341 | 504 | internal static LicenseSubscriptionDetails getLicenseSubscriptionDetails(int licenseId) |
342 | 505 | { |
343 | - DBModel objModel = new DBModel(); | |
344 | - LicenseSubscriptionDetails userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); | |
506 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
507 | + logger.Debug("inside getLicenseSubscriptionDetails for LicenseId =" + licenseId); | |
508 | + LicenseSubscriptionDetails userSubscriptionDetail = null; | |
509 | + | |
510 | + try | |
511 | + { | |
512 | + DBModel objModel = new DBModel(); | |
513 | + userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); | |
514 | + } | |
515 | + catch (Exception e) | |
516 | + { | |
517 | + logger.Fatal("Exception in getLicenseSubscriptionDetails for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
518 | + | |
519 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
520 | + //string mailSubject = "SQL Exception intimation mail"; | |
521 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
522 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
345 | 523 | |
524 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
525 | + } | |
346 | 526 | return userSubscriptionDetail; |
347 | 527 | } |
348 | 528 | |
... | ... | @@ -367,44 +547,118 @@ namespace AIAHTML5.API.Models |
367 | 547 | |
368 | 548 | internal static int insertUserLoginLog(string accountNumber, Int16 failureId, string referalUrl, string edition, string httpReferer) |
369 | 549 | { |
550 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
551 | + logger.Debug("inside insertUserLoginLog for accountNumber =" + accountNumber); | |
552 | + | |
370 | 553 | int result = 0; |
371 | - DBModel objModel = new DBModel(); | |
372 | - result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); | |
373 | 554 | |
555 | + try | |
556 | + { | |
557 | + DBModel objModel = new DBModel(); | |
558 | + result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); | |
559 | + } | |
560 | + catch (Exception e) | |
561 | + { | |
562 | + logger.Fatal("Exception in insertUserLoginLog for accountNumber =" + accountNumber + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
563 | + | |
564 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
565 | + //string mailSubject = "SQL Exception intimation mail"; | |
566 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
567 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
568 | + | |
569 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
570 | + } | |
374 | 571 | return result; |
375 | 572 | } |
376 | 573 | |
377 | 574 | |
378 | 575 | internal static ArrayList getTermsOfServiceText() |
379 | 576 | { |
380 | - ArrayList arrTermsOfService = new ArrayList(); | |
381 | - DBModel objModel = new DBModel(); | |
382 | - arrTermsOfService = DBModel.GetTermsOfServiceText(); | |
577 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
578 | + logger.Debug("inside getTermsOfServiceText"); | |
579 | + | |
580 | + ArrayList arrTermsOfService = new ArrayList(); | |
383 | 581 | |
582 | + try | |
583 | + { | |
584 | + DBModel objModel = new DBModel(); | |
585 | + arrTermsOfService = DBModel.GetTermsOfServiceText(); | |
586 | + } | |
587 | + catch (Exception e) | |
588 | + { | |
589 | + logger.Fatal("Exception in getTermsOfServiceText, Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
590 | + | |
591 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
592 | + //string mailSubject = "SQL Exception intimation mail"; | |
593 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
594 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
595 | + | |
596 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
597 | + } | |
384 | 598 | return arrTermsOfService; |
385 | 599 | } |
386 | 600 | |
387 | 601 | internal static ArrayList getAllModulesList() |
388 | 602 | { |
389 | - DBModel objModel = new DBModel(); | |
390 | - ArrayList modulesList = objModel.GetAllModules(); | |
603 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
604 | + logger.Debug("inside getAllModulesList"); | |
605 | + ArrayList modulesList = new ArrayList (); | |
606 | + | |
607 | + try | |
608 | + { | |
609 | + DBModel objModel = new DBModel(); | |
610 | + modulesList = objModel.GetAllModules(); | |
611 | + } | |
612 | + catch (Exception e) | |
613 | + { | |
614 | + logger.Fatal("Exception in getAllModulesList, Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
391 | 615 | |
616 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
617 | + //string mailSubject = "SQL Exception intimation mail"; | |
618 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
619 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
620 | + | |
621 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
622 | + } | |
392 | 623 | return modulesList; |
393 | 624 | } |
394 | 625 | |
395 | 626 | internal static bool isUserBlocked(int userId, out DateTime blockTime) |
396 | 627 | { |
628 | + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | |
629 | + logger.Debug("inside isUserBlocked for UserId =" + userId); | |
630 | + bool result = false; | |
397 | 631 | blockTime = new DateTime(); |
398 | - DBModel objModel = new DBModel(); | |
399 | - BlockedUser blockedUser = objModel.GetBlockedUserByUserId(userId); | |
400 | 632 | |
401 | - if (blockedUser != null) | |
633 | + try | |
402 | 634 | { |
403 | - blockTime = blockedUser.LoginTime; | |
404 | - return true; | |
635 | + | |
636 | + | |
637 | + DBModel objModel = new DBModel(); | |
638 | + BlockedUser blockedUser = objModel.GetBlockedUserByUserId(userId); | |
639 | + | |
640 | + if (blockedUser != null) | |
641 | + { | |
642 | + blockTime = blockedUser.LoginTime; | |
643 | + result = true; | |
644 | + } | |
645 | + else | |
646 | + result = false; | |
405 | 647 | } |
406 | - else | |
407 | - return false; | |
648 | + | |
649 | + catch (Exception e) | |
650 | + { | |
651 | + logger.Fatal("Exception in isUserBlocked for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); | |
652 | + | |
653 | + //ArrayList supportMailList = UserUtility.GetSupportMailList(); | |
654 | + //string mailSubject = "SQL Exception intimation mail"; | |
655 | + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; | |
656 | + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); | |
657 | + | |
658 | + //userDetails = AIAConstants.SQL_CONNECTION_ERROR; | |
659 | + } | |
660 | + | |
661 | + return result; | |
408 | 662 | } |
409 | 663 | } |
410 | 664 | } |
411 | 665 | \ No newline at end of file | ... | ... |