Commit 913d69ee2b7c7682a44a5f29ec7be1ac72fd87d7

Authored by Nikita Kulshreshtha
1 parent e66ea68e

completed site url intergartiion.

Landing page image is not loaded
400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs
... ... @@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq;
10 10 using System.Data.SqlClient;
11 11 using System.Collections;
12 12 using log4net;
  13 +using Newtonsoft.Json;
13 14  
14 15 namespace AIAHTML5.API.Controllers
15 16 {
... ... @@ -32,16 +33,20 @@ namespace AIAHTML5.API.Controllers
32 33 {
33 34 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
34 35 logger.Debug("inside POST in ClientController");
35   -
36   - HttpResponseMessage response = null;
37   - try
  36 + try{
  37 + HttpResponseMessage response = null;
  38 + if (siteUrl != null)
38 39 {
39   - int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString()));
  40 + if (!string.IsNullOrEmpty(siteUrl["siteIP"].ToString()) && !string.IsNullOrEmpty(siteUrl["remoteIPAddress"].ToString()) && !string.IsNullOrEmpty(siteUrl["accountNumber"].ToString()) && !string.IsNullOrEmpty(siteUrl["edition"].ToString()))
  41 +
  42 + {
  43 +
  44 + int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString()));
40 45 if (siteId > 0)
41 46 {
42 47 dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId);
43 48 if (uerinfo != null)
44   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) };
  49 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(uerinfo)) };
45 50 else
46 51 {
47 52 //ser user = new User();
... ... @@ -52,12 +57,20 @@ namespace AIAHTML5.API.Controllers
52 57 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) };
53 58 }
54 59 }
  60 +
55 61 else
56 62 {
57 63 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) };
58 64  
59   -
60 65 }
  66 + }
  67 + }
  68 + else
  69 + {
  70 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = null };
  71 +
  72 + }
  73 +
61 74 return response;
62 75 }
63 76 catch (SqlException e)
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -1115,7 +1115,7 @@ namespace AIAHTML5.API.Models
1115 1115 {
1116 1116 foreach (DataRow dr in dt.Rows)
1117 1117 {
1118   - if ((bool)dr["IsActive"])
  1118 + if (Convert.ToBoolean(dr["IsActive"]))
1119 1119 {
1120 1120 objFeatures.Add(dr["Id"], dr["Title"]);
1121 1121 }
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -488,7 +488,7 @@ namespace AIAHTML5.API.Models
488 488 if (userInfo.LicenseInfo != null)
489 489 {
490 490 //05.3 get licenseSubscription details
491   - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId);
  491 + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails( userInfo.LicenseInfo.Id);
492 492  
493 493 //05.4 check the License expiration irespective of either user is active or not because on AIA
494 494 //we shows the License expiration message for inactive users too
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -133,9 +133,9 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
133 133  
134 134 }
135 135  
136   -
  136 +
137 137 $rootScope.initializeAIA = function () {
138   - if (urlParams != null && urlParams != undefined) {
  138 + if (params != null && params != undefined && params!="") {
139 139  
140 140 $scope.ValidateClientSiteUrl();
141 141 }
... ... @@ -402,65 +402,259 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
402 402  
403 403 $scope.ValidateClientSiteUrl = function () {
404 404  
  405 + debugger
405 406 var siteInfo = params.split('&');
406 407  
407   - for (var i = 0; i < siteInfo.length; i++)
408   - {
409   - if (isCalsCredantial) {
410   - var paramInfo = siteInfo[i].split('=');
411   - if (paramInfo[0] == 'calsCredantial') {
  408 + for (var i = 0; i < siteInfo.length; i++) {
  409 + debugger;
  410 + if (isCalsCredantialForSIte == "True") {
  411 + var paramInfo = siteInfo[i].split('=');
  412 + if (paramInfo[0] == 'calsCredantial') {
412 413  
413   - $rootScope.siteUrlInfo.calsCreds = paramInfo[1];
414   - }
415   - else if (paramInfo[0] == 'username') {
  414 + $rootScope.siteUrlInfo.calsCreds = paramInfo[1];
  415 + console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds);
  416 + }
  417 + else if (paramInfo[0] == 'username') {
416 418  
417   - $rootScope.siteUrlInfo.username = paramInfo[1];
418   - }
419   - else if (paramInfo[0] == 'password') {
  419 + $rootScope.siteUrlInfo.username = paramInfo[1];
  420 + console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username);
  421 + }
  422 + else if (paramInfo[0] == 'password') {
420 423  
421   - $rootScope.siteUrlInfo.password = paramInfo[1];
422   - }
  424 + $rootScope.siteUrlInfo.password = paramInfo[1];
  425 + console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password);
  426 + }
423 427  
424   - $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;
425   - $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;
  428 + $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;
  429 + $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;
  430 + console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password);
426 431  
427   - $rootScope.AuthenticateUser($rootScope.userInfo);
428 432  
429   - }
430   - else{
431   - var paramInfo = siteInfo[i].split('=');
432   - if (paramInfo[0] == 'siteIP') {
  433 + }
  434 + else {
  435 + var paramInfo = siteInfo[i].split('=');
  436 + if (paramInfo[0] == 'siteIP') {
433 437  
434   - $rootScope.siteUrlInfo.siteIP = paramInfo[1];
435   - }
436   - else if (paramInfo[0] == 'accountNumber') {
  438 + $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  439 + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP);
  440 + }
  441 + else if (paramInfo[0] == 'accountNumber') {
437 442  
438   - $rootScope.siteUrlInfo.accountNumber = paramInfo[1];
439   - }
440   - else if (paramInfo[0] == 'edition') {
  443 + $rootScope.siteUrlInfo.accountNumber = paramInfo[1];
  444 + console.log("$rootScope.siteUrlInfo.accountNumber=" + $rootScope.siteUrlInfo.accountNumber);
  445 + }
  446 + else if (paramInfo[0] == 'edition') {
441 447  
442   - $rootScope.siteUrlInfo.siteIP = paramInfo[1];
443   - }
444   - else if (paramInfo[0] == 'urlReferer') {
  448 + $rootScope.siteUrlInfo.edition = paramInfo[1];
  449 + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP);
  450 + }
  451 + else if (paramInfo[0] == 'urlReferer') {
445 452  
446   - $rootScope.siteUrlInfo.siteIP = paramInfo[1];
447   - }
448   - else if (paramInfo[0] == 'remoteIPAddress') {
  453 + $rootScope.siteUrlInfo.urlReferer = paramInfo[1];
  454 + console.log("$rootScope.siteUrlInfo.siteIP" + $rootScope.siteUrlInfo.siteIP);
  455 + }
  456 + else if (paramInfo[0] == 'remoteIPAddress') {
449 457  
450   - $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];
451   - }
  458 + $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];
  459 + console.log("$rootScope.siteUrlInfo.remoteIPAddress" + $rootScope.siteUrlInfo.remoteIPAddress);
  460 + }
452 461  
453   - AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
454   - .then(
455 462  
456   - function (result) {
457   - console.log(result);
458   -
459   - },
460   - function (error) { }
461   - )
462   - }
463   - }
  463 + }
  464 + }
  465 + if (isCalsCredantialForSIte == "True") {
  466 + $rootScope.AuthenticateUser($rootScope.userInfo);
  467 + }
  468 + else {
  469 +
  470 +
  471 + console.log($rootScope.siteUrlInfo);
  472 +
  473 + AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
  474 + .then(
  475 +
  476 + function (result) {
  477 + debugger;
  478 + console.log(result);
  479 + if (result != null) {
  480 +
  481 +
  482 + console.log(result);
  483 + if (result == LoginConstants.INVALID_CLIENT) {
  484 + $rootScope.isVisibleLogin = true;
  485 + $rootScope.errorMessage = LoginConstants.INVALID_CLIENT;
  486 + $("#messageModal").modal('show');
  487 + }
  488 + else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) {
  489 + $rootScope.isVisibleLogin = true;
  490 + $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER;
  491 + $("#messageModal").modal('show');
  492 + }
  493 +
  494 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) {
  495 + $rootScope.isVisibleLogin = true;
  496 + $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL;
  497 + $("#messageModal").modal('show');
  498 + }
  499 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) {
  500 + $rootScope.isVisibleLogin = true;
  501 + $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL;
  502 + $("#messageModal").modal('show');
  503 + }
  504 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) {
  505 + $rootScope.isVisibleLogin = true;
  506 + $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE;
  507 + $("#messageModal").modal('show');
  508 + }
  509 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) {
  510 + $rootScope.isVisibleLogin = true;
  511 + $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
  512 + $("#messageModal").modal('show');
  513 + }
  514 +
  515 +
  516 + else {
  517 + if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) {
  518 + //code for modesty setting
  519 + if (result.LicenseInfo != null) {
  520 + if (result.Modesty) {
  521 + $rootScope.isModestyOn = true;
  522 + $rootScope.isModestyOff = false;
  523 + localStorage.setItem("globalModesty", "Y");
  524 + $rootScope.formsetting = {
  525 + ethnicity: null,
  526 + modesty: "Y"
  527 + }
  528 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  529 + }
  530 + else {
  531 + $rootScope.isModestyOn = false;
  532 + $rootScope.isModestyOff = true;
  533 + localStorage.setItem("globalModesty", "N");
  534 + $rootScope.formsetting = {
  535 + ethnicity: null,
  536 + modesty: "N"
  537 + }
  538 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  539 + }
  540 + }
  541 + else {
  542 + $rootScope.isModestyOn = true;
  543 + $rootScope.isModestyOff = false;
  544 + localStorage.setItem("globalModesty", "Y");
  545 + $rootScope.formsetting = {
  546 + ethnicity: null,
  547 + modesty: "Y"
  548 + }
  549 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  550 + }
  551 + //code for modesty setting
  552 +
  553 +
  554 +
  555 +
  556 + //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
  557 + if (result.LicenseId == 0) {
  558 + $rootScope.haveRoleAdmin = true;
  559 +
  560 + $rootScope.userData = result;
  561 + $rootScope.userModules = result.Modules;
  562 +
  563 + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
  564 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  565 + }
  566 +
  567 + if (isCommingSoonModel == true) {
  568 +
  569 + ShowAssignedModulesPopup(result.Modules);
  570 +
  571 + //if (userInfo.rememberChk) {
  572 +
  573 + // $scope.saveRemeberMeDetails(result, userInfo);
  574 + //}
  575 +
  576 + sessionStorage.setItem("loginSession", "true");
  577 + localStorage.setItem('isCommingSoonModel', false);
  578 +
  579 + $rootScope.isVisibleLogin = false;
  580 + }
  581 +
  582 +
  583 + $location.path('/');
  584 +
  585 + }
  586 + else {
  587 + if (result.LicenseInfo != null ) {
  588 + //0.
  589 + $rootScope.userData = result;
  590 + $rootScope.userModules = result.Modules;
  591 +
  592 + //1. set haveRoleAdmin = false because LicenseInfo is not null
  593 + $rootScope.haveRoleAdmin = false;
  594 +
  595 + //2.
  596 + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
  597 +
  598 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  599 + }
  600 +
  601 + // 3.ShowAssignedModulesPopup
  602 + //isCommingSoonModel =true only when user comes first time on application and login
  603 + //if (isCommingSoonModel == true) {
  604 +
  605 + // ShowAssignedModulesPopup(result.Modules);
  606 + //}
  607 +
  608 + //4.
  609 + //if ($scope.rememberChk) {
  610 +
  611 + // $scope.saveRemeberMeDetails(result, userInfo);
  612 + //}
  613 +
  614 + //5.
  615 + sessionStorage.setItem("loginSession", "true");
  616 + $rootScope.isVisibleLogin = false;
  617 +
  618 + //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time
  619 + // localStorage.setItem('isCommingSoonModel', false);
  620 +
  621 + $location.path('/');
  622 +
  623 + }
  624 + else {
  625 + if ($('#dvTerms').length > 0) {
  626 + $('#dvTerms').html(result.TermsAndConditionsText);
  627 + }
  628 + $rootScope.isVisibleLogin = true;
  629 + $('#dvTermCondition').fadeIn();
  630 + $rootScope.userData = result;
  631 + $rootScope.haveRoleAdmin = false;
  632 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  633 + $location.path('/');
  634 + }
  635 + }
  636 + }
  637 +
  638 +
  639 + }
  640 + }
  641 +
  642 +
  643 +
  644 + },
  645 +
  646 + function (error) {
  647 +
  648 + console.log(' Error in authentication = ' + error.statusText);
  649 + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  650 + $rootScope.isVisibleLogin = true;
  651 + $rootScope.errorMessage = error;
  652 + $("#messageModal").modal('show');
  653 +
  654 + }
  655 + )
  656 +
  657 + }
464 658 //$rootScope.siteUrlInfo.siteIP = siteInfo[0];
465 659 //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1];
466 660 //$rootScope.siteUrlInfo.accountNumber = siteInfo[2];
... ... @@ -470,7 +664,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
470 664  
471 665 }
472 666  
473   -
474 667 $scope.saveRemeberMeDetails = function (result, userInfo) {
475 668  
476 669 localStorage.setItem('RememberMeLoginId', result.LoginId);
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -361,7 +361,9 @@ AIA.constant(&quot;LoginConstants&quot;, {
361 361 "ACCOUNT_NUMBER_NOT_EXIST": "1",
362 362 "EDITION_NOT_EXIST": "3",
363 363 "MASTER_SITEIP_NOT_EXIST": "2",
364   - "LICENSE_INACTIVE": "6"
  364 + "LICENSE_INACTIVE": "6",
  365 + "INVALID_CLIENT": "Clinet is not valid",
  366 + "MSG_NOT_AUTHORIZE_SITE_USER": "User is not authorized.",
365 367 });
366 368  
367 369 AIA.constant("LoginMessageConstants", {
... ... @@ -400,6 +402,9 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
400 402 "UNABLE_TO_UNBLOCK": "We are unable to unblock. Please try after sometime.",
401 403 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
402 404 //"MAIL_NOT_SENT": "Mail not sent."
  405 + "E_ACCOUNT_NUMBER_NOT_NULL": "Account number cannot be null",
  406 + "E_EDITION_ID_NOT_NULL": "Edition Id cannot be zero.",
  407 + "E_EDITION_NOT_LINKED_WITH_SITE": "Your credentials are invalid. Please contact the site administrator of your institution.",
403 408  
404 409 })
405 410 AIA.constant("AdminConstants", {
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -164,7 +164,7 @@
164 164 </style>
165 165  
166 166 <script>
167   - var params = "<%=urlParams%>"; alert(params);
  167 + var params = "<%=urlParams%>";
168 168 var isCalsCredantialForSIte ="<%=isCalsCredantial%>";
169 169 </script>
170 170  
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx.cs
... ... @@ -15,13 +15,13 @@ namespace ADAM.AIA
15 15 public string strEdition = "";
16 16 public string strUrlReferer = "";
17 17 public string strSiteReferer = "";
18   - public string urlParams = "?";
  18 + public string urlParams = "";
19 19 public string test = "";
20 20 public bool isCalsCredantial = false;
21 21  
22 22 protected void Page_Load(object sender, EventArgs e)
23 23 {
24   - urlParams = "XYZ";
  24 +
25 25  
26 26 if (Request.HttpMethod == "POST")
27 27 {
... ...