コード例 #1
0
        public ProjectValidator(IFiscalScheduleService fiscalScheduleService,
                                IDbContext dbContext)
        {
            //ensure that valid email address is entered if Registered role is checked to avoid registered users with empty email address
            RuleFor(x => x.FiscalYear)
            .NotEqual(0)
            .WithMessage("ระบุปีโครงการวิจัย!");

            RuleFor(x => x.FundAmount)
            .NotEqual(0)
            .WithMessage("ระบุงบประมาณ!");

            RuleFor(x => x.ResearchIssueId)
            .NotEqual(0)
            .WithMessage("ระบุประเด็นการวิจัย!");

            //RuleFor(x => x.FiscalYear).Must((x, context) =>
            //{
            //    return IsFiscalYearChecked(x, fiscalScheduleService);
            //}).WithMessage("ปี ไม่ได้อยู่วันรับข้อเสนอโครงการวิจัย!");

            //RuleFor(x => x.ProjectStartDate).Must((x, context) =>
            //{
            //    return IsFiscalYearChecked(x, fiscalScheduleService);
            //}).WithMessage("วันที่ยื่นข้อเสนอ ไม่อยู่ระหว่างวันรับข้อเสนอโครงการวิจัย!");

            //RuleFor(x => x.ProjectEndDate).Must((x, context) =>
            //{
            //    return IsFiscalYearChecked(x, fiscalScheduleService);
            //}).WithMessage("วันสิ้นสุด ไม่อยู่ระหว่างวันรับข้อเสนอโครงการวิจัย!");


            SetDatabaseValidationRules <Project>(dbContext);
        }
コード例 #2
0
 public FiscalScheduleModelFactory(IActionContextAccessor actionContextAccessor,
                                   IBaseAdminModelFactory baseAdminModelFactory,
                                   IFiscalScheduleService fiscalScheduleService,
                                   IUrlHelperFactory urlHelperFactory,
                                   IWebHelper webHelper)
 {
     this._actionContextAccessor = actionContextAccessor;
     this._baseAdminModelFactory = baseAdminModelFactory;
     this._fiscalScheduleService = fiscalScheduleService;
     this._urlHelperFactory      = urlHelperFactory;
     this._webHelper             = webHelper;
 }
コード例 #3
0
 public FiscalScheduleController(IUserActivityService userActivityService,
                                 IUserService userService,
                                 IPermissionService permissionService,
                                 IFiscalScheduleModelFactory fiscalScheduleModelFactory,
                                 IFiscalScheduleService fiscalScheduleService)
 {
     this._userActivityService        = userActivityService;
     this._userService                = userService;
     this._permissionService          = permissionService;
     this._fiscalScheduleModelFactory = fiscalScheduleModelFactory;
     this._fiscalScheduleService      = fiscalScheduleService;
 }
コード例 #4
0
 public ProjectController(IProjectService projectService,
                          IProjectModelFactory projectModelFactory,
                          IUserActivityService userActivityService,
                          IWorkContext workContext,
                          IFiscalScheduleService fiscalScheduleService,
                          IPermissionService permissionService)
 {
     this._projectService        = projectService;
     this._projectModelFactory   = projectModelFactory;
     this._userActivityService   = userActivityService;
     this._workContext           = workContext;
     this._fiscalScheduleService = fiscalScheduleService;
     this._permissionService     = permissionService;
 }
コード例 #5
0
 public BaseAdminModelFactory(IFacultyService facultyService,
                              ICountryService countryService,
                              IUserActivityService userActivityService,
                              IUserService userService,
                              IDateTimeHelper dateTimeHelper,
                              IEmailAccountService emailAccountService,
                              IProfessorService professorService,
                              IProvinceService provinceService,
                              IStaticCacheManager cacheManager,
                              IAcademicRankService academicRankService,
                              IResearchIssueService researchIssueService,
                              IAgencyService agencyService,
                              IResearcherService researcherService,
                              IEducationLevelService educationLevelService,
                              IStrategyGroupService strategyGroupService,
                              IFiscalScheduleService fiscalScheduleService,
                              ITitleService titleService,
                              IInstituteService instituteService)
 {
     this._facultyService        = facultyService;
     this._countryService        = countryService;
     this._userActivityService   = userActivityService;
     this._userService           = userService;
     this._dateTimeHelper        = dateTimeHelper;
     this._emailAccountService   = emailAccountService;
     this._professorService      = professorService;
     this._provinceService       = provinceService;
     this._cacheManager          = cacheManager;
     this._academicRankService   = academicRankService;
     this._researchIssueService  = researchIssueService;
     this._agencyService         = agencyService;
     this._researcherService     = researcherService;
     this._educationLevelService = educationLevelService;
     this._strategyGroupService  = strategyGroupService;
     this._fiscalScheduleService = fiscalScheduleService;
     this._titleService          = titleService;
     this._instituteService      = instituteService;
 }
コード例 #6
0
        private bool IsFiscalYearChecked(ProjectModel model, IFiscalScheduleService fiscalScheduleService)
        {
            var user = fiscalScheduleService.GetAllFiscalSchedules(fiscalScheduleName: string.Empty, fiscalYear: model.FiscalYear, openingDate: model.ProjectStartDate, closingDate: model.ProjectEndDate).FirstOrDefault();

            return(user != null ? false : true);
        }