Commit 0e02647cba084855ff1c670a5f734c19f6d24383

Authored by Nikita Kulshreshtha
1 parent 022962b1

files came after QA pull

400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs
1 -using System;  
2 -using System.Collections.Generic;  
3 -using System.Linq;  
4 -using System.Web.Http;  
5 -  
6 -namespace AIAHTML5.API  
7 -{  
8 - public static class WebApiConfig  
9 - {  
10 - public static void Register(HttpConfiguration config)  
11 - {  
12 - // Web API configuration and services  
13 -  
14 - // Web API routes  
15 - config.MapHttpAttributeRoutes();  
16 -  
17 - config.Routes.MapHttpRoute(  
18 - name: "DefaultApi",  
19 - routeTemplate: "api/{controller}/{id}",  
20 - defaults: new { id = RouteParameter.Optional }  
21 - );  
22 - }  
23 - }  
24 -} 1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Web.Http;
  5 +
  6 +namespace AIAHTML5.API
  7 +{
  8 + public static class WebApiConfig
  9 + {
  10 + public static void Register(HttpConfiguration config)
  11 + {
  12 + // Web API configuration and services
  13 +
  14 + // Web API routes
  15 + config.MapHttpAttributeRoutes();
  16 +
  17 + config.Routes.MapHttpRoute(
  18 + name: "DefaultApi",
  19 + routeTemplate: "api/{controller}/{id}",
  20 + defaults: new { id = RouteParameter.Optional }
  21 + );
  22 + }
  23 + }
  24 +}
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
1 -using Newtonsoft.Json;  
2 -using Newtonsoft.Json.Linq;  
3 -using System;  
4 -using System.Collections.Generic;  
5 -using System.Linq;  
6 -using System.Net;  
7 -using System.Net.Http;  
8 -using System.Web.Http;  
9 -using log4net;  
10 -using AIAHTML5.API.Constants;  
11 -using AIAHTML5.API.Models;  
12 -using System.Collections;  
13 -  
14 -using System.Data.SqlClient;namespace AIAHTML5.API.Controllers  
15 -{  
16 - public class AuthenticateController : ApiController  
17 - {  
18 - // GET api/authenticate  
19 - public IEnumerable<string> Get()  
20 - {  
21 - return new string[] { "value1", "value2" };  
22 - }  
23 -  
24 - // GET api/authenticate/5  
25 - public string Get(int id)  
26 - {  
27 - return "value";  
28 - }  
29 -  
30 - // POST api/authenticate  
31 - public HttpResponseMessage Post([FromBody]JObject credentials)  
32 - {  
33 - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));  
34 - logger.Debug("inside POST");  
35 -  
36 - dynamic authenticationRepsonse;  
37 - DateTime blockTime;  
38 - bool isUserBlocked;  
39 -  
40 - try  
41 - {  
42 -  
43 - //01.get the user detail to autheticate the user  
44 - User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials);  
45 -  
46 - if (userInfo != null)  
47 - {  
48 - // 02 Check user is authenticated or not by login credential match  
49 - bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo);  
50 -  
51 - if (isUserAuthenticated)  
52 - {  
53 - if (userInfo.IsActive)  
54 - {  
55 - //03. check if user is blocked  
56 - isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime);  
57 -  
58 - if (!isUserBlocked)  
59 - {  
60 - //04.delete past wrong login attempts of user  
61 - int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);  
62 - if (wrongAttemptDeteledCount < 0)  
63 - {  
64 - logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);  
65 - }  
66 - //05.  
67 - GetModulesBasedOnUserType(userInfo);  
68 -  
69 - // authenticationRepsonse = JsonConvert.SerializeObject(userInfo);  
70 - }  
71 -  
72 - else  
73 - {  
74 -  
75 - //compare block time of user with current time if user is blocked  
76 - DateTime blockDuration = blockTime.AddDays(1);  
77 - var difference = DateTime.Compare(DateTime.Now, blockDuration);  
78 -  
79 - //check if credentials are valid credentials  
80 - //bool isCorrectLoginId, isCorrectPassword;  
81 - //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword);  
82 -  
83 - if (difference >= 0)  
84 - {  
85 - //means 24 hours block time is finished  
86 - userInfo.IsBlocked = false;  
87 -  
88 - int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);  
89 - if (wrongAttemptDeteledCount < 0)  
90 - {  
91 - logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);  
92 - }  
93 -  
94 - //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads  
95 - GetModulesBasedOnUserType(userInfo);  
96 -  
97 - }  
98 - else  
99 - {  
100 - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;  
101 - }  
102 - }  
103 - }  
104 - else  
105 - {  
106 - //CODE REVIW: validate that is this tarnslated by UI because we need to show message to user if he is inactive  
107 - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE;  
108 -  
109 - //05.4 check the License expiration irespective of either user is active  
110 - //or not because on AIA, we shows the License expiration message  
111 - //for inactive users too  
112 -  
113 - CheckLicenseStatus(userInfo);  
114 -  
115 - }  
116 - }  
117 -  
118 - else  
119 - {  
120 - //this come in picture when user input wrong passowrd  
121 -  
122 - //get wrong attempt count of user  
123 - int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id);  
124 - userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1;  
125 - userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH;  
126 -  
127 - //01. insert wrong attempt in dtabase  
128 - int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts);  
129 -  
130 - if (updateCount < 0)  
131 - {  
132 - //Put the log in log file  
133 - logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id);  
134 - }  
135 - //else  
136 - //{  
137 - if (userInfo.IncorrectLoginAttemptCount > 4)  
138 - {  
139 - userInfo.IsBlocked = true;  
140 - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;  
141 - }  
142 -  
143 -  
144 - }  
145 -  
146 - authenticationRepsonse = JsonConvert.SerializeObject(userInfo);  
147 -  
148 - }  
149 -  
150 - else  
151 - {  
152 - authenticationRepsonse = AIAConstants.USER_NOT_FOUND;  
153 - }  
154 - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };  
155 - }  
156 - catch(SqlException e){  
157 -  
158 - logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);  
159 -  
160 - ArrayList supportMailList = UserUtility.GetSupportMailList();  
161 - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT;  
162 - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;  
163 - UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);  
164 -  
165 - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };  
166 - }  
167 - catch (Exception e)  
168 - {  
169 -  
170 - logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);  
171 -  
172 - ArrayList supportMailList = UserUtility.GetSupportMailList();  
173 - string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;  
174 - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;  
175 - UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);  
176 -  
177 - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) };  
178 -  
179 - }  
180 -  
181 - }  
182 -  
183 - private static void GetModulesBasedOnUserType(User userInfo)  
184 - {  
185 - //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0.  
186 - //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin  
187 - int licenseId, editionId;  
188 - AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);  
189 -  
190 - userInfo.LicenseId = licenseId;  
191 - userInfo.EditionId = editionId;  
192 -  
193 - //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN)  
194 - if(userInfo.LicenseId == 0)  
195 - {  
196 - userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList();  
197 -  
198 - //Insert user login detail  
199 - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);  
200 - }  
201 - else  
202 - {  
203 - CheckLicenseStatus(userInfo);  
204 -  
205 - if(!userInfo.IsSubscriptionExpired){  
206 - GetModulesBasedOnLicense(userInfo,false);  
207 - }  
208 - }  
209 - }  
210 -  
211 - private static void CheckLicenseStatus(User userInfo)  
212 - {  
213 - //05.1 For normal user need to get the license details, get the license id for authenticated user  
214 - //int licenseId, editionId;  
215 - //AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);  
216 -  
217 - //userInfo.LicenseId = licenseId;  
218 - //userInfo.EditionId = editionId;  
219 -  
220 - //05.2 get license details  
221 - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId);  
222 -  
223 - if (userInfo.LicenseInfo != null)  
224 - {  
225 - //05.3 get licenseSubscription details  
226 - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId);  
227 -  
228 - //05.4 check the License expiration irespective of either user is active or not because on AIA  
229 - //we shows the License expiration message for inactive users too  
230 - string expirationDate = null;  
231 - bool isLicenseExpired = false;  
232 -  
233 - if (userInfo.LicenseSubscriptions != null)  
234 - {  
235 - isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate);  
236 - }  
237 -  
238 - if (isLicenseExpired)  
239 - {  
240 - userInfo.IsSubscriptionExpired = isLicenseExpired;  
241 - userInfo.SubscriptionExpirationDate = expirationDate;  
242 - }  
243 - }  
244 -  
245 - else  
246 - {  
247 - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));  
248 - logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId);  
249 - }  
250 - }  
251 -  
252 - private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired)  
253 - {  
254 -  
255 - //05.6.1  
256 - if (userInfo.LicenseInfo.IsActive)  
257 - {  
258 - if (!userInfo.LicenseInfo.IsTermAccepted)  
259 - {  
260 - ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions();  
261 - foreach (Hashtable item in termsList)  
262 - {  
263 - userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString();  
264 - userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString();  
265 - }  
266 - }  
267 - else  
268 - {  
269 - userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId);  
270 -  
271 - //Insert user login detail  
272 - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);  
273 - }  
274 - }  
275 - else  
276 - {  
277 - userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE;  
278 -  
279 - }  
280 - }  
281 -  
282 -  
283 -  
284 - // PUT api/authenticate/5  
285 - public void Put(int id, [FromBody]string value)  
286 - {  
287 - }  
288 -  
289 - // DELETE api/authenticate/5  
290 - public void Delete(int id)  
291 - {  
292 - }  
293 - } 1 +using Newtonsoft.Json;
  2 +using Newtonsoft.Json.Linq;
  3 +using System;
  4 +using System.Collections.Generic;
  5 +using System.Linq;
  6 +using System.Net;
  7 +using System.Net.Http;
  8 +using System.Web.Http;
  9 +using log4net;
  10 +using AIAHTML5.API.Constants;
  11 +using AIAHTML5.API.Models;
  12 +using System.Collections;
  13 +
  14 +using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
  15 +{
  16 + public class AuthenticateController : ApiController
  17 + {
  18 + // GET api/authenticate
  19 + public IEnumerable<string> Get()
  20 + {
  21 + return new string[] { "value1", "value2" };
  22 + }
  23 +
  24 + // GET api/authenticate/5
  25 + public string Get(int id)
  26 + {
  27 + return "value";
  28 + }
  29 +
  30 + // POST api/authenticate
  31 + public HttpResponseMessage Post([FromBody]JObject credentials)
  32 + {
  33 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  34 + logger.Debug("inside POST");
  35 +
  36 + dynamic authenticationRepsonse;
  37 + DateTime blockTime;
  38 + bool isUserBlocked;
  39 +
  40 + try
  41 + {
  42 +
  43 + //01.get the user detail to autheticate the user
  44 + User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials);
  45 +
  46 + if (userInfo != null)
  47 + {
  48 + // 02 Check user is authenticated or not by login credential match
  49 + bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo);
  50 +
  51 + if (isUserAuthenticated)
  52 + {
  53 + if (userInfo.IsActive)
  54 + {
  55 + //03. check if user is blocked
  56 + isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime);
  57 +
  58 + if (!isUserBlocked)
  59 + {
  60 + //04.delete past wrong login attempts of user
  61 + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);
  62 + if (wrongAttemptDeteledCount < 0)
  63 + {
  64 + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
  65 + }
  66 + //05.
  67 + GetModulesBasedOnUserType(userInfo);
  68 +
  69 + // authenticationRepsonse = JsonConvert.SerializeObject(userInfo);
  70 + }
  71 +
  72 + else
  73 + {
  74 +
  75 + //compare block time of user with current time if user is blocked
  76 + DateTime blockDuration = blockTime.AddDays(1);
  77 + var difference = DateTime.Compare(DateTime.Now, blockDuration);
  78 +
  79 + //check if credentials are valid credentials
  80 + //bool isCorrectLoginId, isCorrectPassword;
  81 + //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword);
  82 +
  83 + if (difference >= 0)
  84 + {
  85 + //means 24 hours block time is finished
  86 + userInfo.IsBlocked = false;
  87 +
  88 + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);
  89 + if (wrongAttemptDeteledCount < 0)
  90 + {
  91 + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
  92 + }
  93 +
  94 + //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads
  95 + GetModulesBasedOnUserType(userInfo);
  96 +
  97 + }
  98 + else
  99 + {
  100 + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;
  101 + }
  102 + }
  103 + }
  104 + else
  105 + {
  106 + //CODE REVIW: validate that is this tarnslated by UI because we need to show message to user if he is inactive
  107 + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE;
  108 +
  109 + //05.4 check the License expiration irespective of either user is active
  110 + //or not because on AIA, we shows the License expiration message
  111 + //for inactive users too
  112 +
  113 + CheckLicenseStatus(userInfo);
  114 +
  115 + }
  116 + }
  117 +
  118 + else
  119 + {
  120 + //this come in picture when user input wrong passowrd
  121 +
  122 + //get wrong attempt count of user
  123 + int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id);
  124 + userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1;
  125 + userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH;
  126 +
  127 + //01. insert wrong attempt in dtabase
  128 + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts);
  129 +
  130 + if (updateCount < 0)
  131 + {
  132 + //Put the log in log file
  133 + logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id);
  134 + }
  135 + //else
  136 + //{
  137 + if (userInfo.IncorrectLoginAttemptCount > 4)
  138 + {
  139 + userInfo.IsBlocked = true;
  140 + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;
  141 + }
  142 +
  143 +
  144 + }
  145 +
  146 + authenticationRepsonse = JsonConvert.SerializeObject(userInfo);
  147 +
  148 + }
  149 +
  150 + else
  151 + {
  152 + authenticationRepsonse = AIAConstants.USER_NOT_FOUND;
  153 + }
  154 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
  155 + }
  156 + catch(SqlException e){
  157 +
  158 + logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  159 +
  160 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  161 + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT;
  162 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  163 + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
  164 +
  165 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
  166 + }
  167 + catch (Exception e)
  168 + {
  169 +
  170 + logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  171 +
  172 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  173 + string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
  174 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  175 + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
  176 +
  177 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) };
  178 +
  179 + }
  180 +
  181 + }
  182 +
  183 + private static void GetModulesBasedOnUserType(User userInfo)
  184 + {
  185 + //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0.
  186 + //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin
  187 + int licenseId, editionId;
  188 + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);
  189 +
  190 + userInfo.LicenseId = licenseId;
  191 + userInfo.EditionId = editionId;
  192 +
  193 + //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN)
  194 + if(userInfo.LicenseId == 0)
  195 + {
  196 + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList();
  197 +
  198 + //Insert user login detail
  199 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  200 + }
  201 + else
  202 + {
  203 + CheckLicenseStatus(userInfo);
  204 +
  205 + if(!userInfo.IsSubscriptionExpired){
  206 + GetModulesBasedOnLicense(userInfo,false);
  207 + }
  208 + }
  209 + }
  210 +
  211 + private static void CheckLicenseStatus(User userInfo)
  212 + {
  213 + //05.1 For normal user need to get the license details, get the license id for authenticated user
  214 + //int licenseId, editionId;
  215 + //AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);
  216 +
  217 + //userInfo.LicenseId = licenseId;
  218 + //userInfo.EditionId = editionId;
  219 +
  220 + //05.2 get license details
  221 + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId);
  222 +
  223 + if (userInfo.LicenseInfo != null)
  224 + {
  225 + //05.3 get licenseSubscription details
  226 + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId);
  227 +
  228 + //05.4 check the License expiration irespective of either user is active or not because on AIA
  229 + //we shows the License expiration message for inactive users too
  230 + string expirationDate = null;
  231 + bool isLicenseExpired = false;
  232 +
  233 + if (userInfo.LicenseSubscriptions != null)
  234 + {
  235 + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate);
  236 + }
  237 +
  238 + if (isLicenseExpired)
  239 + {
  240 + userInfo.IsSubscriptionExpired = isLicenseExpired;
  241 + userInfo.SubscriptionExpirationDate = expirationDate;
  242 + }
  243 + }
  244 +
  245 + else
  246 + {
  247 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  248 + logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId);
  249 + }
  250 + }
  251 +
  252 + private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired)
  253 + {
  254 +
  255 + //05.6.1
  256 + if (userInfo.LicenseInfo.IsActive)
  257 + {
  258 + if (!userInfo.LicenseInfo.IsTermAccepted)
  259 + {
  260 + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions();
  261 + foreach (Hashtable item in termsList)
  262 + {
  263 + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString();
  264 + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString();
  265 + }
  266 + }
  267 + else
  268 + {
  269 + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId);
  270 +
  271 + //Insert user login detail
  272 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  273 + }
  274 + }
  275 + else
  276 + {
  277 + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE;
  278 +
  279 + }
  280 + }
  281 +
  282 +
  283 +
  284 + // PUT api/authenticate/5
  285 + public void Put(int id, [FromBody]string value)
  286 + {
  287 + }
  288 +
  289 + // DELETE api/authenticate/5
  290 + public void Delete(int id)
  291 + {
  292 + }
  293 + }
294 } 294 }
295 \ No newline at end of file 295 \ No newline at end of file
400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js
1 -AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile",  
2 -function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) {  
3 -  
4 -  
5 - $scope.showTabButton = false;  
6 - $scope.threeDAnatomyData;  
7 - $scope.Id;  
8 - $scope.$on('$viewContentLoaded', function (event) {  
9 - var currentURL = $location.path();  
10 - var selectedModuleName = '';  
11 - //set module title  
12 - angular.forEach($rootScope.userModules, function (value, key) {  
13 - if (value.slug === currentURL.replace('/', '')) {  
14 - selectedModuleName = value.name;  
15 - }  
16 - $rootScope.currentActiveModuleTitle = selectedModuleName;  
17 - })  
18 - if ($rootScope.refreshcheck == null) {  
19 - $location.path('/');  
20 - }  
21 - $scope.scroll();  
22 - var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')  
23 - promise.then(  
24 - function (result) {  
25 - $scope.threeDAnatomyData = result;  
26 -  
27 - // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData;  
28 -  
29 - $scope.selectedThreeDAdata = new jinqJs()  
30 - .from($scope.threeDAnatomyData.root.ThreeDAData)  
31 - .orderBy([{ field: '_Title', sort: 'asc' }])  
32 - .select();  
33 -  
34 - // console.log($scope.selectedCIListViewData);  
35 - $('#grid-view').empty();  
36 - angular.forEach($scope.selectedThreeDAdata, function (value, key) {  
37 - $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage;  
38 -  
39 - var $el = $('<div id="3dView' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '">'  
40 - + '<div class="thumbnail">'  
41 - + '<img id="' + value._id + '"ng-src="' + $scope.imagePath + '" alt="" title="' + value._Title + '" data-ng-click="Open3DModel($event)" >'  
42 - + '<div class="caption"><p>' + value._Title + '</p></div></div></div>').appendTo('#grid-view');  
43 -  
44 -  
45 - $compile($el)($scope);  
46 -  
47 - $(".sidebar").mCustomScrollbar({  
48 - autoHideScrollbar: true,  
49 - //theme:"rounded"  
50 - });  
51 -  
52 - });  
53 -  
54 - },  
55 - function (error) {  
56 - // handle errors here  
57 - console.log(' $scope.threeDAnatomyData = ' + error.statusText);  
58 - }  
59 - );  
60 -  
61 - });  
62 - $scope.scroll = function () {  
63 - // $window.scrollTo(0, 0);  
64 - $("html,body").scrollTop(0);  
65 - //alert("scroll");  
66 - }  
67 - $scope.IsVisible = function () {  
68 - //$scope.scroll();  
69 -  
70 - $location.url("/3dAnatomy");  
71 -  
72 - }  
73 -  
74 -  
75 - $scope.Open3DModel = function ($event) {  
76 - $rootScope.currentBodyViewId = $event.currentTarget.id;  
77 - if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") {  
78 - var ThreeDTitle = [];  
79 - ThreeDTitle = new jinqJs()  
80 - .from($scope.selectedThreeDAdata)  
81 - .where('_id = ' + $event.currentTarget.id)  
82 - .select('_Title');  
83 -  
84 - $rootScope.ViewTitle = ThreeDTitle[0]._Title;  
85 - }  
86 - else {  
87 - $rootScope.ViewTitle = $event.currentTarget.textContent;  
88 -  
89 - }  
90 -  
91 -  
92 - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle);  
93 - localStorage.setItem("currentBodyViewId", $event.currentTarget.id);  
94 -  
95 - var u = $location.url();  
96 - $location.url('/3d-anatomy-details');  
97 -  
98 - }  
99 -  
100 - $scope.Open3DModelBody = function () {  
101 -  
102 - if ($rootScope.refreshcheck == null) {  
103 - $location.path('/');  
104 -  
105 - }  
106 - $rootScope.isLoading = true;  
107 - $('#spinner').css('visibility', 'visible');  
108 - //alert($rootScope.getLocalStorageValue("currentBodyViewId"));  
109 - $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId");  
110 -  
111 - //alert($scope.voId3D);  
112 -  
113 -  
114 - //once you get id in scope push detail in jspanel content  
115 -  
116 - var openViews;  
117 - if ($rootScope.openViews.length > 0) {  
118 - openViews = new jinqJs()  
119 - .from($rootScope.openViews)  
120 - .where("BodyViewId==" + $scope.voId3D)  
121 - .select();  
122 - }  
123 - var counter = 1;  
124 - var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson");  
125 -  
126 - if (openViews != null && openViews.length > 0) {  
127 - angular.forEach(openViews, function (value, key) {  
128 -  
129 - if (value.body - views == tittle) {  
130 - tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++;  
131 - $rootScope.currentActiveViewTitle = tittle;  
132 - localStorage.setItem("currentViewTitle", tittle);  
133 - }  
134 -  
135 - });  
136 - }  
137 - else {  
138 - localStorage.setItem("currentViewTitle", tittle);  
139 -  
140 - }  
141 -  
142 - // alert($rootScope.getLocalStorageValue("currentViewTitle"));  
143 -  
144 - var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')  
145 - promise.then(  
146 - function (result) {  
147 - $scope.threeDAnatomyData = result;  
148 -  
149 - var clicked3dAview = [];  
150 - clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData)  
151 - .where('_id == ' + $scope.voId3D)  
152 - .select('_Title', '_3dimagepath');  
153 - $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath;  
154 - $scope.threeDBodySystemTitle = clicked3dAview[0]._Title;  
155 -  
156 - if (clicked3dAview.length > 0) {  
157 -  
158 - $rootScope.isLoading = false;  
159 - $('#spinner').css('visibility', 'hidden');  
160 -  
161 - $.jsPanel({  
162 - id: '3DImagePanel',  
163 - selector: '.threeDView',  
164 - theme: 'success',  
165 - currentController: '3dAController',  
166 - parentSlug: '3d-anatomy-list',  
167 - content: '<div class="col-sm-12">' +  
168 - '<object data="' + $scope.Selected3DImagePath + '" width="100%" height="800px" type="image/svg+xml"></object>' +  
169 - '</div><script>$(document).ready(function(){var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {var threeDivWidth = $("#ThreeDView").css("width");$("#ThreeDView").css({"left":"0px","width":"100%","min-idth": threeDivWidth}); var jspanelContainerWidth = $(".jsPanel-content").css("width"); $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth}); $("#3DImagePanel").css("width", "100%"); }});</script>',  
170 - title: $rootScope.getLocalStorageValue("currentViewTitle"),  
171 - position: {  
172 - top: 70,  
173 - left: 1,  
174 - },  
175 -  
176 - size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 },  
177 -  
178 - });  
179 -  
180 - $rootScope.currentSlug = '3d-anatomy-details';  
181 -  
182 - $rootScope.openViews.push(  
183 - {  
184 - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,  
185 - "slug": $rootScope.currentSlug  
186 - });  
187 -  
188 -  
189 - }  
190 -  
191 -  
192 - },  
193 - function (error) {  
194 - // handle errors here  
195 - console.log(' $scope.CIllustrationData = ' + error.statusText);  
196 - }  
197 -  
198 - );  
199 - $('#ThreeDView').css("height", $(window).outerHeight());  
200 -  
201 - $('#ThreeDView').css("width", $(window).outerWidth());  
202 -  
203 - }  
204 -  
205 -  
206 -  
207 -}]  
208 -  
209 -  
210 - 1 +AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile",
  2 +function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) {
  3 +
  4 +
  5 + $scope.showTabButton = false;
  6 + $scope.threeDAnatomyData;
  7 + $scope.Id;
  8 + $scope.$on('$viewContentLoaded', function (event) {
  9 + var currentURL = $location.path();
  10 + var selectedModuleName = '';
  11 + //set module title
  12 + angular.forEach($rootScope.userModules, function (value, key) {
  13 + if (value.slug === currentURL.replace('/', '')) {
  14 + selectedModuleName = value.name;
  15 + }
  16 + $rootScope.currentActiveModuleTitle = selectedModuleName;
  17 + })
  18 + if ($rootScope.refreshcheck == null) {
  19 + $location.path('/');
  20 + }
  21 + $scope.scroll();
  22 + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')
  23 + promise.then(
  24 + function (result) {
  25 + $scope.threeDAnatomyData = result;
  26 +
  27 + // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData;
  28 +
  29 + $scope.selectedThreeDAdata = new jinqJs()
  30 + .from($scope.threeDAnatomyData.root.ThreeDAData)
  31 + .orderBy([{ field: '_Title', sort: 'asc' }])
  32 + .select();
  33 +
  34 + // console.log($scope.selectedCIListViewData);
  35 + $('#grid-view').empty();
  36 + angular.forEach($scope.selectedThreeDAdata, function (value, key) {
  37 + $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage;
  38 +
  39 + var $el = $('<div id="3dView' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '">'
  40 + + '<div class="thumbnail">'
  41 + + '<img id="' + value._id + '"ng-src="' + $scope.imagePath + '" alt="" title="' + value._Title + '" data-ng-click="Open3DModel($event)" >'
  42 + + '<div class="caption"><p>' + value._Title + '</p></div></div></div>').appendTo('#grid-view');
  43 +
  44 +
  45 + $compile($el)($scope);
  46 +
  47 + $(".sidebar").mCustomScrollbar({
  48 + autoHideScrollbar: true,
  49 + //theme:"rounded"
  50 + });
  51 +
  52 + });
  53 +
  54 + },
  55 + function (error) {
  56 + // handle errors here
  57 + console.log(' $scope.threeDAnatomyData = ' + error.statusText);
  58 + }
  59 + );
  60 +
  61 + });
  62 + $scope.scroll = function () {
  63 + // $window.scrollTo(0, 0);
  64 + $("html,body").scrollTop(0);
  65 + //alert("scroll");
  66 + }
  67 + $scope.IsVisible = function () {
  68 + //$scope.scroll();
  69 +
  70 + $location.url("/3dAnatomy");
  71 +
  72 + }
  73 +
  74 +
  75 + $scope.Open3DModel = function ($event) {
  76 + $rootScope.currentBodyViewId = $event.currentTarget.id;
  77 + if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") {
  78 + var ThreeDTitle = [];
  79 + ThreeDTitle = new jinqJs()
  80 + .from($scope.selectedThreeDAdata)
  81 + .where('_id = ' + $event.currentTarget.id)
  82 + .select('_Title');
  83 +
  84 + $rootScope.ViewTitle = ThreeDTitle[0]._Title;
  85 + }
  86 + else {
  87 + $rootScope.ViewTitle = $event.currentTarget.textContent;
  88 +
  89 + }
  90 +
  91 +
  92 + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle);
  93 + localStorage.setItem("currentBodyViewId", $event.currentTarget.id);
  94 +
  95 + var u = $location.url();
  96 + $location.url('/3d-anatomy-details');
  97 +
  98 + }
  99 +
  100 + $scope.Open3DModelBody = function () {
  101 +
  102 + if ($rootScope.refreshcheck == null) {
  103 + $location.path('/');
  104 +
  105 + }
  106 + $rootScope.isLoading = true;
  107 + $('#spinner').css('visibility', 'visible');
  108 + //alert($rootScope.getLocalStorageValue("currentBodyViewId"));
  109 + $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId");
  110 +
  111 + //alert($scope.voId3D);
  112 +
  113 +
  114 + //once you get id in scope push detail in jspanel content
  115 +
  116 + var openViews;
  117 + if ($rootScope.openViews.length > 0) {
  118 + openViews = new jinqJs()
  119 + .from($rootScope.openViews)
  120 + .where("BodyViewId==" + $scope.voId3D)
  121 + .select();
  122 + }
  123 + var counter = 1;
  124 + var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson");
  125 +
  126 + if (openViews != null && openViews.length > 0) {
  127 + angular.forEach(openViews, function (value, key) {
  128 +
  129 + if (value.body - views == tittle) {
  130 + tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++;
  131 + $rootScope.currentActiveViewTitle = tittle;
  132 + localStorage.setItem("currentViewTitle", tittle);
  133 + }
  134 +
  135 + });
  136 + }
  137 + else {
  138 + localStorage.setItem("currentViewTitle", tittle);
  139 +
  140 + }
  141 +
  142 + // alert($rootScope.getLocalStorageValue("currentViewTitle"));
  143 +
  144 + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')
  145 + promise.then(
  146 + function (result) {
  147 + $scope.threeDAnatomyData = result;
  148 +
  149 + var clicked3dAview = [];
  150 + clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData)
  151 + .where('_id == ' + $scope.voId3D)
  152 + .select('_Title', '_3dimagepath');
  153 + $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath;
  154 + $scope.threeDBodySystemTitle = clicked3dAview[0]._Title;
  155 +
  156 + if (clicked3dAview.length > 0) {
  157 +
  158 + $rootScope.isLoading = false;
  159 + $('#spinner').css('visibility', 'hidden');
  160 +
  161 + $.jsPanel({
  162 + id: '3DImagePanel',
  163 + selector: '.threeDView',
  164 + theme: 'success',
  165 + currentController: '3dAController',
  166 + parentSlug: '3d-anatomy-list',
  167 + content: '<div class="col-sm-12">' +
  168 + '<object data="' + $scope.Selected3DImagePath + '" width="100%" height="800px" type="image/svg+xml"></object>' +
  169 + '</div><script>$(document).ready(function(){var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {var threeDivWidth = $("#ThreeDView").css("width");$("#ThreeDView").css({"left":"0px","width":"100%","min-idth": threeDivWidth}); var jspanelContainerWidth = $(".jsPanel-content").css("width"); $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth}); $("#3DImagePanel").css("width", "100%"); }});</script>',
  170 + title: $rootScope.getLocalStorageValue("currentViewTitle"),
  171 + position: {
  172 + top: 70,
  173 + left: 1,
  174 + },
  175 +
  176 + size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 },
  177 +
  178 + });
  179 +
  180 + $rootScope.currentSlug = '3d-anatomy-details';
  181 +
  182 + $rootScope.openViews.push(
  183 + {
  184 + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
  185 + "slug": $rootScope.currentSlug
  186 + });
  187 +
  188 +
  189 + }
  190 +
  191 +
  192 + },
  193 + function (error) {
  194 + // handle errors here
  195 + console.log(' $scope.CIllustrationData = ' + error.statusText);
  196 + }
  197 +
  198 + );
  199 + $('#ThreeDView').css("height", $(window).outerHeight());
  200 +
  201 + $('#ThreeDView').css("width", $(window).outerWidth());
  202 +
  203 + }
  204 +
  205 +
  206 +
  207 +}]
  208 +
  209 +
  210 +
211 ); 211 );
212 \ No newline at end of file 212 \ No newline at end of file
400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js
1 -var UpdatedGrayImageDataList = [];  
2 -var doneBRID = [];  
3 -var abc = 'hello';  
4 -  
5 -getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {  
6 - var matchedRGBLocationInBodyRegion = [];  
7 - var matched;  
8 -  
9 - for (var x = 0; x < maskCanvasData.length; x++)  
10 - {  
11 -  
12 - matched = false;  
13 - var bodyRegionId = maskCanvasData[x].bodyRegionId;  
14 - var canvasId = maskCanvasData[x].canvasId;  
15 - var maskData = maskCanvasData[x].maskData;  
16 -  
17 - var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1];  
18 - var grayImageDataVar// = grayImageDataList[bodyRegionId - 1];  
19 -  
20 - console.log('canvasId =' + canvasId)  
21 - //if (canvasId.match('_MR')) {  
22 - // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId];  
23 - // grayImageDataVar = grayImageMRDataList[bodyRegionId];  
24 - //}  
25 - //else {  
26 - coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1];  
27 - grayImageDataVar = grayImageDataList[bodyRegionId-1];  
28 - //}  
29 - console.log('grayImageDataVar= ' + grayImageDataVar)  
30 -  
31 - var counter = 0;  
32 -  
33 - var imageDataVar = maskData.data;  
34 -  
35 - var machLocationWP = new Worker('match-pixel-wp.js');  
36 -  
37 -  
38 - machLocationWP.postMessage({  
39 -  
40 - 'termList': termList,  
41 - 'maskCanvasData': maskData,  
42 - 'coloreImageData': coloredImageDataVar,  
43 - 'grayImageData': grayImageDataVar,  
44 - 'grayImageMRDataList': grayImageMRDataList,  
45 - 'bodyRegionId': bodyRegionId,  
46 - 'canvasId': canvasId  
47 -  
48 - });  
49 -  
50 - machLocationWP.onmessage = function (e) {  
51 -  
52 -  
53 -  
54 - doneBRID.push(e.data.bodyRegionId);  
55 - var canvasID = (e.data.canvasId).replace('_mci', '');  
56 -  
57 - UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value });  
58 -  
59 - //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value  
60 -  
61 -  
62 - if (doneBRID.length==9) {  
63 -  
64 - self.postMessage({  
65 - 'value': UpdatedGrayImageDataList,  
66 -  
67 - })  
68 - }  
69 -  
70 - };  
71 - machLocationWP.onerror = function (e) {  
72 - console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);  
73 - };  
74 -  
75 -  
76 - }  
77 -  
78 -  
79 -  
80 -  
81 -}  
82 -  
83 -self.onmessage = function (e) {  
84 - getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,  
85 - e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);  
86 -  
87 -}  
88 -  
89 - 1 +var UpdatedGrayImageDataList = [];
  2 +var doneBRID = [];
  3 +var abc = 'hello';
  4 +
  5 +getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) {
  6 + var matchedRGBLocationInBodyRegion = [];
  7 + var matched;
  8 +
  9 + for (var x = 0; x < maskCanvasData.length; x++)
  10 + {
  11 +
  12 + matched = false;
  13 + var bodyRegionId = maskCanvasData[x].bodyRegionId;
  14 + var canvasId = maskCanvasData[x].canvasId;
  15 + var maskData = maskCanvasData[x].maskData;
  16 +
  17 + var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1];
  18 + var grayImageDataVar// = grayImageDataList[bodyRegionId - 1];
  19 +
  20 + console.log('canvasId =' + canvasId)
  21 + //if (canvasId.match('_MR')) {
  22 + // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId];
  23 + // grayImageDataVar = grayImageMRDataList[bodyRegionId];
  24 + //}
  25 + //else {
  26 + coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1];
  27 + grayImageDataVar = grayImageDataList[bodyRegionId-1];
  28 + //}
  29 + console.log('grayImageDataVar= ' + grayImageDataVar)
  30 +
  31 + var counter = 0;
  32 +
  33 + var imageDataVar = maskData.data;
  34 +
  35 + var machLocationWP = new Worker('match-pixel-wp.js');
  36 +
  37 +
  38 + machLocationWP.postMessage({
  39 +
  40 + 'termList': termList,
  41 + 'maskCanvasData': maskData,
  42 + 'coloreImageData': coloredImageDataVar,
  43 + 'grayImageData': grayImageDataVar,
  44 + 'grayImageMRDataList': grayImageMRDataList,
  45 + 'bodyRegionId': bodyRegionId,
  46 + 'canvasId': canvasId
  47 +
  48 + });
  49 +
  50 + machLocationWP.onmessage = function (e) {
  51 +
  52 +
  53 +
  54 + doneBRID.push(e.data.bodyRegionId);
  55 + var canvasID = (e.data.canvasId).replace('_mci', '');
  56 +
  57 + UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value });
  58 +
  59 + //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value
  60 +
  61 +
  62 + if (doneBRID.length==9) {
  63 +
  64 + self.postMessage({
  65 + 'value': UpdatedGrayImageDataList,
  66 +
  67 + })
  68 + }
  69 +
  70 + };
  71 + machLocationWP.onerror = function (e) {
  72 + console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message);
  73 + };
  74 +
  75 +
  76 + }
  77 +
  78 +
  79 +
  80 +
  81 +}
  82 +
  83 +self.onmessage = function (e) {
  84 + getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList,
  85 + e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList);
  86 +
  87 +}
  88 +
  89 +