diff --git a/150-DOCUMENTATION/002-DBScripts/GetTermsOfServiceText.sql b/150-DOCUMENTATION/002-DBScripts/GetTermsAndConditions.sql index af21104..13a6456 100644 --- a/150-DOCUMENTATION/002-DBScripts/GetTermsOfServiceText.sql +++ b/150-DOCUMENTATION/002-DBScripts/GetTermsAndConditions.sql @@ -18,7 +18,7 @@ GO -- Create date: -- Description: -- ============================================= -CREATE PROCEDURE GetTermsOfServiceText +CREATE PROCEDURE GetTermsAndConditions -- Add the parameters for the stored procedure here AS diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index 1e75e3c..bde877d 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -16,8 +16,8 @@ namespace AIAHTML5.API.Constants public const string UPDATE_USER_PASSWORD = "UpdateUserPassword"; public const string GET_SUBSCRIPTION_DETAILS_BY_LICENSE_ID = "GetSubscriptionDetailsByLicenseId"; public const string GET_LICENSE_DETAILS_BY_ID = "GetLicenseDetailsById"; - public const string UPDATE_LICENSE_TERM_STATUS = "UpdateLicenseTermAcceptedStatus"; - public const string GET_TERMS_OF_SERVICE_TEXT = "GetTermsOfServiceText"; + public const string UPDATE_LICENSE_TERM_STATUS = "UpdateLicenseTermAcceptedStatus"; + public const string GET_TERMS_AND_CONDITIONS = "GetTermsAndConditions"; public const string INSERT_LOGIN_DETAIL = "InsertLoginDetail"; public const string INSERT_INCORRECT_LOGIN_ATTEMPTS = "InsertIncorrectLoginAttempt"; public const string GET_INCORRECT_LOGIN_ATTEMPTS = "GetIncorrectLoginAttempt"; diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index fee558e..22ccb6d 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -34,21 +34,20 @@ namespace AIAHTML5.API.Controllers logger.Debug("inside POST"); dynamic authenticationRepsonse; + DateTime blockTime; + bool isUserBlocked; try { - //01.get the user detail to autheticate user - User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); + //01.get the user detail to autheticate the user + User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); if (userInfo!= null) { - // Check user is authenticated or not by login credential math + // Check user is authenticated or not by login credential match bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo); - DateTime blockTime; - bool isUserBlocked; - if (isUserAuthenticated) { @@ -56,7 +55,8 @@ namespace AIAHTML5.API.Controllers userInfo.IsCorrectPassword = true; //02. check if user is blocked - + if(userInfo.IsActive){ + isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime); @@ -70,86 +70,11 @@ namespace AIAHTML5.API.Controllers } //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads - if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN || userInfo.UserType == AIAHTML5.API.Models.User.GENERAL_ADMIN) - { - userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - else - { - //05.1 For normal user need to get the license details, get the license id for authenticated user - int licenseId, editionId; - AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); - - userInfo.LicenseId = licenseId; - userInfo.EditionId = editionId; - - //05.2 Check user is active or not - - - //05.3 get license details - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); - - if (userInfo.LicenseInfo.Id > 0) - { - //05.4 get licenseSubscription details - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); - - //05.5 check the License expiration irespective of either user is active or not because on AIA - //we shows the License expiration message for inactive users too - string expirationDate = null; - bool isLicenseExpired = false; - - if (userInfo.LicenseSubscriptions.Id > 0) - { - isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); - } - - // send message to the UI for license expiration - //05.6 Check for subscription Expiration [Promoted for case if license inactive along with subscription expired] - if (isLicenseExpired) - { - userInfo.IsSubscriptionExpired = isLicenseExpired; - userInfo.SubscriptionExpirationDate = expirationDate; - } - else - { - //05.6.1 - if (userInfo.LicenseInfo.IsActive) - { - if (!userInfo.LicenseInfo.IsTermAccepted) - { - ArrayList termsList = AIAHTML5.API.Models.Users.getTermsOfServiceText(); - foreach (Hashtable item in termsList) - { - userInfo.TermsOfServiceTitle = item[AIAConstants.KEY_TITLE].ToString(); - userInfo.TermsOfServiceText = item[AIAConstants.KEY_CONTENT].ToString(); - } - } - else - { - userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - } - else - { - //05.6.1.1 - // return message of license inactive - // property value assigned. Separate return statement not required - - } - } - } - } + GetModulesBasedOnUserType(userInfo); - authenticationRepsonse = JsonConvert.SerializeObject(userInfo); - } + // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); } + else { //compare block time of user with current time if user is blocked @@ -157,17 +82,13 @@ namespace AIAHTML5.API.Controllers var difference = DateTime.Compare(DateTime.Now, blockDuration); //check if credentials are valid credentials - bool isCorrectLoginId, isCorrectPassword; - AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword); - - if (isUserBlocked) - { + //bool isCorrectLoginId, isCorrectPassword; + //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword); + if (difference >= 0) { - if (isCorrectPassword) - { - userInfo.IsBlocked = false; - userInfo.IsCorrectPassword = true; + //means 24 hours block time is finished + userInfo.IsBlocked = false; int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); if (wrongAttemptDeteledCount < 0) @@ -176,163 +97,53 @@ namespace AIAHTML5.API.Controllers } //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads - - if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN || userInfo.UserType == AIAHTML5.API.Models.User.GENERAL_ADMIN) - { - userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - else - { - //05.1 For normal user need to get the license details, get the license id for aUTHENTICATED USER - int licenseId, editionId; - AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); - - userInfo.LicenseId = licenseId; - userInfo.EditionId = editionId; - - //05.2 Check user is active or not - - - //05.3 get license/ licenseSubscription details - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); - - if (userInfo.LicenseInfo.Id > 0) - { - //05.4 - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); - - //05.5 check the License expiration irespective of either user is active or not because on AIA - //we shows the License expiration message for inactive users too - string expirationDate = null; - bool isLicenseExpired = false; - - if (userInfo.LicenseSubscriptions.Id > 0) - { - isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); - } - // send message to the UI for license expiration - //05.6 Check for subscription Expiration [Promoted for case if license inactive along with subscription expired] - if (isLicenseExpired) - { - userInfo.IsSubscriptionExpired = isLicenseExpired; - userInfo.SubscriptionExpirationDate = expirationDate; - } - else - { - //05.6.1 - if (userInfo.LicenseInfo.IsActive) - { - if (!userInfo.LicenseInfo.IsTermAccepted) - { - ArrayList termsList = AIAHTML5.API.Models.Users.getTermsOfServiceText(); - foreach (Hashtable item in termsList) - { - userInfo.TermsOfServiceTitle = item[AIAConstants.KEY_TITLE].ToString(); - userInfo.TermsOfServiceText = item[AIAConstants.KEY_CONTENT].ToString(); - } - } - else - { - userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - } - else - { - //05.6.1.1 - // return message of license inactive - // property value assigned. Separate return statement not required - - } - } - } - } - } - else - { - int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); - if (wrongAttemptDeteledCount < 0) - { - logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); - } - - // send message back to th UI that password is incorrect - userInfo.IsCorrectPassword = false; - - //get wrong attempt count of user - userInfo.IncorrectLoginAttemptCount = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id) + 1; - userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH; - - //01. insert wrong attempt in dtabase - int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptofUser(userInfo.Id); - - if (updateCount < 0) - { - //Put the log in log file - logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id); - } - else - { - if (userInfo.IncorrectLoginAttemptCount > 4) - { - userInfo.IsBlocked = true; - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; - } - } - - } - + GetModulesBasedOnUserType(userInfo); + } - else - { + else{ userInfo.IsBlocked = true; } - } + } + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE; + } + } + + else + { - else - { - //bool isCorrectLoginId, isCorrectPassword; - //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, out isCorrectLoginId, out isCorrectPassword); - - //below code commented as way of retrieving data changed 'very first line in this method' - //if (!isCorrectLoginId) - //{ - // // send message back to th UI that login id is incorrect - // authenticationRepsonse = AIAConstants.USER_NOT_FOUND; - //} - //else - //{ - if (!isCorrectPassword) + //NIKITA. in this case user will come only when its is not authenticated and authenticity is checked based on userID and password + //and validating we have got record of user based on userd so this is the case when password is incorrect + userInfo.IsCorrectPassword = false; + if (userInfo.IsCorrectPassword == false) { // send message back to th UI that password is incorrect - userInfo.IsCorrectPassword = false; + // userInfo.IsCorrectPassword = false; //get wrong attempt count of user - userInfo.IncorrectLoginAttemptCount = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id) + 1; + int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id); + userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1; userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH; //01. insert wrong attempt in dtabase - int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptofUser(userInfo.Id); + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts); if (updateCount < 0) { //Put the log in log file logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id); } - else - { + //else + //{ if (userInfo.IncorrectLoginAttemptCount > 4) { userInfo.IsBlocked = true; userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; } - } + //} } } // unreachable code detected as license is null @@ -345,12 +156,12 @@ namespace AIAHTML5.API.Controllers authenticationRepsonse = JsonConvert.SerializeObject(userInfo); //} - } - } - else - { + } + + else + { authenticationRepsonse = AIAConstants.USER_NOT_FOUND; - } + } } catch (Exception e) { @@ -367,6 +178,85 @@ namespace AIAHTML5.API.Controllers return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; } + + private static void GetModulesBasedOnUserType(User userInfo) + { + if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN || userInfo.UserType == AIAHTML5.API.Models.User.GENERAL_ADMIN) + { + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + else + { + //05.1 For normal user need to get the license details, get the license id for authenticated user + int licenseId, editionId; + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); + + userInfo.LicenseId = licenseId; + userInfo.EditionId = editionId; + + //05.2 Check user is active or not + + + //05.3 get license details + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); + + // if (userInfo.LicenseInfo.Id > 0) + if (userInfo.LicenseInfo!= null) + { + //05.4 get licenseSubscription details + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); + + //05.5 check the License expiration irespective of either user is active or not because on AIA + //we shows the License expiration message for inactive users too + string expirationDate = null; + bool isLicenseExpired = false; + + if (userInfo.LicenseSubscriptions!= null) + { + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); + } + + // send message to the UI for license expiration + //05.6 Check for subscription Expiration [Promoted for case if license inactive along with subscription expired] + if (isLicenseExpired) + { + userInfo.IsSubscriptionExpired = isLicenseExpired; + userInfo.SubscriptionExpirationDate = expirationDate; + } + else + { + //05.6.1 + if (userInfo.LicenseInfo.IsActive) + { + if (!userInfo.LicenseInfo.IsTermAccepted) + { + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); + foreach (Hashtable item in termsList) + { + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); + } + } + else + { + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + + } + } + } + } + } // PUT api/authenticate/5 diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index b3e38d0..a53fcac 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -68,7 +68,7 @@ namespace AIAHTML5.API.Models DataSet ds = DBModel.GetDataFromStoredProcedure(sp); - if (ds.Tables.Count > 0) + if (ds!= null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; @@ -182,7 +182,7 @@ namespace AIAHTML5.API.Models adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); - if (ds.Tables.Count > 0) + if (ds!= null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { @@ -323,7 +323,7 @@ namespace AIAHTML5.API.Models adapter.Fill(ds); - if (ds.Tables.Count > 0) + if (ds!= null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; @@ -407,7 +407,7 @@ namespace AIAHTML5.API.Models ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug(" Inside GetLicenseSubscriptionDetailsByLicenseId for LicenseId = " + licenseId); - LicenseSubscriptionDetails lsd = new LicenseSubscriptionDetails(); + LicenseSubscriptionDetails lsd = null; try { conn = new SqlConnection(dbConnectionString); @@ -428,8 +428,9 @@ namespace AIAHTML5.API.Models adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); - if (ds.Tables.Count > 0) - { + if (ds!= null && ds.Tables.Count > 0) + { + lsd = new LicenseSubscriptionDetails(); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) @@ -452,11 +453,7 @@ namespace AIAHTML5.API.Models } } } - else - { - lsd = new LicenseSubscriptionDetails (); - } - + } catch (Exception ex) { @@ -471,7 +468,7 @@ namespace AIAHTML5.API.Models ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug(" inside GetLicenseDetailsByLicenseId for LicenseId = " + licenseId); - License license = new License(); + License license = null; try { conn = new SqlConnection(dbConnectionString); @@ -492,8 +489,10 @@ namespace AIAHTML5.API.Models adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); - if (ds.Tables.Count > 0) - { + if (ds!= null && ds.Tables.Count > 0) + { + license = new License(); + DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { @@ -526,10 +525,7 @@ namespace AIAHTML5.API.Models } } } - else - { - license = new License (); - } + } catch (Exception ex) { @@ -566,21 +562,21 @@ namespace AIAHTML5.API.Models return result; } - internal static ArrayList GetTermsOfServiceText() + internal static ArrayList GetTermsAndConditions() { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); - logger.Debug(" inside GetTermsOfServiceText"); + logger.Debug(" inside GetTermsAndConditions"); - ArrayList arrTermsOfService = new ArrayList(); + ArrayList arrTermsAndConditions = new ArrayList(); try { Hashtable contentHash = null; - string str = string.Empty; - string spName = DBConstants.GET_TERMS_OF_SERVICE_TEXT; - DataSet ds = DBModel.GetDataFromStoredProcedure(spName); - - if (ds.Tables.Count > 0) + string str = string.Empty; + string spName = DBConstants.GET_TERMS_AND_CONDITIONS; + DataSet ds = DBModel.GetDataFromStoredProcedure(spName); + + if (ds!= null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) @@ -589,19 +585,19 @@ namespace AIAHTML5.API.Models { contentHash = new Hashtable(); contentHash.Add(AIAConstants.KEY_TITLE, dr["Title"]); - contentHash.Add(AIAConstants.KEY_CONTENT, dr["Content"]); - arrTermsOfService.Add(contentHash); + contentHash.Add(AIAConstants.KEY_CONTENT, dr["Content"]); + arrTermsAndConditions.Add(contentHash); } } } } catch (SqlException ex) { - logger.Fatal("Exception in GetTermsOfServiceText, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); + logger.Fatal("Exception in GetTermsAndConditions, Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); throw; - } - - return arrTermsOfService; + } + + return arrTermsAndConditions; } internal int InsertLoginDetails(int userId) @@ -686,7 +682,7 @@ namespace AIAHTML5.API.Models DataSet ds = new DataSet(); da.Fill(ds); - if (ds.Tables.Count > 0) + if (ds!= null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index 4174d6b..ba34df4 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -37,8 +37,8 @@ namespace AIAHTML5.API.Models public LicenseSubscriptionDetails LicenseSubscriptions { get; set; } public bool IsSubscriptionExpired { get; set; } public string SubscriptionExpirationDate { get; set; } - public string TermsOfServiceTitle { get; set; } - public string TermsOfServiceText { get; set; } + public string TermsAndConditionsTitle { get; set; } + public string TermsAndConditionsText { get; set; } public const string SUPER_ADMIN = "Super Admin"; public const string GENERAL_ADMIN = "General Admin"; diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index b044fcf..44b0793 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -218,12 +218,7 @@ namespace AIAHTML5.API.Models logger.Fatal("Exception in getUserDetails for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); throw; - //ArrayList supportMailList = UserUtility.GetSupportMailList(); - //string mailSubject = "SQL Exception intimation mail"; - //string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; - //UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - - //userDetails = AIAConstants.SQL_CONNECTION_ERROR; + } return userDetails; @@ -298,7 +293,7 @@ namespace AIAHTML5.API.Models expirationDate = string.Empty; bool isLicenseExpired = false; - if (subscriptionDetail.Id > 0) + if (subscriptionDetail!= null) { DateTime? subscriptionValidThrough = subscriptionDetail.SubscriptionValidThrough; if (subscriptionValidThrough != null && subscriptionValidThrough.Value.Date >= DateTime.Now.Date) @@ -378,7 +373,7 @@ namespace AIAHTML5.API.Models return result; } - internal static int saveWrongAttemptofUser(int userId) + internal static int saveWrongAttemptOfUser(int userId, int previousIncorrectLoginAttempts) { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("inside saveWrongAttemptofUser for UserId =" + userId); @@ -386,11 +381,11 @@ namespace AIAHTML5.API.Models try { - int wrongAttemptCount = Users.checkNoOfWrongAttempts(userId); + // int wrongAttemptCount = Users.checkNoOfWrongAttempts(userId); DBModel objModel = new DBModel(); - if (wrongAttemptCount < 1) + if (previousIncorrectLoginAttempts < 1) { result = objModel.InsertIncorrectLoginAttempts(userId); } @@ -510,7 +505,7 @@ namespace AIAHTML5.API.Models } - internal static ArrayList getTermsOfServiceText() + internal static ArrayList getTermsAndConditions() { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("inside getTermsOfServiceText"); @@ -520,7 +515,7 @@ namespace AIAHTML5.API.Models try { DBModel objModel = new DBModel(); - arrTermsOfService = DBModel.GetTermsOfServiceText(); + arrTermsOfService = DBModel.GetTermsAndConditions(); } catch (Exception e) {