public BDSNewController(IBDSNewService service, IBDSAccountService serviceAccount, IBDSEducationService serviceEducation, IBDSTimeWorkService serviceTimeWork, IBDSCareerService serviceCareer, IBDSNewsTypeService serviceNewsType, IBDSNewsTypePriceService serviceNewsTypePrice, IBDSLanguageService serviceLanguage, IBDSEmployerInformationService serviceEmployerInformation, IBDSPictureService servicePicture, IBDSTransactionHistoryService serviceTransactionHistory, IBDSNewsDateService serviceNewsDate ) { _service = service; _serviceAccount = serviceAccount; _serviceEducation = serviceEducation; _serviceTimeWork = serviceTimeWork; _serviceCareer = serviceCareer; _serviceNewsType = serviceNewsType; _serviceNewsTypePrice = serviceNewsTypePrice; _serviceLanguage = serviceLanguage; _serviceEmployerInformation = serviceEmployerInformation; _servicePicture = servicePicture; _serviceTransactionHistory = serviceTransactionHistory; _serviceNewsDate = serviceNewsDate; }
public HomeController(IBDSNewService service, IBDSExtNewsService serviceExt) { _service = service; _serviceExt = serviceExt; }
public BDSNewValidator(IBDSEmployerInformationService service, IBDSNewService serviceNew) { this._service = service; this._serviceNew = serviceNew; RuleFor(m => m.Title).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.AddressWork).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.Quantity).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.FromSalary).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.ToSalary).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.Bonus).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.Sex).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.IdTimeWork).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.IdEducation).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.Career).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.DesCompany).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.DesWork).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.TimeProbationary).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.FromAge).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.ToAge).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.NameCompany).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.AddressApply).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.NamesContact).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.PhoneContact).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.Email).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.ToDeadline).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); // RuleFor(m => m.Email).Matches(new Regex(@"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$")).WithMessage(Resource.TheEmailAddressEnteredIsInvalid); // RuleFor(m => m.IdLanguage).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.IdTypeNews).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.FromDateToDateString).NotEmpty().WithMessage(Resource.TheFieldShouldNotBeEmpty); RuleFor(m => m.TotalMoney).Must((BDSNew model, double money) => { var account = _service.GetIQueryableItems().FirstOrDefault(T => T.IdAccount == model.IdAcount); if (model.ID == 0) { if (account.BDSAccount.Money < money) { return(false); } } else { var modelOld = _serviceNew.GetItem(model.ID); if (account.BDSAccount.Money + model.TotalMoney - modelOld.TotalMoney < 0) { return(false); } } return(true); }).WithMessage(Utilities.Resource("ValidateNewMoney", "Over due money")); }