public void TestInitialise() { this._portalSettings = new PortalSetting(); this._calculatorService = new Mock <ICalculatorService>(MockBehavior.Strict); this._helper = new MapperHelper(this._portalSettings, this._calculatorService.Object); }
void checkBissines(EvaluationViewModel evaluationVM, int UserID, string pAction) { #region "Bussines" PortalSetting portalSetting = _context.PortalSettings.FirstOrDefault(); Employee employee = _context.EmployeeInfoView.Where(p => p.EmployeeID == evaluationVM.evaluationVM.EmployeeID).FirstOrDefault(); Evaluation evaluation = _context.Evaluations.Where(p => p.EvaluationID == evaluationVM.evaluationVM.EvaluationID).FirstOrDefault(); Users users = _context.Users.Where(p => p.EmployeeId == evaluationVM.evaluationVM.EmployeeID).FirstOrDefault(); switch (pAction) { case "Insert": if (users != null && users.UserId != evaluationVM.evaluationVM.UserID) { throw new Exception("MSG_EVALUATION_CANNOT_SAVE"); } break; case "Update": if (UserID == evaluationVM.evaluationVM.UserID) { if (evaluation.EmployeeApproval == 1) { throw new Exception("MSG_EVALUATION_EMPLOYEE_IS_APPROVAL"); } } if (UserID != evaluationVM.evaluationVM.UserID) { if (evaluation.EmployeeApproval != 1) { throw new Exception("MSG_EVALUATION_EMPLOYEE_IS_NOT_APPROVAL"); } } if (evaluation.HRApproval == 1) { throw new Exception("MSG_EVALUATION_IN_FINAL"); } Users manager = _context.Users.Where(p => p.UserId == UserID).FirstOrDefault(); if (UserID != evaluationVM.evaluationVM.UserID && employee.ManagerID != manager.UserId) { throw new Exception("MSG_NOT_HAVE_PERMISSION_EDIT_THIS_EVALUATION"); } break; case "Delete": break; } //if (portalSetting.NumberSalaryForLoan != null) //{ // string amount = getExtraFieldValue(requestVM.RequestExtraFields, 10); // if (amount != null && Convert.ToDecimal(amount) > (portalSetting.NumberSalaryForLoan * Convert.ToDecimal(employee.BASICSALARY))) // { // throw new Exception("MSG_1_#" + (portalSetting.NumberSalaryForLoan * Convert.ToDecimal(employee.BASICSALARY)).ToString()); // } //} #endregion }
public RegisterVmValidator(PortalSetting portalSetting) { CascadeMode = CascadeMode.StopOnFirstFailure; RuleFor(x => x.EmailAddress) .NotEmpty().WithMessage(ValidationMessages.InvalidEmailAddress) .EmailAddress().WithMessage(ValidationMessages.InvalidEmailAddress) .Matches(@"^[a-zA-Z0-9\.\-_]*@((?!lowell).*)$") .When(x => !portalSetting.AllowLowellEmailAddresses, ApplyConditionTo.CurrentValidator).WithMessage(ValidationMessages.InvalidEmailAddress) .Matches(@"^[a-zA-Z0-9\.\-_]+@(.+)$") .When(x => portalSetting.AllowLowellEmailAddresses, ApplyConditionTo.CurrentValidator).WithMessage(ValidationMessages.InvalidEmailAddress); RuleFor(x => x.Password) .Equal(x => x.ConfirmPassword).WithMessage(ValidationMessages.MismatchPassword) .NotEmpty().WithMessage(ValidationMessages.BadFormatPassword) .MinimumLength(8).WithMessage(ValidationMessages.BadFormatPassword) .MaximumLength(50).WithMessage(ValidationMessages.BadFormatPassword) .Matches(@"^(?=.*[=£)(|<>~:;""'\-\+_\\/!@\{\}#$%^&\[\]*.,?])(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,50}").WithMessage(ValidationMessages.BadFormatPassword); RuleFor(x => x.ConfirmPassword) .Equal(x => x.Password).WithMessage(ValidationMessages.MismatchPassword) .NotEmpty().WithMessage(ValidationMessages.BadFormatPassword) .MinimumLength(8).WithMessage(ValidationMessages.BadFormatPassword) .MaximumLength(50).WithMessage(ValidationMessages.BadFormatPassword) .Matches(@"^(?=.*[=£)(|<>~:;""'\-\+_\\/!@\{\}#$%^&\[\]*.,?])(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,50}").WithMessage(ValidationMessages.BadFormatPassword); RuleFor(x => x.TsAndCsAccepted).Equal(true).WithMessage(ValidationMessages.NotAcceptedTermsAndConditions); RuleFor(x => x.HoneyPotTextBox) .Null() .MaximumLength(0); }
public string AddSetting(PortalSetting portalSetting) { string addSettingsStatusMessage = string.Empty; if (!string.IsNullOrWhiteSpace(portalSetting.Key) && !string.IsNullOrWhiteSpace(portalSetting.Value)) { if (!CheckIfKeyExists(portalSetting.Key)) { if (context.Execute("INSERT INTO PortalSettings ([Key],[Value]) VALUES(@Key,@Value)", new { Key = portalSetting.Key, Value = portalSetting.Value }) == 1) { addSettingsStatusMessage = Constants.PortalSettingsMessageConstants.SETTINGADDSUCCESSFUL; } } else { addSettingsStatusMessage = Constants.PortalSettingsMessageConstants.SETTINGKEYEXISTS; } } else { addSettingsStatusMessage = Constants.PortalSettingsMessageConstants.SETTINGSKEYVALUEEMPTY; } return(addSettingsStatusMessage); }
public SendToRabbitMQProcess(IApiGatewayProxy proxy, PortalSetting portalSetting, IRestClient restClient) { _proxy = proxy; _restClient = restClient; _portalSetting = portalSetting; }
public TriggerFigureService(IRestClient restClient, PortalSetting portalSetting, IMapper mapper) { _restClient = restClient; _portalSetting = portalSetting; _mapper = mapper; }
public void TestInitialise() { this._portalSettings = new PortalSetting(); this._mapperHelper = new Mock <IMapperHelper>(MockBehavior.Strict); this._mapper = new Mock <IMapper>(MockBehavior.Strict); this._converter = new AccountToMyAccountsDetailVmConverter(this._mapperHelper.Object, this._mapper.Object, this._portalSettings); }
public ContactLinksService(ILogger <ContactLinksService> logger, IRestClient restClient, PortalSetting portalSettings) { _logger = logger; _restClient = restClient; _portalSettings = portalSettings; }
public string AddPortalSetting(PortalSetting portalSetting, ref ValidationStateDictionary states) { validationState = validator.Validate(portalSetting, states); if (validationState.IsValid) { return(portalSettingsRepository.AddSetting(portalSetting)); } return(validationState.Errors[0].Message); }
private int GetNumberOfDays(string key, int defaultValue) { bool tryGetexpiredIDNoOfDays = false; PortalSetting portalsetting = portalSettingsServiceInstance.GetSettingByKey(key); tryGetexpiredIDNoOfDays = int.TryParse(portalsetting != null ? portalsetting.Value : string.Empty, out expiredIDNoOfDays); expiredIDNoOfDays = expiredIDNoOfDays == 0 ? defaultValue : expiredIDNoOfDays; return(expiredIDNoOfDays); }
public TransactionsService(IAccountsService accountsService, PortalSetting portalSettings, IRestClient restClient, IMapper mapper) { _accountsService = accountsService; _portalSettings = portalSettings; _restClient = restClient; _mapper = mapper; }
public string UpdateSetting(PortalSetting portalSetting) { string updateStatusMsg = portalSettingsRepository.UpdateSetting(ref portalSetting); RepositoryServicesPortalSetting.PortalSetting[ RepositoryServicesPortalSetting.PortalSetting.FindIndex( item => item.Key == portalSetting.Key)].Value = portalSetting.Value; return(updateStatusMsg); }
public AccountsService(PortalSetting settings, IRestClient restClient, IMapper mapper, IBudgetCalculatorService budgetCalculatorService) { _settings = settings; _restClient = restClient; _mapper = mapper; _budgetCalculatorService = budgetCalculatorService; }
public DocumentsService(ILogger <DocumentsService> logger, IRestClient restClient, PortalSetting portalSettings, IMapper mapper) { _logger = logger; _restClient = restClient; _portalSettings = portalSettings; _mapper = mapper; }
public BudgetCalculatorService( IRestClient restClient, ICalculatorService calculatorService, PortalSetting portalSettings, IMapper mapper) { _restClient = restClient; _calculatorService = calculatorService; _portalSettings = portalSettings; _mapper = mapper; }
public void WhenInstantiatingClassWithDefaultConstructor_Succeeds() { // Arrange PortalSetting model; // Act model = new PortalSetting(); // Assert Assert.NotNull(model); }
public void TestInitialise() { this._logger = new Mock <ILogger <OpenWrksController> >(MockBehavior.Default); this._distributedCache = new Mock <IDistributedCache>(MockBehavior.Strict); this._config = new Mock <IConfiguration>(MockBehavior.Strict); this._sessionState = new Mock <IApplicationSessionState>(MockBehavior.Strict); this._webActivityService = new Mock <IWebActivityService>(MockBehavior.Strict); this._openWrksService = new Mock <IOpenWrksService>(MockBehavior.Strict); this._openWrksService = new Mock <IOpenWrksService>(MockBehavior.Strict); this._mapper = new Mock <IMapper>(MockBehavior.Strict); this._budgetCalculatorService = new Mock <IBudgetCalculatorService>(MockBehavior.Strict); this._openWrksSettings = new OpenWrksSetting { UseLandingPage = true }; this._caseflowUserId = Guid.NewGuid().ToString(); this._accountService = new Mock <IAccountsService>(); this._portalSetting = new PortalSetting { Features = new Features() { EnableOpenWrks = true } }; this._portalCryptoAlgorithm = new Mock <IPortalCryptoAlgorithm>(); this._controller = new OpenWrksController(_logger.Object, _distributedCache.Object, _config.Object, _openWrksSettings, _sessionState.Object, _webActivityService.Object, _accountService.Object, _portalSetting, _budgetCalculatorService.Object, _portalCryptoAlgorithm.Object, _openWrksService.Object); var context = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal(new List <ClaimsIdentity>() { new ClaimsIdentity(new List <Claim>() { new Claim("caseflow_userid", _caseflowUserId) }, "testing...") }) }, RouteData = new RouteData() }; _controller.ControllerContext = context; }
public OpenWrksService( PortalSetting portalSetting, IRestClient restClient, OpenWrksSetting openWrksSetting, ILogger <OpenWrksService> logger, IMapper mapper) { _logger = logger; _portalSetting = portalSetting; _restClient = restClient; _openWrksSetting = openWrksSetting; _mapper = mapper; }
public void TestInitialise() { this._portalSettings = new PortalSetting() { GatewayEndpoint = "TestEndpoint/" }; this._restClient = new Mock <IRestClient>(MockBehavior.Strict); this._mapper = new Mock <IMapper>(MockBehavior.Strict); this._budgetCalculatorService = new Mock <IBudgetCalculatorService>(); this._service = new AccountsService(this._portalSettings, this._restClient.Object, this._mapper.Object, this._budgetCalculatorService.Object); }
public MyProfileService(ILogger <MyProfileService> logger, PortalSetting portalSettings, IRestClient restClient, IMapper mapper, IAccountsService accountsService) { _logger = logger; _portalSettings = portalSettings; _restClient = restClient; _mapper = mapper; _accountsService = accountsService; }
public BuildPaymentOptionsVmService( IApiGatewayProxy apiGatewayProxy, IArrearsDescriptionProcess arrearsDescriptionProcess, IDirectDebitFrequencyTranslator directDebitFrequencyTranslator, PortalSetting portalSetting, IAccountsService accountsService) { _apiGatewayProxy = apiGatewayProxy; _arrearsDescriptionProcess = arrearsDescriptionProcess; _directDebitFrequencyTranslator = directDebitFrequencyTranslator; _portalSetting = portalSetting; _accountsService = accountsService; }
public static IServiceCollection AddProxyMappings( this IServiceCollection services, ILoggerFactory loggerFactory, PortalSetting portalSetting) { var url = portalSetting.GatewayEndpoint; services.AddScoped <IApiGatewayProxy>(x => new ApiGatewayProxy( loggerFactory.CreateLogger <ApiGatewayProxy>(), x.GetRequiredService <IRestClient>(), url)); return(services); }
public RegisterService(ILogger <RegisterService> logger, IApiGatewayProxy apiGatewayProxy, IdentitySetting identitySetting, IRestClient restClient, IPortalCryptoAlgorithm portalCryptoAlgorithm, PortalSetting portalSetting) { _logger = logger; _identitySetting = identitySetting; _apiGatewayProxy = apiGatewayProxy; _restClient = restClient; _portalCryptoAlgorithm = portalCryptoAlgorithm; _portalSetting = portalSetting; }
public BuildAmendDirectDebitVmService(IGetCurrentDirectDebitProcess getCurrentDirectDebitProcess, IBuildFrequencyListProcess buildFrequencyListProcess, IDirectDebitFrequencyTranslator directDebitFrequencyTranslator, PortalSetting portalSetting, IApiGatewayProxy apiGatewayProxy, IAccountsService accountService) { _apiGatewayProxy = apiGatewayProxy; _getCurrentDirectDebitProcess = getCurrentDirectDebitProcess; _buildFrequencyListProcess = buildFrequencyListProcess; _directDebitFrequencyTranslator = directDebitFrequencyTranslator; _accountService = accountService; _portalSetting = portalSetting; }
public void TestInitialise() { this._portalSettings = new PortalSetting() { GatewayEndpoint = "TESTING/" }; this._restClient = new Mock <IRestClient>(MockBehavior.Strict); this._mapper = new Mock <IMapper>(MockBehavior.Strict); this._sessionState = new Mock <IApplicationSessionState>(MockBehavior.Strict); this._triggerFigureService = new TriggerFigureService( this._restClient.Object, this._portalSettings, this._mapper.Object); }
public void TestInitialise() { this._portalSettings = new PortalSetting() { GatewayEndpoint = "TESTING/", Features = new Features() }; this._calculatorService = new Mock <ICalculatorService>(MockBehavior.Strict); this._restClient = new Mock <IRestClient>(MockBehavior.Strict); this._mapper = new Mock <IMapper>(MockBehavior.Strict); this._budgetCalculatorService = new BudgetCalculatorService( this._restClient.Object, this._calculatorService.Object, this._portalSettings, this._mapper.Object); }
public ForgotPasswordVmValidator(PortalSetting portalSettings) { CascadeMode = CascadeMode.StopOnFirstFailure; RuleFor(x => x.EmailAddress) .NotEmpty().WithMessage(ValidationMessages.InvalidEmailAddress) .EmailAddress().WithMessage(ValidationMessages.InvalidEmailAddress) .Matches(@"^[a-zA-Z0-9\.\-_]*@((?!lowell).*)$") .When(x => !portalSettings.AllowLowellEmailAddresses, ApplyConditionTo.CurrentValidator).WithMessage(ValidationMessages.InvalidEmailAddress) .Matches(@"^[a-zA-Z0-9\.\-_]+@(.+)$") .When(x => portalSettings.AllowLowellEmailAddresses, ApplyConditionTo.CurrentValidator).WithMessage(ValidationMessages.InvalidEmailAddress); RuleFor(x => x.HoneyPotTextBox) .Null() .MaximumLength(0); }
public MyProfileController(ILogger <BaseController> logger, IConfiguration configuration, IMyProfileService myProfileService, IGtmService gtmService, IDistributedCache distributedCache, IApplicationSessionState sessionState, IWebActivityService webActivityService, IAccountsService accountsService, PortalSetting portalSetting) : base(logger, distributedCache, sessionState, configuration) { _myProfileService = myProfileService; _gtmService = gtmService; _webActivityService = webActivityService; _accountsService = accountsService; _portalSetting = portalSetting; }
public MyDocumentsController(ILogger <BaseController> logger, IDistributedCache distributedCache, IApplicationSessionState sessionState, IConfiguration configuration, IDocumentsService documentsService, IAccountsService accountsService, IWebActivityService webActivityService, IMapper mapper, PortalSetting setting) : base(logger, distributedCache, sessionState, configuration) { _documentsService = documentsService; _accountsService = accountsService; _webActivityService = webActivityService; _mapper = mapper; _setting = setting; }
public PortalSetting GetSettingByKey(string key) { PortalSetting portalSetting = new PortalSetting(); if (RepositoryServicesPortalSetting.PortalSetting != null) { portalSetting = RepositoryServicesPortalSetting.PortalSetting.Where(f => f.Key == key).Select(k => k).FirstOrDefault(); } if (portalSetting != null) { return(portalSetting); } string sql = "SELECT [Key], [Value], [PSID] FROM PortalSettings WHERE [KEY] = @Key"; portalSetting = context.Query <PortalSetting>(sql, new { KEY = key }).FirstOrDefault(); return(portalSetting); }
public bool IsRepeatingPassword(PasswordHistoryModel passwordHistoryModel, out int unUsablePreviousPasswordCount) { int constValue = 0; int.TryParse(Constants.PortalSettingsKeyFallBackValues.UNUSABLEPREVIOUSPASSWORDSNUMBER, out constValue); unUsablePreviousPasswordCount = constValue; PortalSetting portalSetting = portalSettingsRepository.GetSettingByKey(Constants.PortalSettingsKeysConstants.UNUSABLEPREVIOUSPASSWORDSNUMBER); if (!string.IsNullOrWhiteSpace(portalSetting.Value)) { int.TryParse(portalSetting.Value, out unUsablePreviousPasswordCount); if (unUsablePreviousPasswordCount == 0) { unUsablePreviousPasswordCount = constValue; } } return(passwordHistoryRepository.IsRepeatingPassword(passwordHistoryModel, unUsablePreviousPasswordCount)); }