public CaseConfugurationController(ILookupService lookupService, ICircuitService circuitService, ICaseConfiguration caseSessionsService, ISearchCasesService searchCasesService, IRollService RollService, ISessionService SessionService)
 {
     this.lookupService       = lookupService;
     this.circuitService      = circuitService;
     this.caseSessionsService = caseSessionsService;
     this.searchCasesService  = searchCasesService;
     this.RollService         = RollService;
     this.SessionService      = SessionService;
 }
 public SessionValidator(
     ICircuitService CircuitService,
     ICaseConfiguration CaseConfiguration)
 {
     this.CircuitService    = CircuitService;
     this.CaseConfiguration = CaseConfiguration;
     RuleFor(Session => Session.Circuit_ID)
     .NotEmpty()
     .WithErrorCode(ErrorCode.EmptyCircuitID.ToString());
     RuleFor(Session => Session.Circuit_ID)
     .Must(CheckCircuitIDExist)
     .WithErrorCode(ErrorCode.InvalidCircuitID.ToString());
     RuleFor(Session => Session.Session_Date)
     .NotEmpty()
     .WithErrorCode(ErrorCode.EmptySessionDate.ToString());
     RuleFor(Session => Session.Session_Date)
     .Must(CheckFirstSessionExist)
     .WithErrorCode(ErrorCode.InvalidSessionDate.ToString());
     RuleFor(Session => Session.Reservation_Code)
     .NotEmpty()
     .WithErrorCode(ErrorCode.EmptyReservationCode.ToString());
 }
 public FaultCourtService(
     IFaultCaseService caseService,
     NewCaseValidator caseValidator,
     CompleteCaseValidator completeCaseValidator,
     IDefectsService defectsService,
     IPersonService personService,
     ILookupService lookupService,
     ICaseConfiguration CaseConfiguration,
     IDatabaseRepository databaseRepository,
     ILogger logger,
     IProsecutionCaseService prosecutionCaseService)
 {
     this.caseService           = caseService;
     this.caseValidator         = caseValidator;
     this.completeCaseValidator = completeCaseValidator;
     this.defectsService        = defectsService;
     this.personService         = personService;
     this.databaseRepository    = databaseRepository;
     this.CaseConfiguration     = CaseConfiguration;
     this.lookupService         = lookupService;
     this.logger = logger;
     this.prosecutionCaseService = prosecutionCaseService;
 }
Esempio n. 4
0
 public ViewFactory(ICaseConfiguration CaseConfiguration)
 {
     this.CaseConfiguration = CaseConfiguration;
 }
Esempio n. 5
0
        public CaseBaseValidator(
            CasePartyValidator casePartyValidator,
            CaseDescriptionValidator caseDescriptionValidator,
            ILookupService LookupService,
            ICircuitService CircuitService,
            ICaseConfiguration CaseConfiguration)
        {
            this.LookupService     = LookupService;
            this.CircuitService    = CircuitService;
            this.CaseConfiguration = CaseConfiguration;
            #region CaseBasicData Validator
            RuleFor(Case => Case.Business_Case_Id)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyProsCaseID.ToString());
            RuleFor(Case => Case.Court_ID)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyCourtID.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.Court_ID)
                .Must(CheckCourtIDExist)
                .WithErrorCode(ErrorCode.InvalidCourtID.ToString());
            });
            RuleFor(Case => Case.CrimeID)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyCrimeID.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.CrimeID)
                .Must(CheckCrimeIDExist)
                .WithErrorCode(ErrorCode.InvalidCrimeID.ToString());
            });
            RuleFor(Case => Case.ProcedureTypeID)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyProcedureTypeID.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.ProcedureTypeID)
                .Must(CheckProcedureType)
                .WithErrorCode(ErrorCode.InvalidProcedureTypeID.ToString());
            });
            RuleFor(Case => Case.CaseTypeID)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyCaseTypeID.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.CaseTypeID)
                .Must(CheckCaseTypeID)
                .WithErrorCode(ErrorCode.InvalidCaseTypeID.ToString());
            });
            RuleFor(Case => Case.First_Case_No)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyFirstCaseNo.ToString());
            RuleFor(Case => Case.First_Case_Police_Station_ID)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyFirstPoliceStationID.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.First_Case_Police_Station_ID)
                .Must(CheckPoliceStationIDExist)
                .WithErrorCode(ErrorCode.InvalidFirstPoliceStationID.ToString());
            });
            RuleFor(Case => Case.First_Case_Year)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyFirstCaseYearID.ToString());
            #endregion

            #region CaseDescriptionValidation
            RuleFor(Case => Case.CaseDescription)
            .NotNull()
            .WithErrorCode(ErrorCode.NullCaseDescription.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.CaseDescription).SetValidator(caseDescriptionValidator);
            });

            #endregion

            #region CaseParties
            RuleFor(Case => Case.CaseParties)
            .NotEmpty()
            .WithErrorCode(ErrorCode.EmptyCaseParties.ToString())
            .DependentRules(() =>
            {
                RuleFor(Case => Case.CaseParties)
                .SetCollectionValidator(casePartyValidator);


                //Check For If Defendant and Victim Exist
                RuleFor(Case => Case.CaseParties)
                .Must(CaseParties => CaseParties.Exists(CaseParty => (CaseParty.PartyType == (int)PartyTypes.Victim || CaseParty.PartyType == (int)PartyTypes.VictimAndDefendant)))
                .WithErrorCode(ErrorCode.VictimDoesntExist.ToString());

                RuleFor(Case => Case.CaseParties)
                .Must(CaseParties => CaseParties.Exists(CaseParty => (CaseParty.PartyType == (int)PartyTypes.Defendant || CaseParty.PartyType == (int)PartyTypes.VictimAndDefendant)))
                .WithErrorCode(ErrorCode.DefendantDoesntExist.ToString());

                RuleFor(Case => Case.CaseParties)
                .Must(CaseParties => CaseParties.Count > 1)
                .When(Case => Case.CaseParties.Exists(CaseParty => CaseParty.PartyType == (int)PartyTypes.VictimAndDefendant))
                .WithErrorCode(ErrorCode.OnlyOneVictimDefendantExist.ToString());
            });

            #endregion
        }