Commit 29975015e4b4964027c88a5cced2b4fc05d67acb

Authored by Nikita Kulshreshtha
1 parent 2808e788

finished restructuring

400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... ... @@ -35,6 +35,10 @@ namespace AIAHTML5.API.Constants
35 35  
36 36 public const string USER_UNBLOCK_SUCCESS = "User unblocked";
37 37 public const string USER_UNBLOCK_FAILED = "Unblock operation failed";
38   - public const string USER_ALREADY_UNBLOCKED = "User already unblocked.";
  38 + public const string UNABLE_TO_UNBLOCK = "We are unable to unblock. Please try after sometime.";
  39 +
  40 + public const string FORGOT_USERID_EMAIL_SUBJECT = "UserID recovery mail for:";
  41 + public const string FORGOT_PASSWORD_EMAIL_SUBJECT = "Password recovery mail for:";
  42 + public const string UNBLOCK_USER_EMAIL_SUBJECT = "Unblock user request mail for:";
39 43 }
40 44 }
41 45 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -151,6 +151,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
151 151 {
152 152 authenticationRepsonse = AIAConstants.USER_NOT_FOUND;
153 153 }
  154 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
154 155 }
155 156 catch(SqlException e){
156 157  
... ... @@ -161,7 +162,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
161 162 string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
162 163 UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
163 164  
164   - authenticationRepsonse = AIAConstants.SQL_CONNECTION_ERROR;
  165 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
165 166 }
166 167 catch (Exception e)
167 168 {
... ... @@ -172,11 +173,11 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
172 173 string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
173 174 string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
174 175 UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
175   -
176   - authenticationRepsonse = AIAConstants.EXCEPTION_IN_AIAHTML5;
  176 +
  177 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
  178 +
177 179 }
178 180  
179   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
180 181 }
181 182  
182 183 private static void GetModulesBasedOnUserType(User userInfo)
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs
... ... @@ -66,14 +66,14 @@ namespace AIAHTML5.API.Controllers
66 66 }
67 67 logger.Debug("isMailSent= " + isMailSent);
68 68 if (isMailSent)
69   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) };
  69 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_SENT) };
70 70 else
71 71 return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MAIL_NOT_SENT) };
72 72 }
73 73 else
74 74 {
75 75 logger.Debug("inside else in ForgotUserController userData= " + userData);
76   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) };
  76 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_NOT_FOUND) };
77 77 }
78 78 }
79 79 catch (SqlException e)
... ... @@ -86,7 +86,7 @@ namespace AIAHTML5.API.Controllers
86 86 string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
87 87 UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
88 88  
89   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
  89 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
90 90 }
91 91 catch (Exception e)
92 92 {
... ... @@ -96,7 +96,7 @@ namespace AIAHTML5.API.Controllers
96 96 string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
97 97 string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
98 98 UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
99   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
  99 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
100 100  
101 101 }
102 102 }
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs
... ... @@ -9,7 +9,8 @@ using AIAHTML5.API.Constants;
9 9 using Newtonsoft.Json;
10 10 using Newtonsoft.Json.Linq;
11 11 using AIAHTML5.API.Models;
12   -using System.Collections;
  12 +using System.Collections;
  13 +using System.Data.SqlClient;
13 14  
14 15 namespace AIAHTML5.API.Controllers
15 16 {
... ... @@ -43,8 +44,7 @@ namespace AIAHTML5.API.Controllers
43 44 dynamic userModules = null; // assigned to avoid unassigned local variable compilation error;
44 45  
45 46 dynamic result = AIAHTML5.API.Models.Users.UpdateLicenseTerm(userLicenseInfo);
46   - if (Convert.ToString(result) != AIAConstants.EXCEPTION_IN_AIAHTML5)
47   - {
  47 +
48 48 if (Convert.ToInt32(result) > 0)
49 49 {
50 50 user.Modules = Users.getModuleListByLicenseId(licenseId);
... ... @@ -56,11 +56,20 @@ namespace AIAHTML5.API.Controllers
56 56 {
57 57 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) };
58 58 }
59   - }
60   - else
61   - {
62   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
63   - }
  59 +
  60 + return response;
  61 + }
  62 + catch (SqlException e)
  63 + {
  64 +
  65 + logger.Fatal("SqlException occured for licenseeAccountNumber =" + userLicenseInfo["licenseeAccountNumber"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  66 +
  67 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  68 + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR;
  69 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  70 + UserUtility.SendEmail(userLicenseInfo, supportMailList, "", mailSubject, mailBody);
  71 +
  72 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
64 73 }
65 74 catch (Exception ex)
66 75 {
... ... @@ -71,8 +80,9 @@ namespace AIAHTML5.API.Controllers
71 80 string mailBody = "MESSAGE: " + ex.Message + ", STACKTRACE: " + ex.StackTrace;
72 81 UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
73 82 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
  83 + return response;
74 84 }
75   - return response;
  85 +
76 86 }
77 87  
78 88  
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs
... ... @@ -10,7 +10,8 @@ using Newtonsoft.Json;
10 10 using Newtonsoft.Json.Linq;
11 11 using AIAHTML5.API.Models;
12 12 using AIAHTML5.API.Utility;
13   -using System.Collections;
  13 +using System.Collections;
  14 +using System.Data.SqlClient;
14 15  
15 16 namespace AIAHTML5.API.Controllers
16 17 {
... ... @@ -41,7 +42,7 @@ namespace AIAHTML5.API.Controllers
41 42 {
42 43 dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
43 44  
44   - if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(userData) != AIAConstants.EXCEPTION_IN_AIAHTML5)
  45 + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND)
45 46 {
46 47 int result = 0;
47 48 if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString()))
... ... @@ -55,22 +56,35 @@ namespace AIAHTML5.API.Controllers
55 56 }
56 57 else
57 58 {
58   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) };
  59 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_NOT_FOUND) };
59 60 }
  61 + return response;
  62 + }
  63 + catch (SqlException e)
  64 + {
  65 +
  66 + logger.Fatal("SqlException occured for loginId =" + userInfo["emailId"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  67 +
  68 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  69 + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR;
  70 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  71 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  72 +
  73 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
60 74 }
61 75 catch (Exception e)
62 76 {
63   - logger.Fatal("Exception occured for loginId =" + userInfo["username"].ToString() + " and password= " + userInfo["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  77 + logger.Fatal("Exception occured for loginId =" + userInfo["emailId"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
64 78  
65 79 ArrayList supportMailList = UserUtility.GetSupportMailList();
66 80 string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
67 81 string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
68 82 UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
69   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
70   -
  83 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
  84 + return response;
71 85 }
72 86  
73   - return response;
  87 +
74 88 }
75 89  
76 90 // PUT api/<controller>/5
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs
... ... @@ -7,7 +7,9 @@ using System.Web.Http;
7 7 using AIAHTML5.API.Constants;
8 8 using AIAHTML5.API.Models;
9 9 using AIAHTML5.API.Utility;
10   -using log4net;
  10 +using log4net;
  11 +using System.Collections;
  12 +using System.Data.SqlClient;
11 13  
12 14 namespace AIAHTML5.API.Controllers
13 15 {
... ... @@ -30,29 +32,55 @@ namespace AIAHTML5.API.Controllers
30 32 {
31 33 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
32 34 logger.Debug("inside POST in UnblockUserController for emailId = " + emailId);
33   -
34   - HttpResponseMessage response = null;
35   -
36   - dynamic user = AIAHTML5.API.Models.DBModel.GetUserDetailsByEmailId(emailId);
37   - if (Convert.ToString(user) != AIAConstants.USER_NOT_FOUND && Convert.ToString(user) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
38   - {
39   - int result = 0;
40   -
41   - logger.Debug("1. inside if in UnblockUserController userDetails= " + user.ToString());
42   -
43   - result = AIAHTML5.API.Models.DBModel.UnblockUser(user.Id);
44   -
45   - if (result > 0)
46   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_UNBLOCK_SUCCESS) };
47   - else
48   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_ALREADY_UNBLOCKED) };
  35 +
  36 + HttpResponseMessage response = null;
  37 + Newtonsoft.Json.Linq.JObject userInfo = new Newtonsoft.Json.Linq.JObject();
  38 + userInfo.Add("emailId", emailId);
  39 +
  40 + try
  41 + {
  42 + dynamic user = AIAHTML5.API.Models.DBModel.GetUserDetailsByEmailId(emailId);
  43 +
  44 + if (user!=null && user.Count > 0)
  45 + {
  46 + int result = 0;
  47 +
  48 + logger.Debug("1. inside if in UnblockUserController userDetails= " + user.ToString());
  49 +
  50 + result = AIAHTML5.API.Models.DBModel.UnblockUser(user.Id);
  51 +
  52 + if (result > 0)
  53 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_UNBLOCK_SUCCESS) };
  54 + else
  55 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.UNABLE_TO_UNBLOCK) };
  56 + }
  57 + return response;
  58 + }
  59 + catch (SqlException e)
  60 + {
  61 +
  62 + logger.Fatal("SqlException occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  63 +
  64 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  65 + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR;
  66 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  67 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  68 +
  69 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
  70 + }
  71 + catch (Exception e)
  72 + {
  73 + // logger.Fatal("Exception occured for loginId =" + userInfo["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  74 + logger.Fatal("Exception occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  75 +
  76 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  77 + string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
  78 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  79 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  80 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) };
  81 + return response;
49 82 }
50   - //else
51   - //{
52   - // logger.Debug("inside else in UnblockUserController userData= " + user);
53   - // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(user.ToString()) };
54   - //}
55   - return response;
  83 +
56 84 }
57 85  
58 86 // PUT api/unblockuser/5
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -37,21 +37,13 @@ namespace AIAHTML5.API.Models
37 37  
38 38 logger.Debug(" Inside GetSQLData for command text = " + commandText);
39 39 DataSet ds = null;
40   - try
41   - {
42   - SqlConnection conn = new SqlConnection(dbConnectionString);
  40 + SqlConnection conn = new SqlConnection(dbConnectionString);
43 41 cmd = new SqlCommand(commandText, conn);
44 42 cmd.CommandType = CommandType.StoredProcedure;
45 43 SqlDataAdapter da = new SqlDataAdapter();
46 44 da.SelectCommand = cmd;
47 45 ds = new DataSet();
48 46 da.Fill(ds);
49   - }
50   - catch (SqlException ex)
51   - {
52   - logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
53   - throw;
54   - }
55 47  
56 48 return ds;
57 49 }
... ... @@ -62,9 +54,7 @@ namespace AIAHTML5.API.Models
62 54  
63 55 ArrayList arrUserModules = new ArrayList();
64 56  
65   - try
66   - {
67   - Hashtable userModuleHash = new Hashtable();
  57 + Hashtable userModuleHash = new Hashtable();
68 58  
69 59 string sp = DBConstants.GET_ALL_MODULES;
70 60  
... ... @@ -82,12 +72,6 @@ namespace AIAHTML5.API.Models
82 72 arrUserModules.Add(userModuleHash);
83 73 }
84 74 }
85   - }
86   - catch (SqlException ex)
87   - {
88   - logger.Fatal("Exception in GetAllModules , Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
89   - throw;
90   - }
91 75  
92 76 return arrUserModules;
93 77 }
... ... @@ -99,8 +83,7 @@ namespace AIAHTML5.API.Models
99 83 User objUser = null;
100 84 DBModel objModel = new DBModel();
101 85  
102   - try
103   - {
  86 +
104 87 conn = new SqlConnection(dbConnectionString);
105 88 cmd = new SqlCommand();
106 89 SqlDataAdapter da = new SqlDataAdapter();
... ... @@ -148,12 +131,6 @@ namespace AIAHTML5.API.Models
148 131 }
149 132 }
150 133  
151   - }
152   - catch (SqlException ex)
153   - {
154   - logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
155   - throw;
156   - }
157 134  
158 135 return objUser;
159 136 }
... ... @@ -164,8 +141,6 @@ namespace AIAHTML5.API.Models
164 141  
165 142 Hashtable hash = new Hashtable();
166 143  
167   - try
168   - {
169 144 conn = new SqlConnection(dbConnectionString);
170 145 cmd = new SqlCommand();
171 146 SqlDataAdapter adapter;
... ... @@ -192,13 +167,7 @@ namespace AIAHTML5.API.Models
192 167 hash.Add(AIAConstants.EDITION_KEY_ID, ds.Tables[0].Rows[0][1]);
193 168 }
194 169 }
195   - }
196   - catch (SqlException ex)
197   - {
198   - logger.Fatal("Exception in GetUserLicenseDetailByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
199   - throw;
200   - }
201   -
  170 +
202 171 return hash;
203 172 }
204 173  
... ... @@ -208,9 +177,7 @@ namespace AIAHTML5.API.Models
208 177  
209 178 ArrayList userModulelist = new ArrayList();
210 179  
211   - try
212   - {
213   - Hashtable modulesHash;
  180 + Hashtable modulesHash;
214 181 DataSet ds = new DataSet();
215 182  
216 183 conn = new SqlConnection(dbConnectionString);
... ... @@ -246,13 +213,7 @@ namespace AIAHTML5.API.Models
246 213 }
247 214 }
248 215 }
249   - }
250   -
251   - catch (SqlException ex)
252   - {
253   - logger.Fatal("Exception in GetUserModulesByLicenseId for LicenseId = " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
254   - throw;
255   - }
  216 +
256 217  
257 218 return userModulelist;
258 219 }
... ... @@ -301,9 +262,6 @@ namespace AIAHTML5.API.Models
301 262 User objUser = null;
302 263 DBModel objModel = new DBModel();
303 264  
304   - try
305   - {
306   -
307 265 conn = new SqlConnection(dbConnectionString);
308 266 cmd = new SqlCommand();
309 267 SqlDataAdapter adapter;
... ... @@ -354,17 +312,7 @@ namespace AIAHTML5.API.Models
354 312 }
355 313 }
356 314 }
357   - else
358   - {
359   - objUser = new User ();
360   - }
361   - }
362   - catch (SqlException ex)
363   - {
364   - logger.Fatal("Exception in GetUserDetailsByEmailId for emailId = " + emailId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
365   - throw;
366   - }
367   -
  315 +
368 316 return objUser;
369 317 }
370 318  
... ... @@ -406,8 +354,7 @@ namespace AIAHTML5.API.Models
406 354 logger.Debug(" Inside GetLicenseSubscriptionDetailsByLicenseId for LicenseId = " + licenseId);
407 355  
408 356 LicenseSubscriptionDetails licenseSubscriptionDetails = null;
409   - try
410   - {
  357 +
411 358 conn = new SqlConnection(dbConnectionString);
412 359 cmd = new SqlCommand();
413 360 SqlDataAdapter adapter;
... ... @@ -452,12 +399,7 @@ namespace AIAHTML5.API.Models
452 399 }
453 400 }
454 401  
455   - }
456   - catch (Exception ex)
457   - {
458   - logger.Fatal("Exception in GetLicenseSubscriptionDetailsByLicenseId for LicenseId= " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
459   - throw;
460   - }
  402 +
461 403  
462 404 return licenseSubscriptionDetails;
463 405 }
... ... @@ -467,8 +409,7 @@ namespace AIAHTML5.API.Models
467 409 logger.Debug(" inside GetLicenseDetailsByLicenseId for LicenseId = " + licenseId);
468 410  
469 411 License license = null;
470   - try
471   - {
  412 +
472 413 conn = new SqlConnection(dbConnectionString);
473 414 cmd = new SqlCommand();
474 415 SqlDataAdapter adapter;
... ... @@ -524,11 +465,7 @@ namespace AIAHTML5.API.Models
524 465 }
525 466 }
526 467  
527   - }
528   - catch (Exception ex)
529   - {
530   - logger.Fatal("Exception in GetLicenseDetailsByLicenseId for LicenseId= " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
531   - }
  468 +
532 469  
533 470 return license;
534 471 }
... ... @@ -569,8 +506,7 @@ namespace AIAHTML5.API.Models
569 506  
570 507 ArrayList arrTermsAndConditions = new ArrayList();
571 508  
572   - try
573   - {
  509 +
574 510 Hashtable contentHash = null;
575 511 string str = string.Empty;
576 512 string spName = DBConstants.GET_TERMS_AND_CONDITIONS;
... ... @@ -590,12 +526,7 @@ namespace AIAHTML5.API.Models
590 526 }
591 527 }
592 528 }
593   - }
594   - catch (SqlException ex)
595   - {
596   - logger.Fatal("Exception in GetTermsAndConditions, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
597   - throw;
598   - }
  529 +
599 530  
600 531 return arrTermsAndConditions;
601 532 }
... ... @@ -662,8 +593,7 @@ namespace AIAHTML5.API.Models
662 593 logger.Debug(" inside GetIncorrectLoginAttempts for UserId = " + userId);
663 594  
664 595 int count = 0;
665   - try
666   - {
  596 +
667 597 conn = new SqlConnection(dbConnectionString);
668 598 cmd = new SqlCommand();
669 599 cmd.Connection = conn;
... ... @@ -690,12 +620,7 @@ namespace AIAHTML5.API.Models
690 620 }
691 621 }
692 622 }
693   - }
694   - catch (SqlException ex)
695   - {
696   - logger.Fatal("Exception in GetIncorrectLoginAttempts for UserId = " + userId + " Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
697   - throw;
698   - }
  623 +
699 624  
700 625 return count;
701 626 }
... ... @@ -762,8 +687,6 @@ namespace AIAHTML5.API.Models
762 687  
763 688 ArrayList failureCauseList = new ArrayList();
764 689  
765   - try
766   - {
767 690 Hashtable fcHash = null;
768 691  
769 692 string sp = DBConstants.GET_ALL_LOGIN_FAILURE_CAUSES;
... ... @@ -785,12 +708,7 @@ namespace AIAHTML5.API.Models
785 708 }
786 709 }
787 710 }
788   - }
789   - catch (SqlException ex)
790   - {
791   - logger.Fatal("Exception in GetLoginFailureCauses, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
792   - throw;
793   - }
  711 +
794 712 return failureCauseList;
795 713 }
796 714  
... ... @@ -833,9 +751,8 @@ namespace AIAHTML5.API.Models
833 751  
834 752 BlockedUser blockedUser = new BlockedUser();
835 753 DataTable dt = null;
836   - try
837   - {
838   - conn = new SqlConnection(dbConnectionString);
  754 +
  755 + conn = new SqlConnection(dbConnectionString);
839 756 cmd = new SqlCommand();
840 757 cmd.Connection = conn;
841 758 cmd.CommandText = DBConstants.GET_BLOCKED_USER_BY_USER_ID;
... ... @@ -861,12 +778,6 @@ namespace AIAHTML5.API.Models
861 778 }
862 779 }
863 780  
864   - }
865   - catch (SqlException ex)
866   - {
867   - logger.Fatal("Exception in GetBlockedUserByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
868   - throw;
869   - }
870 781  
871 782 return blockedUser;
872 783 }
... ... @@ -878,8 +789,7 @@ namespace AIAHTML5.API.Models
878 789 ArrayList blockedUsersList = new ArrayList();
879 790 BlockedUser blockedUser = null;
880 791 DataTable dt = null;
881   - try
882   - {
  792 +
883 793 conn = new SqlConnection(dbConnectionString);
884 794 cmd = new SqlCommand();
885 795 cmd.Connection = conn;
... ... @@ -913,12 +823,7 @@ namespace AIAHTML5.API.Models
913 823 {
914 824 blockedUser = new BlockedUser();
915 825 }
916   - }
917   - catch (SqlException ex)
918   - {
919   - logger.Fatal("Exception in GetBlockedUsersByUserType for UserTypeId= " + userTypeId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
920   - throw;
921   - }
  826 +
922 827  
923 828 return blockedUsersList;
924 829 }
... ...
400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
... ... @@ -19,136 +19,126 @@ namespace AIAHTML5.API.Models
19 19 {
20 20 public class UserUtility
21 21 {
22   - public static bool SendEmail(dynamic UserDetails, bool havePassword, bool unbLockUser = false)
23   - {
24   - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
25   - logger.Debug("inside SendEmail in for havePassword =" + havePassword);
26   -
27   - try
28   - {
29   - List<LinkedResource> lstLinkedResource = new List<LinkedResource>();
30   - EmailUtility emailUtility = new EmailUtility();
31   - List<string> lstToAddress = new List<string>();
32   - List<string> lstBccAddress = new List<string>();
33   -
34   - string emailText = string.Empty;
35   - string userId = string.Empty;
36   - string userMail = string.Empty;
37   - string userName = string.Empty;
38   - string fName = string.Empty;
39   - string lName = string.Empty;
40   - string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
41   -
42   - //foreach (KeyValuePair<string, object> userObj in UserDetails)
43   - //{
44   - // if (userObj.Key == "LoginId")
45   - // userId = userObj.Value.ToString();
46   -
47   - // if (userObj.Key == "EmailId")
48   - // userMail = userObj.Value.ToString();
49   -
50   - // if (userObj.Key == "FirstName")
51   - // fName = userObj.Value.ToString();
52   -
53   - // if (userObj.Key == "LastName")
54   - // lName = userObj.Value.ToString();
55   - //}
56   -
57   - if (UserDetails.LoginId != "")
58   - userId = UserDetails.LoginId.ToString();
59   - if (UserDetails.EmailId != "")
60   - userMail = UserDetails.EmailId.ToString();
61   - if (UserDetails.FirstName != "")
62   - fName = UserDetails.FirstName.ToString();
63   - if (UserDetails.LastName != "")
64   - lName = UserDetails.LastName.ToString();
65   -
66   - string fullName = fName + " " + lName;
67 22  
68   - string logoPath = HttpContext.Current.Server.MapPath("~/content/images/logo.png");
69   -
70   - string templatePath = string.Empty;
71   - string resetPasswordLink = string.Empty;
72   -
73   - if (havePassword)
74   - {
75   - if (unbLockUser)
76   - {
77   - templatePath = "~/Templates/unblock-User.html";
78   - resetPasswordLink = site_url + "?unb:" + HttpUtility.UrlEncode(userMail);
79   - }
80   - else
81   - {
82   - templatePath = "~/Templates/forgot-Password.html";
83   - resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail);
84   - }
85   - }
86   - else
87   - templatePath = "~/Templates/forgot-UserId.html";
88   -
89   - logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
90   - string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userMail, fullName, resetPasswordLink);
91   -
92   - lstToAddress.Add(userMail);
93   -
94   - emailText = mailBody;
95   -
96   - logger.Debug("emailText= " + emailText);
97   - // for embedding images in email
98   - if (emailText.Contains("<img"))
99   - {
100   - LinkedResource linkedLogo = new LinkedResource(logoPath, MediaTypeNames.Image.Jpeg);
101   - linkedLogo.ContentId = "AIA_Logo_Image";
102   - linkedLogo.TransferEncoding = TransferEncoding.Base64;
103   - emailText = emailText.Replace("{logoPath}", "cid:" + linkedLogo.ContentId);
104   - lstLinkedResource.Add(linkedLogo);
105   - }
106   -
107   - emailUtility.sAlternateView = AlternateView.CreateAlternateViewFromString(emailText, null, "text/html");
108   - foreach (var sItem in lstLinkedResource)
109   - {
110   - emailUtility.sAlternateView.LinkedResources.Add(sItem);
111   - }
112   -
113   - string mailSubject = string.Empty;
114   - if (!havePassword)
115   - mailSubject = "UserID recovery mail for: ";
116   - else
117   - {
118   - if (unbLockUser)
119   - mailSubject = "Unblock user request mail for: ";
120   - else
121   - mailSubject = "Password recovery mail for: ";
122   - }
123   -
124   - emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
125   - emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
126   - emailUtility.bIsBodyHtml = true;
127   - emailUtility.bEnableSsl = false;
128   - emailUtility.sSubject = mailSubject + userMail;
129   - emailUtility.iPort = 25;
130   - emailUtility.sToAddresses = lstToAddress;
131   - emailUtility.sBccAddresses = lstBccAddress;
132   -
133   - emailUtility.SendSmtpEmail();
134   - return true;
135   - }
136   - catch (Exception ex)
137   - {
138   - string message = "Exception: " + ex.Message;
139   - return false;
  23 + public static bool SendEmail(dynamic UserDetails, bool isMailForForgotPassword, bool unblockUser = false)
  24 + {
  25 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  26 + logger.Debug("inside SendEmail in for isMailForForgotPassword =" + isMailForForgotPassword);
  27 +
  28 + string mailSubject = string.Empty;
  29 + string userEmailId = string.Empty;
  30 + try
  31 + {
  32 + List<LinkedResource> lstLinkedResource = new List<LinkedResource>();
  33 + EmailUtility emailUtility = new EmailUtility();
  34 + List<string> lstToAddress = new List<string>();
  35 + List<string> lstBccAddress = new List<string>();
  36 +
  37 + string emailText = string.Empty;
  38 + string userId = string.Empty;
  39 +
  40 + string userName = string.Empty;
  41 + string fName = string.Empty;
  42 + string lName = string.Empty;
  43 + string site_url = Convert.ToString(ConfigurationManager.AppSettings["Site_URL"]);
  44 +
  45 +
  46 + if (UserDetails.LoginId != "")
  47 + userId = UserDetails.LoginId.ToString();
  48 + if (UserDetails.EmailId != "")
  49 + userEmailId = UserDetails.EmailId.ToString();
  50 + if (UserDetails.FirstName != "")
  51 + fName = UserDetails.FirstName.ToString();
  52 + if (UserDetails.LastName != "")
  53 + lName = UserDetails.LastName.ToString();
  54 +
  55 + string fullName = fName + " " + lName;
  56 +
  57 + string logoPath = HttpContext.Current.Server.MapPath(Convert.ToString(ConfigurationManager.AppSettings["LogoPath"]));
  58 +
  59 + string templatePath = string.Empty;
  60 + string resetPasswordLink = string.Empty;
  61 +
  62 + if (isMailForForgotPassword)
  63 + {
  64 + if (unblockUser)
  65 + {
  66 + templatePath = Convert.ToString(ConfigurationManager.AppSettings["UnblockUserEmailTemplate"]);
  67 + resetPasswordLink = site_url + "?unb:" + HttpUtility.UrlEncode(userEmailId);
  68 + }
  69 + else
  70 + {
  71 + templatePath = Convert.ToString(ConfigurationManager.AppSettings["ForgotPasswordEmailTemplate"]);
  72 + resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userEmailId);
  73 + }
  74 + }
  75 + else
  76 + templatePath = Convert.ToString(ConfigurationManager.AppSettings["ForgotUserIdEmailTemplate"]);
  77 +
  78 + logger.Debug("inside SendEmail for templatePath= " + templatePath + ", userId= " + userId + ", userEmailId= " + userEmailId + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordLink);
  79 + string mailBody = UserUtility.GetMailBodyTextFromTemplate(templatePath, userId, userEmailId, fullName, resetPasswordLink);
  80 +
  81 + lstToAddress.Add(userEmailId);
  82 +
  83 + emailText = mailBody;
  84 +
  85 + logger.Debug("emailText= " + emailText);
  86 + // for embedding images in email
  87 + if (emailText.Contains("<img"))
  88 + {
  89 + LinkedResource linkedLogo = new LinkedResource(logoPath, MediaTypeNames.Image.Jpeg);
  90 + linkedLogo.ContentId = "AIA_Logo_Image";
  91 + linkedLogo.TransferEncoding = TransferEncoding.Base64;
  92 + emailText = emailText.Replace("{logoPath}", "cid:" + linkedLogo.ContentId);
  93 + lstLinkedResource.Add(linkedLogo);
  94 + }
  95 +
  96 + emailUtility.sAlternateView = AlternateView.CreateAlternateViewFromString(emailText, null, "text/html");
  97 + foreach (var sItem in lstLinkedResource)
  98 + {
  99 + emailUtility.sAlternateView.LinkedResources.Add(sItem);
  100 + }
  101 +
  102 +
  103 + if (!isMailForForgotPassword)
  104 + mailSubject = AIAConstants.FORGOT_USERID_EMAIL_SUBJECT;
  105 + else
  106 + {
  107 + if (unblockUser)
  108 + mailSubject = AIAConstants.UNBLOCK_USER_EMAIL_SUBJECT;
  109 + else
  110 + mailSubject = AIAConstants.FORGOT_PASSWORD_EMAIL_SUBJECT;
  111 + }
  112 +
  113 + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
  114 + emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
  115 + emailUtility.bIsBodyHtml = true;
  116 + emailUtility.bEnableSsl = false;
  117 + emailUtility.sSubject = mailSubject + userEmailId;
  118 + emailUtility.iPort = 25;
  119 + emailUtility.sToAddresses = lstToAddress;
  120 + emailUtility.sBccAddresses = lstBccAddress;
  121 +
  122 + emailUtility.SendSmtpEmail();
  123 + return true;
  124 + }
  125 + catch (Exception e)
  126 + {
  127 + logger.Fatal("Exception in SendEmail for mailSubject + userEmailId= " + mailSubject + userEmailId + "..MSG= " + e.Message + "STACKTRACE= " + e.StackTrace);
  128 +
  129 + return false;
140 130 }
  131 +
141 132 }
142 133  
143   - protected static string GetMailBodyTextFromTemplate(string templatePath, string userId, string userMail, string fullName, string resetPasswordUrl)
  134 + protected static string GetMailBodyTextFromTemplate(string templatePath, string userId, string userEmailId, string fullName, string resetPasswordUrl)
144 135 {
145 136 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
146   - logger.Debug("Inside GetMailBodyTextFromTemplate for templatePath= " + templatePath + ", userId= " + userId + ", userMail= " + userMail + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordUrl);
  137 + logger.Debug("Inside GetMailBodyTextFromTemplate for templatePath= " + templatePath + ", userId= " + userId + ", userEmailId= " + userEmailId + ",fullName= " + fullName + ",resetPasswordLink= " + resetPasswordUrl);
147 138  
148 139 string fileToRead = string.Empty;
149 140 string emailBody = string.Empty;
150   - try
151   - {
  141 +
152 142 fileToRead = HttpContext.Current.Server.MapPath(templatePath);
153 143  
154 144 using (StreamReader reader = new StreamReader(fileToRead))
... ... @@ -158,18 +148,13 @@ namespace AIAHTML5.API.Models
158 148  
159 149 if (!string.IsNullOrEmpty(userId))
160 150 emailBody = emailBody.Replace("{loginId}", userId);
161   - if (!string.IsNullOrEmpty(userMail))
162   - emailBody = emailBody.Replace("{emailId}", userMail);
  151 + if (!string.IsNullOrEmpty(userEmailId))
  152 + emailBody = emailBody.Replace("{emailId}", userEmailId);
163 153 if (!string.IsNullOrEmpty(fullName))
164 154 emailBody = emailBody.Replace("{userFullName}", fullName);
165 155 if (!string.IsNullOrEmpty(resetPasswordUrl))
166 156 emailBody = emailBody.Replace("{resetPasswordLink}", resetPasswordUrl);
167   - }
168   - catch (Exception e)
169   - {
170   - emailBody = "Exception: " + e.Message;
171   - logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + e.Message + ", stacktrace= " + e.StackTrace);
172   - }
  157 +
173 158 return emailBody;
174 159 }
175 160  
... ... @@ -184,7 +169,7 @@ namespace AIAHTML5.API.Models
184 169 List<string> lstToAddress = new List<string>();
185 170 List<string> lstBccAddress = new List<string>();
186 171  
187   - string userMail = string.Empty;
  172 + string userEmailId = string.Empty;
188 173 string fullName = string.Empty;
189 174 string emailMessage = string.Empty;
190 175  
... ... @@ -198,10 +183,10 @@ namespace AIAHTML5.API.Models
198 183 }
199 184  
200 185 fullName = userInfo["firstName"].ToString() + " " + userInfo["lastName"].ToString();
201   - userMail = userInfo["emailId"].ToString();
  186 + userEmailId = userInfo["emailId"].ToString();
202 187 emailMessage = userInfo["userMessage"].ToString();
203 188  
204   - lstToAddress.Add(userMail);
  189 + lstToAddress.Add(userEmailId);
205 190  
206 191 emailMessage = emailMessage.Replace("\n", "<br/>");
207 192  
... ... @@ -213,7 +198,7 @@ namespace AIAHTML5.API.Models
213 198 emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
214 199 emailUtility.bIsBodyHtml = true;
215 200 emailUtility.bEnableSsl = false;
216   - emailUtility.sSubject = mailSubject + " " + userMail;
  201 + emailUtility.sSubject = mailSubject + " " + userEmailId;
217 202 emailUtility.sBodyText = emailMessage;
218 203 emailUtility.iPort = 25;
219 204 emailUtility.sToAddresses = lstToAddress;
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -69,10 +69,7 @@ namespace AIAHTML5.API.Models
69 69  
70 70 int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId);
71 71  
72   - if (result > 0)
73   - return result;
74   - else
75   - return AIAConstants.USER_NOT_FOUND;
  72 + return result;
76 73  
77 74 }
78 75  
... ...
400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs
... ... @@ -31,14 +31,21 @@ namespace AIAHTML5.API.Utility
31 31  
32 32 public void SendMail(MailMessage mm)
33 33 {
34   - SmtpClient smtp = new SmtpClient();
35   - smtp.Host = ConfigurationManager.AppSettings["SMTPAddress"];
36   - smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]);
37   - System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]);
38   - smtp.Credentials = NetworkCred;
39   - smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]);
40   -
41   - smtp.Send(mm);
  34 + try
  35 + {
  36 + SmtpClient smtp = new SmtpClient();
  37 + smtp.Host = ConfigurationManager.AppSettings["SMTPAddress"];
  38 + smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]);
  39 + System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]);
  40 + smtp.Credentials = NetworkCred;
  41 + smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]);
  42 +
  43 + smtp.Send(mm);
  44 + }
  45 + catch (Exception e)
  46 + {
  47 + throw;
  48 + }
42 49 }
43 50  
44 51 public void SendSmtpEmail()
... ...
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -40,7 +40,13 @@
40 40 <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
42 42 <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/>
43   - <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>
  43 + <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india12;"/>
  44 + <add key ="LogoPath" value="~/content/images/logo.png"/>
  45 + <add key ="UnblockUserEmailTemplate" value="~/Templates/unblock-User.html"/>
  46 + <add key ="ForgotPasswordEmailTemplate" value="~/Templates/forgot-Password.html"/>
  47 + <add key ="ForgotUserIdEmailTemplate" value="~/Templates/forgot-UserId.html"/>
  48 +
  49 +
44 50 <!--<add key ="AIADatabaseV5Context" value="Data Source=52.6.248.70;Initial Catalog=AIADatabase;User ID=amrita;Password=Ebix@2017;"/>-->
45 51  
46 52 </appSettings>
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -80,11 +80,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
80 80 username: null,
81 81 password: null,
82 82 emailId: null,
83   - havePassword: null,
84 83 newPassword: null,
85 84 confirmPassword: null,
86 85 userMessage: null,
87   - unblockUser: null
  86 + unblockUser: false,
  87 + isMailForForgotPassword:false
88 88 };
89 89 $rootScope.userLicenseInfo = {
90 90 userLicenseId: 0,
... ... @@ -112,13 +112,25 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
112 112 $rootScope.initializeAIA = function () {
113 113  
114 114 $rootScope.isLoading = false;
115   - //$rootScope.isVisibleLogin = false;
116   - //$rootScope.isVisibleResetPass = true;
117   - VerifyUrlForQuerystring();
118   - if ($location.url().indexOf('?unb:') != -1)
  115 +
  116 + var url = $location.url();
  117 +
  118 + if (url.indexOf('?unb:') != -1) {
  119 +
119 120 $rootScope.UnblockUser();
120   - else
121   - getUserDetails();
  121 + }
  122 + else if (url.indexOf('?em:') != -1) {
  123 +
  124 + $rootScope.isVisibleLogin = false;
  125 + $rootScope.isVisibleResetPass = true;
  126 + }
  127 + else {
  128 + $rootScope.isVisibleLogin = true;
  129 + $rootScope.isVisibleResetPass = false;
  130 + getUserDetails();
  131 + }
  132 +
  133 +
122 134 }
123 135  
124 136 $rootScope.AuthenticateUser = function (userInfo) {
... ... @@ -197,18 +209,18 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
197 209 $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
198 210 $("#messageModal").modal('show');
199 211 }
200   - else if ((!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
  212 + else if (result.LicenseInfo!=null && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
201 213 $rootScope.isVisibleLogin = true;
202 214 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
203 215 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
204 216 $("#messageModal").modal('show');
205 217 }
206   - else if ((result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
  218 + else if (result.LicenseInfo != null && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
207 219 $rootScope.isVisibleLogin = true;
208 220 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
209 221 $("#messageModal").modal('show');
210 222 }
211   - else if ((!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
  223 + else if (result.LicenseInfo != null && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
212 224 $rootScope.isVisibleLogin = true;
213 225 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
214 226 $("#messageModal").modal('show');
... ... @@ -226,7 +238,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
226 238  
227 239 }
228 240 else {
229   - if (result.LicenseInfo.IsTermAccepted) {
  241 + if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) {
230 242 $rootScope.userData = result;
231 243 $rootScope.userModules = result.Modules;
232 244 $rootScope.isVisibleLogin = false;
... ... @@ -290,6 +302,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
290 302 }
291 303 }
292 304 }
  305 + else if (result = LoginConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) {
  306 + console.log(result);
  307 + $rootScope.isVisibleLogin = true;
  308 + $('#dvTermCondition').fadeIn();
  309 + $rootScope.errorMessage = LoginConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED;
  310 + $("#messageModal").modal('show');
  311 + $("#messageModal").css("z-index", 111112);
  312 + localStorage.removeItem("loggedInUserDetails");
  313 + }
293 314 else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
294 315 console.log(result);
295 316 $rootScope.isVisibleLogin = true;
... ... @@ -307,20 +328,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
307 328 });
308 329 }
309 330 };
310   - function VerifyUrlForQuerystring() {
311   - var url = $location.url();
312   -
313   - var field = 'em';
314   -
315   - if (url.indexOf('?' + field + ':') != -1) {
316   - $rootScope.isVisibleLogin = false;
317   - $rootScope.isVisibleResetPass = true;
318   - }
319   - else {
320   - $rootScope.isVisibleLogin = true;
321   - $rootScope.isVisibleResetPass = false;
322   - }
323   - }
324 331  
325 332  
326 333 $rootScope.LogoutUser = function () {
... ... @@ -369,21 +376,27 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
369 376 }
370 377 }
371 378  
372   - $rootScope.SendMailToUser = function (userInfo, isMailForPassword) {
373   - var selectedOption = $("input[name='inlineRadioOptions']:checked").val();
  379 + $rootScope.SendMailToUser = function (userInfo, isMailForForgotPassword) {
  380 + //
  381 +
374 382 if ((userInfo.emailId != null) && (userInfo.emailId != '')) {
375   - if (validateEmail(userInfo.emailId)) {
376   - if (isMailForPassword == true && selectedOption == LoginMessageConstants.UNBLOCK_SELECTED) {
377   - userInfo.unblockUser = true;
378   - userInfo.havePassword = true;
379   - }
380   - else if (isMailForPassword == true && selectedOption == LoginMessageConstants.FORGOT_PASSWORD_SELECTED) {
381   - userInfo.unblockUser = false;
382   - userInfo.havePassword = true;
383   - }
384   - else
385   - userInfo.havePassword = false;
386   -
  383 + if (validateEmail(userInfo.emailId)) {
  384 + if (isMailForForgotPassword) {
  385 +
  386 + var selectedOption = $("input[name='inlineRadioOptions']:checked").val();
  387 +
  388 + if (selectedOption == LoginMessageConstants.UNBLOCK_SELECTED) {
  389 + userInfo.unblockUser = true;
  390 + userInfo.isMailForForgotPassword = true;
  391 + }
  392 + else if (selectedOption == LoginMessageConstants.FORGOT_PASSWORD_SELECTED) {
  393 + userInfo.unblockUser = false;
  394 + userInfo.isMailForForgotPassword = true;
  395 + }
  396 + }
  397 + else
  398 + userInfo.isMailForForgotPassword = false;
  399 +
387 400 AuthenticationService.SendMailToUser(userInfo)
388 401 .then(function (result) {
389 402 if (result == LoginConstants.USER_NOT_FOUND) {
... ... @@ -391,13 +404,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
391 404 $rootScope.errorMessage = LoginMessageConstants.INCORRECT_EMAIL_ID;
392 405 $("#messageModal").modal('show');
393 406 }
394   - else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
  407 + else if (result == LoginConstants.EXCEPTION_IN_AIAHTML5) {
395 408 // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
396   - $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
  409 + $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_IN_AIAHTML5;
397 410 $("#messageModal").modal('show');
398 411 }
399 412 else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
400   - $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE;
  413 + $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR;
401 414 $("#messageModal").modal('show');
402 415 }
403 416 else if (result == LoginConstants.MAIL_NOT_SENT) {
... ... @@ -406,7 +419,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
406 419 $("#messageModal").modal('show');
407 420 }
408 421 else {
409   - if (result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) {
  422 + if (result == LoginMessageConstants.MAIL_SENT) {
410 423 var message;
411 424 if ($('.forgot-sm').length > 0) {
412 425 $('.forgot-sm').fadeOut();
... ... @@ -436,7 +449,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
436 449 function (error) {
437 450 console.log(' Error in authentication = ' + error.statusText);
438 451 // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS);
439   - $rootScope.errorMessage = LoginConstants.ERROR_IN_FECTHING_DETAILS;
  452 + $rootScope.errorMessage = LoginConstants.EXCEPTION_IN_AIAHTML5;
440 453 $("#messageModal").modal('show');
441 454 });
442 455 }
... ... @@ -463,6 +476,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
463 476 }
464 477  
465 478 $rootScope.ResetUserPassword = function (userInfo) {
  479 +
466 480 var url = $location.url();
467 481 if (url.indexOf('?em:') != -1) {
468 482 var split = url.split('?em:');
... ... @@ -479,11 +493,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
479 493 function (result) {
480 494 if (result == LoginConstants.USER_NOT_FOUND) {
481 495 // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
482   - $rootScope.errorMessage = LoginMessageConstants.USER_OR_PASSWORD_INCORRECT;
  496 + $rootScope.errorMessage = LoginMessageConstants.USER_NOT_FOUND;
483 497 $("#messageModal").modal('show');
484 498  
485 499 }
486   - else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
  500 + else if (result == LoginConstants.EXCEPTION_IN_AIAHTML5) {
487 501 // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
488 502 $rootScope.errorMessage = LoginConstants.ERROR_IN_FECTHING_DETAILS;
489 503 $("#messageModal").modal('show');
... ... @@ -503,6 +517,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
503 517 $rootScope.isVisibleResetPass = false;
504 518 $location.url("/");
505 519 }
  520 + else {
  521 + $rootScope.errorMessage = LoginMessageConstants.PASSWORD_RESET_FAILURE;
  522 + $("#messageModal").modal('show');
  523 + $rootScope.isVisibleLogin = true;
  524 + $rootScope.isVisibleResetPass = false;
  525 + $location.url("/");
  526 + }
506 527 }
507 528 },
508 529 function (error) {
... ... @@ -526,12 +547,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
526 547 }
527 548  
528 549 $rootScope.UnblockUser = function () {
  550 +
529 551 var userEmailId = '';
530 552 var url = $location.url();
531   - if (url.indexOf('?unb:') != -1) {
532   - var split = url.split('?unb:');
533   - userEmailId = split[1];
534   - }
  553 +
  554 + var split = url.split('?unb:');
  555 + userEmailId = split[1];
  556 +
535 557  
536 558 AuthenticationService.UnblockUser(userEmailId)
537 559 .then(
... ... @@ -543,7 +565,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
543 565 $location.url("/");
544 566 }
545 567 else {
546   - $rootScope.errorMessage = LoginMessageConstants.USER_ALREADY_UNBLOCKED;
  568 + $rootScope.errorMessage = LoginMessageConstants.UNABLE_TO_UNBLOCK;
547 569 $("#messageModal").modal('show');
548 570 $rootScope.isVisibleLogin = true;
549 571 $location.url("/");
... ... @@ -551,7 +573,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
551 573 },
552 574 function (error) {
553 575 console.log(' Error in authentication = ' + error.statusText);
554   - $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
  576 + $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_IN_AIAHTML5;
555 577 $("#messageModal").modal('show');
556 578 }
557 579 );
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -305,6 +305,7 @@ AIA.constant(&quot;LoginConstants&quot;, {
305 305 "USER_NOT_FOUND": "User not found.",
306 306 "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
307 307 "MAIL_NOT_SENT": "Mail not sent.",
  308 + "MAIL_SENT": "Mail sent.",
308 309 "SQL_CONNECTION_ERROR ": "We are unable to connect with database. Please contact customer support",
309 310 "EXCEPTION_IN_AIAHTML5": "We are facing some issue. Please try to login after sometime.",
310 311 "E_NO_ERROR": "0",
... ... @@ -372,6 +373,8 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
372 373 "INCORRECT_EMAIL_ID": "Please enter correct email id.",
373 374 "BLANK_EMAIL_ID": "Please enter your email id.",
374 375 "PASSWORD_RESET_MESSAGE": "Your password has been reset.",
  376 + "PASSWORD_RESET_FAILURE": "We are unable to reset your password. Please try again after sometime.",
  377 +
375 378 "NEW_AND_OLD_PASSWORD_DONOT_MATCH": "Your new password and confirm password not matched!",
376 379 "USER_CREDENTIALS_MISSING": "Please Enter your credentials.",
377 380 "USER_NOT_FOUND": "User not found.",
... ... @@ -392,8 +395,8 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
392 395 "USER_UNBLOCK_FAILED": "Unblock operation failed",
393 396 "USER_ALREADY_UNBLOCKED": "User already unblocked.",
394 397 "LICENSE_TERM_CONDITION_UPDATE_SUCCESS": "License Term Accepted field updated successfully.",
395   - "LICENSE_TERM_CONDITION_UPDATE_FAILED": "License Term Accepted field update failed."
396   -
  398 + "LICENSE_TERM_CONDITION_UPDATE_FAILED": "License Term Accepted field update failed.",
  399 + "UNABLE_TO_UNBLOCK": "We are unable to unblock. Please try after sometime.",
397 400 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
398 401 //"MAIL_NOT_SENT": "Mail not sent."
399 402  
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1150,7 +1150,7 @@
1150 1150 </tr>
1151 1151 <tr>
1152 1152 <td>
1153   - <button type="submit" ng-disabled="resetPasswordForm.$invalid" ng-submit="submitForm(resetPasswordForm.$valid)" ng-click="ResetUserPassword(userInfo)" style="background: #0072a7; border: 1px solid #005076; cursor: pointer; color: #fff; padding: 5px 10px; font-size: 16px; text-transform: uppercase; text-align: center; text-decoration: none; font-family: gotham, 'Helvetica Neue', helvetica, arial, sans-serif; " id="btnUpdatePassword">Submit</button> <!--ng-submit="submitForm(resetPwdForm.$valid)"--> <!--ng-click="ResetUserPassword(userInfo)"-->
  1153 + <button type="submit" ng-disabled="resetPasswordForm.$invalid" ng-click="ResetUserPassword(userInfo)" style="background: #0072a7; border: 1px solid #005076; cursor: pointer; color: #fff; padding: 5px 10px; font-size: 16px; text-transform: uppercase; text-align: center; text-decoration: none; font-family: gotham, 'Helvetica Neue', helvetica, arial, sans-serif; " id="btnUpdatePassword">Submit</button> <!--ng-submit="submitForm(resetPwdForm.$valid)"--> <!--ng-click="ResetUserPassword(userInfo)"-->
1154 1154 </td>
1155 1155 </tr>
1156 1156 </tbody>
... ...