public Response(string providerPortfolioId, string consumerPortfolioId, AccountSession accountSession) : base() { this.ProviderPortfolioId = providerPortfolioId; this.ConsumerPortfolioId = consumerPortfolioId; this.Agreement = new ResponseAgreement(); this.Alternate = new ResponseAlternate(); this.Distance = null; // create the initial receipt and the overall state of this response var receipt = new ResponseReceipt(accountSession); this.Receipts = new List <ResponseReceipt>(); this.Receipts.Add(receipt); this.State = receipt.State; }
public ProviderResponseSchemeValidator(AccountSession accountSession, ValidationMode validationMode, ProviderResponseScheme instance) : base(accountSession, validationMode) { #region Id RuleFor(i => i.Id) .IsCurrentResponse(instance) .WithMessage("Your data is not current") .WithValidationContext(ValidationStatus.Stale); RuleFor(i => i.Id) .OwnsResponseId(accountSession, validationMode) .WithMessage("You do not have ownership of this response") .WithValidationContext(ValidationStatus.Unauthorized); RuleFor(i => i.Id) .CanBecomeAvailable() .When(i => validationMode == ValidationMode.Available) .WithMessage("The state can not be changed") .WithValidationContext(ValidationStatus.Stale); RuleFor(i => i.Id) .CanBecomeDismissed() .When(i => validationMode == ValidationMode.Dismiss) .WithMessage("The state can not be changed") .WithValidationContext(ValidationStatus.Stale); RuleFor(i => i.Id) .CanBecomePending() .When(i => validationMode == ValidationMode.Pending) .WithMessage("The state can not be changed") .WithValidationContext(ValidationStatus.Stale); #endregion #region Quote RuleFor(i => i.Quote) .EnsureCurrency() .EnsureQuote() .When(i => (validationMode == ValidationMode.Pending)) .WithMessage(string.Format("{0} ${1}", "Please specify a valid amount, minimum bid is", FluentValidationExtensions.MIN_QUOTE_VALUE)) .WithValidationContext(ValidationStatus.Invalid); #endregion }
public PropertyValidator(string propertyName, AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Email if (propertyName.ToLower() == "email") { RuleFor(i => i.Email) .NotEmpty() .WithMessage("Please specifiy an email address") .WithValidationContext(ValidationStatus.Required) .EmailAddress() .WithMessage("The email address format is invalid") .WithValidationContext(ValidationStatus.Invalid); RuleFor(i => i.Email) .EnsureUnusedEmail(this.AccountSession) .When(i => (validationMode == ValidationMode.Create)) .WithMessage("The email address is currently in use") .WithValidationContext(ValidationStatus.Invalid); RuleFor(i => i.Email) .EnsureValidEmail() .When(i => (validationMode == ValidationMode.Update)) .WithMessage("The email address does not exist in the system") .WithValidationContext(ValidationStatus.Invalid); } #endregion #region Password if (propertyName.ToLower() == "password") { RuleFor(i => i.Password) .NotEmpty() .WithMessage("A password is required") .WithValidationContext(ValidationStatus.Required) .EnsurePasswordStrength() .WithMessage("Passwords must have at least 6 characters") .WithValidationContext(ValidationStatus.Invalid); } #endregion }
public ResponseFormValidator(AccountSession accountSession, ValidationMode validationMode, ResponseForm instance) : base(accountSession, validationMode) { #region Id RuleFor(i => i.Id) .IsCurrentResponse(instance) .WithMessage("Your data is not current") .WithValidationContext(ValidationStatus.Stale); RuleFor(i => i.Id) .OwnsResponseId(accountSession, validationMode) .WithMessage("You do not have ownership of this response") .WithValidationContext(ValidationStatus.Unauthorized); RuleFor(i => i.Id) .CanBecomeAccepted() .When(i => validationMode == ValidationMode.Accept) .WithMessage("The state can not be changed") .WithValidationContext(ValidationStatus.Stale); #endregion }
public ProviderPrincipalValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Name RuleFor(i => i.Name) .NotEmpty() .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Name is required") .WithValidationContext(ValidationStatus.Required) .Length(1, 64) .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Name must be 64 characters or less") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Phone RuleFor(i => i.Phone) .NotEmpty() .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Phone is required") .WithValidationContext(ValidationStatus.Required) .EnsurePhoneNumber() .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Phone is invalid") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Email RuleFor(i => i.Email) .NotEmpty() .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Email is required") .WithValidationContext(ValidationStatus.Required) .EnsureEmailFormat() .When(i => validationMode == ValidationMode.Create || validationMode == ValidationMode.Update) .WithMessage("Email is invalid") .WithValidationContext(ValidationStatus.Invalid); #endregion }
public ConsumerRegistrationFormValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Password RuleFor(i => i.Password) .NotEmpty() .When(i => validationMode == ValidationMode.Create) .WithMessage("Please specifiy a password") .WithValidationContext(ValidationStatus.Invalid); RuleFor(i => i.Password) .EnsurePasswordStrength() .When(i => validationMode == ValidationMode.Create) .WithMessage("Passwords must have at least 6 characters") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Confirm Password RuleFor(i => i.ConfirmPassword) .NotEmpty() .When(i => validationMode == ValidationMode.Create) .WithMessage("A password confirmation is required") .WithValidationContext(ValidationStatus.Required); RuleFor(i => i.ConfirmPassword) .Equal(i => i.Password) .When(i => validationMode == ValidationMode.Create) .WithMessage("The passwords do not match") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Has Accepted EULA RuleFor(i => i.HasAcceptedEULA) .EnsureHasAcceptedEULA() .When(i => validationMode == ValidationMode.Create) .WithMessage("The end user license agreement must be accepted") .WithValidationContext(ValidationStatus.Required); #endregion }
public ProviderMemberValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Email RuleFor(i => i.Email) .NotEmpty() .WithMessage("Please specifiy an email address") .WithValidationContext(ValidationStatus.Required) .EmailAddress() .WithMessage("The email address format is invalid") .WithValidationContext(ValidationStatus.Invalid); RuleFor(i => i.Email) .EnsureUnusedEmail(this.AccountSession) .WithMessage("The email address is currently in use") .WithValidationContext(ValidationStatus.Invalid); #endregion #region First Name RuleFor(i => i.FirstName) .NotEmpty() .WithMessage("Your first name is required") .WithValidationContext(ValidationStatus.Required) .EnsureCharacterString() .WithMessage("Your first name should only contain characters") .WithValidationContext(ValidationStatus.Invalid, ValidationSeverity.Info); #endregion #region Last Name RuleFor(i => i.LastName) .NotEmpty() .WithMessage("Your last name is required") .WithValidationContext(ValidationStatus.Required) .EnsureCharacterString() .WithMessage("Your last name should only contain characters") .WithValidationContext(ValidationStatus.Invalid, ValidationSeverity.Info); #endregion }
public AdministratorRegistrationFormValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Id RuleFor(i => i.Id) .EnsureAccountTypeAdministrator(accountSession) .WithMessage("You must be an administrator to create an account") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Password RuleFor(i => i.Password) .NotEmpty() .When(i => validationMode == ValidationMode.Create) .WithMessage("Please specify a password") .WithValidationContext(ValidationStatus.Invalid); RuleFor(i => i.Password) .EnsurePasswordStrength() .When(i => validationMode == ValidationMode.Create) .WithMessage("Passwords must have at least 6 characters") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Confirm Password RuleFor(i => i.ConfirmPassword) .NotEmpty() .When(i => validationMode == ValidationMode.Create) .WithMessage("A password confirmation is required") .WithValidationContext(ValidationStatus.Required); RuleFor(i => i.ConfirmPassword) .Equal(i => i.Password) .When(i => validationMode == ValidationMode.Create) .WithMessage("The passwords do not match") .WithValidationContext(ValidationStatus.Invalid); #endregion }
public ConsumerPrincipalValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region First Name RuleFor(i => i.FirstName) .NotEmpty() .WithMessage("First name is required") .WithValidationContext(ValidationStatus.Required) .EnsureCharacterString() .WithMessage("First name must only contain characters") .WithValidationContext(ValidationStatus.Invalid, ValidationSeverity.Info); #endregion #region Last Name RuleFor(i => i.LastName) .NotEmpty() .WithMessage("Last name is required") .WithValidationContext(ValidationStatus.Required) .EnsureCharacterString() .WithMessage("Last name must only contain characters") .WithValidationContext(ValidationStatus.Invalid, ValidationSeverity.Info); #endregion }
public static IRuleBuilderOptions <T, string> CanDeleteAdministratorMember <T>(this IRuleBuilder <T, string> rule, AccountSession accountSession) { // verify they aren't deleting the current administrator member and it's not the last one return(rule.Must(value => { using (var db = new MongoDbContext()) { var members = db.GetAdministratorMembers(); if (members.Count == 1) { return false; } var memberId = (value as string); if (accountSession.MemberId == memberId) { return false; } return true; } })); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new AdministratorRegistrationFormValidator(accountSession, validationMode)).Validate(this) as ValidationResult); }
public static IRuleBuilderOptions <T, string> EnsureUnusedEmail <T>(this IRuleBuilder <T, string> rule, AccountSession accountSession) { // TODO: verify this works when full Mongo DB integration // check if this email is NOT currently in use return(rule.Must(value => { if (DatabaseHelper.UserExists(value)) { return false; } return true; })); }
public static IRuleBuilderOptions <T, string> EnsureAccountTypeAdministrator <T>(this IRuleBuilder <T, string> rule, AccountSession accountSession) { // make sure this account type is valid return(rule.Must(value => { return (accountSession.AccountType == AccountType.Administrator ? true : false); })); }
public ProviderProfileValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { #region Description RuleFor(i => i.Description) .NotEmpty() .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Description must be specified") .WithValidationContext(ValidationStatus.Invalid) .Length(0, 3000) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Description must be 3000 characters or less") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Website RuleFor(i => i.Website) .EnsureUrl() .WithMessage("Website URL invalid") .WithValidationContext(ValidationStatus.Invalid) .Length(0, 100) .WithMessage("Website URL must be 100 characters or less") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Business Established RuleFor(i => i.BusinessEstablished) .NotEqual(BusinessEstablishedTypes.NA) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Business established length must be specified") .WithValidationContext(ValidationStatus.Invalid); #endregion #region FacilityAge RuleFor(i => i.FacilityAge) .NotEqual(FacilityAgeTypes.NA) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Facility age must be specified") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Facility Style RuleFor(i => i.FacilityStyle) .NotEqual(FacilityStyleTypes.NA) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Facility style must be specified") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Funeral Director Experience RuleFor(i => i.FuneralDirectorExperience) .NotEqual(FuneralDirectorExperienceTypes.NA) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Funeral directors' experience must be specified") .WithValidationContext(ValidationStatus.Invalid); #endregion #region Transportation Fleet Age RuleFor(i => i.TransportationFleetAge) .NotEqual(TransportationFleetAgeTypes.NA) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Transportation fleet age must be specified") .WithValidationContext(ValidationStatus.Invalid); #endregion }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new ConsumerPrincipalValidator(accountSession, validationMode)).Validate(this) as ValidationResult); }
public ResponseAgreementValidator(AccountSession accountSession, ValidationMode validationMode, ProviderResponseScheme response) : base(accountSession, validationMode) { #region Wake Date RuleFor(i => i.WakeDate) .HasAgreementDate(response, "WakeDate") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Wake Date must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Ceremony Date RuleFor(i => i.CeremonyDate) .HasAgreementDate(response, "CeremonyDate") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Funeral Date must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Internment Type RuleFor(i => i.InternmentType) .HasAgreement(response, "InternmentType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Internment must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Funeral Type RuleFor(i => i.FuneralType) .HasAgreement(response, "FuneralType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Funeral Style must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Wake Type RuleFor(i => i.WakeType) .HasAgreement(response, "WakeType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Wake Style must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Religion Type RuleFor(i => i.ReligionType) .HasAgreement(response, "ReligionType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Religion must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Expected Attendance Type RuleFor(i => i.ExpectedAttendanceType) .HasAgreement(response, "ExpectedAttendanceType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Expected attendance must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Service Preferences RuleFor(i => i.ServicePreferences) .HasAgreementText(response, "ServicePreferences") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Service Preferences must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Material Type RuleFor(i => i.CasketMaterialType) .HasAgreement(response, "CasketMaterialType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Casket Material must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Size Type RuleFor(i => i.CasketSizeType) .HasAgreement(response, "CasketSizeType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Casket Size must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Color Type RuleFor(i => i.CasketColorType) .HasAgreement(response, "CasketColorType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Casket Color must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Manufacturer Type RuleFor(i => i.CasketManufacturerType) .HasAgreement(response, "CasketManufacturerType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Casket Manufacturer must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Burial Container Type RuleFor(i => i.BurialContainerType) .HasAgreement(response, "BurialContainerType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Burial Container must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Transportation Of Family Type RuleFor(i => i.TransportationOfFamilyType) .HasAgreement(response, "TransportationOfFamilyType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Transportation of family must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Flower Spray Type RuleFor(i => i.FlowerSprayType) .HasAgreement(response, "FlowerSprayType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Flower Spray must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Primary Flower Type RuleFor(i => i.PrimaryFlowerType) .HasAgreement(response, "PrimaryFlowerType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Primary Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Secondary Flower Type RuleFor(i => i.SecondaryFlowerType) .HasAgreement(response, "SecondaryFlowerType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Secondary Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Accent Flower Type RuleFor(i => i.AccentFlowerType) .HasAgreement(response, "AccentFlowerType") .When(i => (validationMode == ValidationMode.Pending)) .WithMessage("Accent Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion }
public ValidationResult ValidatePassword(AccountSession accountSession, ValidationMode validationMode) { return((new PropertyValidator("Password", accountSession, validationMode)).Validate(this) as ValidationResult); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new ConsumerResponseSchemeValidator(accountSession, validationMode)).Validate(this) as ValidationResult); }
public ChangeReceipt(AccountSession accountSession) { this.By = (accountSession != null ? accountSession.MemberId : null); this.On = DateTimeHelper.Now; }
public ConsumerPreferenceValidator(AccountSession accountSession, ValidationMode validationMode, ConsumerPreference instance) : base(accountSession, validationMode) { #region Max Distance RuleFor(i => i.MaxDistance) .GreaterThan(0.0) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Distance is required") .WithValidationContext(ValidationStatus.Required); #endregion #region Internment Type RuleFor(i => i.InternmentType) .HasPreference(instance, "InternmentType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Internment must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Funeral Type RuleFor(i => i.FuneralType) .HasPreference(instance, "FuneralType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Funeral Style must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Wake Type RuleFor(i => i.WakeType) .HasPreference(instance, "WakeType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Wake Style must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Religion Type RuleFor(i => i.ReligionType) .HasPreference(instance, "ReligionType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Religion Type must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Expected Attendance Type RuleFor(i => i.ExpectedAttendanceType) .HasPreference(instance, "ExpectedAttendanceType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Expected attendance must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Remains Choice Type RuleFor(i => i.RemainsChoiceType) .NotEqual(RemainsChoiceTypes.None) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Please specify one option") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Material Type RuleFor(i => i.CasketMaterialType) .HasPreference(instance, "CasketMaterialType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Casket Material must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Size Type RuleFor(i => i.CasketSizeType) .HasPreference(instance, "CasketSizeType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Casket Size must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Color Type RuleFor(i => i.CasketColorType) .HasPreference(instance, "CasketColorType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Casket Color must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Casket Manufacturer Type RuleFor(i => i.CasketManufacturerType) .HasPreference(instance, "CasketManufacturerType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Casket Manufacturer must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Burial Container Type RuleFor(i => i.BurialContainerType) .HasPreference(instance, "BurialContainerType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Burial Container must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Transportation Choice Type RuleFor(i => i.TransportationChoiceType) .NotEqual(TransportationChoiceTypes.None) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Please specify one option") .WithValidationContext(ValidationStatus.Required); #endregion #region Transportation Of Family Type RuleFor(i => i.TransportationOfFamilyType) .HasPreference(instance, "TransportationOfFamilyType") .When(i => (validationMode == ValidationMode.Update && i.TransportationChoiceType == TransportationChoiceTypes.Required)) .WithMessage("Number of family members must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Flower Spray Type RuleFor(i => i.FlowerSprayType) .HasPreference(instance, "FlowerSprayType") .When(i => (validationMode == ValidationMode.Update && i.RemainsChoiceType == RemainsChoiceTypes.CasketRequired)) .WithMessage("Flower Spray must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Primary Flower Type RuleFor(i => i.PrimaryFlowerType) .HasPreference(instance, "PrimaryFlowerType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Primary Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Secondary Flower Type RuleFor(i => i.SecondaryFlowerType) .HasPreference(instance, "SecondaryFlowerType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Secondary Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Accent Flower Type RuleFor(i => i.AccentFlowerType) .HasPreference(instance, "AccentFlowerType") .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Accent Flower must be specified") .WithValidationContext(ValidationStatus.Required); #endregion #region Service Preferences RuleFor(i => i.ServicePreferences) .Length(0, 1000) .When(i => (validationMode == ValidationMode.Update)) .WithMessage("Service Preferences must be 1000 characters or less") .WithValidationContext(ValidationStatus.Invalid); #endregion }
public ResponseValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new PaymentValidator(accountSession, validationMode)).Validate(this) as ValidationResult); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new ConsumerPortfolioValidator(accountSession, validationMode, this)).Validate(this) as ValidationResult); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new AdminMemberValidator(accountSession, validationMode, this)).Validate(this) as ValidationResult); }
public ResponseReceipt(AccountSession accountSession) : base(accountSession) { this.State = ResponseReceiptStates.Available; this.Value = null; }
public ValidationResult ValidateEmail(AccountSession accountSession, ValidationMode validationMode) { return((new PropertyValidator("Email", accountSession, validationMode)).Validate(this) as ValidationResult); }
public ConsumerRequestValidator(AccountSession accountSession, ValidationMode validationMode) : base(accountSession, validationMode) { }
public static IRuleBuilderOptions <T, string> OwnsProviderPortfolioId <T>(this IRuleBuilder <T, string> rule, AccountSession accountSession) { return(rule.Must(id => { if (accountSession.PortfolioIds.Contains(id)) { return true; } return false; })); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode) { return((new ProviderProfileValidator(accountSession, validationMode)).Validate(this) as ValidationResult); }
public static IRuleBuilderOptions <T, string> OwnsResponseId <T>(this IRuleBuilder <T, string> rule, AccountSession accountSession, ValidationMode validationMode) { return(rule.Must(id => { using (var db = new MongoDbContext()) { var response = db.GetResponseById(id); if (response != null) { // if this is a consumer account, verify their portfolio is assigned to this response if (accountSession.AccountType == AccountType.Consumer) { return accountSession.PortfolioIds.Contains(response.ConsumerPortfolioId); } // if this is a provider account, verify their portfolio is assigned to this response if (accountSession.AccountType == AccountType.Provider) { return accountSession.PortfolioIds.Contains(response.ProviderPortfolioId); } } } return false; })); }