diff --git a/150-DOCUMENTATION/002-DBScripts/GetAllAvailableModules.sql b/150-DOCUMENTATION/002-DBScripts/GetAllAvailableModules.sql deleted file mode 100644 index f1a85cc..0000000 --- a/150-DOCUMENTATION/002-DBScripts/GetAllAvailableModules.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ================================================ --- Template generated from Template Explorer using: --- Create Procedure (New Menu).SQL --- --- Use the Specify Values for Template Parameters --- command (Ctrl-Shift-M) to fill in the parameter --- values below. --- --- This block of comments will not be included in --- the definition of the procedure. --- ================================================ -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO --- ============================================= --- Author: --- Create date: <07/18/2017> --- Description: --- ============================================= -CREATE PROCEDURE GetAllAvailableModules - -- Add the parameters for the stored procedure here -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - - -- Insert statements for procedure here - SELECT Title AS Name, Slug FROM ResourceModule -END -GO \ No newline at end of file diff --git a/150-DOCUMENTATION/002-DBScripts/GetAllModuleStatusWithSlug.sql b/150-DOCUMENTATION/002-DBScripts/GetAllModuleStatusWithSlug.sql new file mode 100644 index 0000000..dbc5717 --- /dev/null +++ b/150-DOCUMENTATION/002-DBScripts/GetAllModuleStatusWithSlug.sql @@ -0,0 +1,21 @@ +-- ============================================= +-- Author: +-- Create date: +-- Description: +-- ============================================= +CREATE PROCEDURE [dbo].[GetAllModuleStatusWithSlug] + -- Add the parameters for the stored procedure here + +AS +BEGIN + IF 1=0 BEGIN + SET FMTONLY OFF + END + -- SET NOCOUNT ON added to prevent extra result sets from + -- interfering with SELECT statements. + SET NOCOUNT ON; + + -- Insert statements for procedure here + SELECT ResourceModule.Id,ResourceModule.Title AS Name, ResourceModule.Slug + FROM ResourceModule +END \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 048d2b4..7b8fb88 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -55,7 +55,7 @@ namespace AIAHTML5.API.Models Hashtable userModuleHash = null; userModuleHash = new Hashtable(); - string sp = "GetAllAvailableModules"; + string sp = "GetAllModuleStatusWithSlug"; DataSet ds = DBModel.GetSQLData(sp, true); DataTable dt = ds.Tables[0]; @@ -155,59 +155,53 @@ namespace AIAHTML5.API.Models } } - if (objUser.LoginId != null) + else { - if (objUser.IsActive) + objUser = null; + } + + if (objUser != null) + { + + int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id); + if (licenseId != 0) { - if (objUser.UserType == User.SUPER_ADMIN) - { - objUser.Modules = objModel.GetUserModules(); - } - else - { - int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id); + objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId); + objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); + } + else + { + objUser.License = null; + } - if (licenseId != 0) + if (objUser.UserType == User.SUPER_ADMIN || objUser.UserType == User.GENERAL_ADMIN) + { + objUser.Modules = objModel.GetUserModules(); + } + else + { + if (objUser.License != null) + { + if (objUser.LicenseSubscriptions != null) { - objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId); - if (objUser.LicenseSubscriptions != null) + DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough; + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date > DateTime.Now.Date) { - DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough; - - objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId); - - if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date > DateTime.Now.Date) - { - if (objUser.License.IsActive) - { - ArrayList allModulesList = objModel.GetUserModules(); - ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId); - - ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList); - - objUser.Modules = userModuleList; - } - } - else - { - objUser.IsSubscriptionExpired = true; - objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString(); - } + ArrayList allModulesList = objModel.GetUserModules(); + ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId); + + ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList); + objUser.Modules = userModuleList; + } + else + { + objUser.IsSubscriptionExpired = true; + objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString(); } - } - else - { - objUser.Modules = null; - objUser = new User(); - objUser.License = null; } } } } - else - { - objUser = null; - } return objUser; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index cc9edf5..07f3b61 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -49,21 +49,25 @@ namespace AIAHTML5.API.Models { logger.Debug("userDetails.loginId= " + user.LoginId); // .loginId); - if (user.IsActive) - { - if (user.License != null) - { + //if (user.IsActive) + //{ + //if (user.UserType == User.SUPER_ADMIN) + //{ userDetails = JsonConvert.SerializeObject(user); - } - else - { - userDetails = AIAConstants.INVALID_USER; - } - } - else - { - userDetails = AIAConstants.INVALID_USER; - } + //} + //else if (user.License != null) + //{ + // userDetails = JsonConvert.SerializeObject(user); + //} + //else + //{ + // userDetails = AIAConstants.INVALID_USER; + //} + //} + //else + //{ + // userDetails = AIAConstants.INVALID_USER; + //} } else { diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 7d4244c..c030b00 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index f1ec074..9ac4aaa 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 1912bc0..5bae666 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -151,7 +151,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#messageModal").modal('show'); } else { - if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN)) { $rootScope.userData = result; $rootScope.userModules = result.Modules; @@ -160,7 +159,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); $('#dvUserModulesInfo').modal('show'); } - else if ((!result.IsSubscriptionExpired) && (result.License.IsActive)) { + //else if () + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) { $rootScope.userData = result; $rootScope.userModules = result.Modules; @@ -169,17 +169,39 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); $('#dvUserModulesInfo').modal('show'); } - else if ((result.IsSubscriptionExpired) && (result.License.IsActive)) { + else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) { + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; + $("#messageModal").modal('show'); + } + else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) { + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; + $("#messageModal").modal('show'); + } + else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } - else if ((result.IsSubscriptionExpired) && !(result.License.IsActive)) { + else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && result.IsActive) { $rootScope.isVisibleLogin = true; $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } + else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && !result.IsActive) { + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.'; + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; + $("#messageModal").modal('show'); + } + else if (result.License == null && !result.IsActive) { + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; + $("#messageModal").modal('show'); + } } } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 4c498a4..8bcb88d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -325,7 +325,8 @@ AIA.constant("LoginMessageConstants", { "PASSWORD_UPDATE_FAILED": "Password update failed", "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ", "LICENSE_INACTIVE_MESSAGE": "Your license is inactive.", - "INVALID_USER": "Invalid UserID" + "INVALID_USER": "Invalid UserID", + "USER_INACTIVE_MESSAGE": "User ID is inactive." //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", //"MAIL_NOT_SENT": "Mail not sent."