Commit ae69815144fb9ad932201709a67b9b89571551bd

Authored by Nikita Kulshreshtha
2 parents c4b04495 282f9e5d

merged RestructuredCode branch

Showing 30 changed files with 2636 additions and 706 deletions
150-DOCUMENTATION/002-DBScripts/DeleteIncorretLoginAttempts.sql 0 → 100644
  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: <EBIX SOFTWARE INDIA PVT. LTD>
  18 +-- Create date: <7/27/2017>
  19 +-- Description: <Description,,>
  20 +-- =============================================
  21 +CREATE PROCEDURE DeleteIncorrectLoginAttempts
  22 + -- Add the parameters for the stored procedure here
  23 + @iUserId INT
  24 +AS
  25 +BEGIN
  26 + -- SET NOCOUNT ON added to prevent extra result sets from
  27 + -- interfering with SELECT statements.
  28 + SET NOCOUNT OFF;
  29 +
  30 + -- Insert statements for procedure here
  31 + DELETE from IncorrectLoginAttempts where UserId =@iUserId
  32 +END
  33 +GO
0 34 \ No newline at end of file
... ...
150-DOCUMENTATION/002-DBScripts/GetAllLoginFailureCauses.sql 0 → 100644
  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: <EBIX SOFTWARE INDIA PVT. LTD.>
  18 +-- Create date: <07/31/2017>
  19 +-- Description: <Description,,>
  20 +-- =============================================
  21 +CREATE PROCEDURE GetAllLoginFailureCauses
  22 + -- Add the parameters for the stored procedure here
  23 +
  24 +AS
  25 +BEGIN
  26 + -- SET NOCOUNT ON added to prevent extra result sets from
  27 + -- interfering with SELECT statements.
  28 + SET NOCOUNT ON;
  29 +
  30 + -- Insert statements for procedure here
  31 + SELECT lfc.Id, lfc.Description FROM LoginFailureCause lfc
  32 +END
  33 +GO
... ...
150-DOCUMENTATION/002-DBScripts/GetBlockedUserByUserId.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <>
  3 +-- Create date: <>
  4 +-- Description: <Description,,>
  5 +-- =============================================
  6 +CREATE PROCEDURE GetBlockedUserByUserId
  7 + -- Add the parameters for the stored procedure here
  8 + @userId int
  9 +AS
  10 +BEGIN
  11 + -- returns the metadata
  12 + IF 1=0 BEGIN
  13 + SET FMTONLY OFF
  14 + END
  15 + SELECT DISTINCT
  16 + AIAUser.Id,
  17 + AIAUser.FirstName,
  18 + AIAUser.LastName,
  19 + AIAUser.LoginId,
  20 + AIAUser.Password,
  21 + AIAUser.EmailId,
  22 + ISNULL(License.AccountNumber,'') AccountNumber,
  23 + IncorrectLoginAttempts.LoginTime
  24 + FROM
  25 + IncorrectLoginAttempts
  26 + INNER JOIN AIAUser ON IncorrectLoginAttempts.UserId = AIAUser.Id
  27 + INNER JOIN UserType ON AIAUser.UserTypeId = UserType.Id
  28 + LEFT JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId
  29 + LEFT JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id
  30 + LEFT JOIN License ON LicenseToEdition.LicenseId = License.Id
  31 + WHERE
  32 + IncorrectLoginAttempts.CntIncorrectLogins >= 5
  33 + AND AIAUser.Id = @userId
  34 + --AND UserType.Priority >= (SELECT UserType.Priority FROM UserType WHERE UserType.Id=@iUserTypeId)
  35 + --AND ((@iLicenseId =0) OR (License.Id = @iLicenseId))
  36 + --AND License.IsActive = 1
  37 +END
0 38 \ No newline at end of file
... ...
150-DOCUMENTATION/002-DBScripts/GetLicenseDetailByUserId.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <EBIX SOFTWARE INDIA PVT. LTD.>
  3 +-- Create date: <07/31/2017>
  4 +-- Description: <Description,,>
  5 +-- =============================================
  6 +CREATE PROCEDURE GetLicenseDetailByUserId
  7 + -- Add the parameters for the stored procedure here
  8 + @iUserId int
  9 +AS
  10 +BEGIN
  11 + -- SET NOCOUNT ON added to prevent extra result sets from
  12 + -- interfering with SELECT statements.
  13 + SET NOCOUNT ON;
  14 +
  15 + -- Insert statements for procedure here
  16 + SELECT LicenseId, EditionId FROM LicenseToEdition
  17 + INNER JOIN AIAUserToLicenseEdition on AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id
  18 + WHERE AIAUserToLicenseEdition.UserId = @iUserId
  19 +END
0 20 \ No newline at end of file
... ...
150-DOCUMENTATION/002-DBScripts/GetUserDetailsByLoginId.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <EBIX SOFTWARE INDIA PVT. LTD.>
  3 +-- Create date: <07/18/2017>
  4 +-- Description: <Gets user details based on loginId>
  5 +-- =============================================
  6 +CREATE PROCEDURE GetUserDetailsByLoginId
  7 + -- Add the parameters for the stored procedure here
  8 + @sLoginId VARCHAR(50)
  9 +AS
  10 +BEGIN
  11 + -- SET NOCOUNT ON added to prevent extra result sets from
  12 + -- interfering with SELECT statements.
  13 + SET NOCOUNT OFF;
  14 +
  15 + -- Insert statements for procedure here
  16 + SELECT CreationDate, CreatorId, DeactivationDate, EmailId, FirstName, Id, IsActive, LastName, LoginId, ModifiedDate, ModifierId, Password, SecurityAnswer, SecurityQuestionId, UserTypeId FROM AIAUser WHERE (LoginId = @sLoginId)
  17 +
  18 +END
  19 +
0 20 \ No newline at end of file
... ...
150-DOCUMENTATION/002-DBScripts/GetUserModulesByLicenseId.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <Author,,Name>
  3 +-- Create date: <Create Date,,>
  4 +-- Description: <Description,,>
  5 +-- =============================================
  6 +CREATE PROCEDURE [dbo].[GetUserModulesByLicenseId]
  7 + -- Add the parameters for the stored procedure here
  8 + @iLicenseId int
  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, ResourceModule.Slug
  20 + FROM ResourceModule
  21 + INNER JOIN ModuleToLicense ON ResourceModule.Id = ModuleToLicense.ModuleId
  22 + WHERE ModuleToLicense.Status = 1
  23 + AND ModuleToLicense.LicenseId = @iLicenseId
  24 +
  25 +END
0 26 \ No newline at end of file
... ...
150-DOCUMENTATION/002-DBScripts/InsertIncorrectLoginAttempts.sql 0 → 100644
  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: <7/27/2017>
  19 +-- Description: <Description,,>
  20 +-- =============================================
  21 +CREATE PROCEDURE InsertIncorrectLoginAttempts
  22 + -- Add the parameters for the stored procedure here
  23 + @iUserId INT
  24 +AS
  25 +BEGIN
  26 + -- SET NOCOUNT ON added to prevent extra result sets from
  27 + -- interfering with SELECT statements.
  28 + SET NOCOUNT ON;
  29 +
  30 + -- Insert statements for procedure here
  31 + INSERT into IncorrectLoginAttempts ([UserId] , LoginTime , CntIncorrectLogins) values (@iUserId, getdate(), 1)
  32 +END
  33 +GO
... ...
150-DOCUMENTATION/002-DBScripts/InsertLoginDetail.sql 0 → 100644
  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: <Author,,Name>
  18 +-- Create date: <Create Date,,>
  19 +-- Description: <Description,,>
  20 +-- =============================================
  21 +CREATE PROCEDURE InsertLoginDetail
  22 + -- Add the parameters for the stored procedure here
  23 + @iUserId INT
  24 +AS
  25 +BEGIN
  26 + -- SET NOCOUNT ON added to prevent extra result sets from
  27 + -- interfering with SELECT statements.
  28 + SET NOCOUNT ON;
  29 +
  30 + -- Insert statements for procedure here
  31 + INSERT INTO LoginDetail (UserId, LoginTime) VALUES (@iUserId, GETDATE())
  32 +END
  33 +GO
... ...
150-DOCUMENTATION/002-DBScripts/UpdateIncorrectLoginAttempts.sql 0 → 100644
  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: <Author,,Name>
  18 +-- Create date: <Create Date,,>
  19 +-- Description: <Description,,>
  20 +-- =============================================
  21 +CREATE PROCEDURE UpdateIncorrectLoginAttempts
  22 + -- Add the parameters for the stored procedure here
  23 + @iUserId INT
  24 +AS
  25 +BEGIN
  26 + -- SET NOCOUNT ON added to prevent extra result sets from
  27 + -- interfering with SELECT statements.
  28 + SET NOCOUNT OFF;
  29 +
  30 + -- Insert statements for procedure here
  31 + UPDATE IncorrectLoginAttempts set LoginTime = getdate(), CntIncorrectLogins = CntIncorrectLogins+1 where UserId = @iUserId
  32 +END
  33 +GO
... ...
150-DOCUMENTATION/002-DBScripts/UpdateLicenseTermAcceptedStatus.sql 0 → 100644
  1 +-- =============================================
  2 +-- Author: <Utkarsh Singh>
  3 +-- Create date: <07/21/2017>
  4 +-- Description: <Updates isTermAccepted field of License table >
  5 +-- =============================================
  6 +CREATE PROCEDURE UpdateLicenseTermAcceptedStatus
  7 + -- Add the parameters for the stored procedure here
  8 + @sAccountNumber char(16)
  9 +AS
  10 +BEGIN
  11 + -- SET NOCOUNT ON added to prevent extra result sets from
  12 + -- interfering with SELECT statements.
  13 + SET NOCOUNT OFF;
  14 +
  15 + -- Insert statements for procedure here
  16 + UPDATE License SET IsTermsAccepted =1 WHERE AccountNumber = @sAccountNumber
  17 +END
0 18 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... ... @@ -100,6 +100,7 @@
100 100 <Content Include="index.html" />
101 101 <Content Include="Templates\forgot-Password.html" />
102 102 <Content Include="Templates\forgot-UserId.html" />
  103 + <Content Include="Templates\unblock-User.html" />
103 104 <Content Include="Web.config">
104 105 <SubType>Designer</SubType>
105 106 </Content>
... ... @@ -107,12 +108,15 @@
107 108 <ItemGroup>
108 109 <Compile Include="App_Start\WebApiConfig.cs" />
109 110 <Compile Include="Constants\AIAConstants.cs" />
  111 + <Compile Include="Constants\DBConstants.cs" />
  112 + <Compile Include="Constants\ErrorHelper.cs" />
110 113 <Compile Include="Controllers\AdminAccessController.cs" />
111 114 <Compile Include="Controllers\AuthenticateController.cs" />
112 115 <Compile Include="Controllers\ForgotUserController.cs" />
113 116 <Compile Include="Controllers\LicenseTermConditionController.cs" />
114 117 <Compile Include="Controllers\PixelLocationsController.cs" />
115 118 <Compile Include="Controllers\ResetPasswordController.cs" />
  119 + <Compile Include="Controllers\UnblockUserController.cs" />
116 120 <Compile Include="Global.asax.cs">
117 121 <DependentUpon>Global.asax</DependentUpon>
118 122 </Compile>
... ...
400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... ... @@ -11,11 +11,13 @@ namespace AIAHTML5.API.Constants
11 11 public const string USER_NOT_FOUND = "User not found.";
12 12 public const string MAIL_NOT_SENT = "Mail not sent.";
13 13 public const string MAIL_SENT = "Mail sent.";
  14 + public const string SQL_CONNECTION_ERROR = "SQL Connection Error";
14 15  
15 16 public const string KEY_ID = "id";
16 17 public const string KEY_TITLE = "title";
17 18 public const string KEY_NAME = "name";
18 19 public const string KEY_SLUG = "slug";
  20 + public const string KEY_DESCRIPTION = "Description";
19 21  
20 22 public const string PASSWORD_UPDATE_SUCCESS = "Password updated successfully";
21 23 public const string PASSWORD_UPDATE_FAILED = "Password update failed";
... ... @@ -26,5 +28,12 @@ namespace AIAHTML5.API.Constants
26 28 public const string LICENSE_TERM_CONDITION_UPDATE_FAILED = "License Term Accepted field update failed.";
27 29  
28 30 public const string KEY_CONTENT = "content";
  31 +
  32 + public const string LICENSE_KEY_ID = "LicenseId";
  33 + public const string EDITION_KEY_ID = "EditionId";
  34 +
  35 + public const string USER_UNBLOCK_SUCCESS = "User unblocked";
  36 + public const string USER_UNBLOCK_FAILED = "Unblock operation failed";
  37 + public const string USER_ALREADY_UNBLOCKED = "User already unblocked.";
29 38 }
30 39 }
31 40 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs 0 → 100644
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Web;
  5 +
  6 +namespace AIAHTML5.API.Constants
  7 +{
  8 + public class DBConstants
  9 + {
  10 + public const string GET_ALL_MODULES = "GetAllModuleStatusWithSlug";
  11 + public const string GET_USER_DELAILS_BY_LOGIN_ID = "GetUserDetailsByLoginId";
  12 + public const string GET_LICENSE_DETAILS_BY_USER_ID = "GetLicenseDetailByUserId";
  13 + public const string GET_USER_MODULES_BY_LICENSE_ID = "GetUserModulesByLicenseId";
  14 + public const string GET_USER_DETAILS_BY_EMAILID = "GetUserInfoByEmailId";
  15 +
  16 + public const string UPDATE_USER_PASSWORD = "UpdateUserPassword";
  17 + public const string GET_SUBSCRIPTION_DETAILS_BY_LICENSE_ID = "GetSubscriptionDetailsByLicenseId";
  18 + public const string GET_LICENSE_DETAILS_BY_ID = "GetLicenseDetailsById";
  19 + public const string UPDATE_LICENSE_TERM_STATUS = "UpdateLicenseTermAcceptedStatus";
  20 + public const string GET_TERMS_OF_SERVICE_TEXT = "GetTermsOfServiceText";
  21 + public const string INSERT_LOGIN_DETAIL = "InsertLoginDetail";
  22 + public const string INSERT_INCORRECT_LOGIN_ATTEMPTS = "InsertIncorrectLoginAttempt";
  23 + public const string GET_INCORRECT_LOGIN_ATTEMPTS = "GetIncorrectLoginAttempt";
  24 + public const string UPDATE_INCORRECT_LOGIN_ATTEMPTS = "UpdateIncorrectLoginAttempts";
  25 + public const string DELETE_INCORRECT_LOGIN_ATTEMPTS = "DeleteIncorrectLoginAttempts";
  26 + public const string GET_ALL_LOGIN_FAILURE_CAUSES = "GetAllLoginFailureCauses";
  27 + public const string INSERT_LOGIN_ERROR_LOG = "InsertLoginErrorLog";
  28 + public const string GET_BLOCKED_USER_BY_USER_ID = "GetBlockedUserByUserId";
  29 + public const string GET_BLOCKED_USERS_BY_USER_TYPE = "GetBlockedUserByUserType";
  30 + }
  31 +}
0 32 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Constants/ErrorHelper.cs 0 → 100644
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Collections;
  4 +using System.Linq;
  5 +using System.Web;
  6 +
  7 +namespace AIAHTML5.API.Constants
  8 +{
  9 + /// <summary>
  10 + /// This class is used to provide error description. This class contain
  11 + /// different type of error code and its description.
  12 + /// </summary>
  13 + public class ErrorHelper
  14 + {
  15 + private static ErrorHelper _instance;
  16 + private Hashtable objHash = new Hashtable();
  17 +
  18 +
  19 + /* error Id Const */
  20 + public const Int16 E_NO_ERROR = 0;
  21 + public const Int16 E_USER_NOT_EXIST = 1;
  22 + public const Int16 E_PASSWORD_NOT_MATCH = 2;
  23 + public const Int16 E_USER_ID_BLOCKED_24_HRS = 3;
  24 + public const Int16 E_USER_NOT_ACTIVE = 4;
  25 + public const Int16 E_USER_ID_WILL_BLOCKED = 5;
  26 + public const Int16 E_EMAIL_ID_NOT_EXIT = 6;
  27 + public const Int16 E_LICENCE_IS_INACTIVE = 7;
  28 + public const Int16 E_USER_NOT_MAP_TO_LICENCE_EDITION = 8;
  29 + public const Int16 E_NO_ROW_FOUND_LICENCE_TO_EDITION_TABLE = 9;
  30 + public const Int16 E_NO_ROW_FOUND_LICENCE_TABLE = 10;
  31 + public const Int16 E_SECURITY_QUEST_NOT_MATCH = 11;
  32 + public const Int16 E_SEQURITY_ANSWER_NOT_MATCH = 12;
  33 + public const Int16 E_FORGOT_USER_ID_EMAIL_ID_NOT_EXIT = 13;
  34 + public const Int16 E_TOTAL_NUMBER_LOGIN_EXCEED = 14;
  35 + public const Int16 E_FORGOT_PASSWORD_EMAIL_ID_NOT_EXIST = 15;
  36 + public const Int16 E_TEST_SETUP_ACCOUNT_USER_NAME_EXIST = 16;
  37 + public const Int16 E_TEST_SETUP_ACCOUNT_EMAILID_EXIST = 17;
  38 + public const Int16 E_SP_ERROR = 18;
  39 + public const Int16 E_ACCOUNT_NUMBER_NOT_EXIST = 19;
  40 + public const Int16 E_ACCOUNT_NUMBER_ALREADY_EXIST = 20;
  41 + public const Int16 E_TEST_ACCOUNT_CREATED_MAIL_COULD_NOT_SENT = 21;
  42 + public const Int16 E_MAIL_COULD_NOT_SENT = 22;
  43 + public const Int16 E_RESELLER_ACCOUNT_CREATED_MAIL_COULD_NOT_SENT = 23;
  44 + public const Int16 E_LICENSE_TERM_CONDITION = 24;
  45 + public const Int16 E_EDITION_NOT_LINKED_WITH_SITE = 25;
  46 + public const Int16 E_LOGIN_SESSION_EXPIRE = 26;
  47 + public const Int16 E_DISCOUNT_CODE_NOT_EXIST = 27;
  48 + public const Int16 E_DISCOUNT_CODE_ALREADY_EXIST = 28;
  49 +
  50 + public const Int16 E_SITE_IP_NOT_NULL = 29;
  51 + public const Int16 E_EDITION_ID_NOT_NULL = 30;
  52 + public const Int16 E_MASTER_SITEIP_NOT_EXIST = 31;
  53 + public const Int16 EDITION_ID_NOT_EXIST = 32;
  54 + public const Int16 E_ERROR_LOG = 33;
  55 + public const Int16 E_MASTER_SITE_ALREADY_EXIST = 34;
  56 + public const Int16 E_ACCOUNT_NUMBER_NOT_NULL = 35;
  57 + public const Int16 E_SITE_IP_ALREADY_EXIST = 36;
  58 +
  59 +
  60 + public const Int16 E_LICENCE_IS_EXPIRED = 37;
  61 + public const Int16 E_SINGLEACCOUNT_IS_BEING_USED = 38;
  62 +
  63 +
  64 + public const Int16 E_DATA_BASE_CONNECTION = 4060;
  65 +
  66 +
  67 + //login failure error constant
  68 + public const int ACCOUNT_NUMBER_NOT_NULL = 4;
  69 + public const int EDITION_ID_NOT_NULL = 5;
  70 + public const int ACCOUNT_NUMBER_NOT_EXIST = 1;
  71 + public const int EDITION_NOT_EXIST = 3;
  72 + public const int MASTER_SITEIP_NOT_EXIST = 2;
  73 + public const int LICENSE_INACTIVE = 6;
  74 +
  75 +
  76 + /// <summary>
  77 + /// constructor
  78 + /// </summary>
  79 + private ErrorHelper()
  80 + {
  81 + objHash.Add(E_NO_ERROR, "No Error.");
  82 + objHash.Add(E_USER_NOT_EXIST, "Invalid User ID.");
  83 + objHash.Add(E_PASSWORD_NOT_MATCH, "Invalid Password. User ID and password will be disabled if your password is entered incorrectly for five consecutive attempts. If you have forgotten your password, please click on the forgot password link. ");
  84 + objHash.Add(E_USER_ID_BLOCKED_24_HRS, "User Id is blocked.");
  85 + objHash.Add(E_USER_NOT_ACTIVE, "User Id is Inactive.");
  86 + objHash.Add(E_USER_ID_WILL_BLOCKED, "Invalid Password. Your login will be blocked for a day if you enter wrong password one more time. Click on forgot password link if you have forgotten your password. ");
  87 + objHash.Add(E_EMAIL_ID_NOT_EXIT, "Invalid e-mail ID. If you do not know your correct e-mail ID please contact A.D.A.M. technical support at techsupport@adamcorp.com or your institution's site administrator. ");
  88 + objHash.Add(E_LICENCE_IS_INACTIVE, "Your Licence Is inactive.");
  89 + objHash.Add(E_USER_NOT_MAP_TO_LICENCE_EDITION, "User is not mapped with licence edition.");
  90 + objHash.Add(E_NO_ROW_FOUND_LICENCE_TO_EDITION_TABLE, "No row found in Licence to edition table.");
  91 + objHash.Add(E_NO_ROW_FOUND_LICENCE_TABLE, "No row found in Licence table.");
  92 + objHash.Add(E_SECURITY_QUEST_NOT_MATCH, "Your security question is incorrect. ");
  93 + objHash.Add(E_SEQURITY_ANSWER_NOT_MATCH, "Your answer is incorrect. ");
  94 + objHash.Add(E_FORGOT_USER_ID_EMAIL_ID_NOT_EXIT, "Invalid e-mail ID. If you do not know your correct e-mail ID please contact A.D.A.M. technical support at {0} or your institution's site administrator. ");
  95 + //objHash.Add(E_TOTAL_NUMBER_LOGIN_EXCEED, "User ID and password has been accessed by another user. Your session is currently timed out.");
  96 + objHash.Add(E_TOTAL_NUMBER_LOGIN_EXCEED, "Currently all licenses are in use. Any account that improperly logged out should automatically reset within 5 minutes.");
  97 + objHash.Add(E_FORGOT_PASSWORD_EMAIL_ID_NOT_EXIST, "Invalid e-mail ID. Please be sure to enter the e-mail ID used when you registered your license. ");
  98 + objHash.Add(E_TEST_SETUP_ACCOUNT_USER_NAME_EXIST, "User Name already exist in system.");
  99 + objHash.Add(E_TEST_SETUP_ACCOUNT_EMAILID_EXIST, "Email Id already exist system.");
  100 + objHash.Add(E_SP_ERROR, "Error occured in store procedure.");
  101 + objHash.Add(E_ACCOUNT_NUMBER_NOT_EXIST, "Account Number does not exist in the system. ");
  102 + objHash.Add(E_ACCOUNT_NUMBER_ALREADY_EXIST, "Account Number already exist in the system.");
  103 + objHash.Add(E_TEST_ACCOUNT_CREATED_MAIL_COULD_NOT_SENT, "Test account has been created. Account number is: {0}. Mail could not be sent due to some mail server error. ");
  104 + objHash.Add(E_MAIL_COULD_NOT_SENT, "Mail could not sent due to some mail server error.");
  105 + objHash.Add(E_RESELLER_ACCOUNT_CREATED_MAIL_COULD_NOT_SENT, "Licenses Have been created. Mail could not be sent due to some mail server error. ");
  106 + objHash.Add(E_LICENSE_TERM_CONDITION, "Your license is not enabled yet. Please contact your administrator to accept the term & condition.");
  107 + objHash.Add(E_EDITION_NOT_LINKED_WITH_SITE, "Your credentials are invalid. Please contact the site administrator of your institution or contact A.D.A.M. technical support at techsupport@adamcorp.com. ");
  108 + objHash.Add(E_LOGIN_SESSION_EXPIRE, "Your session has expired. Please log in.");
  109 + objHash.Add(E_DISCOUNT_CODE_NOT_EXIST, "Discount code not exist in the system.");
  110 + objHash.Add(E_DISCOUNT_CODE_ALREADY_EXIST, "Discount code already exist in the system.");
  111 + objHash.Add(E_SITE_IP_NOT_NULL, "SiteIP cannot be null.");
  112 + objHash.Add(E_DATA_BASE_CONNECTION, "Could not connect to Database.");
  113 + objHash.Add(E_EDITION_ID_NOT_NULL, "Edition Id cannot be zero.");
  114 + objHash.Add(E_MASTER_SITEIP_NOT_EXIST, "Master Site IP does not exist in the system.");
  115 + objHash.Add(EDITION_ID_NOT_EXIST, "Edition ID does not exist in the system.");
  116 + objHash.Add(E_ERROR_LOG, "Problem in database.");
  117 + objHash.Add(E_MASTER_SITE_ALREADY_EXIST, "Account already created from this URL.");
  118 + objHash.Add(E_ACCOUNT_NUMBER_NOT_NULL, "Account number cannot be null.");
  119 + objHash.Add(E_SITE_IP_ALREADY_EXIST, "Site IP already exist.");
  120 + objHash.Add(E_LICENCE_IS_EXPIRED, "Your licence is expired since {licenseExpirationDate}.");
  121 + objHash.Add(E_SINGLEACCOUNT_IS_BEING_USED, "This account is currently locked due to improper logout or another active browser session. The account should automatically reset within 5 minutes.");
  122 + }
  123 + /// <summary>
  124 + /// This method checks if instance of ErrorHelper class is exist then it returns
  125 + /// the exist instance else it creates the ErrorHelper class instance and return it.
  126 + /// </summary>
  127 + /// <returns>ErrorHelper instance</returns>
  128 + public static ErrorHelper GetInstance()
  129 + {
  130 + if (_instance == null)
  131 + {
  132 + _instance = new ErrorHelper();
  133 + }
  134 + return _instance;
  135 + }
  136 + }
  137 +}
0 138 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -8,6 +8,8 @@ using System.Net.Http;
8 8 using System.Web.Http;
9 9 using log4net;
10 10 using AIAHTML5.API.Constants;
  11 +using AIAHTML5.API.Models;
  12 +using System.Collections;
11 13  
12 14 namespace AIAHTML5.API.Controllers
13 15 {
... ... @@ -31,28 +33,336 @@ namespace AIAHTML5.API.Controllers
31 33 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
32 34 logger.Debug("inside POST");
33 35  
34   - bool isUserAuthenticatedByDefault = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["isUserAuthenticated"]);
35   - if (isUserAuthenticatedByDefault)
36   - {
37   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("true") };
  36 + dynamic authenticationRepsonse;
38 37  
39   - }
40   - else
  38 + try
41 39 {
42 40  
43   - dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.GetUserDetailsForAuthenticatedUser(credentials);
44   - if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
  41 + //01.get the user detail for autheticate user
  42 + User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials);
  43 +
  44 + if (userInfo.Id > 0)
45 45 {
46   - //string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse);
47   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
  46 + // Check user is authenticated or not by login credential macth
  47 + bool isUserAuthenticated = AIAHTML5.API.Models.Users.IsUserAuthenticated(credentials, userInfo);
  48 +
  49 + // check if user is blocked
  50 + DateTime blockTime;
  51 + bool isUserBlocked = AIAHTML5.API.Models.Users.isUserBlocked(userInfo.Id, out blockTime);
  52 +
  53 + if (isUserAuthenticated && !isUserBlocked)
  54 + {
  55 + //01. Get User details
  56 + //userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials);
  57 +
  58 + //02. assigning isCorrectPassword to true 'required for internal processing'
  59 + userInfo.IsCorrectPassword = true;
  60 +
  61 + //04.delete past wrong login attempts of user
  62 + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);
  63 + if (wrongAttemptDeteledCount < 0)
  64 + {
  65 + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
  66 + }
  67 +
  68 + //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads
  69 + if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN || userInfo.UserType == AIAHTML5.API.Models.User.GENERAL_ADMIN)
  70 + {
  71 + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList();
  72 +
  73 + //Insert user login detail
  74 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  75 + }
  76 + else
  77 + {
  78 + //05.1 For normal user need to get the license details, get the license id for authenticated user
  79 + int licenseId, editionId;
  80 + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);
  81 +
  82 + userInfo.LicenseId = licenseId;
  83 + userInfo.EditionId = editionId;
  84 +
  85 + //05.2 Check user is active or not
  86 +
  87 +
  88 + //05.3 get license details
  89 + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId);
  90 +
  91 + if (userInfo.LicenseInfo.Id > 0)
  92 + {
  93 + //05.4 get licenseSubscription details
  94 + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId);
  95 +
  96 + //05.5 check the License expiration irespective of either user is active or not because on AIA
  97 + //we shows the License expiration message for inactive users too
  98 + string expirationDate = null;
  99 + bool isLicenseExpired = false;
  100 +
  101 + if (userInfo.LicenseSubscriptions.Id > 0)
  102 + {
  103 + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate);
  104 + }
  105 +
  106 + // send message to the UI for license expiration
  107 + //05.6 Check for subscription Expiration [Promoted for case if license inactive along with subscription expired]
  108 + if (isLicenseExpired)
  109 + {
  110 + userInfo.IsSubscriptionExpired = isLicenseExpired;
  111 + userInfo.SubscriptionExpirationDate = expirationDate;
  112 + }
  113 + else
  114 + {
  115 + //05.6.1
  116 + if (userInfo.LicenseInfo.IsActive)
  117 + {
  118 + if (!userInfo.LicenseInfo.IsTermAccepted)
  119 + {
  120 + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsOfServiceText();
  121 + foreach (Hashtable item in termsList)
  122 + {
  123 + userInfo.TermsOfServiceTitle = item[AIAConstants.KEY_TITLE].ToString();
  124 + userInfo.TermsOfServiceText = item[AIAConstants.KEY_CONTENT].ToString();
  125 + }
  126 + }
  127 + else
  128 + {
  129 + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId);
  130 +
  131 + //Insert user login detail
  132 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  133 + }
  134 + }
  135 + else
  136 + {
  137 + //05.6.1.1
  138 + // return message of license inactive
  139 + // property value assigned. Separate return statement not required
  140 +
  141 + }
  142 + }
  143 + }
  144 + }
  145 +
  146 + authenticationRepsonse = JsonConvert.SerializeObject(userInfo);
  147 + }
  148 + else
  149 + {
  150 + //compare block time of user with current time if user is blocked
  151 + DateTime blockDuration = blockTime.AddDays(1);
  152 + var difference = DateTime.Compare(DateTime.Now, blockDuration);
  153 +
  154 + //check if credentials are valid credentials
  155 + bool isCorrectLoginId, isCorrectPassword;
  156 + AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword);
  157 +
  158 + if (isUserBlocked)
  159 + {
  160 + if (difference >= 0)
  161 + {
  162 + if (isCorrectPassword)
  163 + {
  164 + userInfo.IsBlocked = false;
  165 + userInfo.IsCorrectPassword = true;
  166 +
  167 + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);
  168 + if (wrongAttemptDeteledCount < 0)
  169 + {
  170 + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
  171 + }
  172 +
  173 + //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads
  174 +
  175 + if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN || userInfo.UserType == AIAHTML5.API.Models.User.GENERAL_ADMIN)
  176 + {
  177 + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList();
  178 +
  179 + //Insert user login detail
  180 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  181 + }
  182 + else
  183 + {
  184 + //05.1 For normal user need to get the license details, get the license id for aUTHENTICATED USER
  185 + int licenseId, editionId;
  186 + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId);
  187 +
  188 + userInfo.LicenseId = licenseId;
  189 + userInfo.EditionId = editionId;
  190 +
  191 + //05.2 Check user is active or not
  192 +
  193 +
  194 + //05.3 get license/ licenseSubscription details
  195 + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId);
  196 +
  197 + if (userInfo.LicenseInfo.Id > 0)
  198 + {
  199 + //05.4
  200 + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId);
  201 +
  202 + //05.5 check the License expiration irespective of either user is active or not because on AIA
  203 + //we shows the License expiration message for inactive users too
  204 + string expirationDate = null;
  205 + bool isLicenseExpired = false;
  206 +
  207 + if (userInfo.LicenseSubscriptions.Id > 0)
  208 + {
  209 + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate);
  210 + }
  211 + // send message to the UI for license expiration
  212 + //05.6 Check for subscription Expiration [Promoted for case if license inactive along with subscription expired]
  213 + if (isLicenseExpired)
  214 + {
  215 + userInfo.IsSubscriptionExpired = isLicenseExpired;
  216 + userInfo.SubscriptionExpirationDate = expirationDate;
  217 + }
  218 + else
  219 + {
  220 + //05.6.1
  221 + if (userInfo.LicenseInfo.IsActive)
  222 + {
  223 + if (!userInfo.LicenseInfo.IsTermAccepted)
  224 + {
  225 + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsOfServiceText();
  226 + foreach (Hashtable item in termsList)
  227 + {
  228 + userInfo.TermsOfServiceTitle = item[AIAConstants.KEY_TITLE].ToString();
  229 + userInfo.TermsOfServiceText = item[AIAConstants.KEY_CONTENT].ToString();
  230 + }
  231 + }
  232 + else
  233 + {
  234 + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId);
  235 +
  236 + //Insert user login detail
  237 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  238 + }
  239 + }
  240 + else
  241 + {
  242 + //05.6.1.1
  243 + // return message of license inactive
  244 + // property value assigned. Separate return statement not required
  245 +
  246 + }
  247 + }
  248 + }
  249 + }
  250 + }
  251 + else
  252 + {
  253 + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id);
  254 + if (wrongAttemptDeteledCount < 0)
  255 + {
  256 + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
  257 + }
  258 +
  259 + // send message back to th UI that password is incorrect
  260 + userInfo.IsCorrectPassword = false;
  261 +
  262 + //get wrong attempt count of user
  263 + userInfo.IncorrectLoginAttemptCount = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id) + 1;
  264 + userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH;
  265 +
  266 + //01. insert wrong attempt in dtabase
  267 + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptofUser(userInfo.Id);
  268 +
  269 + if (updateCount < 0)
  270 + {
  271 + //Put the log in log file
  272 + logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id);
  273 + }
  274 + else
  275 + {
  276 + if (userInfo.IncorrectLoginAttemptCount > 4)
  277 + {
  278 + userInfo.IsBlocked = true;
  279 + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;
  280 + }
  281 + }
  282 +
  283 + }
  284 +
  285 + }
  286 + else
  287 + {
  288 + userInfo.IsBlocked = true;
  289 + }
  290 + }
  291 +
  292 + else
  293 + {
  294 +
  295 + //bool isCorrectLoginId, isCorrectPassword;
  296 + //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, out isCorrectLoginId, out isCorrectPassword);
  297 +
  298 + //below code commented as way of retrieving data changed 'very first line in this method'
  299 + //if (!isCorrectLoginId)
  300 + //{
  301 + // // send message back to th UI that login id is incorrect
  302 + // authenticationRepsonse = AIAConstants.USER_NOT_FOUND;
  303 + //}
  304 + //else
  305 + //{
  306 + if (!isCorrectPassword)
  307 + {
  308 + // send message back to th UI that password is incorrect
  309 + userInfo.IsCorrectPassword = false;
  310 +
  311 + //get wrong attempt count of user
  312 + userInfo.IncorrectLoginAttemptCount = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id) + 1;
  313 + userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH;
  314 +
  315 + //01. insert wrong attempt in dtabase
  316 + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptofUser(userInfo.Id);
  317 +
  318 + if (updateCount < 0)
  319 + {
  320 + //Put the log in log file
  321 + logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id);
  322 + }
  323 + else
  324 + {
  325 + if (userInfo.IncorrectLoginAttemptCount > 4)
  326 + {
  327 + userInfo.IsBlocked = true;
  328 + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS;
  329 + }
  330 + }
  331 + }
  332 + }
  333 + // unreachable code detected as license is null
  334 + //if (userInfo.License != null && !string.IsNullOrEmpty(userInfo.License.AccountNumber))
  335 + //{
  336 + // int result = AIAHTML5.API.Models.Users.insertUserLoginLog(userInfo.License.AccountNumber, userInfo.LoginFailureCauseId, null, userInfo.EditionId.ToString(), null);
  337 + // if (result < 0)
  338 + // logger.Fatal("Unable to insert wrong attempt detail in UserLoginLog table for accountNumber= " + userInfo.License.AccountNumber);
  339 + //}
  340 +
  341 + authenticationRepsonse = JsonConvert.SerializeObject(userInfo);
  342 + //}
  343 + }
48 344 }
49 345 else
50 346 {
51   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
52   -
  347 + authenticationRepsonse = AIAConstants.USER_NOT_FOUND;
53 348 }
54 349 }
  350 + catch (Exception e)
  351 + {
  352 +
  353 + logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  354 +
  355 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  356 + string mailSubject = "SQL Exception intimation mail";
  357 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  358 + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
  359 +
  360 + authenticationRepsonse = AIAConstants.SQL_CONNECTION_ERROR;
  361 + }
  362 +
  363 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
55 364 }
  365 +
56 366  
57 367 // PUT api/authenticate/5
58 368 public void Put(int id, [FromBody]string value)
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs
... ... @@ -75,8 +75,8 @@ namespace AIAHTML5.API.Controllers
75 75 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
76 76 logger.Debug("inside POST in ForgotUserController for emailId = " + userInfo["emailId"]);
77 77  
78   - User userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
79   - if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
  78 + dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
  79 + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(userData) != AIAConstants.SQL_CONNECTION_ERROR)
80 80 {
81 81 //logger.Debug("inside if in ForgotUserController userData.loginId= " + userData.LoginId);
82 82 bool isMailSent = false;
... ... @@ -85,9 +85,17 @@ namespace AIAHTML5.API.Controllers
85 85  
86 86 if (Convert.ToBoolean(userInfo["havePassword"]))
87 87 {
88   - logger.Debug("2. havePassword= " + Convert.ToBoolean(userInfo["havePassword"]));
  88 + if (Convert.ToBoolean(userInfo["unblockUser"]))
  89 + {
  90 + logger.Debug("2. unblockUser= " + Convert.ToBoolean(userInfo["unblockUser"]));
  91 + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"]), Convert.ToBoolean(userInfo["unblockUser"]));
  92 + }
  93 + else
  94 + {
  95 + logger.Debug("2. havePassword= " + Convert.ToBoolean(userInfo["havePassword"]));
  96 + isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"]));
  97 + }
89 98  
90   - isMailSent = AIAHTML5.API.Models.UserUtility.SendEmail(userData, Convert.ToBoolean(userInfo["havePassword"]));
91 99 }
92 100 else
93 101 {
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs
... ... @@ -8,6 +8,7 @@ using log4net;
8 8 using AIAHTML5.API.Constants;
9 9 using Newtonsoft.Json;
10 10 using Newtonsoft.Json.Linq;
  11 +using AIAHTML5.API.Models;
11 12  
12 13 namespace AIAHTML5.API.Controllers
13 14 {
... ... @@ -26,18 +27,35 @@ namespace AIAHTML5.API.Controllers
26 27 }
27 28  
28 29 // POST api/licensetermcondition
29   - public HttpResponseMessage Post([FromBody]string licenseeAccountNumber)
  30 + public HttpResponseMessage Post([FromBody]JObject userLicenseInfo)
30 31 {
31 32 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
32 33 logger.Debug("inside POST");
33 34 HttpResponseMessage response = null;
34 35  
35   - int result = AIAHTML5.API.Models.Users.UpdateLicenseTerm(licenseeAccountNumber);
36   - if (result > 0)
37   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_SUCCESS) };
38   - else
39   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) };
  36 + int licenseId = Convert.ToInt32(userLicenseInfo["userLicenseId"]);
  37 + User user = new User();
  38 + dynamic userModules = null; // assigned to avoid unassigned local variable compilation error;
  39 +
  40 + dynamic result = AIAHTML5.API.Models.Users.UpdateLicenseTerm(userLicenseInfo);
  41 + if (Convert.ToString(result) != AIAConstants.SQL_CONNECTION_ERROR)
  42 + {
  43 + if (Convert.ToInt32(result) > 0)
  44 + {
  45 + user.Modules = Users.getModuleListByLicenseId(licenseId);
  46 + userModules = JsonConvert.SerializeObject(user);
40 47  
  48 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userModules) };
  49 + }
  50 + else
  51 + {
  52 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.LICENSE_TERM_CONDITION_UPDATE_FAILED) };
  53 + }
  54 + }
  55 + else
  56 + {
  57 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
  58 + }
41 59 return response;
42 60 }
43 61  
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs
... ... @@ -35,20 +35,24 @@ namespace AIAHTML5.API.Controllers
35 35 {
36 36 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
37 37 logger.Debug("inside POST");
38   - User userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
  38 + dynamic userData = AIAHTML5.API.Models.Users.GetUserByEmail(userInfo);
39 39 HttpResponseMessage response = null;
40   - if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
  40 + if (Convert.ToString(userData) != AIAConstants.USER_NOT_FOUND && Convert.ToString(userData) != AIAConstants.ERROR_IN_FECTHING_DETAILS && Convert.ToString(userData) != AIAConstants.SQL_CONNECTION_ERROR)
41 41 {
42 42 int result = 0;
43 43 if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString()))
44 44 {
45   - result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo);
  45 + result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo, userData.LoginId, userData.EmailId);
46 46 if (result > 0)
47 47 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_SUCCESS) };
48 48 else
49   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_FAILED) };
  49 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_FAILED) };
50 50 }
51 51 }
  52 + else
  53 + {
  54 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userData.ToString()) };
  55 + }
52 56  
53 57 return response;
54 58 }
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs 0 → 100644
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Net;
  5 +using System.Net.Http;
  6 +using System.Web.Http;
  7 +using AIAHTML5.API.Constants;
  8 +using AIAHTML5.API.Models;
  9 +using AIAHTML5.API.Utility;
  10 +using log4net;
  11 +
  12 +namespace AIAHTML5.API.Controllers
  13 +{
  14 + public class UnblockUserController : ApiController
  15 + {
  16 + // GET api/unblockuser
  17 + public IEnumerable<string> Get()
  18 + {
  19 + return new string[] { "value1", "value2" };
  20 + }
  21 +
  22 + // GET api/unblockuser/5
  23 + public string Get(int id)
  24 + {
  25 + return "value";
  26 + }
  27 +
  28 + // POST api/unblockuser
  29 + public HttpResponseMessage Post([FromBody]string emailId)
  30 + {
  31 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  32 + logger.Debug("inside POST in UnblockUserController for emailId = " + emailId);
  33 +
  34 + HttpResponseMessage response = null;
  35 +
  36 + dynamic user = AIAHTML5.API.Models.DBModel.GetUserDetailsByEmailId(emailId);
  37 + if (Convert.ToString(user) != AIAConstants.USER_NOT_FOUND && Convert.ToString(user) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
  38 + {
  39 + int result = 0;
  40 +
  41 + logger.Debug("1. inside if in UnblockUserController userDetails= " + user.ToString());
  42 +
  43 + result = AIAHTML5.API.Models.DBModel.UnblockUser(user.Id);
  44 +
  45 + if (result > 0)
  46 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_UNBLOCK_SUCCESS) };
  47 + else
  48 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_ALREADY_UNBLOCKED) };
  49 + }
  50 + //else
  51 + //{
  52 + // logger.Debug("inside else in UnblockUserController userData= " + user);
  53 + // return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(user.ToString()) };
  54 + //}
  55 + return response;
  56 + }
  57 +
  58 + // PUT api/unblockuser/5
  59 + public void Put(int id, [FromBody]string value)
  60 + {
  61 + }
  62 +
  63 + // DELETE api/unblockuser/5
  64 + public void Delete(int id)
  65 + {
  66 + }
  67 + }
  68 +}
0 69 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -30,23 +30,16 @@ namespace AIAHTML5.API.Models
30 30 conn.Open();
31 31 }
32 32  
33   - protected static DataSet GetSQLData(string commandText, bool isSp)
  33 + protected static DataSet GetDataFromStoredProcedure(string commandText)
34 34 {
35 35 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
36   - logger.Debug(" inside GetSQLData for command text = " + commandText);
37   - DataSet ds= null;
  36 + logger.Debug(" Inside GetSQLData for command text = " + commandText);
  37 + DataSet ds = null;
38 38 try
39 39 {
40 40 conn = new SqlConnection(dbConnectionString);
41   - if (isSp)
42   - {
43   - cmd = new SqlCommand(commandText, conn);
44   - cmd.CommandType = CommandType.StoredProcedure;
45   - }
46   - else
47   - {
48   - cmd = new SqlCommand(commandText, conn);
49   - }
  41 + cmd = new SqlCommand(commandText, conn);
  42 + cmd.CommandType = CommandType.StoredProcedure;
50 43 SqlDataAdapter da = new SqlDataAdapter();
51 44 da.SelectCommand = cmd;
52 45 ds = new DataSet();
... ... @@ -54,269 +47,216 @@ namespace AIAHTML5.API.Models
54 47 }
55 48 catch (SqlException ex)
56 49 {
57   - logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message);
  50 + logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  51 + throw;
58 52 }
59 53 return ds;
60 54 }
61 55  
62   - protected ArrayList GetUserModules()
  56 + internal ArrayList GetAllModules()
63 57 {
  58 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  59 + logger.Debug(" Inside GetAllModules");
  60 +
64 61 ArrayList arrUserModules = new ArrayList();
65   - Hashtable userModuleHash = null;
66   - userModuleHash = new Hashtable();
67 62  
68   - string sp = "GetAllModuleStatusWithSlug";
  63 + try
  64 + {
  65 + Hashtable userModuleHash = new Hashtable();
69 66  
70   - DataSet ds = DBModel.GetSQLData(sp, true);
71   - DataTable dt = ds.Tables[0];
  67 + string sp = DBConstants.GET_ALL_MODULES;
72 68  
73   - foreach (DataRow drActType in dt.Rows)
  69 + DataSet ds = DBModel.GetDataFromStoredProcedure(sp);
  70 +
  71 + if (ds.Tables.Count > 0)
  72 + {
  73 + DataTable dt = ds.Tables[0];
  74 +
  75 + foreach (DataRow drModule in dt.Rows)
  76 + {
  77 + userModuleHash = new Hashtable();
  78 + userModuleHash.Add(AIAConstants.KEY_NAME, drModule["Name"]);
  79 + userModuleHash.Add(AIAConstants.KEY_SLUG, drModule["Slug"]);
  80 + arrUserModules.Add(userModuleHash);
  81 + }
  82 + }
  83 + }
  84 + catch (SqlException ex)
74 85 {
75   - userModuleHash = new Hashtable();
76   - userModuleHash.Add(AIAConstants.KEY_NAME, drActType["Name"]);
77   - userModuleHash.Add(AIAConstants.KEY_SLUG, drActType["Slug"]);
78   - arrUserModules.Add(userModuleHash);
  86 + logger.Fatal("Exception in GetAllModules , Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  87 + throw;
79 88 }
80 89 return arrUserModules;
81 90 }
82 91  
83   - public static dynamic GetUserDetailsByLoginIdAndPassword(string loginId, string password)
  92 + internal static User GetUserDetailsByLoginId(string loginId)
84 93 {
85   - User objUser = new User();
86   - DBModel objModel = new DBModel();
  94 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  95 + logger.Debug(" Inside GetUserDetailsByLoginId for LoginId = " + loginId);
87 96  
88   - conn = new SqlConnection(dbConnectionString);
89   - cmd = new SqlCommand();
90   - SqlDataAdapter da = new SqlDataAdapter();
91   - SqlParameter param;
92   - DataSet ds = new DataSet();
  97 + User objUser = null;
  98 + DBModel objModel = new DBModel();
93 99  
94   - cmd.Connection = conn;
95   - cmd.CommandText = "GetUserDetailsByLoginIdAndPassword";
96   - cmd.CommandType = CommandType.StoredProcedure;
  100 + try
  101 + {
  102 + conn = new SqlConnection(dbConnectionString);
  103 + cmd = new SqlCommand();
  104 + SqlDataAdapter da = new SqlDataAdapter();
  105 + SqlParameter param;
  106 + DataSet ds = new DataSet();
97 107  
98   - param = new SqlParameter("@sLoginId", loginId);
99   - param.Direction = ParameterDirection.Input;
100   - param.DbType = DbType.String;
101   - cmd.Parameters.Add(param);
  108 + cmd.Connection = conn;
  109 + cmd.CommandText = DBConstants.GET_USER_DELAILS_BY_LOGIN_ID;
  110 + cmd.CommandType = CommandType.StoredProcedure;
102 111  
103   - param = new SqlParameter("@sPassword", password);
104   - param.Direction = ParameterDirection.Input;
105   - param.DbType = DbType.String;
106   - cmd.Parameters.Add(param);
  112 + param = new SqlParameter("@sLoginId", loginId);
  113 + param.Direction = ParameterDirection.Input;
  114 + param.DbType = DbType.String;
  115 + cmd.Parameters.Add(param);
107 116  
108   - da.SelectCommand = cmd;
109   - DataTable dt = new DataTable();
110   - da.Fill(dt);
  117 + da.SelectCommand = cmd;
  118 + DataTable dt = new DataTable();
  119 + da.Fill(dt);
  120 +
111 121  
112   - if (dt.Rows.Count > 0)
113   - {
114   - foreach (DataRow dr in dt.Rows)
  122 + if (dt.Rows.Count > 0)
115 123 {
116   - foreach (DataColumn dc in dt.Columns)
  124 + foreach (DataRow dr in dt.Rows)
117 125 {
118   - if (dc.ColumnName == "Id")
119   - objUser.Id = Convert.ToInt32(dr[dc]);
120   - if (dc.ColumnName == "FirstName")
121   - objUser.FirstName = dr[dc].ToString();
122   - if (dc.ColumnName == "LastName")
123   - objUser.LastName = dr[dc].ToString();
124   - if (dc.ColumnName == "EmailId")
125   - objUser.EmailId = dr[dc].ToString();
126   - if (dc.ColumnName == "LoginId")
127   - objUser.LoginId = dr[dc].ToString();
128   - if (dc.ColumnName == "Password")
129   - objUser.Password = dr[dc].ToString();
130   - if (dc.ColumnName == "SecurityQuestionId")
131   - {
132   - int tempVal;
133   - objUser.SecurityQuestionId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
134   - }
135   - if (dc.ColumnName == "SecurityAnswer")
136   - objUser.SecurityAnswer = dr[dc].ToString();
137   - if (dc.ColumnName == "CreatorId")
138   - {
139   - int tempVal;
140   - objUser.CreatorId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
141   - }
142   - if (dc.ColumnName == "CreationDate")
143   - objUser.CreationDate = Convert.ToDateTime(dr[dc]);
144   - if (dc.ColumnName == "DeactivationDate")
145   - {
146   - DateTime? date;
147   - if (dr[dc] == DBNull.Value)
148   - date = null;
149   - else
150   - date = (DateTime)dr[dc];
151   -
152   - objUser.DeactivationDate = date;
153   - }
154   - if (dc.ColumnName == "ModifierId")
155   - {
156   - int tempVal;
157   - objUser.ModifierId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
158   - }
159   - if (dc.ColumnName == "ModifiedDate")
160   - {
161   - DateTime? date;
162   - if (dr[dc] == DBNull.Value)
163   - date = null;
164   - else
165   - date = (DateTime)dr[dc];
166   -
167   - objUser.ModifiedDate = date;
168   - }
169   - if (dc.ColumnName == "UserTypeId")
170   - objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr[dc]));
171   - if (dc.ColumnName == "IsActive")
172   - objUser.IsActive = Convert.ToBoolean(dr[dc]);
173   -
  126 + int tempVal;
  127 + DateTime date;
  128 + objUser = new User();
  129 +
  130 + objUser.Id = Convert.ToInt32(dr["Id"]);
  131 + objUser.FirstName = dr["FirstName"].ToString();
  132 + objUser.LastName = dr["LastName"].ToString();
  133 + objUser.EmailId = dr["EmailId"].ToString();
  134 + objUser.LoginId = dr["LoginId"].ToString();
  135 + objUser.Password = dr["Password"].ToString();
  136 + objUser.SecurityQuestionId =Int32.TryParse(dr["SecurityQuestionId"].ToString(), out tempVal) ? tempVal : (int?)null;
  137 + objUser.SecurityAnswer = dr["SecurityAnswer"].ToString(); ;
  138 + objUser.CreatorId = Int32.TryParse(dr["CreatorId"].ToString(), out tempVal) ? tempVal : (int?)null;
  139 + objUser.CreationDate = Convert.ToDateTime(dr["CreationDate"]);
  140 + objUser.DeactivationDate = DateTime.TryParse(dr["DeactivationDate"].ToString(), out date) ? date : (DateTime?)null;
  141 + objUser.ModifierId = Int32.TryParse(dr["ModifierId"].ToString(), out tempVal) ? tempVal : (int?)null;
  142 + objUser.ModifiedDate = DateTime.TryParse(dr["ModifiedDate"].ToString(), out date) ? date : (DateTime?)null;
  143 + objUser.UserTypeId = Convert.ToInt32(dr["UserTypeId"]);
  144 + objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr["UserTypeId"]));
  145 + objUser.IsActive = Convert.ToBoolean(dr["IsActive"]);
174 146 }
175 147 }
  148 + else
  149 + {
  150 + objUser = new User();
  151 + }
176 152 }
177   -
178   - else
179   - {
180   - objUser = null;
  153 + catch (SqlException ex)
  154 + {
  155 + logger.Fatal("Exception in GetUserDetailsByLoginId for LoginId: " + loginId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  156 + throw;
181 157 }
  158 + return objUser;
  159 + }
  160 +
  161 + internal Hashtable GetLicenseDetailByUserId(int userId)
  162 + {
  163 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  164 + logger.Debug(" Inside GetUserLicenseDetailByUserId for UserId = " + userId);
182 165  
183   - if (objUser != null)
  166 + Hashtable hash = new Hashtable();
  167 +
  168 + try
184 169 {
  170 + conn = new SqlConnection(dbConnectionString);
  171 + cmd = new SqlCommand();
  172 + SqlDataAdapter adapter;
  173 + SqlParameter param;
  174 + DataSet ds = new DataSet();
185 175  
186   - int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id);
187   - if (licenseId != 0)
188   - {
189   - objUser.License = objModel.GetLicenseDetailsByLicenseId(licenseId);
190   - objUser.LicenseSubscriptions = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId);
191   - }
192   - else
193   - {
194   - objUser.License = null;
195   - }
  176 + cmd.Connection = conn;
  177 + cmd.CommandText = DBConstants.GET_LICENSE_DETAILS_BY_USER_ID;
  178 + cmd.CommandType = CommandType.StoredProcedure;
196 179  
197   - if (objUser.UserType == User.SUPER_ADMIN || objUser.UserType == User.GENERAL_ADMIN)
198   - {
199   - objUser.Modules = objModel.GetUserModules();
200   - }
201   - else
  180 + param = new SqlParameter("@iUserId", userId);
  181 + param.Direction = ParameterDirection.Input;
  182 + param.DbType = DbType.Int32;
  183 + cmd.Parameters.Add(param);
  184 +
  185 + adapter = new SqlDataAdapter(cmd);
  186 + adapter.Fill(ds);
  187 +
  188 + if (ds.Tables.Count > 0)
202 189 {
203   - if (objUser.License != null)
  190 + if (ds.Tables[0].Rows.Count > 0)
204 191 {
205   - if (objUser.LicenseSubscriptions != null)
206   - {
207   - DateTime? subscriptionValidThrough = objUser.LicenseSubscriptions.SubscriptionValidThrough;
208   - if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date)
209   - {
210   - ArrayList allModulesList = objModel.GetUserModules();
211   - ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId);
212   -
213   - ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList);
214   - objUser.Modules = userModuleList;
215   -
216   - if (!objUser.License.IsTermAccepted)
217   - {
218   - ArrayList termsList = DBModel.GetTermsOfServiceText();
219   - foreach(Hashtable item in termsList)
220   - {
221   - objUser.TermsOfServiceTitle = item["title"].ToString();
222   - objUser.TermsOfServiceText = item["content"].ToString();
223   - }
224   - }
225   - }
226   - else
227   - {
228   - objUser.IsSubscriptionExpired = true;
229   - objUser.SubscriptionExpirationDateString = objUser.LicenseSubscriptions.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString();
230   - }
231   - }
  192 + hash.Add(AIAConstants.LICENSE_KEY_ID, ds.Tables[0].Rows[0][0]);
  193 + hash.Add(AIAConstants.EDITION_KEY_ID, ds.Tables[0].Rows[0][1]);
232 194 }
233 195 }
234 196 }
  197 + catch (SqlException ex)
  198 + {
  199 + logger.Fatal("Exception in GetUserLicenseDetailByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  200 + throw;
  201 + }
235 202  
236   - return objUser;
  203 + return hash;
237 204 }
238 205  
239   - protected int GetUserLicenseIdByUserId(int userId)
  206 + internal ArrayList GetUserModulesByLicenseId(int licenseId)
240 207 {
241   - int _licenseId = 0;
242   - conn = new SqlConnection(dbConnectionString);
243   - cmd = new SqlCommand();
244   - SqlDataAdapter adapter;
245   - SqlParameter param;
246   - DataSet ds = new DataSet();
247   -
248   - cmd.Connection = conn;
249   - cmd.CommandText = "GetLicenseIdByUserId";
250   - cmd.CommandType = CommandType.StoredProcedure;
251   -
252   - param = new SqlParameter("@iUserId", userId);
253   - param.Direction = ParameterDirection.Input;
254   - param.DbType = DbType.Int32;
255   - cmd.Parameters.Add(param);
256   -
257   - adapter = new SqlDataAdapter(cmd);
258   - adapter.Fill(ds);
259   - if (ds.Tables[0].Rows.Count > 0)
260   - _licenseId = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
261   - return _licenseId;
262   - }
  208 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  209 + logger.Debug(" Inside GetUserModulesByLicenseId for LicenseId = " + licenseId);
263 210  
264   - protected ArrayList GetModuleStatusByLicenseId(int licenseId)
265   - {
266 211 ArrayList userModulelist = new ArrayList();
267   - Hashtable modulesHash;
268   - DataSet ds = new DataSet();
269   -
270   - conn = new SqlConnection(dbConnectionString);
271   - cmd = new SqlCommand();
272   - SqlDataAdapter adapter;
273   - SqlParameter param;
274 212  
275   - cmd.Connection = conn;
276   - cmd.CommandText = "GetModuleStatusByLicenseId";
277   - cmd.CommandType = CommandType.StoredProcedure;
  213 + try
  214 + {
  215 + Hashtable modulesHash;
  216 + DataSet ds = new DataSet();
278 217  
279   - param = new SqlParameter("@iLicenseId", licenseId);
280   - param.Direction = ParameterDirection.Input;
281   - param.DbType = DbType.Int32;
282   - cmd.Parameters.Add(param);
  218 + conn = new SqlConnection(dbConnectionString);
  219 + cmd = new SqlCommand();
  220 + SqlDataAdapter adapter;
  221 + SqlParameter param;
283 222  
284   - adapter = new SqlDataAdapter(cmd);
285   - adapter.Fill(ds);
286   - DataTable dt = ds.Tables[0];
  223 + cmd.Connection = conn;
  224 + cmd.CommandText = DBConstants.GET_USER_MODULES_BY_LICENSE_ID;
  225 + cmd.CommandType = CommandType.StoredProcedure;
287 226  
288   - foreach (DataRow dr in dt.Rows)
289   - {
290   - modulesHash = new Hashtable();
291   - modulesHash.Add("Id", dr["Id"]);
292   - modulesHash.Add("Title", dr["Title"]);
293   - modulesHash.Add("Status", dr["Status"]);
294   - userModulelist.Add(modulesHash);
295   - }
  227 + param = new SqlParameter("@iLicenseId", licenseId);
  228 + param.Direction = ParameterDirection.Input;
  229 + param.DbType = DbType.Int32;
  230 + cmd.Parameters.Add(param);
296 231  
297   - return userModulelist;
298   - }
  232 + adapter = new SqlDataAdapter(cmd);
  233 + adapter.Fill(ds);
  234 +
299 235  
300   - protected ArrayList GetUserModulesList(ArrayList allModules, ArrayList modulesByLicense)
301   - {
302   - ArrayList userModules = new ArrayList();
303   - Hashtable moduleHash;
304   - foreach (Hashtable module in allModules)
305   - {
306   - foreach (Hashtable userModule in modulesByLicense)
  236 + if (ds.Tables.Count > 0)
307 237 {
308   - if ((userModule["Title"].ToString().Trim() == module["name"].ToString().Trim()) && (Convert.ToBoolean(userModule["Status"]) == true))
309   - {
310   - moduleHash = new Hashtable();
311   - moduleHash.Add("name", userModule["Title"]);
312   - moduleHash.Add("slug", module["slug"]);
  238 + DataTable dt = ds.Tables[0];
313 239  
314   - userModules.Add(moduleHash);
  240 + if (dt.Rows.Count > 0)
  241 + {
  242 + foreach (DataRow dr in dt.Rows)
  243 + {
  244 + modulesHash = new Hashtable();
  245 + modulesHash.Add(AIAConstants.KEY_NAME, dr["Title"]);
  246 + modulesHash.Add(AIAConstants.KEY_SLUG, dr["Slug"]);
  247 + userModulelist.Add(modulesHash);
  248 + }
315 249 }
316 250 }
317 251 }
318 252  
319   - return userModules;
  253 + catch (SqlException ex)
  254 + {
  255 + logger.Fatal("Exception in GetUserModulesByLicenseId for LicenseId = " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  256 + throw;
  257 + }
  258 +
  259 + return userModulelist;
320 260 }
321 261  
322 262 protected string GetUserTypeStringById(int userTypeId)
... ... @@ -325,44 +265,48 @@ namespace AIAHTML5.API.Models
325 265  
326 266 switch (userTypeId)
327 267 {
328   - case 1:
  268 + case (int)UserType.SUPER_ADMIN:
329 269 userType = User.SUPER_ADMIN;
330 270 break;
331   - case 2:
  271 + case (int)UserType.GENERAL_ADMIN:
332 272 userType = User.GENERAL_ADMIN;
333 273 break;
334   - case 3:
  274 + case (int)UserType.DISTRICT_ADMIN:
335 275 userType = User.DISTRICT_ADMIN;
336 276 break;
337   - case 4:
  277 + case (int)UserType.CLIENT_ADMIN:
338 278 userType = User.CLIENT_ADMIN;
339 279 break;
340   - case 5:
  280 + case (int)UserType.SINGLE_USER:
341 281 userType = User.SINGLE_USER;
342 282 break;
343   - case 6:
  283 + case (int)UserType.CONCURRENT_USER:
344 284 userType = User.CONCURRENT_USER;
345 285 break;
346   - case 7:
  286 + case (int)UserType.RESELLER:
347 287 userType = User.RESELLER;
348 288 break;
349   - case 8:
  289 + case (int)UserType.TEST_ACCOUNT:
350 290 userType = User.TEST_ACCOUNT;
351 291 break;
352   - case 9:
  292 + case (int)UserType.SITE_USER:
353 293 userType = User.SITE_USER;
354 294 break;
355 295 }
356 296 return userType;
357 297 }
358 298  
359   - public static User GetUserDetailsByEmailId(string emailId)
  299 + internal static User GetUserDetailsByEmailId(string emailId)
360 300 {
361   - User objUser = new User();
  301 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  302 + logger.Debug(" Inside GetUserDetailsByEmailId for emailId = " + emailId);
  303 +
  304 + User objUser = null;
362 305 DBModel objModel = new DBModel();
363 306  
364 307 try
365 308 {
  309 +
366 310 conn = new SqlConnection(dbConnectionString);
367 311 cmd = new SqlCommand();
368 312 SqlDataAdapter adapter;
... ... @@ -370,7 +314,7 @@ namespace AIAHTML5.API.Models
370 314 DataSet ds = new DataSet();
371 315  
372 316 cmd.Connection = conn;
373   - cmd.CommandText = "GetUserInfoByEmailId";
  317 + cmd.CommandText = DBConstants.GET_USER_DETAILS_BY_EMAILID;
374 318 cmd.CommandType = CommandType.StoredProcedure;
375 319  
376 320 param = new SqlParameter("@sEmailId", emailId);
... ... @@ -380,96 +324,92 @@ namespace AIAHTML5.API.Models
380 324  
381 325 adapter = new SqlDataAdapter(cmd);
382 326 adapter.Fill(ds);
383   - DataTable dt = ds.Tables[0];
384 327  
385   - foreach (DataRow dr in dt.Rows)
  328 +
  329 + if (ds.Tables.Count > 0)
386 330 {
387   - foreach (DataColumn dc in dt.Columns)
388   - {
389   - if (dc.ColumnName == "Id")
390   - objUser.Id = Convert.ToInt32(dr[dc]);
391   - if (dc.ColumnName == "FirstName")
392   - objUser.FirstName = dr[dc].ToString();
393   - if (dc.ColumnName == "LastName")
394   - objUser.LastName = dr[dc].ToString();
395   - if (dc.ColumnName == "EmailId")
396   - objUser.EmailId = dr[dc].ToString();
397   - if (dc.ColumnName == "LoginId")
398   - objUser.LoginId = dr[dc].ToString();
399   - if (dc.ColumnName == "Password")
400   - objUser.Password = dr[dc].ToString();
401   - if (dc.ColumnName == "SecurityQuestionId")
402   - {
403   - int tempVal;
404   - objUser.SecurityQuestionId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
405   - }
406   - if (dc.ColumnName == "SecurityAnswer")
407   - objUser.SecurityAnswer = dr[dc].ToString();
408   - if (dc.ColumnName == "CreatorId")
409   - {
410   - int tempVal;
411   - objUser.CreatorId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
412   - }
413   - if (dc.ColumnName == "CreationDate")
414   - objUser.CreationDate = Convert.ToDateTime(dr[dc]);
415   - if (dc.ColumnName == "DeactivationDate")
416   - {
417   - DateTime? date;
418   - if (dr[dc] == DBNull.Value)
419   - date = null;
420   - else
421   - date = (DateTime)dr[dc];
  331 + DataTable dt = ds.Tables[0];
422 332  
423   - objUser.DeactivationDate = date;
424   - }
425   - if (dc.ColumnName == "ModifierId")
  333 + if (dt.Rows.Count > 0)
  334 + {
  335 + foreach (DataRow dr in dt.Rows)
426 336 {
427 337 int tempVal;
428   - objUser.ModifierId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
  338 + DateTime date;
  339 + objUser = new User();
  340 +
  341 + objUser.Id = Convert.ToInt32(dr["Id"]);
  342 + objUser.FirstName = dr["FirstName"].ToString();
  343 + objUser.LastName = dr["LastName"].ToString();
  344 + objUser.EmailId = dr["EmailId"].ToString();
  345 + objUser.LoginId = dr["LoginId"].ToString();
  346 + objUser.Password = dr["Password"].ToString();
  347 + objUser.SecurityQuestionId = Int32.TryParse(dr["SecurityQuestionId"].ToString(), out tempVal) ? tempVal : (int?)null;
  348 + objUser.SecurityAnswer = dr["SecurityAnswer"].ToString(); ;
  349 + objUser.CreatorId = Int32.TryParse(dr["CreatorId"].ToString(), out tempVal) ? tempVal : (int?)null;
  350 + objUser.CreationDate = Convert.ToDateTime(dr["CreationDate"]);
  351 + objUser.DeactivationDate = DateTime.TryParse(dr["DeactivationDate"].ToString(), out date) ? date : (DateTime?)null;
  352 + objUser.ModifierId = Int32.TryParse(dr["ModifierId"].ToString(), out tempVal) ? tempVal : (int?)null;
  353 + objUser.ModifiedDate = DateTime.TryParse(dr["ModifiedDate"].ToString(), out date) ? date : (DateTime?)null;
  354 + objUser.UserTypeId = Convert.ToInt32(dr["UserTypeId"]);
  355 + objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr["UserTypeId"]));
  356 + objUser.IsActive = Convert.ToBoolean(dr["IsActive"]);
429 357 }
430   - if (dc.ColumnName == "ModifiedDate")
431   - {
432   - DateTime? date;
433   - if (dr[dc] == DBNull.Value)
434   - date = null;
435   - else
436   - date = (DateTime)dr[dc];
437   -
438   - objUser.ModifiedDate = date;
439   - }
440   - if (dc.ColumnName == "UserTypeId")
441   - objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr[dc]));
442   - if (dc.ColumnName == "IsActive")
443   - objUser.IsActive = Convert.ToBoolean(dr[dc]);
444   -
445 358 }
446 359 }
  360 + else
  361 + {
  362 + objUser = new User ();
  363 + }
  364 + }
  365 + catch (SqlException ex)
  366 + {
  367 + logger.Fatal("Exception in GetUserDetailsByEmailId for emailId = " + emailId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  368 + throw;
447 369 }
448   - catch (Exception ex)
449   - { }
450 370  
451 371 return objUser;
452 372 }
453 373  
454   - public static int UpdateUserPassword(dynamic userInfo)
  374 + internal static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId)
455 375 {
  376 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  377 + logger.Debug(" Inside UpdateUserPassword for LoginId: " + loginId + ", EmailId: " + emailId);
  378 +
456 379 int result = 0;
457   - conn = new SqlConnection(dbConnectionString);
458   - cmd = new SqlCommand();
459   - cmd.Connection = conn;
460   - conn.Open();
461   - cmd.CommandText = "UpdateUserPassword";
462   - cmd.CommandType = CommandType.StoredProcedure;
463   - cmd.Parameters.AddWithValue("@sLoginId", userInfo["loginId"].ToString());
464   - cmd.Parameters.AddWithValue("@sEmailId", userInfo["emailId"].ToString());
465   - cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString());
466   - result = cmd.ExecuteNonQuery();
467   - conn.Close();
  380 +
  381 + try
  382 + {
  383 + conn = new SqlConnection(dbConnectionString);
  384 + cmd = new SqlCommand();
  385 + cmd.Connection = conn;
  386 + conn.Open();
  387 + cmd.CommandText = DBConstants.UPDATE_USER_PASSWORD;
  388 + cmd.CommandType = CommandType.StoredProcedure;
  389 + cmd.Parameters.AddWithValue("@sLoginId", loginId);
  390 + cmd.Parameters.AddWithValue("@sEmailId", emailId);
  391 + cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString());
  392 + result = cmd.ExecuteNonQuery();
  393 + conn.Close();
  394 + }
  395 + catch (SqlException ex)
  396 + {
  397 + conn.Close();
  398 + logger.Fatal("Exception in UpdateUserPassword for LoginId: " + loginId + ", EmailId: " + emailId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  399 + throw;
  400 + }
  401 + finally
  402 + {
  403 + conn.Dispose();
  404 + }
468 405 return result;
469 406 }
470 407  
471   - protected LicenseSubscriptionDetails GetLicenseSubscriptionDetailsByLicenseId(int licenseId)
  408 + internal LicenseSubscriptionDetails GetLicenseSubscriptionDetailsByLicenseId(int licenseId)
472 409 {
  410 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  411 + logger.Debug(" Inside GetLicenseSubscriptionDetailsByLicenseId for LicenseId = " + licenseId);
  412 +
473 413 LicenseSubscriptionDetails lsd = new LicenseSubscriptionDetails();
474 414 try
475 415 {
... ... @@ -480,7 +420,7 @@ namespace AIAHTML5.API.Models
480 420 DataSet ds = new DataSet();
481 421  
482 422 cmd.Connection = conn;
483   - cmd.CommandText = "GetSubscriptionDetailsByLicenseId";
  423 + cmd.CommandText = DBConstants.GET_SUBSCRIPTION_DETAILS_BY_LICENSE_ID;
484 424 cmd.CommandType = CommandType.StoredProcedure;
485 425  
486 426 param = new SqlParameter("@iLicenseId", licenseId);
... ... @@ -489,76 +429,52 @@ namespace AIAHTML5.API.Models
489 429 cmd.Parameters.Add(param);
490 430  
491 431 adapter = new SqlDataAdapter(cmd);
492   - adapter.Fill(ds);
493   - DataTable dt = ds.Tables[0];
  432 + adapter.Fill(ds);
494 433  
495   - foreach (DataRow dr in dt.Rows)
  434 + if (ds.Tables.Count > 0)
496 435 {
497   - foreach (DataColumn dc in dt.Columns)
  436 + DataTable dt = ds.Tables[0];
  437 +
  438 + if (dt.Rows.Count > 0)
498 439 {
499   - if (dc.ColumnName == "Id")
500   - lsd.Id = Convert.ToInt32(dr[dc]);
501   - if (dc.ColumnName == "LicenseId")
502   - lsd.LicenseId = Convert.ToInt32(dr[dc]);
503   - if (dc.ColumnName == "SubscriptionPlanId")
  440 + foreach (DataRow dr in dt.Rows)
504 441 {
505 442 int tempVal;
506   - lsd.SubscriptionPlanId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null;
507   - }
508   - if (dc.ColumnName == "SubscriptionValidFrom")
509   - {
510   - DateTime? date;
511   - if (dr[dc] == DBNull.Value)
512   - date = null;
513   - else
514   - date = (DateTime)dr[dc];
515   -
516   - lsd.SubscriptionValidFrom = date;
  443 + DateTime date;
  444 + lsd.Id = Convert.ToInt32(dr["Id"]);
  445 + lsd.LicenseId = Convert.ToInt32(dr["LicenseId"]);
  446 + lsd.SubscriptionPlanId = Int32.TryParse(dr["SubscriptionPlanId"].ToString(), out tempVal) ? tempVal : (int?)null;
  447 + lsd.SubscriptionValidFrom = DateTime.TryParse(dr["SubscriptionValidFrom"].ToString(), out date) ? date : (DateTime?)null;
  448 + lsd.SubscriptionValidThrough = DateTime.TryParse(dr["SubscriptionValidThrough"].ToString(), out date) ? date : (DateTime?)null;
  449 + lsd.RenewalDate = DateTime.TryParse(dr["RenewalDate"].ToString(), out date) ? date : (DateTime?)null;
  450 + lsd.PaymentMode = dr["PaymentMode"].ToString();
  451 + lsd.TotalAmount = Convert.ToDouble(dr["TotalAmount"]);
  452 + lsd.AmountPaid = Convert.ToDouble(dr["AmountPaid"]);
  453 + lsd.AmountPending = Convert.ToDouble(dr["AmountPending"]);
  454 + lsd.NoOfImages = Convert.ToInt32(dr["NoofImages"]);
517 455 }
518   - if (dc.ColumnName == "SubscriptionValidThrough")
519   - {
520   - DateTime? date;
521   - if (dr[dc] == DBNull.Value)
522   - date = null;
523   - else
524   - date = (DateTime)dr[dc];
525   -
526   - lsd.SubscriptionValidThrough = date;
527   - }
528   - if (dc.ColumnName == "RenewelDate")
529   - {
530   - DateTime? date;
531   - if (dr[dc] == DBNull.Value)
532   - date = null;
533   - else
534   - date = (DateTime)dr[dc];
535   -
536   - lsd.RenewalDate = date;
537   - }
538   - if (dc.ColumnName == "PaymentMode")
539   - lsd.PaymentMode = dr[dc].ToString();
540   - if (dc.ColumnName == "TotalAmount")
541   - lsd.TotalAmount = Convert.ToDouble(dr[dc]);
542   - if (dc.ColumnName == "AmountPaid")
543   - lsd.AmountPaid = Convert.ToDouble(dr[dc]);
544   - if (dc.ColumnName == "AmountPending")
545   - lsd.AmountPending = Convert.ToDouble(dr[dc]);
546   - if (dc.ColumnName == "NoofImages")
547   - lsd.NoOfImages = Convert.ToInt32(dr[dc]);
548 456 }
549 457 }
  458 + else
  459 + {
  460 + lsd = new LicenseSubscriptionDetails ();
  461 + }
  462 +
550 463 }
551 464 catch (Exception ex)
552 465 {
553   -
  466 + logger.Fatal("Exception in GetLicenseSubscriptionDetailsByLicenseId for LicenseId= " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
554 467 }
555 468  
556 469 return lsd;
557 470 }
558 471  
559   - protected License GetLicenseDetailsByLicenseId(int licenseId)
  472 + internal License GetLicenseDetailsByLicenseId(int licenseId)
560 473 {
561   - License lic = new License();
  474 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  475 + logger.Debug(" inside GetLicenseDetailsByLicenseId for LicenseId = " + licenseId);
  476 +
  477 + License license = new License();
562 478 try
563 479 {
564 480 conn = new SqlConnection(dbConnectionString);
... ... @@ -568,7 +484,7 @@ namespace AIAHTML5.API.Models
568 484 DataSet ds = new DataSet();
569 485  
570 486 cmd.Connection = conn;
571   - cmd.CommandText = "GetLicenseDetailsById";
  487 + cmd.CommandText = DBConstants.GET_LICENSE_DETAILS_BY_ID;
572 488 cmd.CommandType = CommandType.StoredProcedure;
573 489  
574 490 param = new SqlParameter("@Id", licenseId);
... ... @@ -578,89 +494,68 @@ namespace AIAHTML5.API.Models
578 494  
579 495 adapter = new SqlDataAdapter(cmd);
580 496 adapter.Fill(ds);
581   - DataTable dt = ds.Tables[0];
582 497  
583   - foreach (DataRow dr in dt.Rows)
  498 + if (ds.Tables.Count > 0)
584 499 {
585   - foreach (DataColumn dc in dt.Columns)
  500 + DataTable dt = ds.Tables[0];
  501 + if (dt.Rows.Count > 0)
586 502 {
587   - if (dc.ColumnName == "Id")
588   - lic.Id = Convert.ToInt32(dr[dc]);
589   - if (dc.ColumnName == "AccountNumber")
590   - lic.AccountNumber = dr[dc].ToString();
591   - if (dc.ColumnName == "LicenseeFirstName")
592   - lic.LicenseeFirstName = dr[dc].ToString();
593   - if (dc.ColumnName == "LicenseeLastName")
594   - lic.LicenseeLastName = dr[dc].ToString();
595   - if (dc.ColumnName == "LicenseTypeId")
596   - lic.LicenseTypeId = Convert.ToInt32(dr[dc]);
597   - if (dc.ColumnName == "InstitutionName")
598   - lic.InstitutionName = dr[dc].ToString();
599   - if (dc.ColumnName == "Address1")
600   - lic.Address1 = dr[dc].ToString();
601   - if (dc.ColumnName == "Address2")
602   - lic.Address2 = dr[dc].ToString();
603   - if (dc.ColumnName == "CountryId")
604   - lic.CountryId = Convert.ToInt32(dr[dc]);
605   - if (dc.ColumnName == "StateId")
606   - lic.StateId = Convert.ToInt32(dr[dc]);
607   - if (dc.ColumnName == "City")
608   - lic.City = dr[dc].ToString();
609   - if (dc.ColumnName == "Zip")
610   - lic.Zip = dr[dc].ToString();
611   - if (dc.ColumnName == "Phone")
612   - lic.Phone = dr[dc].ToString();
613   - if (dc.ColumnName == "EmailId")
614   - lic.EmailId = dr[dc].ToString();
615   - if (dc.ColumnName == "TotalLogins")
616   - lic.TotalLogins = Convert.ToInt32(dr[dc]);
617   - if (dc.ColumnName == "AccountTypeId")
618   - lic.AccountTypeId = Convert.ToInt32(dr[dc]);
619   - if (dc.ColumnName == "IsActive")
620   - lic.IsActive = Convert.ToBoolean(dr[dc]);
621   - if (dc.ColumnName == "IsDistrictSiteLicense")
622   - lic.IsDistrictSiteLicense = Convert.ToBoolean(dr[dc]);
623   - if (dc.ColumnName == "CreationDate")
624   - lic.CreationDate = Convert.ToDateTime(dr[dc]);
625   - if (dc.ColumnName == "ModifiedDate")
  503 + foreach (DataRow dr in dt.Rows)
626 504 {
627   - DateTime? date;
628   - if (dr[dc] == DBNull.Value)
629   - date = null;
630   - else
631   - date = (DateTime)dr[dc];
632   -
633   - lic.ModifiedDate = date;
  505 + DateTime date;
  506 + license.Id = Convert.ToInt32(dr["Id"]);
  507 + license.AccountNumber = dr["AccountNumber"].ToString();
  508 + license.LicenseeFirstName = dr["LicenseeFirstName"].ToString();
  509 + license.LicenseeLastName = dr["LicenseeLastName"].ToString();
  510 + license.LicenseTypeId = Convert.ToInt32(dr["LicenseTypeId"]);
  511 + license.InstitutionName = dr["InstitutionName"].ToString();
  512 + license.Address1 = dr["Address1"].ToString();
  513 + license.Address2 = dr["Address2"].ToString();
  514 + license.CountryId = Convert.ToInt32(dr["CountryId"]);
  515 + license.StateId = Convert.ToInt32(dr["StateId"]);
  516 + license.City = dr["City"].ToString();
  517 + license.Zip = dr["Zip"].ToString();
  518 + license.Phone = dr["Phone"].ToString();
  519 + license.EmailId = dr["EmailId"].ToString();
  520 + license.TotalLogins = Convert.ToInt32(dr["TotalLogins"]);
  521 + license.AccountTypeId = Convert.ToInt32(dr["AccountTypeId"]);
  522 + license.IsActive = Convert.ToBoolean(dr["IsActive"]);
  523 + license.IsDistrictSiteLicense = Convert.ToBoolean(dr["IsDistrictSiteLicense"]);
  524 + license.CreationDate = Convert.ToDateTime(dr["CreationDate"]);
  525 + license.ModifiedDate = DateTime.TryParse(dr["ModifiedDate"].ToString(), out date) ? date : (DateTime?)null;
  526 + license.NoOfRenewals = Convert.ToInt32(dr["NoOfRenewals"]);
  527 + license.IsTermAccepted = Convert.ToBoolean(dr["IsTermsAccepted"]);
  528 + license.ProductId = dr["ProductId"].ToString();
634 529 }
635   - if (dc.ColumnName == "NoOfRenewals")
636   - lic.NoOfRenewals = Convert.ToInt32(dr[dc]);
637   - if (dc.ColumnName == "IsTermsAccepted")
638   - lic.IsTermAccepted = Convert.ToBoolean(dr[dc]);
639   - if (dc.ColumnName == "ProductId")
640   - lic.ProductId = dr[dc].ToString();
641 530 }
642 531 }
  532 + else
  533 + {
  534 + license = new License ();
  535 + }
643 536 }
644 537 catch (Exception ex)
645 538 {
646   -
  539 + logger.Fatal("Exception in GetLicenseDetailsByLicenseId for LicenseId= " + licenseId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
647 540 }
648 541  
649   - return lic;
  542 + return license;
650 543 }
651 544  
652   - public static int UpdateLicenseTermStatus(string accountNumber)
  545 + internal static int UpdateLicenseTermStatus(string accountNumber)
653 546 {
654 547 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
655   - logger.Debug(" inside UpdateTermAcceptedStatus for AccountNumber = " + accountNumber);
  548 + logger.Debug(" inside UpdateLicenseTermStatus for AccountNumber = " + accountNumber);
  549 +
656 550 int result = 0;
  551 +
657 552 try
658   - {
  553 + {
659 554 conn = new SqlConnection(dbConnectionString);
660 555 cmd = new SqlCommand();
661 556 cmd.Connection = conn;
662 557 conn.Open();
663   - cmd.CommandText = "UpdateLicenseTermAcceptedStatus";
  558 + cmd.CommandText = DBConstants.UPDATE_LICENSE_TERM_STATUS;
664 559 cmd.CommandType = CommandType.StoredProcedure;
665 560 cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber);
666 561 result = cmd.ExecuteNonQuery();
... ... @@ -668,29 +563,427 @@ namespace AIAHTML5.API.Models
668 563 }
669 564 catch (SqlException ex)
670 565 {
671   - conn.Close();
672   - logger.Fatal("Exception in UpdateLicenseTermStatus for AccountNumber =" + accountNumber + ", Exception= " + ex.Message);
  566 + logger.Fatal("Exception in UpdateLicenseTermStatus for AccountNumber =" + accountNumber + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  567 + throw;
673 568 }
674 569 return result;
675 570 }
676 571  
677   - protected static ArrayList GetTermsOfServiceText()
  572 + internal static ArrayList GetTermsOfServiceText()
678 573 {
  574 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  575 + logger.Debug(" inside GetTermsOfServiceText");
  576 +
679 577 ArrayList arrTermsOfService = new ArrayList();
680   - Hashtable contentHash = null;
681   - string str = string.Empty;
682   - string spName = "GetTermsOfServiceText";
683   - DataSet ds = DBModel.GetSQLData(spName, true);
684   - DataTable dt = ds.Tables[0];
685 578  
686   - foreach (DataRow dr in dt.Rows)
  579 + try
  580 + {
  581 + Hashtable contentHash = null;
  582 + string str = string.Empty;
  583 + string spName = DBConstants.GET_TERMS_OF_SERVICE_TEXT;
  584 + DataSet ds = DBModel.GetDataFromStoredProcedure(spName);
  585 +
  586 + if (ds.Tables.Count > 0)
  587 + {
  588 + DataTable dt = ds.Tables[0];
  589 + if (dt.Rows.Count > 0)
  590 + {
  591 + foreach (DataRow dr in dt.Rows)
  592 + {
  593 + contentHash = new Hashtable();
  594 + contentHash.Add(AIAConstants.KEY_TITLE, dr["Title"]);
  595 + contentHash.Add(AIAConstants.KEY_CONTENT, dr["Content"]);
  596 + arrTermsOfService.Add(contentHash);
  597 + }
  598 + }
  599 + }
  600 + }
  601 + catch (SqlException ex)
687 602 {
688   - contentHash = new Hashtable();
689   - contentHash.Add(AIAConstants.KEY_TITLE, dr["Title"]);
690   - contentHash.Add(AIAConstants.KEY_CONTENT, dr["Content"]);
691   - arrTermsOfService.Add(contentHash);
  603 + logger.Fatal("Exception in GetTermsOfServiceText, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  604 + throw;
692 605 }
  606 +
693 607 return arrTermsOfService;
694 608 }
  609 +
  610 + internal int InsertLoginDetails(int userId)
  611 + {
  612 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  613 + logger.Debug(" inside InsertLoginDetails for UserId= " + userId);
  614 +
  615 + int result = 0;
  616 + try
  617 + {
  618 + conn = new SqlConnection(dbConnectionString);
  619 + cmd = new SqlCommand();
  620 + cmd.Connection = conn;
  621 + conn.Open();
  622 + cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL;
  623 + cmd.CommandType = CommandType.StoredProcedure;
  624 + cmd.Parameters.AddWithValue("@iUserId", userId);
  625 + result = cmd.ExecuteNonQuery();
  626 + conn.Close();
  627 + }
  628 + catch (SqlException ex)
  629 + {
  630 + conn.Close();
  631 + logger.Fatal("Exception in InsertLoginDetails for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace);
  632 + throw;
  633 + }
  634 + finally
  635 + {
  636 + conn.Dispose();
  637 + }
  638 +
  639 + return result;
  640 + }
  641 +
  642 + internal int InsertIncorrectLoginAttempts(int userId)
  643 + {
  644 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  645 + logger.Debug(" inside InsertIncorrectLoginAttempts for UserId= " + userId);
  646 +
  647 + int result = 0;
  648 + try
  649 + {
  650 + conn = new SqlConnection(dbConnectionString);
  651 + cmd = new SqlCommand();
  652 + cmd.Connection = conn;
  653 + conn.Open();
  654 + cmd.CommandText = DBConstants.INSERT_INCORRECT_LOGIN_ATTEMPTS;
  655 + cmd.CommandType = CommandType.StoredProcedure;
  656 + cmd.Parameters.AddWithValue("@iUserId", userId);
  657 + result = cmd.ExecuteNonQuery();
  658 + conn.Close();
  659 + }
  660 + catch (SqlException ex)
  661 + {
  662 + conn.Close();
  663 + logger.Fatal("Exception in InsertIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  664 + throw;
  665 + }
  666 + finally
  667 + {
  668 + conn.Dispose();
  669 + }
  670 + return result;
  671 + }
  672 +
  673 + internal int GetIncorrectLoginAttempts(int userId)
  674 + {
  675 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  676 + logger.Debug(" inside GetIncorrectLoginAttempts for UserId = " + userId);
  677 +
  678 + int count = 0;
  679 + try
  680 + {
  681 + conn = new SqlConnection(dbConnectionString);
  682 + cmd = new SqlCommand();
  683 + cmd.Connection = conn;
  684 + cmd.CommandText = DBConstants.GET_INCORRECT_LOGIN_ATTEMPTS;
  685 + cmd.CommandType = CommandType.StoredProcedure;
  686 + cmd.Parameters.AddWithValue("@iUserId", userId);
  687 + SqlDataAdapter da = new SqlDataAdapter();
  688 + da.SelectCommand = cmd;
  689 + DataSet ds = new DataSet();
  690 + da.Fill(ds);
  691 +
  692 + if (ds.Tables.Count > 0)
  693 + {
  694 + DataTable dt = ds.Tables[0];
  695 +
  696 + if (dt.Rows.Count > 0)
  697 + {
  698 + foreach (DataRow dr in dt.Rows)
  699 + {
  700 + foreach (DataColumn dc in dt.Columns)
  701 + {
  702 + count = Convert.ToInt32(dr[dc]);
  703 + }
  704 + }
  705 + }
  706 + }
  707 + }
  708 + catch (SqlException ex)
  709 + {
  710 + logger.Fatal("Exception in GetIncorrectLoginAttempts for UserId = " + userId + " Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  711 + throw;
  712 + }
  713 + return count;
  714 + }
  715 +
  716 + internal int UpdateIncorrectLoginAttempts(int userId)
  717 + {
  718 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  719 + logger.Debug(" inside UpdateIncorrectLoginAttempts for UserId= " + userId);
  720 +
  721 + int result = 0;
  722 + try
  723 + {
  724 + conn = new SqlConnection(dbConnectionString);
  725 + cmd = new SqlCommand();
  726 + cmd.Connection = conn;
  727 + conn.Open();
  728 + cmd.CommandText = DBConstants.UPDATE_INCORRECT_LOGIN_ATTEMPTS;
  729 + cmd.CommandType = CommandType.StoredProcedure;
  730 + cmd.Parameters.AddWithValue("@iUserId", userId);
  731 + result = cmd.ExecuteNonQuery();
  732 + conn.Close();
  733 + }
  734 + catch (SqlException ex)
  735 + {
  736 + conn.Close();
  737 + logger.Fatal("Exception in UpdateIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace);
  738 + throw;
  739 + }
  740 + finally
  741 + {
  742 + conn.Dispose();
  743 + }
  744 + return result;
  745 + }
  746 +
  747 + public int DeleteIncorrectLoginAttempts(int userId)
  748 + {
  749 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  750 + logger.Debug(" inside DeleteIncorrectLoginAttempts for UserId= " + userId);
  751 +
  752 + int result = 0;
  753 + try
  754 + {
  755 + conn = new SqlConnection(dbConnectionString);
  756 + cmd = new SqlCommand();
  757 + cmd.Connection = conn;
  758 + conn.Open();
  759 + cmd.CommandText = DBConstants.DELETE_INCORRECT_LOGIN_ATTEMPTS;
  760 + cmd.CommandType = CommandType.StoredProcedure;
  761 + cmd.Parameters.AddWithValue("@iUserId", userId);
  762 + result = cmd.ExecuteNonQuery();
  763 + conn.Close();
  764 + }
  765 + catch (SqlException ex)
  766 + {
  767 + conn.Close();
  768 + logger.Fatal("Exception in DeleteIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  769 + throw;
  770 + }
  771 + finally
  772 + {
  773 + conn.Dispose();
  774 + }
  775 + return result;
  776 + }
  777 +
  778 + protected ArrayList GetLoginFailureCauses()
  779 + {
  780 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  781 + logger.Debug(" Inside GetLoginFailureCauses");
  782 +
  783 + ArrayList failureCauseList = new ArrayList();
  784 +
  785 + try
  786 + {
  787 + Hashtable fcHash = null;
  788 +
  789 + string sp = DBConstants.GET_ALL_LOGIN_FAILURE_CAUSES;
  790 +
  791 + DataSet ds = DBModel.GetDataFromStoredProcedure(sp);
  792 +
  793 + if (ds.Tables.Count > 0)
  794 + {
  795 + DataTable dt = ds.Tables[0];
  796 +
  797 + if (dt.Rows.Count > 0)
  798 + {
  799 + foreach (DataRow drFailureCause in dt.Rows)
  800 + {
  801 + fcHash = new Hashtable();
  802 + fcHash.Add(AIAConstants.KEY_ID, drFailureCause["Id"]);
  803 + fcHash.Add(AIAConstants.KEY_DESCRIPTION, drFailureCause["Description"]);
  804 + failureCauseList.Add(fcHash);
  805 + }
  806 + }
  807 + }
  808 + }
  809 + catch (SqlException ex)
  810 + {
  811 + logger.Fatal("Exception in GetLoginFailureCauses, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  812 + throw;
  813 + }
  814 + return failureCauseList;
  815 + }
  816 +
  817 + internal int InsertUserLoginLog(string accountNumber, Int16 failureId, string referalUrl, string edition, string httpReferer)
  818 + {
  819 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  820 + logger.Debug(" inside InsertUserLoginLog for AccountNumber= " + accountNumber);
  821 +
  822 + int result = 0;
  823 + try
  824 + {
  825 + conn = new SqlConnection(dbConnectionString);
  826 + cmd = new SqlCommand();
  827 + cmd.Connection = conn;
  828 + conn.Open();
  829 + cmd.CommandText = DBConstants.INSERT_LOGIN_ERROR_LOG;
  830 + cmd.CommandType = CommandType.StoredProcedure;
  831 + cmd.Parameters.AddWithValue("@nvAccountNumber", accountNumber);
  832 + cmd.Parameters.AddWithValue("@dtLogDate", DateTime.Now);
  833 + cmd.Parameters.AddWithValue("@tiFailureId", failureId);
  834 + cmd.Parameters.AddWithValue("@nvReferalUrl", referalUrl);
  835 + cmd.Parameters.AddWithValue("@nvEdition", edition);
  836 + cmd.Parameters.AddWithValue("@nvHttpReferer", httpReferer);
  837 + result = cmd.ExecuteNonQuery();
  838 + conn.Close();
  839 + }
  840 + catch (SqlException ex)
  841 + {
  842 + conn.Close();
  843 + logger.Fatal("Exception in InsertUserLoginLog for AccountNumber= " + accountNumber + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  844 + throw;
  845 + }
  846 + finally
  847 + {
  848 + conn.Dispose();
  849 + }
  850 + return result;
  851 + }
  852 +
  853 + internal BlockedUser GetBlockedUserByUserId(int userId)
  854 + {
  855 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  856 + logger.Debug(" inside GetBlockedUserByUserId for UserId= " + userId);
  857 +
  858 + BlockedUser blockedUser = new BlockedUser();
  859 + DataTable dt = null;
  860 + try
  861 + {
  862 + conn = new SqlConnection(dbConnectionString);
  863 + cmd = new SqlCommand();
  864 + cmd.Connection = conn;
  865 + cmd.CommandText = DBConstants.GET_BLOCKED_USER_BY_USER_ID;
  866 + cmd.CommandType = CommandType.StoredProcedure;
  867 + cmd.Parameters.AddWithValue("@userId", userId);
  868 + SqlDataAdapter da = new SqlDataAdapter();
  869 + da.SelectCommand = cmd;
  870 + dt = new DataTable();
  871 + da.Fill(dt);
  872 +
  873 + if (dt.Rows.Count > 0)
  874 + {
  875 + foreach (DataRow dr in dt.Rows)
  876 + {
  877 + blockedUser.Id = Convert.ToInt32(dr["Id"]);
  878 + blockedUser.FirstName = dr["FirstName"].ToString();
  879 + blockedUser.LastName = dr["LastName"].ToString();
  880 + blockedUser.EmailId = dr["EmailId"].ToString();
  881 + blockedUser.LoginId = dr["LoginId"].ToString();
  882 + blockedUser.Password = dr["Password"].ToString();
  883 + blockedUser.AccountNumber = dr["AccountNumber"].ToString();
  884 + blockedUser.LoginTime = Convert.ToDateTime(dr["LoginTime"]);
  885 + }
  886 + }
  887 + else
  888 + {
  889 + blockedUser = new BlockedUser ();
  890 + }
  891 + }
  892 + catch (SqlException ex)
  893 + {
  894 + logger.Fatal("Exception in GetBlockedUserByUserId for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  895 + throw;
  896 + }
  897 + return blockedUser;
  898 + }
  899 +
  900 + protected ArrayList GetBlockedUsersByUserType(int userTypeId)
  901 + {
  902 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  903 + logger.Debug(" inside GetBlockedUsersByUserType for UserTypeId= " + userTypeId);
  904 +
  905 + ArrayList blockedUsersList = new ArrayList();
  906 + BlockedUser blockedUser = null;
  907 + DataTable dt = null;
  908 + try
  909 + {
  910 + conn = new SqlConnection(dbConnectionString);
  911 + cmd = new SqlCommand();
  912 + cmd.Connection = conn;
  913 + cmd.CommandText = DBConstants.GET_BLOCKED_USERS_BY_USER_TYPE;
  914 + cmd.CommandType = CommandType.StoredProcedure;
  915 + cmd.Parameters.AddWithValue("@iUserTypeId", userTypeId);
  916 + SqlDataAdapter da = new SqlDataAdapter();
  917 + da.SelectCommand = cmd;
  918 + dt = new DataTable();
  919 + da.Fill(dt);
  920 +
  921 + if (dt.Rows.Count > 0)
  922 + {
  923 + foreach (DataRow dr in dt.Rows)
  924 + {
  925 + blockedUser = new BlockedUser();
  926 +
  927 + blockedUser.Id = Convert.ToInt32(dr["Id"]);
  928 + blockedUser.FirstName = dr["FirstName"].ToString();
  929 + blockedUser.LastName = dr["LastName"].ToString();
  930 + blockedUser.EmailId = dr["EmailId"].ToString();
  931 + blockedUser.LoginId = dr["LoginId"].ToString();
  932 + blockedUser.Password = dr["Password"].ToString();
  933 + blockedUser.AccountNumber = dr["AccountNumber"].ToString();
  934 + blockedUser.LoginTime = Convert.ToDateTime(dr["LoginTime"]);
  935 +
  936 + blockedUsersList.Add(blockedUser);
  937 + }
  938 + }
  939 + else
  940 + {
  941 + blockedUser = new BlockedUser();
  942 + }
  943 + }
  944 + catch (SqlException ex)
  945 + {
  946 + logger.Fatal("Exception in GetBlockedUsersByUserType for UserTypeId= " + userTypeId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  947 + throw;
  948 + }
  949 + return blockedUsersList;
  950 + }
  951 +
  952 + internal static int UnblockUser(int userId)
  953 + {
  954 + int result = 0;
  955 + DBModel objModel = new DBModel();
  956 +
  957 + result = objModel.DeleteIncorrectLoginAttempts(userId);
  958 +
  959 + return result;
  960 + }
  961 +
  962 + internal static bool ValidateUserAuthenticity(string username, string password, User user)
  963 + {
  964 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  965 + logger.Debug(" Inside ValidateUserAuthenticity for Username = " + username + ", Password: " + password);
  966 +
  967 + bool result = false;
  968 +
  969 + try
  970 + {
  971 + if ((string.Equals(username.ToUpper(), user.LoginId.ToUpper())) && (string.Equals(password, user.Password)))
  972 + {
  973 + result = true;
  974 + }
  975 + else
  976 + {
  977 + result = false;
  978 + }
  979 + }
  980 + catch (SqlException ex)
  981 + {
  982 + logger.Fatal("Exception in ValidateUserAuthenticity for Username = " + username + ", Password: " + password + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace);
  983 + throw;
  984 + }
  985 +
  986 + return result;
  987 + }
695 988 }
696 989 }
697 990 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/User.cs
... ... @@ -22,14 +22,21 @@ namespace AIAHTML5.API.Models
22 22 public int? ModifierId { get; set; }
23 23 public DateTime? ModifiedDate { get; set; }
24 24 public string UserType { get; set; }
  25 + public int UserTypeId { get; set; }
25 26 public bool IsActive { get; set; }
  27 + public bool IsCorrectPassword { get; set; }
  28 + public int IncorrectLoginAttemptCount { get; set; }
  29 + public bool IsBlocked { get; set; }
  30 + public int LicenseId { get; set; }
  31 + public int EditionId { get; set; }
  32 + public Int16 LoginFailureCauseId { get; set; }
26 33  
27 34 public ArrayList Modules { get; set; }
28 35  
29   - public License License { get; set; }
  36 + public License LicenseInfo { get; set; }
30 37 public LicenseSubscriptionDetails LicenseSubscriptions { get; set; }
31 38 public bool IsSubscriptionExpired { get; set; }
32   - public string SubscriptionExpirationDateString { get; set; }
  39 + public string SubscriptionExpirationDate { get; set; }
33 40 public string TermsOfServiceTitle { get; set; }
34 41 public string TermsOfServiceText { get; set; }
35 42  
... ... @@ -44,6 +51,11 @@ namespace AIAHTML5.API.Models
44 51 public const string SITE_USER = "Site User";
45 52 }
46 53  
  54 + public enum UserType
  55 + {
  56 + SUPER_ADMIN = 1, GENERAL_ADMIN, DISTRICT_ADMIN, CLIENT_ADMIN, SINGLE_USER, CONCURRENT_USER, RESELLER, TEST_ACCOUNT, SITE_USER
  57 + }
  58 +
47 59 public class License
48 60 {
49 61 public int Id { get; set; }
... ... @@ -89,4 +101,16 @@ namespace AIAHTML5.API.Models
89 101 public double AmountPending { get; set; }
90 102 public int NoOfImages { get; set; }
91 103 }
  104 +
  105 + public class BlockedUser
  106 + {
  107 + public int Id { get; set; }
  108 + public string FirstName { get; set; }
  109 + public string LastName { get; set; }
  110 + public string LoginId { get; set; }
  111 + public string Password { get; set; }
  112 + public string EmailId { get; set; }
  113 + public string AccountNumber { get; set; }
  114 + public DateTime LoginTime { get; set; }
  115 + }
92 116 }
93 117 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/UserUtility.cs
1   -using System;
  1 +using System;
2 2 using System.Collections.Generic;
3 3 using System.Linq;
4 4 using System.Web;
... ... @@ -13,12 +13,13 @@ using System.Text;
13 13 using System.IO;
14 14 using System.Net.Mime;
15 15 using System.Configuration;
  16 +using System.Collections;
16 17  
17 18 namespace AIAHTML5.API.Models
18 19 {
19 20 public class UserUtility
20 21 {
21   - public static bool SendEmail(dynamic UserDetails, bool havePassword)
  22 + public static bool SendEmail(dynamic UserDetails, bool havePassword, bool unbLockUser = false)
22 23 {
23 24 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
24 25 logger.Debug("inside SendEmail in for havePassword =" + havePassword);
... ... @@ -71,8 +72,16 @@ namespace AIAHTML5.API.Models
71 72  
72 73 if (havePassword)
73 74 {
74   - templatePath = "~/Templates/forgot-Password.html";
75   - resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail);
  75 + if (unbLockUser)
  76 + {
  77 + templatePath = "~/Templates/unblock-User.html";
  78 + resetPasswordLink = site_url + "?unb:" + HttpUtility.UrlEncode(userMail);
  79 + }
  80 + else
  81 + {
  82 + templatePath = "~/Templates/forgot-Password.html";
  83 + resetPasswordLink = site_url + "?em:" + HttpUtility.UrlEncode(userMail);
  84 + }
76 85 }
77 86 else
78 87 templatePath = "~/Templates/forgot-UserId.html";
... ... @@ -105,8 +114,12 @@ namespace AIAHTML5.API.Models
105 114 if (!havePassword)
106 115 mailSubject = "UserID recovery mail for: ";
107 116 else
108   - mailSubject = "Password recovery mail for: ";
109   -
  117 + {
  118 + if (unbLockUser)
  119 + mailSubject = "Unblock user request mail for: ";
  120 + else
  121 + mailSubject = "Password recovery mail for: ";
  122 + }
110 123  
111 124 emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
112 125 emailUtility.sFromAddress = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
... ... @@ -211,10 +224,93 @@ namespace AIAHTML5.API.Models
211 224 }
212 225 catch (Exception ex)
213 226 {
214   - logger.Fatal("exception in GetMailBodyTextFromTemplate. msg= " + ex.Message + ", stacktrace= " + ex.StackTrace);
  227 + logger.Fatal("exception in SendAdminRequestEmail for email =" + userInfo["emailId"] + ". msg= " + ex.Message + ", stacktrace= " + ex.StackTrace);
  228 + return false;
  229 + }
  230 + }
  231 +
  232 + public static bool SendEmail(Newtonsoft.Json.Linq.JObject userInfo, ArrayList mailToList, string sender, string mailSubject = "", string mailBody = "")
  233 + {
  234 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  235 + logger.Debug("Inside SendEmail with UserInfo =" + userInfo);
  236 +
  237 + try
  238 + {
  239 + EmailUtility emailUtility = new EmailUtility();
  240 + List<string> lstToAddress = new List<string>();
  241 + List<string> lstBccAddress = new List<string>();
  242 +
  243 + string emailMessage = string.Empty;
  244 + string senderEmailId = string.Empty;
  245 +
  246 + foreach (string email in mailToList)
  247 + {
  248 + lstToAddress.Add(email);
  249 + }
  250 +
  251 + emailMessage = "Unable to process request for ";
  252 +
  253 + if (UserUtility.CheckIfPropertyExists(userInfo, "username") && !string.IsNullOrEmpty(userInfo["username"].ToString()))
  254 + emailMessage += "username: <b>" + userInfo["username"].ToString() + "</b>";
  255 + if (UserUtility.CheckIfPropertyExists(userInfo, "password") && !string.IsNullOrEmpty(userInfo["password"].ToString()))
  256 + emailMessage += "& password: <b>" + userInfo["password"].ToString() + "</b><br/><br/>";
  257 + if (UserUtility.CheckIfPropertyExists(userInfo, "emailId") && !string.IsNullOrEmpty(userInfo["emailId"].ToString()))
  258 + emailMessage += "emailId: <b>" + userInfo["emailId"].ToString() + "</b><br/><br/>";
  259 + if (UserUtility.CheckIfPropertyExists(userInfo, "accountNumber") && !string.IsNullOrEmpty(userInfo["accountNumber"].ToString()))
  260 + emailMessage += "accountNumber: <b>" + userInfo["accountNumber"].ToString() + "</b><br/><br/>";
  261 +
  262 + if (string.IsNullOrEmpty(sender))
  263 + senderEmailId = Convert.ToString(ConfigurationManager.AppSettings["SenderEmailAddress"]);
  264 + else
  265 + senderEmailId = sender;
  266 +
  267 + emailMessage += mailBody;
  268 +
  269 + emailMessage = emailMessage.Replace("\n", "<br/>");
  270 +
  271 + emailMessage += "<br/><br/>";
  272 +
  273 + emailUtility.sHostName = Convert.ToString(ConfigurationManager.AppSettings["HostAddress"]);
  274 + emailUtility.sFromAddress = senderEmailId;
  275 + emailUtility.bIsBodyHtml = true;
  276 + emailUtility.bEnableSsl = false;
  277 + emailUtility.sSubject = mailSubject;
  278 + emailUtility.sBodyText = emailMessage;
  279 + emailUtility.iPort = 25;
  280 + emailUtility.sToAddresses = lstToAddress;
  281 + emailUtility.sBccAddresses = lstBccAddress;
  282 +
  283 + emailUtility.SendSmtpEmail();
  284 + return true;
  285 + }
  286 + catch (Exception ex)
  287 + {
  288 + logger.Fatal("exception in SendEmail for username: " + userInfo["username"].ToString() + " & password: " + userInfo["password"].ToString() + " email =" + userInfo["emailId"] + ". msg= " + ex.Message + ", stacktrace= " + ex.StackTrace);
215 289 return false;
216 290 }
217 291 }
218 292  
  293 + public static ArrayList GetSupportMailList()
  294 + {
  295 + ArrayList supoortMailList = new ArrayList();
  296 + string[] mailToArr = (ConfigurationManager.AppSettings["AdminSupport"]).Split(',');
  297 + if (mailToArr.Length > 0)
  298 + {
  299 + for (int i = 0; i < mailToArr.Length; i++)
  300 + {
  301 + supoortMailList.Add(mailToArr[i].ToString());
  302 + }
  303 + }
  304 + return supoortMailList;
  305 + }
  306 +
  307 + protected static bool CheckIfPropertyExists(dynamic dynamicObject, string propertyName)
  308 + {
  309 + var res = dynamicObject[propertyName];
  310 + if (res != null)
  311 + return true;
  312 + else
  313 + return false;
  314 + }
219 315 }
220 316 }
221 317 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -9,6 +9,7 @@ using AIAHTML5.API.Constants;
9 9 using log4net;
10 10 using AIAHTML5.API.Models;
11 11 using Newtonsoft.Json;
  12 +using System.Collections;
12 13  
13 14 namespace AIAHTML5.API.Models
14 15 {
... ... @@ -22,27 +23,7 @@ namespace AIAHTML5.API.Models
22 23  
23 24 try
24 25 {
25   - //var client = new MongoClient();
26   - //var db = client.GetDatabase(Settings.Default.database);
27   -
28   - //var collection = db.GetCollection<dynamic>("Users");
29   -
30   - //FilterDefinition<dynamic>[] filterCondition = { Builders<dynamic>.Filter.Eq("loginId", credentials["username"].ToString()),
31   - // Builders<dynamic>.Filter.Eq("password", credentials["password"].ToString())};
32   -
33   - //dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault();
34   -
35   -
36   - //if (userDetails != null)
37   - //{
38   - // logger.Debug("userDetails.loginId= " + userDetails.loginId);
39   - // return userDetails;
40   - //}
41   - //else
42   - //{
43   - // return AIAConstants.USER_NOT_FOUND;
44   - //}
45   - User user = DBModel.GetUserDetailsByLoginIdAndPassword(credentials["username"].ToString(), credentials["password"].ToString());
  26 + User user = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString());
46 27 //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString());
47 28  
48 29 if (user != null)
... ... @@ -60,11 +41,18 @@ namespace AIAHTML5.API.Models
60 41 catch (Exception e)
61 42 {
62 43  
63   - logger.Fatal("Exception in AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message);
  44 + logger.Fatal("Exception in AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  45 +
  46 + //string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS;
  47 + //string error = "Message: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  48 + //userDetails = errorMessage;
64 49  
65   - string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS;
66   - string error = "Message: " + e.Message + ", STACKTRACE: " + e.StackTrace;
67   - userDetails = error;
  50 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  51 + string mailSubject = "SQL Exception intimation mail";
  52 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  53 + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
  54 +
  55 + userDetails = AIAConstants.SQL_CONNECTION_ERROR;
68 56 }
69 57 return userDetails;
70 58 }
... ... @@ -109,7 +97,7 @@ namespace AIAHTML5.API.Models
109 97  
110 98 //dynamic userDetails;
111 99  
112   - if (objUser != null)
  100 + if (objUser.Id > 0)
113 101 {
114 102 logger.Debug("userDetails.loginId= " + objUser.LoginId);
115 103 //return userDetails = JsonConvert.SerializeObject(objUser);
... ... @@ -122,16 +110,23 @@ namespace AIAHTML5.API.Models
122 110 }
123 111 catch (Exception ex)
124 112 {
125   - logger.Fatal("Exception in Gettting UserDetailsByEmailId for EmailId =" + userInfo["emailId"].ToString() + " Exception= " + ex.Message);
  113 + logger.Fatal("Exception in Gettting UserDetailsByEmailId for EmailId =" + userInfo["emailId"].ToString() + " Exception= " + ex.Message + ", STACKTRACE: " + ex.StackTrace);
  114 +
  115 + //string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS;
  116 + //return errorMessage;
126 117  
127   - string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS;
128   - return errorMessage;
  118 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  119 + string mailSubject = "SQL Exception intimation mail";
  120 + string mailBody = "MESSAGE: " + ex.Message + ", STACKTRACE: " + ex.StackTrace;
  121 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  122 +
  123 + return AIAConstants.SQL_CONNECTION_ERROR;
129 124 }
130 125  
131 126  
132 127 }
133 128  
134   - internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo)
  129 + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId)
135 130 {
136 131 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
137 132 //var client = new MongoClient();
... ... @@ -144,23 +139,444 @@ namespace AIAHTML5.API.Models
144 139  
145 140 //var result = collection.UpdateOne(filter, update);
146 141  
147   - int result = DBModel.UpdateUserPassword(userInfo);
  142 + int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId);
148 143  
149   - if (result != null)
  144 + if (result > 0)
150 145 return result;
151 146 else
152 147 return AIAConstants.USER_NOT_FOUND;
153 148 }
154 149 catch (Exception e)
155 150 {
156   - logger.Fatal("Exception= " + e.Message);
157   - return AIAConstants.ERROR_IN_FECTHING_DETAILS;
  151 + logger.Fatal("Exception in UdatePassword with user details = " + userInfo + ", LoginId:" + sLoginId + ", EmailId: "+ sEmailId + "<br/>MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace);
  152 + //return AIAConstants.ERROR_IN_FECTHING_DETAILS;
  153 +
  154 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  155 + string mailSubject = "SQL Exception intimation mail";
  156 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  157 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  158 +
  159 + return AIAConstants.SQL_CONNECTION_ERROR;
  160 + }
  161 + }
  162 +
  163 + internal static dynamic UpdateLicenseTerm(Newtonsoft.Json.Linq.JObject userLicenseInfo)
  164 + {
  165 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  166 + logger.Debug(" inside UpdateLicenseTerm for AccountNumber = " + userLicenseInfo["licenseeAccountNumber"].ToString() + ", LicenseId: " + userLicenseInfo["userLicenseId"].ToString());
  167 + Newtonsoft.Json.Linq.JObject userInfo = new Newtonsoft.Json.Linq.JObject();
  168 +
  169 + dynamic result;
  170 + string accountNumber = userLicenseInfo["licenseeAccountNumber"].ToString();
  171 +
  172 + userInfo.Add("accountNumber", accountNumber);
  173 +
  174 + try
  175 + {
  176 + result = DBModel.UpdateLicenseTermStatus(accountNumber);
  177 +
  178 + if (result < 0)
  179 + {
  180 + logger.Fatal("Unable to update LicenseTermAccepted status for AccountNumber =" + accountNumber);
  181 + }
  182 + }
  183 + catch (Exception ex)
  184 + {
  185 + logger.Fatal("Exception in UpdateLicenseTerm for AccountNumber =" + accountNumber + " Exception= " + ex.Message + ", STACKTRACE: " + ex.StackTrace);
  186 +
  187 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  188 + string mailSubject = "SQL Exception intimation mail";
  189 + string mailBody = "MESSAGE: " + ex.Message + ", STACKTRACE: " + ex.StackTrace;
  190 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  191 +
  192 + result = AIAConstants.SQL_CONNECTION_ERROR;
  193 + }
  194 +
  195 +
  196 + return result;
  197 + }
  198 +
  199 + internal static bool IsUserAuthenticated(Newtonsoft.Json.Linq.JObject credentials, User user)
  200 + {
  201 + bool isAuthenticatedUser = DBModel.ValidateUserAuthenticity(credentials["username"].ToString(), credentials["password"].ToString(), user);
  202 +
  203 + return isAuthenticatedUser;
  204 + }
  205 +
  206 + internal static User getUserDetails(Newtonsoft.Json.Linq.JObject credentials)
  207 + {
  208 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  209 + logger.Debug("inside getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString());
  210 + User userDetails = null;
  211 +
  212 + try
  213 + {
  214 + userDetails = DBModel.GetUserDetailsByLoginId(credentials["username"].ToString());
  215 + }
  216 + catch (Exception e)
  217 + {
  218 +
  219 + logger.Fatal("Exception in getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  220 + throw;
  221 + //ArrayList supportMailList = UserUtility.GetSupportMailList();
  222 + //string mailSubject = "SQL Exception intimation mail";
  223 + //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  224 + //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody);
  225 +
  226 + //userDetails = AIAConstants.SQL_CONNECTION_ERROR;
  227 + }
  228 +
  229 + return userDetails;
  230 + }
  231 +
  232 + internal static void getLicenseIdForThisUser(int userId, out int licenseId, out int editionId)
  233 + {
  234 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  235 + logger.Debug("inside getLicenseIdForThisUser for UserId =" + userId);
  236 +
  237 + //assigning below variable to avoid compiler error for unassignd out params
  238 + licenseId = 0;
  239 + editionId = 0;
  240 +
  241 + try
  242 + {
  243 +
  244 + DBModel objModel = new DBModel();
  245 + Hashtable licenseEditionHash = objModel.GetLicenseDetailByUserId(userId);
  246 +
  247 + if (licenseEditionHash.ContainsKey(AIAConstants.LICENSE_KEY_ID))
  248 + licenseId = Convert.ToInt32(licenseEditionHash[AIAConstants.LICENSE_KEY_ID]);
  249 +
  250 + if (licenseEditionHash.ContainsKey(AIAConstants.EDITION_KEY_ID))
  251 + editionId = Convert.ToInt32(licenseEditionHash[AIAConstants.EDITION_KEY_ID]);
  252 + //foreach (DictionaryEntry de in licenseEditionHash)
  253 + //{
  254 + // if (de.Key.ToString() == AIAConstants.LICENSE_KEY_ID)
  255 + // licenseId = Convert.ToInt32(de.Value);
  256 + // if (de.Key.ToString() == AIAConstants.EDITION_KEY_ID)
  257 + // editionId = Convert.ToInt32(de.Value);
  258 + //}
  259 + }
  260 + catch (Exception e)
  261 + {
  262 + logger.Fatal("Exception in getLicenseIdForThisUser for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  263 + throw;
  264 + }
  265 + }
  266 +
  267 + internal static int insertLoginDetails(int userId)
  268 + {
  269 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  270 + logger.Debug("inside insertLoginDetails for UserId =" + userId);
  271 +
  272 + int result = 0;
  273 + try
  274 + {
  275 + DBModel objModel = new DBModel();
  276 +
  277 + result = objModel.InsertLoginDetails(userId);
  278 + }
  279 + catch (Exception e)
  280 + {
  281 + logger.Fatal("Exception in insertLoginDetails for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  282 + throw;
  283 + }
  284 +
  285 + return result;
  286 + }
  287 +
  288 + internal static bool isUSerActive(User user)
  289 + {
  290 + if (user.IsActive)
  291 + return true;
  292 + else
  293 + return false;
  294 + }
  295 +
  296 + internal static bool checkIfLicenseExpired(LicenseSubscriptionDetails subscriptionDetail, out string expirationDate)
  297 + {
  298 + expirationDate = string.Empty;
  299 + bool isLicenseExpired = false;
  300 +
  301 + if (subscriptionDetail.Id > 0)
  302 + {
  303 + DateTime? subscriptionValidThrough = subscriptionDetail.SubscriptionValidThrough;
  304 + if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date)
  305 + {
  306 + isLicenseExpired = false;
  307 + }
  308 + else
  309 + {
  310 + isLicenseExpired = true;
  311 + expirationDate = subscriptionDetail.SubscriptionValidThrough.Value.Date.ToString("MM/dd/yyyy").ToString();
  312 + }
  313 + }
  314 + return isLicenseExpired;
  315 + }
  316 +
  317 + internal static ArrayList getModuleListByLicenseId(int licenseId)
  318 + {
  319 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  320 + logger.Debug("inside getModuleListByLicenseId for LicenseId =" + licenseId);
  321 +
  322 + ArrayList licensedModulesList = new ArrayList();
  323 +
  324 + try
  325 + {
  326 +
  327 + DBModel objModel = new DBModel();
  328 + licensedModulesList = objModel.GetUserModulesByLicenseId(licenseId);
  329 + }
  330 + catch (Exception e)
  331 + {
  332 + logger.Fatal("Exception in getModuleListByLicenseId for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  333 + throw;
  334 + }
  335 +
  336 + return licensedModulesList;
  337 + }
  338 +
  339 + internal static int deletePastWrongAttempts(int userId)
  340 + {
  341 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  342 + logger.Debug("inside deletePastWrongAttempts for UserId =" + userId);
  343 +
  344 + int result = 0;
  345 +
  346 + try
  347 + {
  348 + DBModel objModel = new DBModel();
  349 +
  350 + result = objModel.DeleteIncorrectLoginAttempts(userId);
  351 + }
  352 + catch (Exception e)
  353 + {
  354 + logger.Fatal("Exception in deletePastWrongAttempts for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  355 + throw;
  356 + }
  357 + return result;
  358 + }
  359 +
  360 + internal static int checkNoOfWrongAttempts(int userId)
  361 + {
  362 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  363 + logger.Debug("inside checkNoOfWrongAttempts for UserId =" + userId);
  364 +
  365 + int result = 0;
  366 +
  367 + try
  368 + {
  369 + DBModel objModel = new DBModel();
  370 +
  371 + result = objModel.GetIncorrectLoginAttempts(userId);
  372 + }
  373 + catch (Exception e)
  374 + {
  375 + logger.Fatal("Exception in checkNoOfWrongAttempts for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  376 + throw;
  377 + }
  378 + return result;
  379 + }
  380 +
  381 + internal static int saveWrongAttemptofUser(int userId)
  382 + {
  383 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  384 + logger.Debug("inside saveWrongAttemptofUser for UserId =" + userId);
  385 + int result = 0;
  386 +
  387 + try
  388 + {
  389 + int wrongAttemptCount = Users.checkNoOfWrongAttempts(userId);
  390 +
  391 + DBModel objModel = new DBModel();
  392 +
  393 + if (wrongAttemptCount < 1)
  394 + {
  395 + result = objModel.InsertIncorrectLoginAttempts(userId);
  396 + }
  397 + else
  398 + {
  399 + result = objModel.UpdateIncorrectLoginAttempts(userId);
  400 + }
  401 + }
  402 + catch (Exception e)
  403 + {
  404 + logger.Fatal("Exception in saveWrongAttemptofUser for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  405 + throw;
  406 + }
  407 +
  408 + return result;
  409 + }
  410 +
  411 + internal static bool isLicenseActive(int licenseId)
  412 + {
  413 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  414 + logger.Debug("inside isLicenseActive for LicenseId =" + licenseId);
  415 + bool result = false;
  416 +
  417 + try
  418 + {
  419 + DBModel objModel = new DBModel();
  420 + License userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId);
  421 +
  422 +
  423 + if (userLicense.IsActive)
  424 + result = true;
  425 + else
  426 + result = false;
  427 + }
  428 + catch (Exception e)
  429 + {
  430 + logger.Fatal("Exception in isLicenseActive for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  431 + throw;
  432 + }
  433 + return result;
  434 + }
  435 +
  436 + internal static License getLicenseDetails(int licenseId)
  437 + {
  438 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  439 + logger.Debug("inside getLicenseDetails for LicenseId =" + licenseId);
  440 +
  441 + License userLicense = null;
  442 +
  443 + try
  444 + {
  445 + DBModel objModel = new DBModel();
  446 + userLicense = objModel.GetLicenseDetailsByLicenseId(licenseId);
  447 + }
  448 + catch (Exception e)
  449 + {
  450 + logger.Fatal("Exception in getLicenseDetails for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  451 + throw;
  452 + }
  453 + return userLicense;
  454 + }
  455 +
  456 + internal static LicenseSubscriptionDetails getLicenseSubscriptionDetails(int licenseId)
  457 + {
  458 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  459 + logger.Debug("inside getLicenseSubscriptionDetails for LicenseId =" + licenseId);
  460 + LicenseSubscriptionDetails userSubscriptionDetail = null;
  461 +
  462 + try
  463 + {
  464 + DBModel objModel = new DBModel();
  465 + userSubscriptionDetail = objModel.GetLicenseSubscriptionDetailsByLicenseId(licenseId);
  466 + }
  467 + catch (Exception e)
  468 + {
  469 + logger.Fatal("Exception in getLicenseSubscriptionDetails for LicenseId =" + licenseId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  470 + throw;
158 471 }
  472 + return userSubscriptionDetail;
159 473 }
160 474  
161   - internal static dynamic UpdateLicenseTerm(string accNumber)
  475 + internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword)
162 476 {
163   - int result = DBModel.UpdateLicenseTermStatus(accNumber);
  477 + isCorrectLoginId = false;
  478 + isCorrectPassword = false;
  479 +
  480 + if (userInfo.Id> 0)
  481 + {
  482 + if (string.Equals(credentials["username"].ToString().ToUpper(), userInfo.LoginId.ToUpper()))
  483 + isCorrectLoginId = true;
  484 +
  485 + if (string.Equals(credentials["password"].ToString(), userInfo.Password))
  486 + {
  487 + isCorrectPassword = true;
  488 + }
  489 + }
  490 + }
  491 +
  492 + internal static int insertUserLoginLog(string accountNumber, Int16 failureId, string referalUrl, string edition, string httpReferer)
  493 + {
  494 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  495 + logger.Debug("inside insertUserLoginLog for accountNumber =" + accountNumber);
  496 +
  497 + int result = 0;
  498 +
  499 + try
  500 + {
  501 + DBModel objModel = new DBModel();
  502 + result = objModel.InsertUserLoginLog(accountNumber, failureId, null, edition, null);
  503 + }
  504 + catch (Exception e)
  505 + {
  506 + logger.Fatal("Exception in insertUserLoginLog for accountNumber =" + accountNumber + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  507 + throw;
  508 + }
  509 + return result;
  510 + }
  511 +
  512 +
  513 + internal static ArrayList getTermsOfServiceText()
  514 + {
  515 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  516 + logger.Debug("inside getTermsOfServiceText");
  517 +
  518 + ArrayList arrTermsOfService = new ArrayList();
  519 +
  520 + try
  521 + {
  522 + DBModel objModel = new DBModel();
  523 + arrTermsOfService = DBModel.GetTermsOfServiceText();
  524 + }
  525 + catch (Exception e)
  526 + {
  527 + logger.Fatal("Exception in getTermsOfServiceText, Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  528 + throw;
  529 + }
  530 + return arrTermsOfService;
  531 + }
  532 +
  533 + internal static ArrayList getAllModulesList()
  534 + {
  535 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  536 + logger.Debug("inside getAllModulesList");
  537 + ArrayList modulesList = new ArrayList ();
  538 +
  539 + try
  540 + {
  541 + DBModel objModel = new DBModel();
  542 + modulesList = objModel.GetAllModules();
  543 + }
  544 + catch (Exception e)
  545 + {
  546 + logger.Fatal("Exception in getAllModulesList, Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  547 + throw;
  548 + }
  549 + return modulesList;
  550 + }
  551 +
  552 + internal static bool isUserBlocked(int userId, out DateTime blockTime)
  553 + {
  554 + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
  555 + logger.Debug("inside isUserBlocked for UserId =" + userId);
  556 + bool result = false;
  557 + blockTime = new DateTime();
  558 +
  559 + try
  560 + {
  561 +
  562 +
  563 + DBModel objModel = new DBModel();
  564 + BlockedUser blockedUser = objModel.GetBlockedUserByUserId(userId);
  565 +
  566 + if (blockedUser.Id> 0)
  567 + {
  568 + blockTime = blockedUser.LoginTime;
  569 + result = true;
  570 + }
  571 + else
  572 + result = false;
  573 + }
  574 +
  575 + catch (Exception e)
  576 + {
  577 + logger.Fatal("Exception in isUserBlocked for UserId =" + userId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  578 + throw;
  579 + }
164 580  
165 581 return result;
166 582 }
... ...
400-SOURCECODE/AIAHTML5.API/Templates/unblock-User.html 0 → 100644
  1 +<style type='text/css'>
  2 + strong {
  3 + font-size: 18px;
  4 + color: #ffff00;
  5 + }
  6 +</style>
  7 +<table width='500' border='0' align='center' cellpadding='0' cellspacing='0'>
  8 + <tbody>
  9 + <tr>
  10 + <td align='center' valign='middle' bgcolor='#393939' style='padding:30px 0 20px 0;'>
  11 + <a href='#'><img src='{logoPath}' alt='AIA' title='AIA' /></a>
  12 + </td>
  13 + </tr>
  14 + <tr>
  15 + <td align='center' valign='top' bgcolor='#808d43' style='padding:20px;'>
  16 + <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
  17 + <tbody>
  18 + <tr>
  19 + <td colspan='2' style=' font-size:32px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Unblock Account</td>
  20 + </tr>
  21 + <tr>
  22 + <td colspan='2'>&nbsp;</td>
  23 + </tr>
  24 + <tr>
  25 + <td colspan='2' style='font-size:20px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Hi,</td>
  26 + </tr>
  27 + <tr>
  28 + <td colspan='2'>&nbsp;</td>
  29 + </tr>
  30 + <tr>
  31 + <td colspan='2' style=' font-size:16px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>You have requested to unblock your account for emailId: {emailId}</td>
  32 + </tr>
  33 + <tr>
  34 + <td colspan='2'>&nbsp;</td>
  35 + </tr>
  36 + <tr>
  37 + <td colspan='2' style=' font-size:16px; font-weight:bold; color:#fff; font-family:Gotham, Helvetica, Arial, sans-serif'>Click the Unblock button below to unblock your A.D.A.M. Interactive Anatomy™ account</td>
  38 + </tr>
  39 + <tr>
  40 + <td colspan='2'>&nbsp;</td>
  41 + </tr>
  42 + <tr>
  43 + <td width="45%" bgcolor="#0072a7" style="padding:15px 20px; cursor: pointer;" onclick="document.location.href = '{resetPasswordLink}'">
  44 + <a href="{resetPasswordLink}" style="color:#ffffff; font-size:16px; text-transform:uppercase; text-align:center; text-decoration:none; font-family:Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; display: block;">Unblock</a>
  45 + </td>
  46 + <td width="55%" style="padding:10px 20px;">&nbsp;</td>
  47 + </tr>
  48 + <tr>
  49 + <td colspan='2'>&nbsp;</td>
  50 + </tr>
  51 + <tr>
  52 + <td colspan='2'>&nbsp;</td>
  53 + </tr>
  54 + <tr>
  55 + <td colspan='2'>&nbsp;</td>
  56 + </tr>
  57 + <tr>
  58 + <td colspan='2'>&nbsp;</td>
  59 + </tr>
  60 + </tbody>
  61 + </table>
  62 + </td>
  63 + </tr>
  64 + <tr>
  65 + <td bgcolor='#f9f2e7' style='padding:20px;'>
  66 + <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
  67 + <tbody>
  68 + <tr>
  69 + <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>A.D.A.M. – the company that pioneered online health content – is dedicated to creating and offering the most effective and innovative educational solutions possible for teaching medical science and improving health literacy.</td>
  70 + </tr>
  71 + <tr>
  72 + <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td>
  73 + </tr>
  74 + <tr>
  75 + <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>Give us a <b>call toll-free at 1-888-278-9614</b> or <em>send us an email</em> if you have any questions or if you need help. It will be our pleasure to help you.</td>
  76 + </tr>
  77 + <tr><td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td></tr>
  78 + <tr><td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'>&nbsp;</td></tr>
  79 + <tr>
  80 + <td style=' font-size:12px; font-family:Gotham, Helvetica, Arial, sans-serif; color:#000000;'><em>&copy; 2017 Ebix, Inc. All Rights Reserved. </em></td>
  81 + </tr>
  82 + </tbody>
  83 + </table>
  84 + </td>
  85 + </tr>
  86 + </tbody>
  87 +</table>
0 88 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -39,7 +39,6 @@
39 39 <add key="EnableSSL" value="false" />
40 40 <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
42   - <add key="isUserAuthenticated" value="false"/>
43 42 <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/>
44 43 <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/>
45 44 <!--<add key ="AIADatabaseV5Context" value="Data Source=52.6.248.70;Initial Catalog=AIADatabase;User ID=amrita;Password=Ebix@2017;"/>-->
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -43,7 +43,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
43 43 // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed.
44 44 $rootScope.refreshcheck = null;
45 45  
46   -
  46 +
47 47  
48 48 $rootScope.isModestyOn;
49 49 $rootScope.isModestyOff;
... ... @@ -83,7 +83,12 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
83 83 havePassword: null,
84 84 newPassword: null,
85 85 confirmPassword: null,
86   - userMessage: null
  86 + userMessage: null,
  87 + unblockUser: null
  88 + };
  89 + $rootScope.userLicenseInfo = {
  90 + userLicenseId: 0,
  91 + licenseeAccountNumber: null
87 92 };
88 93 $rootScope.userData;
89 94 $rootScope.userModules;
... ... @@ -91,21 +96,18 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
91 96 $rootScope.isVisibleLogin;
92 97 $rootScope.haveRoleAdmin;
93 98 $rootScope.checked = false;
94   - $rootScope.licenseeAccountNumber = null;
95 99 var isfilloptionChecked = "";
96 100 var isOutlineOptionChecked = "";
97   - $rootScope.forgotPwdModalShow = function ()
98   - {
99   - document.getElementById("forgetPwdForm").reset();
  101 + $rootScope.forgotPwdModalShow = function () {
  102 + document.getElementById("forgetPwdForm").reset()
100 103 $("#forgotPwdModal").modal("show");
101   - $(".modal-backdrop").css("opacity",".5");
  104 + $(".modal-backdrop").css("opacity", ".5");
102 105 }
103   - $rootScope.forgotUserModalShow=function()
104   - {
  106 + $rootScope.forgotUserModalShow = function () {
105 107 document.getElementById("forgetUSerIdForm").reset();
106 108 $("#forgotUserModal").modal("show");
107 109 $(".modal-backdrop").css("opacity", ".5");
108   -
  110 +
109 111 }
110 112 $rootScope.initializeAIA = function () {
111 113  
... ... @@ -113,6 +115,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
113 115 //$rootScope.isVisibleLogin = false;
114 116 //$rootScope.isVisibleResetPass = true;
115 117 VerifyUrlForQuerystring();
  118 + if ($location.url().indexOf('?unb:') != -1)
  119 + $rootScope.UnblockUser();
116 120 getUserDetails();
117 121 }
118 122  
... ... @@ -129,39 +133,54 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
129 133 .then(
130 134  
131 135 function (result) {
132   - if (result == 'true') {
133   -
134   - $rootScope.userModules = UserModules;
135   - $rootScope.isVisibleLogin = false;
136   - $location.path('/');
137   -
  136 + if (result == LoginConstants.USER_NOT_FOUND) {
  137 + $rootScope.isVisibleLogin = true;
  138 + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
  139 + $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
  140 + $("#messageModal").modal('show');
  141 + }
  142 + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
  143 + //alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  144 + $rootScope.isVisibleLogin = true;
  145 + $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
  146 + $("#messageModal").modal('show');
  147 + }
  148 + else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
  149 + $rootScope.isVisibleLogin = true;
  150 + $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE;
  151 + $("#messageModal").modal('show');
138 152 }
139 153 else {
140   - if (result == LoginConstants.USER_NOT_FOUND) {
141   - $rootScope.isVisibleLogin = true;
142   - // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
143   - $rootScope.errorMessage = LoginMessageConstants.USER_OR_PASSWORD_INCORRECT;
144   - $("#messageModal").modal('show');
145   - }
146   - else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
147   - //alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
148   - $rootScope.isVisibleLogin = true;
149   - $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
150   - $("#messageModal").modal('show');
151   - }
152   - else {
153   - if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) {
  154 + if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) {
154 155  
155   - if ($("#messageModal").length > 0){
156   - $("#messageModal").modal('hide');
157   - }
158   - if (result == LoginMessageConstants.INVALID_USER) {
159   - $rootScope.isVisibleLogin = true;
160   - $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
161   - $("#messageModal").modal('show');
  156 + if ($("#messageModal").length > 0) {
  157 + $("#messageModal").modal('hide');
  158 + }
  159 + if (result == LoginMessageConstants.INVALID_USER) {
  160 + $rootScope.isVisibleLogin = true;
  161 + $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
  162 + $("#messageModal").modal('show');
  163 + }
  164 + else if (result.IsBlocked) {
  165 + $rootScope.isVisibleLogin = true;
  166 + $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;
  167 + $("#messageModal").modal('show');
  168 + }
  169 + else {
  170 + if (!result.IsCorrectPassword) {
  171 + if (result.IncorrectLoginAttemptCount < 5) {
  172 + $rootScope.isVisibleLogin = true;
  173 + $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD;
  174 + $("#messageModal").modal('show');
  175 + }
  176 + else {
  177 + $rootScope.isVisibleLogin = true;
  178 + $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;
  179 + $("#messageModal").modal('show');
  180 + }
162 181 }
163 182 else {
164   - if ((!result.IsSubscriptionExpired) && (result.UserType == UserTypeConstants.SUPER_ADMIN) || result.UserType == UserTypeConstants.GENERAL_ADMIN && result.IsActive) {
  183 + if (result.UserType == UserTypeConstants.SUPER_ADMIN || result.UserType == UserTypeConstants.GENERAL_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) &&
165 184 $rootScope.userData = result;
166 185 $rootScope.userModules = result.Modules;
167 186 $rootScope.isVisibleLogin = false;
... ... @@ -169,22 +188,19 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
169 188 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
170 189 $('#dvUserModulesInfo').modal('show');
171 190 $location.path('/');
172   -
173   - }
174   - //else if ((!result.IsSubscriptionExpired) && (result.UserType== UserTypeConstants.CLIENT_ADMIN || result.UserType== UserTypeConstants.DISTRICT_ADMIN || result.UserType== UserTypeConstants.SINGLE_USER ||result.UserType== UserTypeConstants.RESELLER) && result.License.IsTermAccepted) {}
175 191  
176   - else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
  192 + }
  193 + else if ((!result.IsSubscriptionExpired) && (result.LicenseInfo != null) && (result.LicenseInfo.IsActive) && result.IsActive) {
177 194 if (result.UserType == UserTypeConstants.CLIENT_ADMIN || result.UserType == UserTypeConstants.DISTRICT_ADMIN || result.UserType == UserTypeConstants.SINGLE_USER || result.UserType == UserTypeConstants.RESELLER) {
178   - if (result.License.IsTermAccepted) {
  195 + if (result.LicenseInfo.IsTermAccepted) {
179 196 $rootScope.userData = result;
180 197 $rootScope.userModules = result.Modules;
181 198 $rootScope.isVisibleLogin = false;
182   - $rootScope.haveRoleAdmin = true;
183   - $rootScope.licenseeAccountNumber = result.License.AccountNumber;
  199 + $rootScope.haveRoleAdmin = true;
184 200 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
185 201 $('#dvUserModulesInfo').modal('show');
186 202 $location.path('/');
187   -
  203 +
188 204 }
189 205 else {
190 206 if ($('#dvTerms').length > 0) {
... ... @@ -193,9 +209,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
193 209 $rootScope.isVisibleLogin = true;
194 210 $('#dvTermCondition').fadeIn();
195 211 $rootScope.userData = result;
196   - $rootScope.userModules = result.Modules;
197 212 $rootScope.haveRoleAdmin = true;
198   - $rootScope.licenseeAccountNumber = result.License.AccountNumber;
199 213 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
200 214 $location.path('/');
201 215 }
... ... @@ -210,41 +224,41 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
210 224 $location.path('/');
211 225 }
212 226 }
213   - else if ((!result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) {
  227 + else if ((!result.IsSubscriptionExpired) && (result.LicenseInfo != null) && (result.LicenseInfo.IsActive) && !result.IsActive) {
214 228 $rootScope.isVisibleLogin = true;
215 229 $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
216 230 $("#messageModal").modal('show');
217 231 }
218   - else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && result.IsActive) {
  232 + else if ((result.IsSubscriptionExpired) && (result.LicenseInfo != null) && (result.LicenseInfo.IsActive) && result.IsActive) {
219 233 $rootScope.isVisibleLogin = true;
220   - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  234 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
221 235 $("#messageModal").modal('show');
222 236 }
223   - else if ((result.IsSubscriptionExpired) && (result.License != null) && (result.License.IsActive) && !result.IsActive) {
  237 + else if ((result.IsSubscriptionExpired) && (result.LicenseInfo != null) && (result.LicenseInfo.IsActive) && !result.IsActive) {
224 238 $rootScope.isVisibleLogin = true;
225   - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  239 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
226 240 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
227 241 $("#messageModal").modal('show');
228 242 }
229   - else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && result.IsActive) {
  243 + else if ((result.IsSubscriptionExpired) && (result.LicenseInfo != null) && !(result.LicenseInfo.IsActive) && result.IsActive) {
230 244 $rootScope.isVisibleLogin = true;
231   - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  245 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
232 246 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
233 247 $("#messageModal").modal('show');
234 248 }
235   - else if ((result.IsSubscriptionExpired) && (result.License != null) && !(result.License.IsActive) && !result.IsActive) {
  249 + else if ((result.IsSubscriptionExpired) && (result.LicenseInfo != null) && !(result.LicenseInfo.IsActive) && !result.IsActive) {
236 250 $rootScope.isVisibleLogin = true;
237   - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDateString + '.';
  251 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
238 252 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
239 253 $("#messageModal").modal('show');
240 254 }
241   - else if (result.License == null && !result.IsActive) {
  255 + else if (typeof (result.LicenseInfo) != "undefined" && !result.IsActive) {
242 256 $rootScope.isVisibleLogin = true;
243 257 $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
244 258 $("#messageModal").modal('show');
245 259 }
246 260 }
247   - }
  261 + }
248 262 }
249 263 }
250 264 },
... ... @@ -260,28 +274,46 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
260 274 }
261 275 $rootScope.UpdateLicenseTermStatus = function () {
262 276 $('#dvTermCondition').fadeOut();
263   - if($rootScope.licenseeAccountNumber !=null) {
264   -
265   - AuthenticationService.UpdateLicenseTerm($rootScope.licenseeAccountNumber)
266   - .then(function (result) {
267   - console.log(' Term and Condition acceptance status updated successfully.');
268   -
269   - },
270   - function (error) {
271   - console.log(' Error in Term and Condition acceptance status update = ' + error);//.statusText
272   - });
273   - }
274   - var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
275   - if (currentUserDetails) {
276   - var userInfo = JSON.parse(currentUserDetails);
277   -
278   - if (userInfo.loginId != undefined || userInfo.loginId != "" || userInfo.loginId != null) {
279   - $rootScope.isVisibleLogin = false;
280   - $rootScope.userData = userInfo;
281   - $rootScope.userModules = userInfo.Modules;
282   - $('#dvUserModulesInfo').modal('show');
283   - }
284   - }
  277 + var currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
  278 + if (currentUserDetails) {
  279 + var userInfo = JSON.parse(currentUserDetails);
  280 + }
  281 + if (userInfo.LicenseInfo.AccountNumber != null && userInfo.LicenseInfo.Id != 0) {
  282 + $rootScope.userLicenseInfo.userLicenseId = userInfo.LicenseInfo.Id;
  283 + $rootScope.userLicenseInfo.licenseeAccountNumber = userInfo.LicenseInfo.AccountNumber;
  284 +
  285 + AuthenticationService.UpdateLicenseTerm($rootScope.userLicenseInfo)
  286 + .then(function (result) {
  287 + if (result.Modules !=="" && result.Modules !== null) { // LoginMessageConstants.LICENSE_TERM_CONDITION_UPDATE_SUCCESS) {
  288 + console.log(' Term and Condition acceptance status updated successfully.');
  289 + if (currentUserDetails) {
  290 + var userInfo = JSON.parse(currentUserDetails);
  291 + userInfo.Modules = result.Modules;
  292 +
  293 + if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) {
  294 + $rootScope.isVisibleLogin = false;
  295 + $rootScope.userData = userInfo;
  296 + $rootScope.userModules = userInfo.Modules;
  297 + $('#dvUserModulesInfo').modal('show');
  298 + }
  299 + }
  300 + }
  301 + else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
  302 + console.log(result);
  303 + $rootScope.isVisibleLogin = true;
  304 + $('#dvTermCondition').fadeIn();
  305 + $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE;
  306 + $("#messageModal").modal('show');
  307 + $("#messageModal").css("z-index", 111112);
  308 + localStorage.removeItem("loggedInUserDetails");
  309 + }
  310 + },
  311 + function (error) {
  312 + console.log(' Error in Term and Condition acceptance status update = ' + error);//.statusText
  313 + $rootScope.isVisibleLogin = true;
  314 + $('#dvTermCondition').fadeIn();
  315 + });
  316 + }
285 317 };
286 318 function VerifyUrlForQuerystring() {
287 319 var url = $location.url();
... ... @@ -312,11 +344,29 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
312 344 try {
313 345 var userInfo = JSON.parse(currentUserDetails);
314 346  
315   - if (userInfo.loginId != undefined || userInfo.loginId != "" || userInfo.loginId != null) {
316   - $rootScope.isVisibleLogin = false;
317   - $rootScope.userData = userInfo;
318   - $rootScope.userModules = userInfo.Modules;
319   - if ($rootScope.refreshcheck == null) {
  347 + if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) {
  348 + if (userInfo.LicenseInfo.IsTermAccepted) {
  349 + $rootScope.userData = userInfo;
  350 + $rootScope.userModules = userInfo.Modules;
  351 + $rootScope.isVisibleLogin = false;
  352 + //$rootScope.haveRoleAdmin = true;
  353 + $rootScope.licenseeAccountNumber = userInfo.LicenseInfo.AccountNumber;
  354 +
  355 + if ($rootScope.refreshcheck == null) {
  356 + $location.path('/');
  357 + }
  358 +
  359 + }
  360 + else {
  361 + if ($('#dvTerms').length > 0) {
  362 + $('#dvTerms').html(userInfo.TermsOfServiceText);
  363 + }
  364 + $rootScope.isVisibleLogin = true;
  365 + $('#dvTermCondition').fadeIn();
  366 + $rootScope.userData = userInfo;
  367 + $rootScope.userModules = userInfo.Modules;
  368 + //$rootScope.haveRoleAdmin = true;
  369 + $rootScope.licenseeAccountNumber = userInfo.LicenseInfo.AccountNumber;
320 370 $location.path('/');
321 371 }
322 372 }
... ... @@ -328,10 +378,17 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
328 378 }
329 379  
330 380 $rootScope.SendMailToUser = function (userInfo, isMailForPassword) {
  381 + var selectedOption = $("input[name='inlineRadioOptions']:checked").val();
331 382 if ((userInfo.emailId != null) && (userInfo.emailId != '')) {
332 383 if (validateEmail(userInfo.emailId)) {
333   - if (isMailForPassword == true)
  384 + if (isMailForPassword == true && selectedOption == LoginMessageConstants.UNBLOCK_SELECTED) {
  385 + userInfo.unblockUser = true;
  386 + userInfo.havePassword = true;
  387 + }
  388 + else if (isMailForPassword == true && selectedOption == LoginMessageConstants.FORGOT_PASSWORD_SELECTED) {
  389 + userInfo.unblockUser = false;
334 390 userInfo.havePassword = true;
  391 + }
335 392 else
336 393 userInfo.havePassword = false;
337 394  
... ... @@ -347,6 +404,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
347 404 $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
348 405 $("#messageModal").modal('show');
349 406 }
  407 + else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
  408 + $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE;
  409 + $("#messageModal").modal('show');
  410 + }
350 411 else if (result == LoginConstants.MAIL_NOT_SENT) {
351 412 // alert(LoginMessageConstants.MAIL_NOT_SENT);
352 413 $rootScope.errorMessage = LoginMessageConstants.MAIL_NOT_SENT;
... ... @@ -363,8 +424,12 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
363 424 $('.forgot-sm1').fadeOut();
364 425 $('.forgot-sm1').modal('hide');
365 426 }
366   - if (isMailForPassword)
367   - message = LoginMessageConstants.RESET_PASSWORD;
  427 + if (isMailForPassword) {
  428 + if (userInfo.unblockUser)
  429 + message = LoginMessageConstants.USER_UNBLOCK_LINK_IN_EMAIL;
  430 + else
  431 + message = LoginMessageConstants.RESET_PASSWORD;
  432 + }
368 433 else
369 434 message = LoginMessageConstants.USERID_SENT_IN_EMAIL
370 435 //alert(message);
... ... @@ -397,7 +462,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
397 462 }
398 463 };
399 464  
400   -
  465 +
401 466  
402 467  
403 468 function validateEmail(email) {
... ... @@ -411,6 +476,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
411 476 var split = url.split('?em:');
412 477 userInfo.emailId = split[1];
413 478 }
  479 +
414 480 if (userInfo.newPassword != null) {
415 481  
416 482 if (userInfo.newPassword === userInfo.confirmPassword) {
... ... @@ -431,6 +497,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
431 497 $("#messageModal").modal('show');
432 498  
433 499 }
  500 + else if (result == LoginConstants.SQL_CONNECTION_ERROR) {
  501 + $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE;
  502 + $("#messageModal").modal('show');
  503 + }
434 504 else {
435 505 //if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) {
436 506 if (result == LoginMessageConstants.PASSWORD_UPDATE_SUCCESS) {
... ... @@ -460,7 +530,39 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
460 530 $rootScope.errorMessage = LoginMessageConstants.NEW_PASSWORD_FIELD_IS_EMPTY;
461 531 $("#messageModal").modal('show');
462 532 }
463   -
  533 +
  534 + }
  535 +
  536 + $rootScope.UnblockUser = function () {
  537 + var userEmailId = '';
  538 + var url = $location.url();
  539 + if (url.indexOf('?unb:') != -1) {
  540 + var split = url.split('?unb:');
  541 + userEmailId = split[1];
  542 + }
  543 +
  544 + AuthenticationService.UnblockUser(userEmailId)
  545 + .then(
  546 + function (result) {
  547 + if (result == LoginMessageConstants.USER_UNBLOCK_SUCCESS) {
  548 + $rootScope.errorMessage = LoginMessageConstants.USER_UNBLOCK_SUCCESS_MESSAGE;
  549 + $("#messageModal").modal('show');
  550 + $rootScope.isVisibleLogin = true;
  551 + $location.url("/");
  552 + }
  553 + else {
  554 + $rootScope.errorMessage = LoginMessageConstants.USER_ALREADY_UNBLOCKED;
  555 + $("#messageModal").modal('show');
  556 + $rootScope.isVisibleLogin = true;
  557 + $location.url("/");
  558 + }
  559 + },
  560 + function (error) {
  561 + console.log(' Error in authentication = ' + error.statusText);
  562 + $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS;
  563 + $("#messageModal").modal('show');
  564 + }
  565 + );
464 566 }
465 567  
466 568 $rootScope.lexiconLanguageArray = [];
... ... @@ -475,9 +577,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
475 577 dataType: "json",
476 578 success: function (result) {
477 579 $(result.root.uc.al.lx).each(function (key, value) {
478   -
  580 +
479 581 $('#lexiconLangDropdown').append('<option val="' + this._id + '">' + this._tl + '</option>');
480   -
  582 +
481 583 });
482 584  
483 585 }
... ... @@ -540,7 +642,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
540 642  
541 643 if ($.browser.msie) {
542 644 $("#resetBtn").css("display", "inline-block");
543   - // $rootScope.refreshCanvas();
  645 + // $rootScope.refreshCanvas();
544 646  
545 647 }
546 648 $(function () {
... ... @@ -625,7 +727,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
625 727 }
626 728 $("#annotationToolBarOptions").removeClass("disableMenuoption");
627 729 $("#optionsListManagerTab").removeClass("disableMenuoption");
628   -
  730 +
629 731  
630 732 if (($location.url() == "/da-body-view")) {
631 733 $rootScope.disableMenuannotation = " ";
... ... @@ -648,7 +750,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
648 750 $("#annotationToolBarOptions").removeClass("disableSubMenu");
649 751 $rootScope.disableFileMenu = " ";
650 752 }
651   -
  753 +
652 754 else if ($location.url() == "/clinical-animations-detail") {
653 755 $rootScope.disableMenuannotation = "disableMenuannotation";
654 756 $rootScope.disableMenuoption = " ";
... ... @@ -683,14 +785,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
683 785 $rootScope.getModuleScrollPosition = function () {
684 786 $rootScope.refreshcheck = "check";
685 787 $('.mCSB_container ul li').click(function () {
686   -
  788 +
687 789 $rootScope.scrollTopPosition = $(this).position().top;
688   -
  790 +
689 791 });
690 792 setTimeout(function () {
691 793  
692 794 $(".sidebar").mCustomScrollbar("scrollTo", $rootScope.scrollTopPosition + "px");
693   -
  795 +
694 796  
695 797  
696 798 }, 300);
... ... @@ -708,7 +810,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
708 810 if (openViews.length > 0) {
709 811 var lastOpenMoudle = $rootScope.openViews[openViews.length - 1];
710 812 }
711   - // $('#daImagePanel').remove();
  813 + // $('#daImagePanel').remove();
712 814 if ($('#jsPanel-1').length > 0)
713 815 $('#jsPanel-1').remove();
714 816  
... ... @@ -3532,7 +3634,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3532 3634  
3533 3635 $rootScope.disableAnnotationtoolOnListManager = false;
3534 3636 $rootScope.ShowListManager = function () {
3535   -
  3637 +
3536 3638 $rootScope.switchCanvas();
3537 3639 $("#annotationpaintbrushsize").attr("href", "#");
3538 3640 $("#annotationpainteraser").attr("href", "#");
... ... @@ -3552,9 +3654,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3552 3654  
3553 3655 $('#listManager').draggable();
3554 3656 $rootScope.islistManagerEventAlredayDispachted = true;
3555   -
  3657 +
3556 3658 $rootScope.$broadcast('listManagerEvent', true);
3557   -
  3659 +
3558 3660 if ($rootScope.selectedBodySystemName == undefined && $rootScope.slectedActualTermNumber == undefined) {
3559 3661 if ($location.path() == "/module-item-view") {
3560 3662 $timeout(function () {
... ... @@ -3570,7 +3672,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3570 3672 $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
3571 3673 $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
3572 3674 }
3573   - }
  3675 + }
3574 3676 else {
3575 3677  
3576 3678 if ($rootScope.selectedBodySystemId == undefined) {
... ... @@ -3585,7 +3687,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3585 3687 else {
3586 3688 $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId);
3587 3689 }
3588   -
  3690 +
3589 3691 }
3590 3692 }
3591 3693 else {
... ... @@ -3595,14 +3697,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3595 3697 else {
3596 3698 $rootScope.refreshTermListOnSystemSelection($rootScope.selectedBodySystemId);
3597 3699 }
3598   -
  3700 +
3599 3701 }
3600   -
  3702 +
3601 3703 $timeout(function () {
3602   - $('#bodySystems option[selected="selected"]').prop("selected", false);
3603   - $('#bodySystems option[value="' + $rootScope.selectedBodySystemName + '"]').prop("selected", true);
3604   - $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
3605   - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
  3704 + $('#bodySystems option[selected="selected"]').prop("selected", false);
  3705 + $('#bodySystems option[value="' + $rootScope.selectedBodySystemName + '"]').prop("selected", true);
  3706 + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  3707 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
3606 3708 }, 1000);
3607 3709 }
3608 3710 $("#optionsListManagerTab").addClass("active");
... ... @@ -3613,7 +3715,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3613 3715 }
3614 3716  
3615 3717 $rootScope.CloseListManager = function () {
3616   -
  3718 +
3617 3719 $("#btnTranparency").removeAttr('disabled', 'disabled');
3618 3720 $("#optionsListManagerTab").removeClass("active");
3619 3721 $rootScope.isListManagerMenuSelected = false;
... ... @@ -3785,8 +3887,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3785 3887 }
3786 3888 $rootScope.isApplyBtnClicked = false;
3787 3889 //$timeout(function () {
3788   - $('#modal-settings').css("display", "none");
3789   - $("#modelsettingsbackground").css("display", "none");
  3890 + $('#modal-settings').css("display", "none");
  3891 + $("#modelsettingsbackground").css("display", "none");
3790 3892 // $("#setting-spinner").css("display", "none");
3791 3893 if ($rootScope.MenuModuleName == "DA" || $rootScope.MenuModuleName == "AA") {
3792 3894 $("#setting-spinner").css("display", "block");
... ... @@ -3794,7 +3896,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3794 3896  
3795 3897 $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length;
3796 3898  
3797   - // }, 6000);
  3899 + // }, 6000);
3798 3900 };
3799 3901  
3800 3902  
... ... @@ -3975,7 +4077,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3975 4077 $(".modal-backdrop").css("z-index", "1200001");
3976 4078 };
3977 4079  
3978   -
  4080 +
3979 4081  
3980 4082 $rootScope.ShowPrintWindow = function () { // Print Active Viewer
3981 4083 html2canvas($("#canvasDiv"), {
... ... @@ -4018,8 +4120,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4018 4120 var curPosture = $rootScope.getLocalStorageValue('currentViewTitle');
4019 4121  
4020 4122 if (document.getElementById('jsPanel-1')) { //document.getElementsByClassName('ppImagePanel')) {
4021   - if (dataURL == "" || dataURL == undefined)
4022   - {
  4123 + if (dataURL == "" || dataURL == undefined) {
4023 4124  
4024 4125 setTimeout(function () {
4025 4126 document.getElementById('imgPortrait').setAttribute('src', dataURL);
... ... @@ -4034,8 +4135,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4034 4135 }
4035 4136 }, 520);
4036 4137 }
4037   - else
4038   - {
  4138 + else {
4039 4139 setTimeout(function () {
4040 4140 document.getElementById('imgPortrait').setAttribute('src', dataURL);
4041 4141 document.getElementById('imgLandscape').setAttribute('src', dataURL);
... ... @@ -4049,14 +4149,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4049 4149 }
4050 4150 }, 320);
4051 4151 }
4052   -
  4152 +
4053 4153 }
4054 4154  
4055 4155 $('#fileMenuAnchor').parent().addClass('disableFileMenu');
4056 4156 if ($('#daImagePanel').length > 0) {
4057 4157 console.log('close')
4058 4158 //$('#daImagePanel').css('display', 'none');
4059   - // $('#daImagePanel').remove();
  4159 + // $('#daImagePanel').remove();
4060 4160 }
4061 4161 }
4062 4162 });
... ... @@ -4079,17 +4179,18 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4079 4179 top: 70,
4080 4180 left: 1,
4081 4181 },
4082   - controls: { buttons: 'closeonly'},
  4182 + controls: { buttons: 'closeonly' },
4083 4183 size: { width: $(window).outerWidth(), height: $(window).outerHeight() + 60 },
4084 4184 //size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
4085 4185 });
4086 4186 }
4087 4187 $rootScope.getLocalStorageValue = function (localStorageParam) {
4088   -
4089   - if ((localStorage.getItem('loggedInUserDetails') == null) && ($rootScope.isVisibleLogin == false))
4090   - {
4091 4188  
4092   - $rootScope.LogoutUser();
  4189 +
  4190 +
  4191 + if ((localStorage.getItem('loggedInUserDetails') == null) && ($rootScope.isVisibleLogin == false)) {
  4192 + if ($location.url().indexOf('?em') == -1 && $location.url().indexOf('?unb') == -1)
  4193 + $rootScope.LogoutUser();
4093 4194  
4094 4195  
4095 4196 }
... ... @@ -4189,7 +4290,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4189 4290 }
4190 4291  
4191 4292 $(document).on('click', '#jsPanel-1 .jsglyph-remove', function () {
4192   - $("#daImagePanel").css({ "pointer-events": "auto", "opacity": "1" });
  4293 + $("#daImagePanel").css({ "pointer-events": "auto", "opacity": "1" });
4193 4294 $("#ciImagePanel").css({ "pointer-events": "auto", "opacity": "1" });
4194 4295 $("#annotationButton").parent().removeClass("disableMenuannotation");
4195 4296 $("#annotationToolBarOptions").removeClass("disableMenuoption");
... ... @@ -4276,9 +4377,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4276 4377 };
4277 4378  
4278 4379 $rootScope.resetDrawing = function (e) {
4279   -
4280   - $('#canvas').removeLayers();
4281   -
  4380 +
  4381 + $('#canvas').removeLayers();
  4382 +
4282 4383 };
4283 4384  
4284 4385 }]
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -14,11 +14,11 @@ AIA.constant(&#39;pages&#39;, [
14 14 pageController: 'HomeController'
15 15 },
16 16 { // id:1,
17   - name: 'Dissectible Anatomy Views List',
18   - pageSlug: 'da-view-list',
19   - pageUrl: 'app/views/da/da-body-view-list.html',
20   - pageController: 'DAController'
21   - },
  17 + name: 'Dissectible Anatomy Views List',
  18 + pageSlug: 'da-view-list',
  19 + pageUrl: 'app/views/da/da-body-view-list.html',
  20 + pageController: 'DAController'
  21 + },
22 22 { //id:2,
23 23 name: 'Dissectible Anatomy Body View',
24 24 pageSlug: 'da-body-view',
... ... @@ -40,11 +40,11 @@ AIA.constant(&#39;pages&#39;, [
40 40  
41 41 },
42 42 {
43   - // id:4,
44   - name: 'Clinical Animations',
45   - pageSlug: 'clinical-animations',
46   - pageUrl: 'app/views/ca/ca-view.html',
47   - pageController: 'CAController'
  43 + // id:4,
  44 + name: 'Clinical Animations',
  45 + pageSlug: 'clinical-animations',
  46 + pageUrl: 'app/views/ca/ca-view.html',
  47 + pageController: 'CAController'
48 48  
49 49 },
50 50 { // id:5,
... ... @@ -139,7 +139,7 @@ AIA.constant(&#39;pages&#39;, [
139 139 pageController: 'LinkController'
140 140  
141 141 },
142   - {
  142 + {
143 143 name: 'A.D.A.M OnDemand',
144 144 pageSlug: 'Link/aod',
145 145 pageUrl: 'app/views/Link/Link-view.html',
... ... @@ -239,8 +239,8 @@ AIA.constant(&#39;Modules&#39;, [
239 239 Name: 'Lab Exercises',
240 240 },
241 241 {
242   - Id: 9,
243   - Name: 'ADAM Images',
  242 + Id: 9,
  243 + Name: 'ADAM Images',
244 244 },
245 245 {
246 246 Id: 10,
... ... @@ -249,32 +249,32 @@ AIA.constant(&#39;Modules&#39;, [
249 249 {
250 250 Id: 11,
251 251 Name: 'Encyclopedia',
252   -
  252 +
253 253 },
254 254 {
255 255 Id: 12,
256 256 Name: 'IP 10',
257 257 },
258   -
  258 +
259 259 {
260   - Id: 13,
261   - Name: 'In-Depth Reports',
  260 + Id: 13,
  261 + Name: 'In-Depth Reports',
262 262 },
263 263 {
264   - Id: 14,
265   - Name: 'Complementary and Alternative Medicine',
  264 + Id: 14,
  265 + Name: 'Complementary and Alternative Medicine',
266 266 },
267 267 {
268   - Id: 15,
269   - Name: 'Body Guide',
  268 + Id: 15,
  269 + Name: 'Body Guide',
270 270 },
271 271 {
272   - Id: 16,
273   - Name: 'Health Navigator',
  272 + Id: 16,
  273 + Name: 'Health Navigator',
274 274 },
275 275 {
276   - Id: 17,
277   - Name: 'The Wellness Tools',
  276 + Id: 17,
  277 + Name: 'The Wellness Tools',
278 278 },
279 279  
280 280 ]);
... ... @@ -291,7 +291,7 @@ AIA.constant(&#39;BodyRegions&#39;, [&#39;Abdomen&#39;, &#39;Body Wall and Back&#39;, &#39;Head and Neck&#39;, &#39;
291 291  
292 292 AIA.constant('BodySystems', ['Cardiovascular', 'Digestive', 'Endocrine', 'Immune', 'Integumentary', 'Lymphatic', 'Muscular', 'Nervous', 'Reproductive', 'Respiratory', 'Skeletal', 'Urinary']);
293 293  
294   -AIA.constant('ViewOrientations', ['Anterior', 'Posterior', 'Lateral','Medial', 'Superior', 'Inferior', 'Non-standard']);
  294 +AIA.constant('ViewOrientations', ['Anterior', 'Posterior', 'Lateral', 'Medial', 'Superior', 'Inferior', 'Non-standard']);
295 295  
296 296  
297 297 AIA.constant('MedicalSpecialties', ['Allergy & Immunology', 'Anesthesiology', 'Cardiology', 'Chiropractic', 'Dentistry', 'Dermatology', 'Embryology', 'Emergency Medicine', 'Endocrinology', 'First Aid', 'Gastroenterology', 'General Surgery', 'Geriatrics', 'Hematology', 'Infectious Diseases', 'Microbiology', 'Nuclear Medicine', 'Nephrology', 'Neurology', 'Nutrition', 'Obstetrics and Gynecology (OB/GYN)', 'Oncology (Cancer)', 'Opthalmology', 'Optometry', 'Orthopedics', 'Osteopathy', 'Otolaryngology (ENT)', 'Pathology', 'Pediatrics', 'Physiology', 'Plastic Surgery', 'Podiatry', 'Pulmonary Medicine', 'Radiology', 'Respiratory Therapy', 'Rheumatology', 'Sports Medicine', 'Urology', 'Vascular Medicine', 'Thoracic Surgery']);
... ... @@ -304,8 +304,10 @@ AIA.constant(&#39;ImageTypes&#39;, [&#39;Illustration&#39;, &#39;Cadaver Photograph&#39;, &#39;Radiograph&#39;])
304 304 AIA.constant("LoginConstants", {
305 305 "USER_NOT_FOUND": "User not found.",
306 306 "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
307   - "MAIL_NOT_SENT": "Mail not sent."
308   -
  307 + "MAIL_NOT_SENT": "Mail not sent.",
  308 + "SQL_CONNECTION_ERROR": "SQL Connection Error",
  309 + "SQL_CONNECTION_ERROR_MESSAGE": "Due to some issue we are unable to connect with database. Kindly, contact customer support"
  310 +
309 311 })
310 312  
311 313 AIA.constant("LoginMessageConstants", {
... ... @@ -323,10 +325,22 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
323 325 "NEW_PASSWORD_FIELD_IS_EMPTY": "Please enter new password to reset your password.",
324 326 "PASSWORD_UPDATE_SUCCESS": "Password updated successfully",
325 327 "PASSWORD_UPDATE_FAILED": "Password update failed",
326   - "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license has been expired since ",
  328 + "SUBSCRIPTION_EXPIRATION_MESSAGE": "Your license is expired since ",
327 329 "LICENSE_INACTIVE_MESSAGE": "Your license is inactive.",
328 330 "INVALID_USER": "Invalid UserID",
329   - "USER_INACTIVE_MESSAGE": "User ID is inactive."
  331 + "USER_INACTIVE_MESSAGE": "User ID is inactive.",
  332 + "INVALID_PASSWORD": "Invalid Password. UserID and password will be disabled if your password is entered incorrectly for five consecutive attempts. If you have forgotten your password, please click on the forgot password link.",
  333 + "USER_BLOCKED": 'Your User ID has been disabled for 24 hours. To unblock please click on "Reset Password" link and select "unblock" radio button.',
  334 + "UNBLOCK_SELECTED": "unblock",
  335 + "FORGOT_PASSWORD_SELECTED": "forgotpwd",
  336 + "USER_UNBLOCK_LINK_IN_EMAIL": "Please check you email and unblock your account.",
  337 + "USER_UNBLOCK_SUCCESS": "User unblocked",
  338 + "USER_UNBLOCK_SUCCESS_MESSAGE": "Your account has been unblocked sucessfully.",
  339 + "USER_UNBLOCK_FAILED": "Unblock operation failed",
  340 + "USER_ALREADY_UNBLOCKED": "User already unblocked.",
  341 + "LICENSE_TERM_CONDITION_UPDATE_SUCCESS": "License Term Accepted field updated successfully.",
  342 + "LICENSE_TERM_CONDITION_UPDATE_FAILED": "License Term Accepted field update failed."
  343 +
330 344 //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
331 345 //"MAIL_NOT_SENT": "Mail not sent."
332 346  
... ... @@ -335,8 +349,7 @@ AIA.constant(&quot;AdminConstants&quot;, {
335 349 "ERROR_IN_SENDING_MAIL": "Some internal error occured.",
336 350 "MAIL_SENT": "Mail sent.",
337 351 "MAIL_NOT_SENT": "Mail not sent.",
338   - "MAIL_SENT_SUCCESS_MESSAGE": "We have received your request. We will get back to you soon.",
339   -
  352 + "MAIL_SENT_SUCCESS_MESSAGE": "We have received your request. We will get back to you soon."
340 353 })
341 354 AIA.constant("UserTypeConstants", {
342 355 "SUPER_ADMIN": "Super Admin",
... ... @@ -351,9 +364,9 @@ AIA.constant(&quot;UserTypeConstants&quot;, {
351 364 })
352 365  
353 366 AIA.constant("AIAConstants", {
354   -
355   - "NO_BODY_SYSTEM_AVAILABLE" : "This body system is not available on this layer.",
356   -
  367 +
  368 + "NO_BODY_SYSTEM_AVAILABLE": "No body system available in this layer.",
  369 +
357 370 })
358 371  
359 372 AIA.constant("UserModules", [
... ... @@ -428,7 +441,7 @@ AIA.constant(&quot;UserModules&quot;, [
428 441 ]);
429 442 AIA.constant("AIAConstants", {
430 443  
431   - "NO_BODY_SYSTEM_AVAILABLE" : "No body system available in this layer.",
  444 + "NO_BODY_SYSTEM_AVAILABLE": "No body system available in this layer.",
432 445 })
433 446 AIA.config(function ($routeProvider, pages, $locationProvider) {
434 447  
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -70,6 +70,24 @@
70 70 deferred.reject(status);
71 71 });
72 72 return deferred.promise;
  73 + },
  74 +
  75 + UnblockUser: function (userEmailId) {
  76 + var deferred = $q.defer();
  77 +
  78 + $http.post('/API/api/UnblockUser', JSON.stringify(userEmailId), {
  79 + headers: {
  80 + 'Content-Type': 'application/json'
  81 + }
  82 + })
  83 + .success(function (data, status, headers, config) {
  84 + console.log('success')
  85 + deferred.resolve(data);
  86 + }).error(function (data, status, headers, config) {
  87 + console.log('error')
  88 + deferred.reject(status);
  89 + });
  90 + return deferred.promise;
73 91 }
74 92  
75 93 }
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -159,7 +159,6 @@
159 159 #refreshBtn {
160 160 color: #ffffff;
161 161 }
162   -
163 162 </style>
164 163  
165 164  
... ... @@ -231,7 +230,7 @@
231 230 </div>
232 231 <!-- Forgot User ID (Small modal) -->
233 232 <div class="modal fade" id="forgotUserModal" role="dialog" tabindex="-1" aria-labelledby="exampleModalLabel" data-target=".forgot-sm">
234   - <div class="modal-dialog modal-sm" role="document">
  233 + <div class="modal-dialog" role="document">
235 234 <div class="modal-content">
236 235 <div class="modal-header">
237 236 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
... ... @@ -247,7 +246,7 @@
247 246 </div>
248 247 </form>
249 248 </div>
250   - <div class="modal-footer">
  249 + <div class="modal-footer" style="padding-bottom:10px;">
251 250 <button type="button" class="btn btn-primary btn-block" ng-click="SendMailToUser(userInfo, false)">Send Mail</button>
252 251 </div>
253 252 <!--<div style="color: maroon; font-weight: bold; " ng-if="message">{{message}}</div>-->
... ... @@ -256,23 +255,35 @@
256 255 </div>
257 256 <!-- Forgot Password (Small modal) -->
258 257 <div class="modal fade" id="forgotPwdModal" role="dialog" tabindex="-1" aria-labelledby="exampleModalLabel" data-target=".forgot-sm1">
259   - <div class="modal-dialog modal-sm" role="document">
  258 + <div class="modal-dialog" role="document">
260 259 <div class="modal-content">
261 260 <div class="modal-header">
262 261 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
263   - <h5 class="modal-title" id="exampleModalLabel">Enter your email id to recover Password</h5>
  262 + <h5 class="modal-title" id="exampleModalLabel">Enter your email id to unblock/ recover Password</h5>
264 263 </div>
265   - <div class="modal-body">
266   - <form id="forgetPwdForm">
  264 + <div class="modal-body" style="padding: 15px;">
  265 + <form id="forgetPwdForm" class="ng-pristine ng-valid ng-valid-email">
267 266 <div class="form-group">
268   - <div class="input-group">
  267 + <div class="">
  268 + <label class="radio-inline">
  269 + <input name="inlineRadioOptions" id="inlineRadio1" value="unblock" type="radio"> Unblock
  270 + </label>
  271 + <label class="radio-inline">
  272 + <input name="inlineRadioOptions" id="inlineRadio2" value="forgotpwd" type="radio"> Forgot Password
  273 + </label>
  274 + </div>
  275 + </div>
  276 +
  277 +
  278 + <div class="form-group">
  279 + <div class="input-group" style="margin-top: 8px;">
269 280 <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
270   - <input id="btnEmail2" class="form-control" placeholder="Email" type="email" ng-model="userInfo.emailId">
  281 + <input id="btnEmail2" class="form-control ng-pristine ng-untouched ng-valid ng-valid-email" placeholder="Email" ng-model="userInfo.emailId" type="email">
271 282 </div>
272 283 </div>
273 284 </form>
274 285 </div>
275   - <div class="modal-footer">
  286 + <div class="modal-footer modal-footer-forgot-password" style="padding-bottom:10px;">
276 287 <button type="button" class="btn btn-primary btn-block" ng-click="SendMailToUser(userInfo, true)">Send Mail</button>
277 288 </div>
278 289 <!--<div style="color: maroon; font-weight: bold; " ng-if="message">{{message}}</div>-->
... ... @@ -496,8 +507,8 @@
496 507 <div class="form-group">
497 508 <label for="SystemFont" class="font13">Primary Lexicon</label>
498 509 <input type="text" id="primarylaxican" class="form-control" value="English" name="1" disabled>
499   - <button class="btn btn-sm btn-success btn-block marginTop5" id="laxicanlanguageChagne" disabled>Change</button>
500   -</div>
  510 + <button class="btn btn-sm btn-success btn-block marginTop5" id="laxicanlanguageChagne" disabled>Change</button>
  511 + </div>
501 512  
502 513 <div class="form-group">
503 514 <label for="SystemFont" class="font13">Secondary Lexicons</label>
... ... @@ -513,8 +524,7 @@
513 524 <div class="col-sm-6">
514 525 <div class="form-group">
515 526 <label for="SystemFont" class="font13">Available Lexicon</label>
516   - <select class="form-control" size="8" id="lexiconLangDropdown">
517   - </select>
  527 + <select class="form-control" size="8" id="lexiconLangDropdown"></select>
518 528 </div>
519 529 <p class="font11"><strong>Note :</strong> Some languages require special system fonts to display correctly</p>
520 530 </div>
... ... @@ -586,8 +596,8 @@
586 596 </div>
587 597 <div class="modal-footer">
588 598 <button type="button" class="btn btn-primary" ng-click="UpdateAndCloseSetting(formsetting)">OK</button>
589   -
590   - <!--<button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>-->
  599 +
  600 + <!--<button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>-->
591 601 <button type="button" class="btn btn-primary" ng-click="CloseSetting()">Cancel</button>
592 602 <button type="button" class="btn btn-primary" ng-click="UpdateSetting(formsetting)">Apply</button>
593 603 </div>
... ... @@ -597,7 +607,7 @@
597 607 </div>
598 608 <div id="setting-spinner" style="display:none;position: fixed; top: 50%; left: 50%; margin-left: -50px; z-index: 1234; overflow: auto; width: 100px;">
599 609 <img id="img-spinner" src="content/images/common/loading.gif" alt="Loading">
600   - </div>
  610 + </div>
601 611 <!--Annotation Modal-->
602 612 <div class="annotationTollbar" style="width: 300px;position: fixed; top: 80px; right: 20px; display: none; z-index: 1200000;">
603 613 <div class="annotationbar">
... ... @@ -852,7 +862,7 @@
852 862 <label class="col-sm-4 control-label" for="System">System</label>
853 863 <div class="col-sm-8">
854 864 <select id="bodySystems" class="form-control" onchange="if (typeof (this.selectedIndex) != 'undefined') refreshTermListOnSystem(this.options[this.selectedIndex].id)"></select>
855   - <select id="AABodySystems" class="form-control" onchange="if (typeof (this.selectedIndex) != 'undefined') refreshTermListOnSystemSel(this.options[this.selectedIndex].id)" style="display:none;" ></select>
  865 + <select id="AABodySystems" class="form-control" onchange="if (typeof (this.selectedIndex) != 'undefined') refreshTermListOnSystemSel(this.options[this.selectedIndex].id)" style="display:none;"></select>
856 866 </div>
857 867 </div>
858 868 <div class="form-group">
... ... @@ -1025,7 +1035,7 @@
1025 1035 </div>
1026 1036  
1027 1037 <!--Export Image Modal-->
1028   - <div class="modal fade export-image ui-draggable in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
  1038 + <div class="modal fade export-image ui-draggable in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
1029 1039 style="z-index: 1200002;">
1030 1040 <div class="modal-dialog modal-sm" role="document">
1031 1041 <div class="modal-content">
... ... @@ -1229,7 +1239,7 @@
1229 1239 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1230 1240 <h4 class="text-left lhgt19 padd5" style="color:#fff; text-align:left;">Modules Availability</h4>
1231 1241 </div>
1232   -
  1242 +
1233 1243 <div class="modal-body">
1234 1244 <div class="panel-body">
1235 1245 <!-- form -->
... ... @@ -1252,7 +1262,7 @@
1252 1262 <div class="form-group">
1253 1263 <div class="col-sm-12"><i>• Curriculum Builder (To be available by 09/25/2017)</i></div>
1254 1264 </div>
1255   -
  1265 +
1256 1266 <div class="form-group">
1257 1267 <div class="col-sm-8"><i>• Anatomy Test (To be available by 08/28/2017)</i></div>
1258 1268 </div>
... ... @@ -1310,15 +1320,16 @@
1310 1320  
1311 1321 <div class="modal-body" style="width: 597px; height: 400px; overflow-x: auto;">
1312 1322 <div class="panel-body">
1313   - <div id="dvTerms" style="font-size: 13px;"></div>
  1323 + <div id="dvTerms" style="font-size: 13px;"></div>
1314 1324 </div>
1315 1325 </div>
1316   - <div class="modal-footer ui-draggable-handle " style="color: #ffffff; cursor:default;"> <!--background-color: #0095da; border-color: #007ab3;-->
  1326 + <div class="modal-footer ui-draggable-handle " style="color: #ffffff; cursor:default;">
  1327 + <!--background-color: #0095da; border-color: #007ab3;-->
1317 1328 <!-- form -->
1318 1329 <form class="form-horizontal">
1319 1330 <!--<div class="form-group">-->
1320   - <div style="clear: left; float: left; color: #000;"><input type="checkbox" id="chkAccept" ng-model="checked" style="vertical-align: top;"/> I accept</div>
1321   - <div style="float: right;"><button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal" ng-disabled="!checked" data-dismiss="modal" ng-click="UpdateLicenseTermStatus()"><i class="fa fa-check"></i> Next</button></div>
  1331 + <div style="clear: left; float: left; color: #000;"><input type="checkbox" id="chkAccept" ng-model="checked" style="vertical-align: top;" /> I accept</div>
  1332 + <div style="float: right;"><button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mymodal" ng-disabled="!checked" data-dismiss="modal" ng-click="UpdateLicenseTermStatus()"><i class="fa fa-check"></i> Next</button></div>
1322 1333 <!--</div>-->
1323 1334 </form>
1324 1335 </div>
... ... @@ -1481,10 +1492,10 @@
1481 1492  
1482 1493 <script>
1483 1494  
1484   - $(function () {
1485   - $('[data-toggle="tooltip"]').tooltip();
1486   - })
1487   -
  1495 + $(function () {
  1496 + $('[data-toggle="tooltip"]').tooltip();
  1497 + })
  1498 +
1488 1499 </script>
1489 1500 <script>
1490 1501 (function ($) {
... ... @@ -1797,14 +1808,14 @@
1797 1808 }
1798 1809 });
1799 1810 $("#btnBrushSizeDecrease").click(function () {
1800   -
  1811 +
1801 1812 onBrushSizeChange();
1802 1813 var brushDecreaseVar = $("#btnBrushSize").val();
1803 1814 if (brushDecreaseVar == "") {
1804 1815  
1805 1816 $("#btnBrushSizeDecrease").css({ "pointer-events": "none", "opacity": ".5" });
1806 1817 $("#btnBrushSizeDecrease").css({ "pointer-events": "none", "opacity": ".5" });
1807   -
  1818 +
1808 1819 }
1809 1820 else if (brushDecreaseVar <= 1) {
1810 1821 $("#slider-range-min-2").slider("value", 1);
... ... @@ -1814,7 +1825,7 @@
1814 1825 $("#btnBrushSizeDecrease").css({ "pointer-events": "auto", "opacity": ".5" });
1815 1826 $("#btnBrushSizeDecrease").css({ "pointer-events": "auto", "opacity": ".5" });
1816 1827 }
1817   -
  1828 +
1818 1829 }
1819 1830 else {
1820 1831 var brushDecrementedValue = parseInt(brushDecreaseVar) - 1;
... ... @@ -1922,7 +1933,7 @@
1922 1933 <script>
1923 1934 $(function () {
1924 1935 $("#btnSaveEI").click(function () {
1925   - $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
  1936 + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
1926 1937 html2canvas($("#canvasDiv"), {
1927 1938 onrendered: function (canvas) {
1928 1939 theCanvas = canvas;
... ...
400-SOURCECODE/AIAHTML5.Web/themes/default/css/bootstrap/3.3.6/main.css
... ... @@ -601,6 +601,7 @@ ul.listgrid-view li.active, ul.listgrid-view li:active{ background:#0095da!impo
601 601 .font13{ font-size:13px;}
602 602 .font11{ font-size:11px;}
603 603 .modal-footer{ padding:5px 10px;}
  604 +.modal-footer-forgot-password {padding:5px 15px;}
604 605 .paddTop0{ padding-top:0;}
605 606 .no-margin-top{ margin-top:0;}
606 607  
... ... @@ -1080,4 +1081,4 @@ color:#ffffff !important;
1080 1081 #selectedPin{background-position:15px -24px;}
1081 1082 #allPinBtn{background-position:12px -105px;}
1082 1083 #dropdownMenu221{background-position:10px -49px;}
1083   -#comment-box{background-position:28px -73px; width:80px;}
1084 1084 \ No newline at end of file
  1085 +#comment-box{background-position:28px -73px; width:80px;}
... ...