Commit b70689396b2b17af14351e0588321375c89ddfaa
1 parent
bcfbbecc
wrote backend code. need to interprate on ui
Showing
7 changed files
with
318 additions
and
278 deletions
400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs
... | ... | @@ -30,9 +30,14 @@ namespace AIAHTML5.API.Controllers |
30 | 30 | HttpResponseMessage response = null; |
31 | 31 | |
32 | 32 | int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); |
33 | - int x = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(),siteUrl["accountNumber"].ToString(),siteUrl["urlReferer"].ToString(),siteUrl["edition"].ToString(),siteId) | |
34 | - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.VALIDATED_CLIENT) }; | |
35 | - | |
33 | + if (siteId > 0) | |
34 | + { | |
35 | + dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId); | |
36 | + if (uerinfo != null) | |
37 | + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) }; | |
38 | + else | |
39 | + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) }; | |
40 | + } | |
36 | 41 | return response; |
37 | 42 | } |
38 | 43 | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/IPValidator.cs
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... | ... | @@ -18,7 +18,7 @@ namespace AIAHTML5.API.Models |
18 | 18 | public byte LicenseTypeId { get; set; } |
19 | 19 | public bool Modesty { get; set; } |
20 | 20 | public bool ModestyMode { get; set; } |
21 | - public Hashtable objEditionFeatures { get;set} | |
21 | + public Hashtable objEditionFeatures { get; set; } | |
22 | 22 | public int? SecurityQuestionId { get; set; } |
23 | 23 | public string SecurityAnswer { get; set; } |
24 | 24 | public int? CreatorId { get; set; } | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -24,22 +24,22 @@ namespace AIAHTML5.API.Models |
24 | 24 | logger.Debug("inside AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); |
25 | 25 | dynamic userDetails = null; |
26 | 26 | |
27 | - | |
28 | - User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
29 | - //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString()); | |
30 | 27 | |
31 | - if (user != null) | |
32 | - { | |
33 | - logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); | |
28 | + User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
29 | + //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString()); | |
30 | + | |
31 | + if (user != null) | |
32 | + { | |
33 | + logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); | |
34 | + | |
35 | + userDetails = JsonConvert.SerializeObject(user); | |
36 | + } | |
37 | + else | |
38 | + { | |
39 | + userDetails = AIAConstants.USER_NOT_FOUND; | |
40 | + } | |
34 | 41 | |
35 | - userDetails = JsonConvert.SerializeObject(user); | |
36 | - } | |
37 | - else | |
38 | - { | |
39 | - userDetails = AIAConstants.USER_NOT_FOUND; | |
40 | - } | |
41 | 42 | |
42 | - | |
43 | 43 | return userDetails; |
44 | 44 | } |
45 | 45 | |
... | ... | @@ -47,32 +47,32 @@ namespace AIAHTML5.API.Models |
47 | 47 | { |
48 | 48 | logger.Debug(" inside GetUserByEmail for emailId = " + userInfo["emailId"]); |
49 | 49 | |
50 | - | |
51 | - User objUser = DBModel.GetUserDetailsByEmailId(userInfo["emailId"].ToString()); | |
52 | 50 | |
53 | - //dynamic userDetails; | |
51 | + User objUser = DBModel.GetUserDetailsByEmailId(userInfo["emailId"].ToString()); | |
52 | + | |
53 | + //dynamic userDetails; | |
54 | + | |
55 | + if (objUser != null) | |
56 | + { | |
57 | + logger.Debug("userDetails.loginId= " + objUser.LoginId); | |
58 | + //return userDetails = JsonConvert.SerializeObject(objUser); | |
59 | + return objUser; | |
60 | + } | |
61 | + else | |
62 | + { | |
63 | + return AIAConstants.USER_NOT_FOUND; | |
64 | + } | |
54 | 65 | |
55 | - if (objUser!= null) | |
56 | - { | |
57 | - logger.Debug("userDetails.loginId= " + objUser.LoginId); | |
58 | - //return userDetails = JsonConvert.SerializeObject(objUser); | |
59 | - return objUser; | |
60 | - } | |
61 | - else | |
62 | - { | |
63 | - return AIAConstants.USER_NOT_FOUND; | |
64 | - } | |
65 | - | |
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | 69 | internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId) |
70 | 70 | { |
71 | - | |
72 | - int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); | |
73 | 71 | |
74 | - return result; | |
75 | - | |
72 | + int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); | |
73 | + | |
74 | + return result; | |
75 | + | |
76 | 76 | } |
77 | 77 | |
78 | 78 | internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject userLicenseInfo) |
... | ... | @@ -85,13 +85,13 @@ namespace AIAHTML5.API.Models |
85 | 85 | |
86 | 86 | userInfo.Add("accountNumber", accountNumber); |
87 | 87 | |
88 | - | |
89 | - result = DBModel.UpdateLicenseTermStatus(accountNumber); | |
90 | 88 | |
91 | - if (result < 0) | |
92 | - { | |
93 | - logger.Fatal("Unable to update LicenseTermAccepted status for AccountNumber =" + accountNumber); | |
94 | - } | |
89 | + result = DBModel.UpdateLicenseTermStatus(accountNumber); | |
90 | + | |
91 | + if (result < 0) | |
92 | + { | |
93 | + logger.Fatal("Unable to update LicenseTermAccepted status for AccountNumber =" + accountNumber); | |
94 | + } | |
95 | 95 | |
96 | 96 | return result; |
97 | 97 | } |
... | ... | @@ -108,10 +108,10 @@ namespace AIAHTML5.API.Models |
108 | 108 | logger.Debug("inside getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); |
109 | 109 | User userDetails = null; |
110 | 110 | |
111 | - | |
112 | - userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
113 | 111 | |
114 | - return userDetails; | |
112 | + userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString()); | |
113 | + | |
114 | + return userDetails; | |
115 | 115 | } |
116 | 116 | |
117 | 117 | internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId) |
... | ... | @@ -122,18 +122,18 @@ namespace AIAHTML5.API.Models |
122 | 122 | licenseId = 0; |
123 | 123 | editionId = 0; |
124 | 124 | |
125 | - | |
126 | 125 | |
127 | - DBModel objModel = new DBModel(); | |
128 | - Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); | |
129 | 126 | |
130 | - if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) | |
131 | - licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); | |
127 | + DBModel objModel = new DBModel(); | |
128 | + Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId); | |
129 | + | |
130 | + if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID)) | |
131 | + licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]); | |
132 | + | |
133 | + if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) | |
134 | + editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); | |
135 | + | |
132 | 136 | |
133 | - if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID)) | |
134 | - editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]); | |
135 | - | |
136 | - | |
137 | 137 | } |
138 | 138 | |
139 | 139 | internal static int insertLoginDetails(int userId) |
... | ... | @@ -141,12 +141,12 @@ namespace AIAHTML5.API.Models |
141 | 141 | logger.Debug("inside insertLoginDetails for UserId =" + userId); |
142 | 142 | |
143 | 143 | int result = 0; |
144 | - | |
145 | - DBModel objModel = new DBModel(); | |
146 | 144 | |
147 | - result = objModel.InsertLoginDetails(userId); | |
148 | - | |
149 | - return result; | |
145 | + DBModel objModel = new DBModel(); | |
146 | + | |
147 | + result = objModel.InsertLoginDetails(userId); | |
148 | + | |
149 | + return result; | |
150 | 150 | } |
151 | 151 | |
152 | 152 | internal static bool isUSerActive(User user) |
... | ... | @@ -162,7 +162,7 @@ namespace AIAHTML5.API.Models |
162 | 162 | expirationDate = string.Empty; |
163 | 163 | bool isLicenseExpired = false; |
164 | 164 | |
165 | - if (subscriptionDetail!= null) | |
165 | + if (subscriptionDetail != null) | |
166 | 166 | { |
167 | 167 | DateTime? subscriptionValidThrough = subscriptionDetail.SubscriptionValidThrough; |
168 | 168 | if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) |
... | ... | @@ -173,7 +173,7 @@ namespace AIAHTML5.API.Models |
173 | 173 | { |
174 | 174 | isLicenseExpired = true; |
175 | 175 | expirationDate = subscriptionDetail.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString(); |
176 | - } | |
176 | + } | |
177 | 177 | } |
178 | 178 | return isLicenseExpired; |
179 | 179 | } |
... | ... | @@ -184,13 +184,13 @@ namespace AIAHTML5.API.Models |
184 | 184 | |
185 | 185 | ArrayList licensedModulesList = new ArrayList(); |
186 | 186 | |
187 | - | |
188 | 187 | |
189 | - DBModel objModel = new DBModel(); | |
190 | - licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); | |
191 | - | |
192 | 188 | |
193 | - return licensedModulesList; | |
189 | + DBModel objModel = new DBModel(); | |
190 | + licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId); | |
191 | + | |
192 | + | |
193 | + return licensedModulesList; | |
194 | 194 | } |
195 | 195 | |
196 | 196 | internal static int deletePastWrongAttempts(int userId) |
... | ... | @@ -199,10 +199,10 @@ namespace AIAHTML5.API.Models |
199 | 199 | |
200 | 200 | int result = 0; |
201 | 201 | |
202 | - | |
203 | - DBModel objModel = new DBModel(); | |
204 | - result = objModel.DeleteIncorrectLoginAttempts(userId); | |
205 | - return result; | |
202 | + | |
203 | + DBModel objModel = new DBModel(); | |
204 | + result = objModel.DeleteIncorrectLoginAttempts(userId); | |
205 | + return result; | |
206 | 206 | } |
207 | 207 | |
208 | 208 | internal static int checkNoOfWrongAttempts(int userId) |
... | ... | @@ -211,10 +211,10 @@ namespace AIAHTML5.API.Models |
211 | 211 | |
212 | 212 | int incorrectLoginAttemptCount = 0; |
213 | 213 | |
214 | - | |
215 | - DBModel objModel = new DBModel(); | |
216 | - incorrectLoginAttemptCount = objModel.GetIncorrectLoginAttempts(userId); | |
217 | - return incorrectLoginAttemptCount; | |
214 | + | |
215 | + DBModel objModel = new DBModel(); | |
216 | + incorrectLoginAttemptCount = objModel.GetIncorrectLoginAttempts(userId); | |
217 | + return incorrectLoginAttemptCount; | |
218 | 218 | } |
219 | 219 | |
220 | 220 | internal static int saveWrongAttemptOfUser(int userId, int previousIncorrectLoginAttempts) |
... | ... | @@ -222,18 +222,18 @@ namespace AIAHTML5.API.Models |
222 | 222 | logger.Debug("inside saveWrongAttemptofUser for UserId =" + userId); |
223 | 223 | int result = 0; |
224 | 224 | |
225 | - | |
226 | - DBModel objModel = new DBModel(); | |
227 | 225 | |
228 | - if (previousIncorrectLoginAttempts < 1) | |
229 | - { | |
230 | - result = objModel.InsertIncorrectLoginAttempts(userId); | |
231 | - } | |
232 | - else | |
233 | - { | |
234 | - result = objModel.UpdateIncorrectLoginAttempts(userId); | |
235 | - } | |
236 | - | |
226 | + DBModel objModel = new DBModel(); | |
227 | + | |
228 | + if (previousIncorrectLoginAttempts < 1) | |
229 | + { | |
230 | + result = objModel.InsertIncorrectLoginAttempts(userId); | |
231 | + } | |
232 | + else | |
233 | + { | |
234 | + result = objModel.UpdateIncorrectLoginAttempts(userId); | |
235 | + } | |
236 | + | |
237 | 237 | |
238 | 238 | return result; |
239 | 239 | } |
... | ... | @@ -243,16 +243,16 @@ namespace AIAHTML5.API.Models |
243 | 243 | logger.Debug("inside isLicenseActive for LicenseId =" + licenseId); |
244 | 244 | bool result = false; |
245 | 245 | |
246 | - DBModel objModel = new DBModel(); | |
247 | - License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
246 | + DBModel objModel = new DBModel(); | |
247 | + License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
248 | 248 | |
249 | 249 | |
250 | - if (userLicense.IsActive) | |
251 | - result = true; | |
252 | - else | |
253 | - result = false; | |
254 | - | |
255 | - return result; | |
250 | + if (userLicense.IsActive) | |
251 | + result = true; | |
252 | + else | |
253 | + result = false; | |
254 | + | |
255 | + return result; | |
256 | 256 | } |
257 | 257 | |
258 | 258 | internal static License getLicenseDetails(int licenseId) |
... | ... | @@ -261,11 +261,11 @@ namespace AIAHTML5.API.Models |
261 | 261 | |
262 | 262 | License userLicense = null; |
263 | 263 | |
264 | - | |
265 | - DBModel objModel = new DBModel(); | |
266 | - userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
267 | - | |
268 | - return userLicense; | |
264 | + | |
265 | + DBModel objModel = new DBModel(); | |
266 | + userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId); | |
267 | + | |
268 | + return userLicense; | |
269 | 269 | } |
270 | 270 | |
271 | 271 | internal static LicenseSubscriptionDetails getLicenseSubscriptionDetails(int licenseId) |
... | ... | @@ -274,19 +274,19 @@ namespace AIAHTML5.API.Models |
274 | 274 | |
275 | 275 | LicenseSubscriptionDetails userSubscriptionDetail = null; |
276 | 276 | |
277 | - | |
278 | - DBModel objModel = new DBModel(); | |
279 | - userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); | |
280 | - | |
277 | + | |
278 | + DBModel objModel = new DBModel(); | |
279 | + userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); | |
280 | + | |
281 | 281 | return userSubscriptionDetail; |
282 | 282 | } |
283 | 283 | |
284 | 284 | internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword) |
285 | 285 | { |
286 | 286 | isCorrectLoginId = false; |
287 | - isCorrectPassword = false; | |
287 | + isCorrectPassword = false; | |
288 | 288 | |
289 | - if (userInfo.Id> 0) | |
289 | + if (userInfo.Id > 0) | |
290 | 290 | { |
291 | 291 | if (string.Equals(credentials["username"].ToString().ToUpper(), userInfo.LoginId.ToUpper())) |
292 | 292 | isCorrectLoginId = true; |
... | ... | @@ -304,10 +304,10 @@ namespace AIAHTML5.API.Models |
304 | 304 | |
305 | 305 | int result = 0; |
306 | 306 | |
307 | - | |
308 | - DBModel objModel = new DBModel(); | |
309 | - result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); | |
310 | - | |
307 | + | |
308 | + DBModel objModel = new DBModel(); | |
309 | + result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null); | |
310 | + | |
311 | 311 | return result; |
312 | 312 | } |
313 | 313 | |
... | ... | @@ -318,21 +318,21 @@ namespace AIAHTML5.API.Models |
318 | 318 | |
319 | 319 | ArrayList arrTermsOfService = new ArrayList(); |
320 | 320 | |
321 | - DBModel objModel = new DBModel(); | |
322 | - arrTermsOfService = DBModel.GetTermsAndConditions(); | |
323 | - | |
321 | + DBModel objModel = new DBModel(); | |
322 | + arrTermsOfService = DBModel.GetTermsAndConditions(); | |
323 | + | |
324 | 324 | return arrTermsOfService; |
325 | 325 | } |
326 | 326 | |
327 | 327 | internal static ArrayList getAllModulesList() |
328 | 328 | { |
329 | 329 | logger.Debug("inside getAllModulesList"); |
330 | - ArrayList modulesList = new ArrayList (); | |
330 | + ArrayList modulesList = new ArrayList(); | |
331 | + | |
332 | + | |
333 | + DBModel objModel = new DBModel(); | |
334 | + modulesList = objModel.GetAllModules(); | |
331 | 335 | |
332 | - | |
333 | - DBModel objModel = new DBModel(); | |
334 | - modulesList = objModel.GetAllModules(); | |
335 | - | |
336 | 336 | return modulesList; |
337 | 337 | } |
338 | 338 | |
... | ... | @@ -342,18 +342,18 @@ namespace AIAHTML5.API.Models |
342 | 342 | bool isUserBlocked = false; |
343 | 343 | blockTime = new DateTime(); |
344 | 344 | |
345 | - | |
346 | - DBModel objModel = new DBModel(); | |
347 | - BlockedUser blockedUser = objModel.GetUserBlockedStatusByUserId(userId); | |
348 | 345 | |
349 | - if (blockedUser!= null) | |
350 | - { | |
351 | - blockTime = blockedUser.LoginTime; | |
352 | - isUserBlocked = true; | |
353 | - } | |
354 | - else | |
355 | - isUserBlocked = false; | |
356 | - | |
346 | + DBModel objModel = new DBModel(); | |
347 | + BlockedUser blockedUser = objModel.GetUserBlockedStatusByUserId(userId); | |
348 | + | |
349 | + if (blockedUser != null) | |
350 | + { | |
351 | + blockTime = blockedUser.LoginTime; | |
352 | + isUserBlocked = true; | |
353 | + } | |
354 | + else | |
355 | + isUserBlocked = false; | |
356 | + | |
357 | 357 | return isUserBlocked; |
358 | 358 | } |
359 | 359 | |
... | ... | @@ -365,10 +365,10 @@ namespace AIAHTML5.API.Models |
365 | 365 | strLicenseSiteIP = remoteIpAddress; |
366 | 366 | |
367 | 367 | int intReturn = 0; |
368 | - DBModel objDBModel = new DBModel(); | |
369 | - DataTable dtLicense = objDBModel.GetLicenseInfoBySiteUrl(strAccountNumber, (byte)editionId); | |
368 | + DBModel objDBModel = new DBModel(); | |
369 | + DataTable dtLicense = objDBModel.GetLicenseInfoBySiteUrl(strAccountNumber, (byte)editionId); | |
370 | 370 | |
371 | - if (dtLicense.Rows.Count > 0) | |
371 | + if (dtLicense.Rows.Count > 0) | |
372 | 372 | { |
373 | 373 | //strLicenseSiteIP |
374 | 374 | String strSiteIP = ""; |
... | ... | @@ -434,144 +434,169 @@ namespace AIAHTML5.API.Models |
434 | 434 | } |
435 | 435 | return intReturn; |
436 | 436 | } |
437 | - | |
438 | - public static int ValidateSiteLogin( String strSiteIP, String strAcccountNumber,String strUrlReferer,string strEdition,int intSiteId ) { | |
437 | + | |
438 | + public static User ValidateSiteLogin(String strSiteIP, String strAcccountNumber, String strUrlReferer, string strEdition, int intSiteId) | |
439 | + { | |
439 | 440 | Int32 intUserId = 0; |
440 | - bool isExpired ; | |
441 | - try { | |
442 | - Int16 intErrorID = ErrorHelper.E_NO_ERROR; | |
443 | - String strStatus = AIAConstants.STATUS_OK; | |
444 | - | |
445 | - int intLicenseId = 0; | |
446 | - int intEditionId = Convert.ToInt16(strEdition); | |
447 | - | |
448 | - DateTime dtLogDate = DateTime.Now; | |
449 | - //strSiteIP = (String)objRequest.GetData(AIAConstants.SITE_IP); | |
450 | - //strAcccountNumber = (String)objRequest.GetData(AIAConstants.ACCOUNT_NUMBER); | |
451 | - //intEditionId = Convert.ToInt16(objRequest.GetData(AIAConstants.EDITION_ID)); | |
452 | - //strUrlReferer = (String)objRequest.GetData(AIAConstants.URL_REFERER); | |
453 | - //strEdition = (String)objRequest.GetData(AIAConstants.EDITION_ID); | |
454 | - //intSiteId = (Int32)objRequest.GetData(AIAConstants.SITE_ID); | |
455 | - //AdminDAL.AdminDal.GetLicenseBySiteIdDataTable dtLicense = new ADAM.AIA50.AdminDAL.AdminDal.GetLicenseBySiteIdDataTable(); | |
456 | - if (string.IsNullOrEmpty(strAcccountNumber)) { | |
457 | - //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.ACCOUNT_NUMBER_NOT_NULL, strSiteIP, strEdition, strUrlReferer); | |
458 | - intErrorID = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; | |
459 | - strStatus = AIAConstants.STATUS_NOT_OK; | |
460 | - } else if (string.IsNullOrEmpty(strEdition)) { | |
461 | - strEdition = "0"; | |
462 | - //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.EDITION_ID_NOT_NULL, strSiteIP, strEdition, strUrlReferer); | |
463 | - intErrorID = ErrorHelper.E_EDITION_ID_NOT_NULL; | |
464 | - strStatus = AIAConstants.STATUS_NOT_OK; | |
465 | - } | |
466 | - else { | |
467 | - DBModel objDBModel = new DBModel(); | |
468 | - DataTable dtLicense = objDBModel.GetLicenseBySiteId(intSiteId); | |
469 | - if (dtLicense.Rows.Count > 0) { | |
470 | - foreach (DataRow licRow in dtLicense.Rows) | |
441 | + bool isExpired = false; | |
442 | + User userInfo = null; | |
443 | + //try { | |
444 | + Int16 intErrorID = ErrorHelper.E_NO_ERROR; | |
445 | + String strStatus = AIAConstants.STATUS_OK; | |
446 | + | |
447 | + int intLicenseId = 0; | |
448 | + int intEditionId = Convert.ToInt16(strEdition); | |
449 | + | |
450 | + DateTime dtLogDate = DateTime.Now; | |
451 | + //strSiteIP = (String)objRequest.GetData(AIAConstants.SITE_IP); | |
452 | + //strAcccountNumber = (String)objRequest.GetData(AIAConstants.ACCOUNT_NUMBER); | |
453 | + //intEditionId = Convert.ToInt16(objRequest.GetData(AIAConstants.EDITION_ID)); | |
454 | + //strUrlReferer = (String)objRequest.GetData(AIAConstants.URL_REFERER); | |
455 | + //strEdition = (String)objRequest.GetData(AIAConstants.EDITION_ID); | |
456 | + //intSiteId = (Int32)objRequest.GetData(AIAConstants.SITE_ID); | |
457 | + //AdminDAL.AdminDal.GetLicenseBySiteIdDataTable dtLicense = new ADAM.AIA50.AdminDAL.AdminDal.GetLicenseBySiteIdDataTable(); | |
458 | + if (string.IsNullOrEmpty(strAcccountNumber)) | |
459 | + { | |
460 | + //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.ACCOUNT_NUMBER_NOT_NULL, strSiteIP, strEdition, strUrlReferer); | |
461 | + //intErrorID = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; | |
462 | + //strStatus = AIAConstants.STATUS_NOT_OK; | |
463 | + | |
464 | + userInfo.LoginFailureCauseId = ErrorHelper.E_ACCOUNT_NUMBER_NOT_NULL; | |
465 | + } | |
466 | + else if (string.IsNullOrEmpty(strEdition)) | |
467 | + { | |
468 | + strEdition = "0"; | |
469 | + //----logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.EDITION_ID_NOT_NULL, strSiteIP, strEdition, strUrlReferer); | |
470 | + //intErrorID = ErrorHelper.E_EDITION_ID_NOT_NULL; | |
471 | + //strStatus = AIAConstants.STATUS_NOT_OK; | |
472 | + userInfo.LoginFailureCauseId = ErrorHelper.E_EDITION_ID_NOT_NULL; | |
473 | + | |
474 | + } | |
475 | + else | |
476 | + { | |
477 | + DBModel objDBModel = new DBModel(); | |
478 | + DataTable dtLicense = objDBModel.GetLicenseBySiteId(intSiteId); | |
479 | + if (dtLicense.Rows.Count > 0) | |
480 | + { | |
481 | + //foreach (DataRow licRow in dtLicense.Rows) | |
482 | + //{ | |
483 | + DataRow licRow = dtLicense.Rows[0]; | |
484 | + //isExpired = LicenseHelper.IsLicenseExpired(licRow["Id"]); | |
485 | + userInfo = new User(); | |
486 | + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(Convert.ToInt32(licRow["Id"])); | |
487 | + | |
488 | + if (userInfo.LicenseInfo != null) | |
489 | + { | |
490 | + //05.3 get licenseSubscription details | |
491 | + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); | |
492 | + | |
493 | + //05.4 check the License expiration irespective of either user is active or not because on AIA | |
494 | + //we shows the License expiration message for inactive users too | |
495 | + | |
496 | + | |
497 | + if (userInfo.LicenseSubscriptions != null) | |
471 | 498 | { |
472 | - | |
473 | - //isExpired = LicenseHelper.IsLicenseExpired(licRow["Id"]); | |
474 | - User userInfo = new User(); | |
475 | - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(Convert.ToInt32(licRow["Id"])); | |
499 | + DateTime? subscriptionValidThrough = userInfo.LicenseSubscriptions.SubscriptionValidThrough; | |
500 | + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) | |
501 | + { | |
502 | + isExpired = false; | |
503 | + } | |
504 | + else | |
505 | + { | |
506 | + isExpired = true; | |
507 | + } | |
508 | + } | |
476 | 509 | |
477 | - if (userInfo.LicenseInfo != null) | |
510 | + | |
511 | + | |
512 | + if (!isExpired && Convert.ToBoolean(licRow["IsActive"]) == true) | |
513 | + { | |
514 | + //User objUserContext = new User(); | |
515 | + userInfo.Id = 0; | |
516 | + userInfo.FirstName = licRow["LicenseeFirstName"].ToString(); | |
517 | + userInfo.LastName = licRow["LicenseeLastName"].ToString(); | |
518 | + userInfo.UserTypeId = AIAConstants.SITE_USER; | |
519 | + if (licRow["EmailId"].ToString() != null) | |
478 | 520 | { |
479 | - //05.3 get licenseSubscription details | |
480 | - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); | |
521 | + userInfo.EmailId = licRow["EmailId"].ToString(); | |
522 | + } | |
523 | + else | |
524 | + { | |
525 | + userInfo.EmailId = null; | |
526 | + } | |
527 | + userInfo.AccountNumber = strAcccountNumber; | |
528 | + userInfo.EditionId = (Byte)intEditionId; | |
529 | + userInfo.LicenseTypeId = (byte)licRow["LicenseTypeId"]; | |
530 | + userInfo.LicenseId = Convert.ToInt32(licRow["Id"]); | |
531 | + userInfo.LoginId = ""; | |
532 | + userInfo.Modesty = (bool)licRow["IsModesty"]; | |
533 | + //Retreive ModestyMode | |
534 | + userInfo.ModestyMode = false; | |
481 | 535 | |
482 | - //05.4 check the License expiration irespective of either user is active or not because on AIA | |
483 | - //we shows the License expiration message for inactive users too | |
484 | - | |
536 | + intLicenseId = Convert.ToInt32(licRow["Id"]); | |
485 | 537 | |
486 | - if (userInfo.LicenseSubscriptions != null) | |
487 | - { | |
488 | - DateTime? subscriptionValidThrough = userInfo.LicenseSubscriptions.SubscriptionValidThrough; | |
489 | - if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) | |
490 | - { | |
491 | - isExpired = false; | |
492 | - } | |
493 | - else | |
494 | - { | |
495 | - isExpired = true; | |
496 | - } | |
497 | - } | |
498 | 538 | |
499 | - | |
500 | - | |
501 | - if (!isExpired && Convert.ToBoolean(licRow["IsActive"]) == true) { | |
502 | - User objUserContext = new User(); | |
503 | - objUserContext.Id = 0; | |
504 | - objUserContext.FirstName = licRow["LicenseeFirstName"].ToString(); | |
505 | - objUserContext.LastName = licRow["LicenseeLastName"].ToString(); | |
506 | - objUserContext.UserTypeId = AIAConstants.SITE_USER; | |
507 | - if (licRow["EmailId"].ToString()!= null) | |
508 | - { | |
509 | - objUserContext.EmailId = licRow["EmailId"].ToString(); | |
510 | - } else { | |
511 | - objUserContext.EmailId = null; | |
539 | + DataTable dtblEditionForModesty = new DBModel().GetEditionsForModesty(userInfo.LicenseId, 0); | |
540 | + //This table result set should return always have 0 or 1 record if modesty mode is present. | |
541 | + foreach (DataRow drEditionForModesty in dtblEditionForModesty.Rows) | |
542 | + { | |
543 | + if ((bool)drEditionForModesty["IsModesty"]) | |
544 | + { | |
545 | + userInfo.Modesty = true; | |
546 | + userInfo.ModestyMode = true; | |
512 | 547 | } |
513 | - objUserContext.AccountNumber = strAcccountNumber; | |
514 | - objUserContext.EditionId = (Byte)intEditionId; | |
515 | - objUserContext.LicenseTypeId = (byte)licRow["LicenseTypeId"]; | |
516 | - objUserContext.LicenseId = Convert.ToInt32(licRow["Id"]); | |
517 | - objUserContext.LoginId = ""; | |
518 | - objUserContext.Modesty =(bool)licRow["IsModesty"]; | |
519 | - //Retreive ModestyMode | |
520 | - objUserContext.ModestyMode = false; | |
521 | - | |
522 | - intLicenseId = Convert.ToInt32(licRow["Id"]); | |
523 | - | |
524 | - | |
525 | - DataTable dtblEditionForModesty = new DBModel().GetEditionsForModesty(objUserContext.LicenseId, 0); | |
526 | - //This table result set should return always have 0 or 1 record if modesty mode is present. | |
527 | - foreach (DataRow drEditionForModesty in dtblEditionForModesty.Rows) { | |
528 | - if ((bool)drEditionForModesty["IsModesty"]) { | |
529 | - objUserContext.Modesty = true; | |
530 | - objUserContext.ModestyMode = true; | |
531 | 548 | } |
532 | - } | |
533 | 549 | |
534 | - // get edition features details | |
535 | - objUserContext.objEditionFeatures = objDBModel.GetEditionFeatures((Byte)intEditionId); | |
550 | + // get edition features details | |
551 | + userInfo.objEditionFeatures = objDBModel.GetEditionFeatures((Byte)intEditionId); | |
536 | 552 | |
537 | - | |
538 | 553 | |
539 | - if (intLicenseId > 0) | |
540 | - objUserContext.Modules = getModuleListByLicenseId(intLicenseId); | |
541 | - else | |
542 | - objUserContext.Modules = getAllModulesList(); | |
543 | 554 | |
544 | - objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext); | |
545 | - // SessionManager.GetInstance().AddSession((int)0, (int)objLicenseRow.Id, (byte)intEditionId); | |
555 | + if (intLicenseId > 0) | |
556 | + userInfo.Modules = getModuleListByLicenseId(intLicenseId); | |
557 | + else | |
558 | + userInfo.Modules = getAllModulesList(); | |
559 | + | |
560 | + // objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext); | |
546 | 561 | |
547 | 562 | |
548 | - // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id); | |
549 | - //if (arrModuleList[9].Equals(true)) { | |
550 | - // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10"); | |
551 | - //} | |
563 | + // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id); | |
564 | + //if (arrModuleList[9].Equals(true)) { | |
565 | + // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10"); | |
566 | + //} | |
552 | 567 | |
553 | - //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer); | |
554 | - } else { | |
555 | - // logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.LICENSE_INACTIVE, strSiteIP, Convert.ToString(intEditionId), strUrlReferer); | |
556 | - intErrorID = ErrorHelper.E_LICENCE_IS_INACTIVE; | |
557 | - strStatus = AIAConstants.STATUS_NOT_OK; | |
568 | + //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer); | |
569 | + } | |
570 | + else | |
571 | + { | |
572 | + // logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, ErrorHelper.LICENSE_INACTIVE, strSiteIP, Convert.ToString(intEditionId), strUrlReferer); | |
573 | + // intErrorID = ErrorHelper.E_LICENCE_IS_INACTIVE; | |
574 | + // strStatus = AIAConstants.STATUS_NOT_OK; | |
575 | + userInfo.LoginFailureCauseId = ErrorHelper.LICENSE_INACTIVE; | |
576 | + } | |
558 | 577 | } |
559 | - } else { | |
560 | - | |
561 | - intErrorID = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; | |
562 | - strStatus = AIAConstants.STATUS_NOT_OK; | |
563 | - } | |
578 | + else | |
579 | + { | |
580 | + | |
581 | + // intErrorID = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; | |
582 | + // strStatus = AIAConstants.STATUS_NOT_OK; | |
583 | + userInfo.LoginFailureCauseId = ErrorHelper.E_EDITION_NOT_LINKED_WITH_SITE; | |
584 | + } | |
585 | + //} | |
564 | 586 | } |
565 | - objResponse.ErrorCode = intErrorID; | |
566 | - objResponse.Status = strStatus; | |
567 | - objResponse.ErrorDesc = ErrorHelper.GetInstance().GetErrorDescriptionHelper(intErrorID).ToString(); | |
568 | - } catch (Exception objExp) { | |
569 | - objResponse.Status = GlobalConstant.STATUS_NOT_OK; | |
570 | - objResponse.ErrorCode = GlobalConstant.RUN_TIME_EXCEPTION; | |
571 | - objResponse.strErrorDesc = objExp.Message; | |
572 | 587 | } |
573 | - if (isExpired != null && (bool)isExpired["result"]) | |
574 | - objResponse.strErrorDesc = objResponse.strErrorDesc.Replace("{0}", (string)isExpired["date"]); | |
575 | - return intUserId; | |
588 | + //objResponse.ErrorCode = intErrorID; | |
589 | + //objResponse.Status = strStatus; | |
590 | + //objResponse.ErrorDesc = ErrorHelper.GetInstance().GetErrorDescriptionHelper(intErrorID).ToString(); | |
591 | + //} catch (Exception objExp) { | |
592 | + // objResponse.Status = GlobalConstant.STATUS_NOT_OK; | |
593 | + // objResponse.ErrorCode = GlobalConstant.RUN_TIME_EXCEPTION; | |
594 | + // objResponse.strErrorDesc = objExp.Message; | |
595 | + //} | |
596 | + //if (isExpired != null && (bool)isExpired["result"]) | |
597 | + // objResponse.strErrorDesc = objResponse.strErrorDesc.Replace("{0}", (string)isExpired["date"]); | |
598 | + //return intUserId; | |
599 | + return userInfo; | |
600 | + } | |
576 | 601 | } |
577 | 602 | } |
578 | 603 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -136,26 +136,26 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A |
136 | 136 | |
137 | 137 | $scope.ValidateClientSiteUrl(); |
138 | 138 | } |
139 | - | |
140 | - | |
141 | - if (navigator.cookieEnabled) { | |
142 | - | |
143 | - $rootScope.isLoading = false; | |
144 | 139 | |
145 | - var url = $location.url(); | |
140 | + else { | |
141 | + if (navigator.cookieEnabled) { | |
146 | 142 | |
147 | - //unblock user | |
148 | - if (url.indexOf('?unb:') != -1) { | |
143 | + $rootScope.isLoading = false; | |
149 | 144 | |
150 | - $rootScope.isVisibleLogin = true; | |
151 | - $rootScope.UnblockUser(); | |
152 | - } | |
153 | - else if (url.indexOf('?em:') != -1) { | |
145 | + var url = $location.url(); | |
154 | 146 | |
155 | - $rootScope.isVisibleLogin = false; | |
156 | - $rootScope.isVisibleResetPass = true; | |
157 | - } | |
158 | - else { | |
147 | + //unblock user | |
148 | + if (url.indexOf('?unb:') != -1) { | |
149 | + | |
150 | + $rootScope.isVisibleLogin = true; | |
151 | + $rootScope.UnblockUser(); | |
152 | + } | |
153 | + else if (url.indexOf('?em:') != -1) { | |
154 | + | |
155 | + $rootScope.isVisibleLogin = false; | |
156 | + $rootScope.isVisibleResetPass = true; | |
157 | + } | |
158 | + else { | |
159 | 159 | |
160 | 160 | $rootScope.isVisibleLogin = true; |
161 | 161 | $rootScope.isVisibleResetPass = false; |
... | ... | @@ -166,7 +166,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A |
166 | 166 | AuthenticateAlreadyLoggedInUser(); |
167 | 167 | } |
168 | 168 | var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); |
169 | - | |
169 | + | |
170 | 170 | if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { |
171 | 171 | sessionStorage.setItem("loginSession", "true"); |
172 | 172 | } |
... | ... | @@ -176,17 +176,18 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A |
176 | 176 | $rootScope.userInfo = { username: $rootScope.getLocalStorageValue('RememberMeLoginId'), password: $rootScope.getLocalStorageValue('RememberMePassword'), rememberChk: true }; |
177 | 177 | }, 800); |
178 | 178 | } |
179 | + } | |
179 | 180 | } |
180 | - } | |
181 | - | |
182 | - else { | |
183 | - | |
184 | - $rootScope.isVisibleLogin = true; | |
185 | 181 | |
186 | - $rootScope.promptUserForCookies(); | |
182 | + else { | |
183 | + | |
184 | + $rootScope.isVisibleLogin = true; | |
185 | + | |
186 | + $rootScope.promptUserForCookies(); | |
187 | + } | |
188 | + | |
189 | + $rootScope.getConfigurationValues(); | |
187 | 190 | } |
188 | - | |
189 | - $rootScope.getConfigurationValues(); | |
190 | 191 | } |
191 | 192 | $rootScope.getConfigurationValues = function () |
192 | 193 | { |
... | ... | @@ -397,7 +398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A |
397 | 398 | |
398 | 399 | |
399 | 400 | $scope.ValidateClientSiteUrl = function () { |
400 | - urlParams = strIPAddress + "&" + strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : ""); | |
401 | + // urlParams = strIPAddress + "&" + strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : ""); | |
401 | 402 | |
402 | 403 | var siteInfo = urlParams.split('&'); |
403 | 404 | $rootScope.siteUrlInfo.siteIP = siteInfo[0]; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.aspx
... | ... | @@ -163,7 +163,10 @@ |
163 | 163 | } |
164 | 164 | </style> |
165 | 165 | |
166 | - <script> var params = "<%=urlParams%>"; alert(params) </script> | |
166 | + <script> | |
167 | + var params = "<%=urlParams%>"; alert(params); | |
168 | + var isCalsCredantialForSIte ="<%=isCalsCredantial%>"; | |
169 | + </script> | |
167 | 170 | |
168 | 171 | </head> |
169 | 172 | <body ng-controller="HomeController" id="bo" ng-init="initializeAIA()" ng-keydown="CheckRefresh($event)"> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.aspx.cs
... | ... | @@ -17,7 +17,7 @@ namespace ADAM.AIA |
17 | 17 | public string strSiteReferer = ""; |
18 | 18 | public string urlParams = "?"; |
19 | 19 | public string test = ""; |
20 | - | |
20 | + public bool isCalsCredantial = false; | |
21 | 21 | protected void Page_Load(object sender, EventArgs e) |
22 | 22 | { |
23 | 23 | urlParams = "XYZ"; |
... | ... | @@ -26,7 +26,12 @@ namespace ADAM.AIA |
26 | 26 | { |
27 | 27 | if (Request.Form["calsCredantial"] != null && Request.Form["calsCredantial"].ToString() == "yes") |
28 | 28 | { |
29 | - urlParams = "?calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); | |
29 | + isCalsCredantial = true; | |
30 | + | |
31 | + //urlParams = "?calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); | |
32 | + //calsCredantialusername&password | |
33 | + urlParams = Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString(); | |
34 | + | |
30 | 35 | } |
31 | 36 | } |
32 | 37 | ... | ... |