Commit 9903b566b82585e710964bb5c2d68b620eb90c5c

Authored by Utkarsh Singh
1 parent 9243b3c3

Committing updated files

150-DOCUMENTATION/002-DBScripts/GetAllAvailableModules.sql deleted
1 --- ================================================  
2 --- Template generated from Template Explorer using:  
3 --- Create Procedure (New Menu).SQL  
4 ---  
5 --- Use the Specify Values for Template Parameters  
6 --- command (Ctrl-Shift-M) to fill in the parameter  
7 --- values below.  
8 ---  
9 --- This block of comments will not be included in  
10 --- the definition of the procedure.  
11 --- ================================================  
12 -SET ANSI_NULLS ON  
13 -GO  
14 -SET QUOTED_IDENTIFIER ON  
15 -GO  
16 --- =============================================  
17 --- Author: <Utkarsh Singh>  
18 --- Create date: <07/18/2017>  
19 --- Description: <Get all available modules for user>  
20 --- =============================================  
21 -CREATE PROCEDURE GetAllAvailableModules  
22 - -- Add the parameters for the stored procedure here  
23 -AS  
24 -BEGIN  
25 - -- SET NOCOUNT ON added to prevent extra result sets from  
26 - -- interfering with SELECT statements.  
27 - SET NOCOUNT ON;  
28 -  
29 - -- Insert statements for procedure here  
30 - SELECT Title AS Name, Slug FROM ResourceModule  
31 -END  
32 -GO  
33 \ No newline at end of file 0 \ No newline at end of file
150-DOCUMENTATION/002-DBScripts/GetAllModuleStatusWithSlug.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <Author,,Name>
  3 +-- Create date: <Create Date,,>
  4 +-- Description: <Description,,>
  5 +-- =============================================
  6 +CREATE PROCEDURE [dbo].[GetAllModuleStatusWithSlug]
  7 + -- Add the parameters for the stored procedure here
  8 +
  9 +AS
  10 +BEGIN
  11 + IF 1=0 BEGIN
  12 + SET FMTONLY OFF
  13 + END
  14 + -- SET NOCOUNT ON added to prevent extra result sets from
  15 + -- interfering with SELECT statements.
  16 + SET NOCOUNT ON;
  17 +
  18 + -- Insert statements for procedure here
  19 + SELECT ResourceModule.Id,ResourceModule.Title AS Name, ResourceModule.Slug
  20 + FROM ResourceModule
  21 +END
0 \ No newline at end of file 22 \ No newline at end of file
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
@@ -55,7 +55,7 @@ namespace AIAHTML5.API.Models @@ -55,7 +55,7 @@ namespace AIAHTML5.API.Models
55 Hashtable userModuleHash = null; 55 Hashtable userModuleHash = null;
56 userModuleHash = new Hashtable(); 56 userModuleHash = new Hashtable();
57 57
58 - string sp = "GetAllAvailableModules"; 58 + string sp = "GetAllModuleStatusWithSlug";
59 59
60 DataSet ds = DBModel.GetSQLData(sp, true); 60 DataSet ds = DBModel.GetSQLData(sp, true);
61 DataTable dt = ds.Tables[0]; 61 DataTable dt = ds.Tables[0];
@@ -155,59 +155,53 @@ namespace AIAHTML5.API.Models @@ -155,59 +155,53 @@ namespace AIAHTML5.API.Models
155 } 155 }
156 } 156 }
157 157
158 - if (objUser.LoginId != null) 158 + else
159 { 159 {
160 - if (objUser.IsActive) 160 + objUser = null;
  161 + }
  162 +
  163 + if (objUser != null)
  164 + {
  165 +
  166 + int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id);
  167 + if (licenseId != 0)
161 { 168 {
162 - if (objUser.UserType == User.SUPER_ADMIN)  
163 - {  
164 - objUser.Modules = objModel.GetUserModules();  
165 - }  
166 - else  
167 - {  
168 - int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id); 169 + objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId);
  170 + objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId);
  171 + }
  172 + else
  173 + {
  174 + objUser.License = null;
  175 + }
169 176
170 - if (licenseId != 0) 177 + if (objUser.UserType == User.SUPER_ADMIN || objUser.UserType == User.GENERAL_ADMIN)
  178 + {
  179 + objUser.Modules = objModel.GetUserModules();
  180 + }
  181 + else
  182 + {
  183 + if (objUser.License != null)
  184 + {
  185 + if (objUser.LicenseSubscriptions != null)
171 { 186 {
172 - objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId);  
173 - if (objUser.LicenseSubscriptions != null) 187 + DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough;
  188 + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date > DateTime.Now.Date)
174 { 189 {
175 - DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough;  
176 -  
177 - objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId);  
178 -  
179 - if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date > DateTime.Now.Date)  
180 - {  
181 - if (objUser.License.IsActive)  
182 - {  
183 - ArrayList allModulesList = objModel.GetUserModules();  
184 - ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId);  
185 -  
186 - ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList);  
187 -  
188 - objUser.Modules = userModuleList;  
189 - }  
190 - }  
191 - else  
192 - {  
193 - objUser.IsSubscriptionExpired = true;  
194 - objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString();  
195 - } 190 + ArrayList allModulesList = objModel.GetUserModules();
  191 + ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId);
  192 +
  193 + ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList);
  194 + objUser.Modules = userModuleList;
  195 + }
  196 + else
  197 + {
  198 + objUser.IsSubscriptionExpired = true;
  199 + objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString();
196 } 200 }
197 - }  
198 - else  
199 - {  
200 - objUser.Modules = null;  
201 - objUser = new User();  
202 - objUser.License = null;  
203 } 201 }
204 } 202 }
205 } 203 }
206 } 204 }
207 - else  
208 - {  
209 - objUser = null;  
210 - }  
211 205
212 return objUser; 206 return objUser;
213 } 207 }
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
@@ -49,21 +49,25 @@ namespace AIAHTML5.API.Models @@ -49,21 +49,25 @@ namespace AIAHTML5.API.Models
49 { 49 {
50 logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); 50 logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId);
51 51
52 - if (user.IsActive)  
53 - {  
54 - if (user.License != null)  
55 - { 52 + //if (user.IsActive)
  53 + //{
  54 + //if (user.UserType == User.SUPER_ADMIN)
  55 + //{
56 userDetails = JsonConvert.SerializeObject(user); 56 userDetails = JsonConvert.SerializeObject(user);
57 - }  
58 - else  
59 - {  
60 - userDetails = AIAConstants.INVALID_USER;  
61 - }  
62 - }  
63 - else  
64 - {  
65 - userDetails = AIAConstants.INVALID_USER;  
66 - } 57 + //}
  58 + //else if (user.License != null)
  59 + //{
  60 + // userDetails = JsonConvert.SerializeObject(user);
  61 + //}
  62 + //else
  63 + //{
  64 + // userDetails = AIAConstants.INVALID_USER;
  65 + //}
  66 + //}
  67 + //else
  68 + //{
  69 + // userDetails = AIAConstants.INVALID_USER;
  70 + //}
67 } 71 }
68 else 72 else
69 { 73 {
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -151,7 +151,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -151,7 +151,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
151 $("#messageModal").modal('show'); 151 $("#messageModal").modal('show');
152 } 152 }
153 else { 153 else {
154 -  
155 if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN)) { 154 if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN)) {
156 $rootScope.userData = result; 155 $rootScope.userData = result;
157 $rootScope.userModules = result.Modules; 156 $rootScope.userModules = result.Modules;
@@ -160,7 +159,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -160,7 +159,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
160 localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); 159 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
161 $('#dvUserModulesInfo').modal('show'); 160 $('#dvUserModulesInfo').modal('show');
162 } 161 }
163 - else if ((!result.IsSubscriptionExpired) && (result.License.IsActive)) { 162 + //else if ()
  163 + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
164 164
165 $rootScope.userData = result; 165 $rootScope.userData = result;
166 $rootScope.userModules = result.Modules; 166 $rootScope.userModules = result.Modules;
@@ -169,17 +169,39 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -169,17 +169,39 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
169 localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); 169 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
170 $('#dvUserModulesInfo').modal('show'); 170 $('#dvUserModulesInfo').modal('show');
171 } 171 }
172 - else if ((result.IsSubscriptionExpired) && (result.License.IsActive)) { 172 + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) {
  173 + $rootScope.isVisibleLogin = true;
  174 + $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
  175 + $("#messageModal").modal('show');
  176 + }
  177 + else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
  178 + $rootScope.isVisibleLogin = true;
  179 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  180 + $("#messageModal").modal('show');
  181 + }
  182 + else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) {
173 $rootScope.isVisibleLogin = true; 183 $rootScope.isVisibleLogin = true;
174 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; 184 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  185 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
175 $("#messageModal").modal('show'); 186 $("#messageModal").modal('show');
176 } 187 }
177 - else if ((result.IsSubscriptionExpired) && !(result.License.IsActive)) { 188 + else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && result.IsActive) {
178 $rootScope.isVisibleLogin = true; 189 $rootScope.isVisibleLogin = true;
179 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; 190 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
180 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; 191 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
181 $("#messageModal").modal('show'); 192 $("#messageModal").modal('show');
182 } 193 }
  194 + else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && !result.IsActive) {
  195 + $rootScope.isVisibleLogin = true;
  196 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  197 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
  198 + $("#messageModal").modal('show');
  199 + }
  200 + else if (result.License == null && !result.IsActive) {
  201 + $rootScope.isVisibleLogin = true;
  202 + $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
  203 + $("#messageModal").modal('show');
  204 + }
183 } 205 }
184 } 206 }
185 207
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -325,7 +325,8 @@ AIA.constant(&quot;LoginMessageConstants&quot;, { @@ -325,7 +325,8 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
325 "PASSWORD_UPDATE_FAILED": "Password update failed", 325 "PASSWORD_UPDATE_FAILED": "Password update failed",
326 "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ", 326 "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ",
327 "LICENSE_INACTIVE_MESSAGE": "Your license is inactive.", 327 "LICENSE_INACTIVE_MESSAGE": "Your license is inactive.",
328 - "INVALID_USER": "Invalid UserID" 328 + "INVALID_USER": "Invalid UserID",
  329 + "USER_INACTIVE_MESSAGE": "User ID is inactive."
329 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", 330 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
330 //"MAIL_NOT_SENT": "Mail not sent." 331 //"MAIL_NOT_SENT": "Mail not sent."
331 332