public Task <Vacancy> Update(Vacancy vacancy, ICollection <int> candidates, int userId) { return(Task.Run(async() => { await Task.Run(() => { vacancy.LastModifier = userId; AttachNewCandidates(vacancy, candidates); SetUpNulls(vacancy); }).ConfigureAwait(false); await ApplyStatusChange(vacancy.Id, vacancy.Status); return await Task.Run(() => vacancyRepository.Update(vacancy)).ConfigureAwait(false); })); }
public void UpdateVacancy(VacancyDTO vacancyDTO) { Vacancy vacancy = Database.Vacancies.Get(vacancyDTO.VacancyId); if (vacancy == null) { throw new ValidationException("Вакансия не найдена", ""); } vacancy.VacancyName = vacancyDTO.VacancyName; vacancy.VacancyDescript = vacancyDTO.VacancyDescript; vacancy.CustomerId = vacancyDTO.CustomerId; vacancy.Date = DateTime.Now; vacancy.CategoryId = vacancyDTO.CategoryId; Database.Vacancies.Update(vacancy); Database.Save(); }
public void MatchServiceSetUp() { var candidate = new User("", "", UserType.Candidate); var recruiter = new User("", "", UserType.Recruiter); var specialization = new Specialization("spec"); var summary = new Summary(candidate, specialization, new List <Skill>(), ""); var vacancy = new Vacancy(recruiter, specialization, new List <Skill>(), ""); var matchRepository = new MatchRepositoryMock(new List <Match>()); var userRepository = Mock.Of <IUserRepository>(x => x.Get(0) == candidate); var summaryRepository = Mock.Of <ISummaryRepository>(x => x.GetForUser(0) == summary && x.Get(0) == summary); var vacancyRepository = Mock.Of <IVacancyRepository>(x => x.Get(0) == vacancy); _matchService = new MatchService(matchRepository, userRepository, summaryRepository, vacancyRepository); }
public Task <Vacancy> Post(Vacancy vacancy, ICollection <int> candidates, int userId) { return(Task.Run(async() => { await Task.Run(() => { AttachNewCandidates(vacancy, candidates); SetUpNulls(vacancy); vacancy.HRM = userId; vacancy.LastModifier = userId; }).ConfigureAwait(false); return await Task.Run(() => vacancyRepository.Create(vacancy)).ConfigureAwait(false); })); }
public ActionResult VacancyEdit(int?id) //получаем id редактируемой вакансии { if (id == null) { return(HttpNotFound()); } // Находим в бд вакансию Vacancy newvacancy = db.Vacancies.Find(id); if (newvacancy != null) { SelectList Vacancystates = new SelectList(db.VacancyStates, "Id", "VacancyStateName"); ViewBag.VacancyStates = Vacancystates; return(View(newvacancy)); } return(RedirectToAction("Index")); }
private VacancyReview BuildNewReview(Vacancy vacancy, int previousReviewCount, DateTime slaDeadline, List <string> updatedFieldIdentifiers) { var review = new VacancyReview { VacancyReference = vacancy.VacancyReference.Value, Title = vacancy.Title, Status = ReviewStatus.New, CreatedDate = _time.Now, EmployerAccountId = vacancy.EmployerAccountId, SubmittedByUser = vacancy.SubmittedByUser, SubmissionCount = previousReviewCount + 1, SlaDeadline = slaDeadline, VacancySnapshot = vacancy, UpdatedFieldIdentifiers = updatedFieldIdentifiers }; return(review); }
public JsonResult Delete(int id) { Vacancy xdb = db.Vacancies.Find(id); string oldImagePath = Path.Combine(Server.MapPath("~/Uploads/"), xdb.CoverImage); System.IO.File.Delete(oldImagePath); db.Vacancies.Remove(xdb); db.SaveChanges(); int AdminId = (int)Session["AdminId"]; string ConnectionId = db.Admin.FirstOrDefault(c => c.Id == AdminId).ConnectionId; GlobalHost.ConnectionManager.GetHubContext <NotifyHub>().Clients.AllExcept(ConnectionId).modelDelete(((Models.Admin)Session["Admin"]).FullName, DateTime.Now.ToString("HH:mm"), xdb.Title, "Vacancy"); return(Json(JsonRequestBehavior.AllowGet)); }
public void ShouldRedirectToLocationGet() { var vacancy = new Vacancy { EmployerAccountId = "EMPLOYER ACCOUNT ID", Id = Guid.Parse("84af954e-5baf-4942-897d-d00180a0839e"), Title = "has a value", ProgrammeId = "has a value", NumberOfPositions = 3, LegalEntityName = "legal name", EmployerNameOption = EmployerNameOption.RegisteredName, Wage = new Wage { WageType = WageType.FixedWage } }; CheckRouteIsValidForVacancyTest(vacancy, RouteNames.Location_Get, false, null); }
public void ShouldRedirectToDates(string route, bool shouldRedirect) { var vacancy = new Vacancy { EmployerAccountId = "EMPLOYER ACCOUNT ID", Id = Guid.Parse("84af954e-5baf-4942-897d-d00180a0839e"), Title = "has a value", ProgrammeId = "has a value", NumberOfPositions = 3, LegalEntityName = "legal name", EmployerNameOption = EmployerNameOption.RegisteredName, EmployerLocation = new Address { Postcode = "has a value" } }; CheckRouteIsValidForVacancyTest(vacancy, route, shouldRedirect, RouteNames.Dates_Get); }
public void ShouldMapVacancyAddressWhenSpecified() { // Arrange. var src = new Vacancy { Status = "Live", VacancyType = "Traineeship", VacancyAddress = new AddressDetails { AddressLine1 = "AddressLine1", AddressLine2 = "AddressLine2", AddressLine3 = "AddressLine3", AddressLine4 = "AddressLine4", AddressLine5 = "AddressLine5", Town = "Town", County = "County", PostCode = "Postcode", LatitudeSpecified = true, Latitude = 1.0m, LongitudeSpecified = true, Longitude = 2.0m, }, WageType = "Weekly" }; // Act. var dest = new LegacyTraineeshipVacancyDetailMapper().Map <Vacancy, TraineeshipVacancyDetail>(src); // Assert. dest.Should().NotBeNull(); dest.VacancyAddress.Should().NotBeNull(); dest.VacancyAddress.AddressLine1.Should().Be("AddressLine1"); dest.VacancyAddress.AddressLine2.Should().Be("AddressLine2, AddressLine3, AddressLine4, AddressLine5"); dest.VacancyAddress.AddressLine3.Should().Be("Town"); dest.VacancyAddress.AddressLine4.Should().Be("County"); dest.VacancyAddress.Postcode.Should().Be("Postcode"); dest.VacancyAddress.Uprn.Should().BeNull(); dest.VacancyAddress.GeoPoint.Should().NotBeNull(); dest.VacancyAddress.GeoPoint.Latitude.Should().Be(1.0); dest.VacancyAddress.GeoPoint.Longitude.Should().Be(2.0); }
public static T ToVacancyProjectionBase <T>(this Vacancy vacancy, ApprenticeshipProgramme programme, Func <string> getDocumentId, ITimeProvider timeProvider) where T : VacancyProjectionBase { var projectedVacancy = (T)Activator.CreateInstance <T>(); projectedVacancy.Id = getDocumentId(); projectedVacancy.LastUpdated = timeProvider.Now; projectedVacancy.VacancyId = vacancy.Id; projectedVacancy.ApplicationInstructions = vacancy.ApplicationInstructions; projectedVacancy.ApplicationMethod = vacancy.ApplicationMethod.GetValueOrDefault().ToString(); projectedVacancy.ApplicationUrl = vacancy.ApplicationUrl; projectedVacancy.ClosingDate = vacancy.ClosingDate.GetValueOrDefault(); projectedVacancy.Description = vacancy.Description; projectedVacancy.DisabilityConfident = vacancy.DisabilityConfident; projectedVacancy.EmployerContactEmail = vacancy.EmployerContact?.Email; projectedVacancy.EmployerContactName = vacancy.EmployerContact?.Name; projectedVacancy.EmployerContactPhone = vacancy.EmployerContact?.Phone; projectedVacancy.ProviderContactEmail = vacancy.ProviderContact?.Email; projectedVacancy.ProviderContactName = vacancy.ProviderContact?.Name; projectedVacancy.ProviderContactPhone = vacancy.ProviderContact?.Phone; projectedVacancy.EmployerDescription = vacancy.EmployerDescription; projectedVacancy.EmployerLocation = vacancy.EmployerLocation.ToProjection(vacancy.IsAnonymous); projectedVacancy.EmployerName = vacancy.EmployerName; projectedVacancy.EmployerWebsiteUrl = vacancy.IsAnonymous ? null : vacancy.EmployerWebsiteUrl; projectedVacancy.IsAnonymous = vacancy.IsAnonymous; projectedVacancy.LiveDate = vacancy.LiveDate.GetValueOrDefault(); projectedVacancy.NumberOfPositions = vacancy.NumberOfPositions.GetValueOrDefault(); projectedVacancy.OutcomeDescription = vacancy.OutcomeDescription; projectedVacancy.ProgrammeId = vacancy.ProgrammeId; projectedVacancy.ProgrammeLevel = programme.ApprenticeshipLevel.ToString(); projectedVacancy.ProgrammeType = programme.ApprenticeshipType.ToString(); projectedVacancy.Qualifications = vacancy.Qualifications.ToProjection(); projectedVacancy.ShortDescription = vacancy.ShortDescription; projectedVacancy.Skills = vacancy.Skills; projectedVacancy.StartDate = vacancy.StartDate.GetValueOrDefault(); projectedVacancy.ThingsToConsider = vacancy.ThingsToConsider; projectedVacancy.Title = vacancy.Title; projectedVacancy.TrainingDescription = vacancy.TrainingDescription; projectedVacancy.TrainingProvider = vacancy.TrainingProvider.ToProjection(); projectedVacancy.VacancyReference = vacancy.VacancyReference.GetValueOrDefault(); projectedVacancy.Wage = vacancy.Wage.ToProjection(); projectedVacancy.EducationLevelNumber = programme.EducationLevelNumber; return(projectedVacancy); }
public MediatorResponse <TransferVacanciesResultsViewModel> GetVacancyDetails(TransferVacanciesViewModel viewModel) { try { IList <TransferVacancyViewModel> vacanciesToBeTransferred = new List <TransferVacancyViewModel>(); TransferVacanciesResultsViewModel transferVacanciesResultsViewModel = new TransferVacanciesResultsViewModel() { TransferVacanciesViewModel = viewModel }; foreach (var vacancy in viewModel.VacancyReferenceNumbers.Split(',')) { string vacancyReference; if (VacancyHelper.TryGetVacancyReference(vacancy, out vacancyReference)) { Vacancy vacancyDetails = _vacancyPostingService.GetVacancyByReferenceNumber(Convert.ToInt32(vacancyReference)); if (vacancyDetails != null) { TransferVacancyViewModel vacancyView = new TransferVacancyViewModel { ContractOwnerId = vacancyDetails.ProviderId, VacancyManagerId = vacancyDetails.VacancyManagerId, VacancyReferenceNumber = vacancyDetails.VacancyReferenceNumber, DeliveryOrganisationId = vacancyDetails.DeliveryOrganisationId, VacancyOwnerRelationShipId = vacancyDetails.VacancyOwnerRelationshipId, ProviderName = _providerService.GetProvider(vacancyDetails.ProviderId).TradingName, }; if (vacancyDetails.VacancyManagerId.HasValue) { vacancyView.ProviderSiteName = _providerService.GetProviderSite(vacancyDetails.VacancyManagerId.Value).TradingName; } vacanciesToBeTransferred.Add(vacancyView); } } } transferVacanciesResultsViewModel.VacanciesToBeTransferredVm = vacanciesToBeTransferred; return(GetMediatorResponse(AdminMediatorCodes.GetVacancyDetails.Ok, transferVacanciesResultsViewModel)); } catch (CustomException exception) when(exception.Code == ErrorCodes.ProviderVacancyAuthorisation.Failed) { return(GetMediatorResponse(AdminMediatorCodes.GetVacancyDetails.FailedAuthorisation, new TransferVacanciesResultsViewModel(), TransferVacanciesMessages.UnAuthorisedAccess, UserMessageLevel.Warning)); } }
private TrainingProviderOrchestrator GetTrainingProviderOrchestrator(Vacancy vacancy) { var mockClient = new Mock <IEmployerVacancyClient>(); var mockTrainingProviderService = new Mock <ITrainingProviderService>(); mockTrainingProviderService.Setup(t => t.GetProviderAsync(88888888)) .ReturnsAsync(new TrainingProvider { Ukprn = 88888888 }); var mockRecruitClient = new Mock <IRecruitVacancyClient>(); mockRecruitClient.Setup(c => c.GetVacancyAsync(VacancyId)).ReturnsAsync(vacancy); var mockTrainingProviderSummaryProvider = new Mock <ITrainingProviderSummaryProvider>(); var mrEggTrainingProvider = new TrainingProviderSummary { ProviderName = "MR EGG", Ukprn = 88888888 }; var mrsEggTrainingProvider = new TrainingProviderSummary { ProviderName = "MRS EGG", Ukprn = 88888889 }; mockTrainingProviderSummaryProvider.Setup(p => p.FindAllAsync()).ReturnsAsync(new List <TrainingProviderSummary> { mrEggTrainingProvider, mrsEggTrainingProvider }); mockTrainingProviderSummaryProvider.Setup(p => p.GetAsync(88888888)) .ReturnsAsync(mrEggTrainingProvider); mockTrainingProviderSummaryProvider.Setup(p => p.GetAsync(88888889)) .ReturnsAsync(mrsEggTrainingProvider); mockRecruitClient.Setup(c => c.Validate(It.IsAny <Vacancy>(), VacancyRuleSet.TrainingProvider)) .Returns(new EntityValidationResult()); var mockLog = new Mock <ILogger <TrainingProviderOrchestrator> >(); var mockReview = new Mock <IReviewSummaryService>(); return(new TrainingProviderOrchestrator(mockClient.Object, mockRecruitClient.Object, mockLog.Object, mockReview.Object, mockTrainingProviderSummaryProvider.Object, mockTrainingProviderService.Object)); }
public void SetViewModelSkillsFromVacancy_ShouldOrderVacancySkills() { var helper = new SkillsOrchestratorHelper(GetBaseSkills); var vm = new SkillsViewModelBase(); var vacancy = new Vacancy { Skills = new List <string> { "Custom Skill 2", "Initiative", "Problem solving skills", "Custom Skill 1", "Administrative skills", "Communication skills" } }; helper.SetViewModelSkillsFromVacancy(vm, vacancy); vm.Column1Checkboxes.Count.Should().Be(10); vm.Column1Checkboxes.Count(c => c.Selected == false).Should().Be(6); vm.Column2Checkboxes.Count.Should().Be(9); vm.Column2Checkboxes.Count(c => c.Selected == false).Should().Be(7); vm.Column1Checkboxes[0].Value.Should().Be("Communication skills"); vm.Column1Checkboxes[0].Selected.Should().BeTrue(); vm.Column1Checkboxes[5].Value.Should().Be("Problem solving skills"); vm.Column1Checkboxes[5].Selected.Should().BeTrue(); vm.Column1Checkboxes[7].Value.Should().Be("Administrative skills"); vm.Column1Checkboxes[7].Selected.Should().BeTrue(); vm.Column1Checkboxes[9].Value.Should().Be("2-Custom Skill 1"); vm.Column1Checkboxes[9].Selected.Should().BeTrue(); vm.Column2Checkboxes[4].Value.Should().Be("Initiative"); vm.Column2Checkboxes[4].Selected.Should().BeTrue(); vm.Column2Checkboxes[8].Value.Should().Be("1-Custom Skill 2"); vm.Column2Checkboxes[8].Selected.Should().BeTrue(); }
public void EmployerAddressLine1MustContainValidCharacters(string testValue) { var vacancy = new Vacancy { EmployerLocation = new Address { AddressLine1 = testValue, Postcode = "AB12 3DZ" } }; var result = Validator.Validate(vacancy, VacancyRuleSet.EmployerAddress); result.HasErrors.Should().BeTrue(); result.Errors.Should().HaveCount(1); result.Errors[0].PropertyName.Should().Be($"{nameof(vacancy.EmployerLocation)}.{nameof(vacancy.EmployerLocation.AddressLine1)}"); result.Errors[0].ErrorCode.Should().Be("6"); result.Errors[0].RuleId.Should().Be((long)VacancyRuleSet.EmployerAddress); }
public void ShouldNotRedirect(string route, bool shouldRedirect) { var vacancy = new Vacancy { EmployerAccountId = "EMPLOYER ACCOUNT ID", Id = Guid.Parse("84af954e-5baf-4942-897d-d00180a0839e"), Title = "has a value", EmployerLocation = new Address { Postcode = "has a value" }, ShortDescription = "has a value", ProgrammeId = "has a value", Wage = new Wage { WageType = WageType.FixedWage } }; CheckRouteIsValidForVacancyTest(vacancy, route, shouldRedirect, null); }
public async Task WhenVacancyReferenceNotSet_ShouldRaiseException() { var id = Guid.NewGuid(); var expectedExceptionMessage = string.Format(TransferEmployerReviewToQAReviewCommandHandler.MissingReferenceNumberExceptionMessageFormat, id); var existingVacancy = new Vacancy { Id = id }; _mockVacancyRepository.Setup(x => x.GetVacancyAsync(existingVacancy.Id)) .ReturnsAsync(existingVacancy); var command = new TransferEmployerReviewToQAReviewCommand(id, _existingUserGuid, UserEmailAddress, UserName); var exception = await Assert.ThrowsAsync <InvalidOperationException>(async() => await _sut.Handle(command, new CancellationToken())); exception.Message.Should().Be(expectedExceptionMessage); }
public async Task <IActionResult> DeleteByObject([FromBody] Vacancy vacancy) { if (vacancy == null) { return(new BadRequestObjectResult("vacancy isn`t null")); } var userId = this._httpContext.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; var user = await _userManager.FindByIdAsync(userId); if (user.Email != vacancy.AuthorEmail) { return(new BadRequestObjectResult("Authorizated user and Author have different email. ")); } this._repository.VacancyRepository.Delete(vacancy); await this._repository.SaveAsync(); return(new OkResult()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Vacancy = await _context.Vacancy .Include(p => p.Location) .ThenInclude(l => l.City) .ThenInclude(c => c.Country) .FirstOrDefaultAsync(m => m.Id == id); if (Vacancy == null) { return(NotFound()); } return(Page()); }
public void DurationMustBeAtLeast12Months(DurationUnit unitValue, int durationValue) { var vacancy = new Vacancy { Wage = new Wage { DurationUnit = unitValue, Duration = durationValue } }; var result = Validator.Validate(vacancy, VacancyRuleSet.Duration); result.HasErrors.Should().BeTrue(); result.Errors.Should().HaveCount(1); result.Errors[0].PropertyName.Should().Be($"{nameof(vacancy.Wage)}.{nameof(vacancy.Wage.Duration)}"); result.Errors[0].ErrorCode.Should().Be("36"); result.Errors[0].RuleId.Should().Be((long)VacancyRuleSet.Duration); }
public Vacancy Create(Vacancy vacancy) { DbVacancy dbVacancy = DbVacancy.FromModel(vacancy); dbVacancy = _context.Vacancies .Add(dbVacancy) .Entity; try { _context.SaveChanges(); } catch (DbUpdateException) { throw new ArgumentException("Unable to create Vacancy with such data!"); } return(dbVacancy.ToModel()); }
public async Task <ActionResult> Create(UIVacancy vacancy) { ApplicationUser user = await GetCurrentUser(); if (ModelState.IsValid) { //конфигурация маппера Mapper.Initialize(cfg => cfg.CreateMap <UIVacancy, Vacancy>()); //сопоставление Vacancy DBvacancy = Mapper.Map <UIVacancy, Vacancy>(vacancy); DBvacancy.User = user; user.Vacancies.Add(DBvacancy); db.Users.Attach(user); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View()); }
public void EmployerWeb_Anonymous_ShouldValidateSpecialCharactersAndLength() { var vacancy = new Vacancy() { EmployerName = "a valid anonymous name", EmployerNameOption = EmployerNameOption.Anonymous, SourceOrigin = SourceOrigin.EmployerWeb, AnonymousReason = "£$$%$%£$<>" + new string('a', 200), }; var result = Validator.Validate(vacancy, VacancyRuleSet.EmployerNameOption); result.HasErrors.Should().BeTrue(); result.Errors.Count.Should().Be(2); result.Errors[0].PropertyName.Should().Be(nameof(vacancy.AnonymousReason)); result.Errors[0].ErrorCode.Should().Be("409"); result.Errors[1].PropertyName.Should().Be(nameof(vacancy.AnonymousReason)); result.Errors[1].ErrorCode.Should().Be("410"); }
private static void RefreshExistingVacanciesProgress(Vacancy destination, VacancyDTO source, IVacancyStageInfoRepository vacancyStageInfoRepository) { source.CandidatesProgress.Where(x => !x.IsNew()).ToList().ForEach(updatedVacanciesStageInfo => { var domainVacancyStageInfo = destination.CandidatesProgress.FirstOrDefault(x => x.Id == updatedVacanciesStageInfo.Id); if (domainVacancyStageInfo == null) { throw new ArgumentNullException("You trying to update vacanies progress which is actually doesn't exists in database"); } if (updatedVacanciesStageInfo.ShouldBeRemoved()) { vacancyStageInfoRepository.Delete(updatedVacanciesStageInfo.Id); } else { domainVacancyStageInfo.Update(destination, updatedVacanciesStageInfo); } }); }
public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Vacancy DBvacancy = await db.Vacancies.FindAsync(id); if (DBvacancy == null) { return(HttpNotFound()); } //конфигурация маппера Mapper.Initialize(cfg => cfg.CreateMap <Vacancy, UIVacancy>()); //сопоставление UIVacancy UIvacancy = Mapper.Map <Vacancy, UIVacancy>(DBvacancy); return(View(UIvacancy)); }
private static void RefreshExistingComments(Vacancy destination, VacancyDTO source, IRepository <Comment> commentRepository) { source.Comments.Where(x => !x.IsNew()).ToList().ForEach(updatedComment => { var domainComment = destination.Comments.FirstOrDefault(x => x.Id == updatedComment.Id); if (domainComment == null) { throw new ArgumentNullException("You trying to update comment which is actually doesn't exists in database"); } if (updatedComment.ShouldBeRemoved()) { commentRepository.Delete(updatedComment.Id); } else { domainComment.Update(updatedComment); } }); }
public void EmployerAddressLine1CannotBeLongerThan100Characters() { var vacancy = new Vacancy { EmployerLocation = new Address { AddressLine1 = new string('a', 101), Postcode = "AB12 3DZ" } }; var result = Validator.Validate(vacancy, VacancyRuleSet.EmployerAddress); result.HasErrors.Should().BeTrue(); result.Errors.Should().HaveCount(1); result.Errors[0].PropertyName.Should().Be($"{nameof(vacancy.EmployerLocation)}.{nameof(vacancy.EmployerLocation.AddressLine1)}"); result.Errors[0].ErrorCode.Should().Be("7"); result.Errors[0].RuleId.Should().Be((long)VacancyRuleSet.EmployerAddress); }
public void EmployerPostCodeMustBeValidFormat(string postCodeValue) { var vacancy = new Vacancy { EmployerLocation = new Address { AddressLine1 = "2 New Street", Postcode = postCodeValue } }; var result = Validator.Validate(vacancy, VacancyRuleSet.EmployerAddress); result.HasErrors.Should().BeTrue(); result.Errors.Should().HaveCount(1); result.Errors[0].PropertyName.Should().Be($"{nameof(vacancy.EmployerLocation)}.{nameof(vacancy.EmployerLocation.Postcode)}"); result.Errors[0].ErrorCode.Should().Be("9"); result.Errors[0].RuleId.Should().Be((long)VacancyRuleSet.EmployerAddress); }
public static bool Create(Vacancy vacancy) { using (var session = NHibernateHelper.OpenSession()) { IQuery query = session.CreateSQLQuery("exec create_vacancy @Name=:name, @CompanyName=:companyName, @Description=:description, @Requirements=:requirements, @Payment=:payment, @KeyWords=:keyWords, @CloseTime=:closeTime, @IsOpen=:isOpen, @UserId=:userId, @WorkExpirience=:workExpirience"); query.SetString("name", vacancy.Name); query.SetString("companyName", vacancy.CompanyName); query.SetString("description", vacancy.Description); query.SetString("requirements", vacancy.Requirements); query.SetString("payment", vacancy.Payment); query.SetString("keyWords", vacancy.KeyWords); query.SetDateTime("closeTime", vacancy.CloseTime); query.SetBoolean("isOpen", vacancy.IsOpen); query.SetInt32("userId", vacancy.UserId.Id); query.SetParameter("workExpirience", vacancy.WorkExpirience); var result = query.UniqueResult(); return(Convert.ToInt32(result) == 0); } }
public void DurationMustHaveAValue() { var vacancy = new Vacancy { Wage = new Wage { DurationUnit = DurationUnit.Month, Duration = null } }; var result = Validator.Validate(vacancy, VacancyRuleSet.Duration); result.HasErrors.Should().BeTrue(); result.Errors.Should().HaveCount(1); result.Errors[0].PropertyName.Should().Be($"{nameof(vacancy.Wage)}.{nameof(vacancy.Wage.Duration)}"); result.Errors[0].ErrorCode.Should().Be("34"); result.Errors[0].RuleId.Should().Be((long)VacancyRuleSet.Duration); }
public void It_should_handle_joins() { using (var context = ContextFactory.Current.StartNewContext()) { var now = DateTime.Now; var employee = new Employee { Name = "Foo" }; context.Add(employee); context.Add(new Employee { Name = "FooBar" }); var vacancy = new Vacancy { Employee = employee, StartDate = now, EndDate = now.AddDays(5) }; context.Add(vacancy); dynamic query = new NHDynamicQuery<Employee>(); query.Vacancies.StartDate.Gt(now.AddDays(-1)); query.Vacancies.EndDate.Lt(now.AddDays(6)); context.Fulfill((NHDynamicQuery<Employee>)query).Count().Should().Be(1); } }
protected void btnConfirmComplete_Click(object sender, EventArgs e) { //confirm Complete startOver(); //Update vacancy status. Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = vacancyNo; vacancy.PostedDate = VacancyDate; vacancy.Status = VacancyConstants.VACANCY_EVALUTION2_DONE; VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy); TransactionResponse response = manager.updateVacancyStatusforVacancyCompletion(); displayMessageToTheUser(response); if (response.isSuccessful()) { populateVacancy(); //delete notification for HR Officer 2nd phase rating. NotificationManager notificationManager = new NotificationManager(vacancy); TransactionResponse deleteResponse = notificationManager.deleteNotificationForAssignedVacancy(Membership.GetUser()); //display Message to the user only if there was an issue while removing notification. if (!deleteResponse.isSuccessful()) { displayMessageToTheUser(deleteResponse); } //Add notification for HR Manager, as Rating is done for 2nd phase TransactionResponse notificationResponse = notificationManager.addNotification(Membership.GetUser(), "8"); //display Message to the user only if there was an issue while add notification for rating done. if (!notificationResponse.isSuccessful()) { displayMessageToTheUser(notificationResponse); } } }
private void BindFirstPhaseReport(int isfromAll, DropDownList selectDropDown) { lblVacancyPhase1.Visible = false; lblVacancyPhase1.Visible = false; string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; string[] VacancyInfoTosplit = (selectDropDown.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries); currentVacancyNo = VacancyInfoTosplit[0].Trim(); currentVacancyDate = VacancyInfoTosplit[1].Trim(); resposibleHROfficer = VacancyInfoTosplit[3].Trim(); Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = currentVacancyNo; vacancy.PostedDate = currentVacancyDate; //get recently selected employee getRecentlySelectedLateralPenalityEmployee(vacancy, isfromAll); //get and display the vacancy to user. getVacancyReportAndDisplayToUser(vacancy, PageConstants.REPORT_PHASE1, isfromAll); VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(); TransactionResponse response = new TransactionResponse(); //get vacancy detail response = manager.getVacancyDetail(vacancy); DataTable dataTable = (DataTable)response.Data; string postDate = ""; try { postDate = String.Format("{0:MMM d, yyyy}", Convert.ToDateTime(dataTable.Rows[0]["posted_date"])); } catch (Exception) { } VacDetailPanel.Visible = true; lblVacancyPost.Text = dataTable.Rows[0]["Vancay_title"].ToString() + " ( JG - " + dataTable.Rows[0]["vacancy_for_JobGrade"].ToString() + " )"; lblVacancyNum.Text = dataTable.Rows[0]["vacancy_No"].ToString() + " dated " + postDate; //lblJobDes.Text = "Specification: "; lblJobReq.Text = dataTable.Rows[0]["JobDescription"].ToString() + " " + dataTable.Rows[0]["JobRequirement"].ToString() + ". "; VacDetailAllForstPhasePanel.Visible = true; lblAll1stVacancyPost.Text = dataTable.Rows[0]["Vancay_title"].ToString() + " ( JG - " + dataTable.Rows[0]["vacancy_for_JobGrade"].ToString() + " )"; lblAll1stVacancyNum.Text = dataTable.Rows[0]["vacancy_No"].ToString() + " dated " + postDate; //lblJobDes.Text = "Specification: "; lblAll1stJobReq.Text = dataTable.Rows[0]["JobDescription"].ToString() + " " + dataTable.Rows[0]["JobRequirement"].ToString() + ". "; }
/** * Return list of Applciant for the selected vacancy. */ public static TransactionResponse getApplicantDetialforProfileRequest(Vacancy vacancy) { TransactionResponse response = new TransactionResponse(); IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@vNumber", vacancy.VacancyNo); parameters.Add("@vPostDate", vacancy.PostedDate); parameters.Add("@status", vacancy.Status); DBOperationsUtil gvOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantDetialForProfileRequest, parameters); DataTable dataTable = gvOperation.getRecord(); response.Data = dataTable; response.setSuccess(true); return response; }
/** * Checkes if Processor and Checker has a permission to evaluate the current employee. */ private void manageProcessingAndCheckingPermission(Employee replyEmployee, string hrOfficerType, TransactionResponse response) { if (PageConstants.PROCESSOR.Equals(hrOfficerType)) { if (replyEmployee.CheckedDate != null && replyEmployee.ProcessedDate != null) { response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_ALREADY_CHECKED); response.setMessageType(TransactionResponse.SeverityLevel.WARNING); //log permission refusal reason. LoggerManager.LogInfo("Applicant : " + replyEmployee.EmpID + " can not be processed; Because it is already checked. Checked date : " + replyEmployee.CheckedDate + "Processed date : " + replyEmployee.ProcessedDate, logger); } else { response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_ALREADY_PROCESSED_BY_YOU); response.setMessageType(TransactionResponse.SeverityLevel.INFO); } } else if (PageConstants.CHECKER.Equals(hrOfficerType)) { if (replyEmployee.ProcessedDate == null) { response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_NOT_PROCESSED_YET); response.setMessageType(TransactionResponse.SeverityLevel.WARNING); LoggerManager.LogInfo("Applicant : " + replyEmployee.EmpID + " can not be checked; Because it is not processed yet. Checked date : " + replyEmployee.CheckedDate + "Processed date : " + replyEmployee.ProcessedDate, logger); } else { //CHECK if the vacancy is still in ASSIGNED STATE Vacancy currentVacancy = new Vacancy(); currentVacancy.VacancyNo = vacanyEvaluationForm.VacancyNo; currentVacancy.PostedDate = vacanyEvaluationForm.VacancyDate; //initialise before calling method : getCurrentStatusOfVacancy this.vacancy = currentVacancy; TransactionResponse vacancyStatusResp = getCurrentStatusOfVacancy(); string vacancyStatus = ""; if (vacancyStatusResp.Data != null) { vacancyStatus = (string)vacancyStatusResp.Data; } // check if Vacancy is still in assigned state or processing done state, but not checking done state if (!vacancyStatus.Equals("") && (VacancyConstants.VACANCY_ASSIGNED_TO_HR_OFFICERS.Equals(vacancyStatus) || VacancyConstants.VACANCY_PROCESSING_DONE.Equals(vacancyStatus)) && replyEmployee.CheckedDate != null) { response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_ALREADY_CHECKED_BY_YOU); response.setMessageType(TransactionResponse.SeverityLevel.INFO); } //check if the status is neither not-in-Assigned-state nor in processing done state //it means the vacancy is either cancelled/readvertised,... OR checking is done. state. else if (!VacancyConstants.VACANCY_ASSIGNED_TO_HR_OFFICERS.Equals(vacancyStatus) && !VacancyConstants.VACANCY_PROCESSING_DONE.Equals(vacancyStatus)) { response.setMessage(DBOperationErrorConstants.M_VACANCY_NOT_IN_ASSIGNED_STATE); response.setMessageType(TransactionResponse.SeverityLevel.WARNING); } } } }
private bool checkAlreadyEvaluatedApplicantAndDisplayForUpdate(Employee employee, Vacancy vacancy) { //CHECK IF THIS EMPLOYEE IS ALREADY PROCESSED EMPLOYEE VacancyEvaluationForm vacanyEvaluationForm = new VacancyEvaluationForm(); vacanyEvaluationForm.EmpId = employee.EmpID; vacanyEvaluationForm.VacancyNo = vacancy.VacancyNo; vacanyEvaluationForm.VacancyDate = vacancy.PostedDate; vacanyEvaluationForm.FormType = isGenOrGSpecificForm; //get employee type. - it can be internal or external. applicantType = employee.EmployeeType; VacancyRegistrationAndEvaluationManager vacancyManager = new VacancyRegistrationAndEvaluationManager(vacanyEvaluationForm); TransactionResponse response = vacancyManager.checkIfItIslreadyEvaluatedEmployeeForSecondPhase(employee); //If the employee is already evaluated employee if (response.isSuccessful()) { if (response.getMessageType() != TransactionResponse.SeverityLevel.WARNING) { //display detail of Existing data for update displayEmployeeDetailForUpdate(employee, response.Data); } displayMessageToTheUser(response); //we stop the flow return true; } return false; }
public TransactionResponse DeleteApplicat(Vacancy vacancy, string eid) { TransactionResponse response = new TransactionResponse(); try { //Add List of Arguments for new employee @EID IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@vacancy_No", vacancy.VacancyNo); parameters.Add("@vancacy_Date", vacancy.PostedDate); parameters.Add("@EID", eid); //get report for the Processor DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spDeleteApplicant, parameters); DataTable dataTable = dpOperation.getRecord(); response.Data = dataTable; response.setSuccess(true); response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); } catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
public bool CreateVacancy(Vacancy vacancy) { return _vacancyRepository.CreateVacancy(vacancy); }
protected void btnGenerateFinalReport_Click(object sender, EventArgs e) { if (DropDownListFinalResult.SelectedValue == "-1") { lblVacancyFinal.Visible = true; return; } lblVacancyFinal.Visible = false; string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; VacancyInfoTosplit = (DropDownListFinalResult.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries); currentVacancyNo = VacancyInfoTosplit[0].Trim(); currentVacancyDate = VacancyInfoTosplit[1].Trim(); Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = currentVacancyNo; vacancy.PostedDate = currentVacancyDate; //get and display the vacancy to user. int isfromAll = 0; getVacancyReportAndDisplayToUser(vacancy, PageConstants.REPORT_PHASE2, isfromAll); VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(); TransactionResponse response = new TransactionResponse(); //get vacancy detail response = manager.getVacancyDetail(vacancy); DataTable dataTable = (DataTable)response.Data; string postDate = ""; try { postDate = String.Format("{0:MMM d, yyyy}", Convert.ToDateTime(dataTable.Rows[0]["posted_date"])); } catch (Exception) { } VacDetailFinalPanel.Visible = true; lblfinalVacancyPost.Text = dataTable.Rows[0]["Vancay_title"].ToString() + " ( JG - " + dataTable.Rows[0]["vacancy_for_JobGrade"].ToString() + " )"; lblfinalVacancyNum.Text = dataTable.Rows[0]["vacancy_No"].ToString() + " dated " + postDate; lblfinalJobReq.Text = dataTable.Rows[0]["JobDescription"].ToString() + " " + dataTable.Rows[0]["JobRequirement"].ToString() + ". "; }
//Update Applicant Result public DataTable UpdateApplicantResult(VacancyEvaluationForm vacancyEvaluationForm, Vacancy vacancy) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Emp_ID", vacancyEvaluationForm.EmpId); argumentsMap.Add("@vacancy_No", vacancy.VacancyNo); argumentsMap.Add("@vacancy_date", vacancy.PostedDate); argumentsMap.Add("@education_level_mark", vacancyEvaluationForm.EducationLevelMark); argumentsMap.Add("@general_work_expr", vacancyEvaluationForm.GeneralWorkExpr); argumentsMap.Add("@specific_work_expr", vacancyEvaluationForm.SpecificWorkRxpr); argumentsMap.Add("@recommendation_of_mgr_line", vacancyEvaluationForm.RecommendationOfMgrLine); argumentsMap.Add("@interview_result_recommendation", vacancyEvaluationForm.InterviewResult); argumentsMap.Add("@remark", vacancyEvaluationForm.Remark); argumentsMap.Add("@evaluation_status", vacancyEvaluationForm.ApplicantStatus); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spUpdateApplicantDetailform1, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public TransactionResponse updateVacancyDetailNotAssignedtoHROfficer(Vacancy vacancy) { TransactionResponse response = new TransactionResponse(); try { //Add List of Arguments for new employee IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@vacancy_No", vacancy.VacancyNo); parameters.Add("@posted_date", vacancy.PostedDate); parameters.Add("@Vancay_title", vacancy.VancayTitle); parameters.Add("@branch_id", vacancy.BranchId); parameters.Add("@vancy_deadline", vacancy.VancyDeadline); parameters.Add("@vacancy_for_JobGrade", vacancy.VacancyforJobGrade); parameters.Add("@year_gen_required", vacancy.YearRequiredforGeneral); parameters.Add("@year_spec_required", vacancy.YearRequiredforSpec); parameters.Add("@general_wrk_expr_percent", vacancy.GeneralWrkExprPercent); parameters.Add("@specific_wrk_expr_percent", vacancy.SpecificWrkExprPercent); parameters.Add("@related_wrk_expr_percent", vacancy.RelatedWrkExprPercent); parameters.Add("@examination_percent", vacancy.ExaminationPercent); parameters.Add("@manager_Recom_percent", vacancy.ManagerRecPercent); parameters.Add("@interview_percent", vacancy.InterviewPercent); parameters.Add("@JobBenefit", vacancy.SalaryAndBenefit); parameters.Add("@JobDescription", vacancy.JobDescription); parameters.Add("@JobRequirement", vacancy.JobRequirement); //get report for the Processor DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdateNotAssignedVacancyDetail, parameters); DataTable dataTable = dpOperation.getRecord(); response.Data = dataTable; response.setSuccess(true); response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setMessage(DBOperationErrorConstants.M_VACANCY_UPDATE_OK); } catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
protected void btnConfirmComplete_Click(object sender, EventArgs e) { string temp = DropDownVacancyProfList.SelectedValue; if (temp == "-1") { lblDropVacancyList.Visible = true; return; } string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; VacancyInfoTosplit = (temp).Split(splitter, StringSplitOptions.RemoveEmptyEntries); vacancyNo = VacancyInfoTosplit[0].Trim(); VacancyDate = VacancyInfoTosplit[1].Trim(); //Update vacancy Profile arrived date. Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = vacancyNo; vacancy.PostedDate = VacancyDate; TransactionResponse response = new TransactionResponse(); VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy); response = manager.updateProfileArrivedDateAndVacancyStatus(); PanelConfirmVacancyComplete.Visible = false; displayMessageToTheUser(response); if (response.isSuccessful()) { //REGISTER NOTIFICATION for HR Manager //check the vacancy status whether its re-advertise or Normal response = manager.getVacancyDetail(vacancy); DataTable dataTable = (DataTable)response.Data; string vacStatus = null; string repHROfficerProcessor = null; string repHROfficerCheckor = null; NotificationManager notificationManager = new NotificationManager(vacancy); TransactionResponse notificationResponse = null; if (dataTable != null && dataTable.Rows.Count > 0) { vacStatus = dataTable.Rows[0]["status"].ToString(); repHROfficerProcessor = dataTable.Rows[0]["responsible_processor_EID"].ToString(); repHROfficerCheckor = dataTable.Rows[0]["reponsible_accessor_EID"].ToString(); if (vacStatus.Trim() == "11") { if (repHROfficerCheckor != null || repHROfficerProcessor != null) { } else { notificationResponse = notificationManager.addNotification(Membership.GetUser(), "6"); } } else { notificationResponse = notificationManager.addNotification(Membership.GetUser(), "6"); } } if (!notificationResponse.isSuccessful()) { WarnDIV.Visible = true; lblWarningMsg.Text = notificationResponse.getMessage() + notificationResponse.getErrorCode(); } DropDownVacancyProfList.ClearSelection(); } else { msgPanel.Visible = true; InfoDIV.Visible = true; lblInformationMsg.Text = response.getMessage(); DropDownVacancyProfList.ClearSelection(); } }
protected void btnShow_Click(object sender, EventArgs e) { lblmsg.Visible = false; if (DropDownVacancyList.SelectedValue == "-1") { lblmsg.Visible = true; return; } string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; VacancyInfoTosplit = (DropDownVacancyList.SelectedItem.Text).Split(splitter, StringSplitOptions.RemoveEmptyEntries); vacancyNo = VacancyInfoTosplit[0].Trim(); VacancyDate = VacancyInfoTosplit[1].Trim(); Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = vacancyNo; vacancy.PostedDate = VacancyDate; vacancy.Status = VacancyConstants.VACANCY_ACTIVE; getApplicantList(vacancy); }
public void It_should_work_with_string_accessor() { using (var context = ContextFactory.Current.StartNewContext()) { var now = DateTime.Now; var manager = new Employee { Name = "The Boss." }; context.Add(manager); var subordinate = new Employee { Name = "subordinate", Manager = manager }; context.Add(subordinate); var vacancy = new Vacancy { Employee = subordinate, StartDate = now, EndDate = now.AddDays(5) }; context.Add(vacancy); context.Add(new Employee { Name = "another one" }); dynamic query = new NHDynamicQuery<Employee>(); query["Name.Like"] = "subordinate"; query["Vacancies.StartDate.Gt"] = now.AddDays(-1); query["Manager.Name.Eq"] = "The Boss."; query["Manager.Manager.IsNull"] = true; context.Fulfill((NHDynamicQuery<Employee>)query).Count().Should().Be(1); } }
private void getRecentlySelectedLateralPenalityEmployee(Vacancy vacancy, int isfromAll) { TransactionResponse response = null; VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy); try { // Notification Manager. response = manager.getRecentlySelectedEmpResult(); DataTable dataTable = null; if (response.isSuccessful()) { //get Data from TransactionResponse dataTable = (DataTable)response.Data; if (isfromAll == 0) { if (dataTable != null && dataTable.Rows.Count != 0) { RecSelectedPanel.Visible = true; recentlySecGV.DataSource = dataTable; recentlySecGV.DataBind(); } else { RecSelectedPanel.Visible = false; } } else if (isfromAll == 1) { if (dataTable != null && dataTable.Rows.Count != 0) { AllUnqualifiedReportPanel.Visible = true; allPhaseUnqalifiedReportGV.DataSource = dataTable; allPhaseUnqalifiedReportGV.DataBind(); } else { AllUnqualifiedReportPanel.Visible = false; } } } //display message to user. displayMessageToTheUser(response); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); ErroroDIV.Visible = true; if (response != null) { lblErrorMsg.Text = response.getMessage() + response.getErrorCode(); } else { lblErrorMsg.Text = DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR + DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR; } } }
private void populateEmployeeData(Vacancy vacancy) { vacancy.ResponsibleProcessorEID = loggedInEmpID; VacancyRegistrationAndEvaluationManager vacancyRegEvaluationManager = new VacancyRegistrationAndEvaluationManager(vacancy); List<string> empID = vacancyRegEvaluationManager.getListEmpIDForProcessorSecondPhase(evalutedEmpID); if (empID.Count != 0 && empID != null) { Employee emply = new Employee(); emply.EmpID = empID[0]; EmployeeManager EmployeeManager = new EmployeeManager(emply); Employee employee = EmployeeManager.detailOfEmployeToBeEvaluated(vacancy.VacancyNo, VacancyDate); if (employee != null) { //Get the current vacancy detail //Check vacancy status [if status = 7 interview only else if status = 8 exam only, else if status = 9 exam & interview] TransactionResponse response = new TransactionResponse(); response = vacancyRegEvaluationManager.getVacancyDetail(vacancy); DataTable vacancyDetail = (DataTable)response.Data; string formtype = vacancyDetail.Rows[0]["vacancy_evaluation_form"].ToString(); vacancyStatus = vacancyDetail.Rows[0]["status"].ToString(); if (formtype == "2") { if (vacancyStatus == "7") { ExamPanelforForm2.Visible = false; InterviewPanelforForm2.Visible = true; } else if (vacancyStatus == "8") { ExamPanelforForm2.Visible = true; InterviewPanelforForm2.Visible = false; } else if (vacancyStatus == "9") { ExamPanelforForm2.Visible = true; InterviewPanelforForm2.Visible = true; } } if (checkAlreadyEvaluatedApplicantAndDisplayForUpdate(employee, vacancy)) { return; } displayApplcantDetailEvaluationForm(employee); } else { UserDetialPanel.Visible = false; PanelApplicantmsg.Visible = true; ApplErrorDiv.Visible = true; lblApplicantErrormsg.Text = DBOperationErrorConstants.M_NO_EMPLOYEE_REGISTERED_FOR_PROCESSOR_SECOND_PHASE; } } else { UserDetialPanel.Visible = false; PanelApplicantmsg.Visible = true; ApplErrorDiv.Visible = true; lblApplicantErrormsg.Text = DBOperationErrorConstants.M_NO_EMPLOYEE_REGISTERED_FOR_PROCESSOR_SECOND_PHASE; } }
private void getVacancyReportAndDisplayToUser(Vacancy vacancy, string reportPhase, int isfromAll) { TransactionResponse response = null; VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy); try { // Notification Manager. response = manager.getVacancyEvaluationResult(reportPhase); DataTable dataTable = null; if (response.isSuccessful()) { //get Data from TransactionResponse dataTable = (DataTable)response.Data; if (dataTable != null) { if (isfromAll == 0) { if (PageConstants.REPORT_PHASE1.Equals(reportPhase)) { firstPhaseDataTable = dataTable; firstPhaseResultGV.DataSource = dataTable; firstPhaseResultGV.DataBind(); } else { finalPhaseDataTable = dataTable; gvFinalReport.DataSource = dataTable; gvFinalReport.DataBind(); } } else if (isfromAll == 1) { firstPhaseDataTable = dataTable; allPhaseReportGV.DataSource = dataTable; allPhaseReportGV.DataBind(); } } } //display message to user. displayMessageToTheUser(response); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); ErroroDIV.Visible = true; if (response != null) { lblErrorMsg.Text = response.getMessage() + response.getErrorCode(); } else { lblErrorMsg.Text = DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR + DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR; } } }
private Vacancy getSelectedVacancy(DropDownList Dropd) { string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; VacancyInfoTosplit = (Dropd.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries); currentVacancyNo = VacancyInfoTosplit[0].Trim(); currentVacancyDate = VacancyInfoTosplit[1].Trim(); Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = currentVacancyNo; vacancy.PostedDate = currentVacancyDate; return vacancy; }
private void bindAccessorProcessor(GridViewRowEventArgs e, DropDownList selectDropDown, GridView selectGV) { //get processor and check name string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; string[] VacancyInfoTosplit = (selectDropDown.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries); currentVacancyNo = VacancyInfoTosplit[0].Trim(); currentVacancyDate = VacancyInfoTosplit[1].Trim(); resposibleHROfficer = VacancyInfoTosplit[3].Trim(); Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = currentVacancyNo; vacancy.PostedDate = currentVacancyDate; VacancyRegistrationAndEvaluationManager vacancyRegEvaluationManager = new VacancyRegistrationAndEvaluationManager(vacancy); TransactionResponse response = new TransactionResponse(); response = vacancyRegEvaluationManager.getVacancyDetail(vacancy); DataTable employeeData = (DataTable)response.Data; Employee employee = new Employee(); //get list of Employee using Employee manager. if (employeeData != null && employeeData.Rows.Count > 0) { // Display processor and checker in the gridview footer if (e.Row.RowType == DataControlRowType.Footer) { //get processor First name & Middle Name employee.EmpID = employeeData.Rows[0]["responsible_processor_EID"].ToString(); EmployeeManager employeeManager = new EmployeeManager(employee); List<Employee> listOfEmployee = employeeManager.getEmployeeDetial(); string fullName = null; foreach (Employee emply in listOfEmployee) { fullName = emply.FName + " " + emply.MName; } e.Row.Cells[2].Text = "Processed by :"; e.Row.Cells[2].Font.Bold = true; e.Row.Cells[3].Text = fullName; e.Row.Cells[3].Font.Bold = true; //get checkor First name & Middle Name employee.EmpID = employeeData.Rows[0]["reponsible_accessor_EID"].ToString(); employeeManager = new EmployeeManager(employee); listOfEmployee = employeeManager.getEmployeeDetial(); fullName = null; foreach (Employee emply in listOfEmployee) { fullName = emply.FName + " " + emply.MName; } e.Row.Cells[7].Text = "Assessed by :"; e.Row.Cells[7].Font.Bold = true; e.Row.Cells[8].Text = fullName; e.Row.Cells[8].Font.Bold = true; } } else { selectGV.ShowFooter = false; } }
private string getDetailOfSelectedVacancy(Vacancy vacancy) { VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(); TransactionResponse response = new TransactionResponse(); //get vacancy detail response = manager.getVacancyDetail(vacancy); DataTable dataTable = (DataTable)response.Data; return (dataTable.Rows[0]["vacancy_evaluation_form"].ToString().Trim()); }
/** * Get applicant result after checking done, or while interview or exam result is entering */ public TransactionResponse getApplicantPassedToSecPhase(Vacancy vacancy) { TransactionResponse response = new TransactionResponse(); try { //Add List of Arguments for new employee IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@vacancyNo", vacancy.VacancyNo); parameters.Add("@vacancyDate", vacancy.PostedDate); DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantPassedToSecPhase, parameters); DataTable appResult = dpOperation.getRecord(); response.Data = appResult; response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setMessage(DBOperationErrorConstants.M_REPORT_GENERATED_SUCCESS); response.setSuccess(true); return response; } catch (SqlException ex) { //Other SqlException is catched response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_APPLICANT_RESULT); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION); response.setSuccess(false); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
private TransactionResponse getAppPassedto2ndPhase(Vacancy vacancy) { TransactionResponse response = null; VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(); try { response = manager.getApplicantPassedToSecPhase(vacancy); } catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); msgPanel.Visible = true; ErroroDIV.Visible = true; if (response != null) { lblErrorMsg.Text = response.getMessage() + response.getErrorCode(); } else { lblErrorMsg.Text = DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR + DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR; } } return response; }
/** * Return list of Applciant for the selected vacancy. */ public static TransactionResponse getApplicantRegCompVacancy(Vacancy vacancy) { TransactionResponse response = new TransactionResponse(); IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@vacancy_No", vacancy.VacancyNo); parameters.Add("@posted_date", vacancy.PostedDate); DBOperationsUtil gvOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantRegCompVacancy, parameters); DataTable dataTable = gvOperation.getRecord(); response.Data = dataTable; response.setSuccess(true); response.setMessage(DBOperationErrorConstants.M_VACANCY_REVERSE_WARNING); return response; }
//get applicant result after evaluation, so that HR Manager can edit there result private void getApplicantPassedTo2ndPhase(Vacancy vacancy, GridView gv) { TransactionResponse response = getAppPassedto2ndPhase(vacancy); DataTable dataTable = null; if (response.isSuccessful()) { //get Data from TransactionResponse dataTable = (DataTable)response.Data; if (dataTable != null && dataTable.Rows.Count > 0) { gv.Visible = true; gv.DataSource = dataTable; gv.DataBind(); } } //display message to user. displayMessageToTheUser(response); }
public VacancyRegistrationAndEvaluationManager(Vacancy vacancy) { this.vacancy = vacancy; }
public bool SaveVacancy(Vacancy vacancy) { return _vacancyRepository.SaveVacancy(vacancy); }
protected void btnSearch_Click(object sender, EventArgs e) { clearGControls(); clearGSControls(); clearLabelmgs(); clearMsgPanelAndLabel(); //READ THE INPUT AND INITIALIZE MANDATORY VARIABLES try { //stop if invalid input if (!readInputsAndInitVariables()) { return; } updateCurrentVacancyTobeEaluated(); } catch (Exception ex) { UserDetialPanel.Visible = false; PanelApplicantmsg.Visible = true; ApplErrorDiv.Visible = true; lblApplicantErrormsg.Text = "Invaild Input!"; //and dont continue. return; } Vacancy vacancy = new Vacancy(); vacancy.VacancyNo = vacancyNo.Trim(); vacancy.PostedDate = VacancyDate.Trim(); populateEmployeeData(vacancy); }
protected void btnRegister_Click(object sender, EventArgs e) { clearLabelMsg(); Vacancy vacancy = new Vacancy(); if (!validateAllData(vacancy) && isGeneralOrGSpecific != 0) { return; } VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy); TransactionResponse response = manager.addNewVacancy(); if (response.isSuccessful()) { //update promotion table for the specified minute number Promotion promotion = new Promotion(); if (vacancy.VacancyOpenedFor == "2") { if (DropDPromMinNumb.SelectedValue != "-1") { string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN }; MinNumInfo = (DropDPromMinNumb.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries); applicantEID = MinNumInfo[0].Trim(); MinNumber = MinNumInfo[1].Trim(); promotion.EmpID = applicantEID; promotion.MinuteNo = MinNumber; PromotionManager promotionManager = new PromotionManager(promotion); TransactionResponse promotionResponse = promotionManager.updatePromotion(promotion, vacancy.VacancyNo); if (!promotionResponse.isSuccessful()) { clearLabelMsg(); msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = promotionResponse.getMessage(); return; } } else { lblvacForPromotion.Visible = true; lblvacForPromotion.Text = "You can't register vacancy for promotion now. If you want to register vacancy for promotion please first register promotion."+ "Or if promotion is already registered please contact you manager to assign promotion to you."; } } clearLabelMsg(); msgPanel.Visible = true; SucessDIV.Visible = true; lblSuccessMessage.Text = response.getMessage(); btnRegister.Visible = false; btnCancel.Visible = true; PromotionAssigment promotionAssigment = new PromotionAssigment(); promotionAssigment.MinuteNo = MinNumber; if (isVacncyForPromotion) { //REMOVE THIS TASK FROM HR_MANGERS MAIL BOX NotificationManager notificationManager = new NotificationManager(promotion); TransactionResponse delteResponse = notificationManager.deleteNotificationForAssignedPromotionforSpecificHROfficer(Membership.GetUser()); if (!delteResponse.isSuccessful()) { //check if Warning Message is already logged, if so just add on it if (WarnDIV.Visible) { msgPanel.Visible = true; ErroroDIV.Visible = true; lblWarningMsg.Text = lblWarningMsg.Text + " and " + delteResponse.getMessage() + delteResponse.getErrorCode(); } else { msgPanel.Visible = true; ErroroDIV.Visible = true; lblWarningMsg.Text = delteResponse.getMessage() + delteResponse.getErrorCode(); } } } } else { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = response.getMessage() + response.getErrorCode(); } }
private bool validateAllData(Vacancy vacancy) { clearLabelControl(); bool trackAll = true; string vacNo = null; string vacTitle = null; string vacforBranch = null; string vacDeadline = null; string vacJobGrade = null; string vacDescription = null; string vacCategory = null; string vacRequirement = null; string SalaryAndBenefit = null; string vacOpenfor = "1"; string yearReqGen = null; string yearReqSpec = null; string relatedWorkExpPerc = null; string relatedWorkExp4specPerc = null; string relatedWorkExp4genPerc = null; string managerRecPerc = null; string interviewPerc = null; string examPerc = null; if (txtVacNo.Text != "") { vacNo = txtVacNo.Text.Trim(); } else { trackAll = false; lblVacNo.Visible = true; } if (txtVacTitle.Text != "") { vacTitle = txtVacTitle.Text.Trim(); } else { trackAll = false; lblVacTitle.Visible = true; } if (dropDownBranchList.SelectedValue != "-1") { vacforBranch = dropDownBranchList.SelectedValue.Trim(); } else { trackAll = false; lblBranch.Visible = true; } if (txtVacancyDeadLine.Text != "") { vacDeadline = txtVacancyDeadLine.Text.Trim(); } else { trackAll = false; lblVacdeadLine.Visible = true; } if (DropDownJGrade.SelectedValue != "-1") { vacJobGrade = DropDownJGrade.SelectedValue.Trim(); } else { trackAll = false; lblJGrade.Visible = true; } if (txtJobDescription.Text.Trim() != "") { vacDescription = txtJobDescription.Text; } else { trackAll = false; lbljobDesc.Visible = true; } if (RadiobtnVacCategory.SelectedValue != "") { vacCategory = RadiobtnVacCategory.SelectedValue.Trim(); } else { trackAll = false; lblvacCategory.Visible = true; } if (RadioBVacForPromotion.SelectedValue != "") { vacOpenfor = RadioBVacForPromotion.SelectedValue.Trim(); } else { trackAll = false; lblvacForPromotion.Visible = true; } if (txtSalaryBenefit.Text.Trim() != "") { SalaryAndBenefit = txtSalaryBenefit.Text; } else { trackAll = false; lblvacForPromotion.Visible = true; } if (txtSalaryBenefit.Text.Trim() != "") { vacRequirement = txtJobRequirement.Text; } else { trackAll = false; lblJobRequirement.Visible = true; } if (isGeneralOrGSpecific == 1) // IF isGeneralOrGSpecific = 1 mean the form General Specific is choosed { try { yearReqGen = txtGSYearOfExpGPercent.Text; yearReqSpec = txtGSYearOfExpSPercent.Text; relatedWorkExp4specPerc = txtGSworkExpSpecPercent.Text; relatedWorkExp4genPerc = txtGSworkExpGenPercent.Text; managerRecPerc = txtGSManRecPercent.Text; interviewPerc = txtGSInterviewPercent.Text; } catch (FormatException) { ErrorPanel4GS.Visible = true; lblError4GS.Visible = true; lblError4GS.Text = "Invalid input for percetage value(s). please enter the corrent number"; lblError4GS.ForeColor = System.Drawing.Color.Red; } catch (Exception) { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "something went wrong, please contact your system administrator"; } } else if (isGeneralOrGSpecific == 2) // If isGeneralOrGSpecific = 2 mean the only General form is choosed { try { yearReqGen = txtGenYearOfExpPercent.Text; relatedWorkExpPerc = txtGenWExpPercent.Text; interviewPerc = txtGenInterPercent.Text; examPerc = txtGenExamPercent.Text; } catch (FormatException) { ErrorPanel4Gonly.Visible = true; lblError4GOnly.Visible = true; lblError4GOnly.Text = "Invalid input for percetage value(s). please enter the corrent number"; lblError4GOnly.ForeColor = System.Drawing.Color.Red; } catch (Exception) { msgPanel.Visible = true; ErroroDIV.Visible = true; lblErrorMsg.Text = "something went wrong, please contact your system administrator"; } } if (!trackAll) { return false; } vacancy.VacancyNo = vacNo; vacancy.VancayTitle = vacTitle; vacancy.BranchId = vacforBranch.ToString(); vacancy.VancyDeadline = vacDeadline; vacancy.VacancyforJobGrade = vacJobGrade; vacancy.VacancyEvaluationForm = vacCategory; vacancy.VacancyOpenedFor = vacOpenfor; vacancy.InterviewPercent = interviewPerc; vacancy.JobDescription = vacDescription; vacancy.JobRequirement = vacRequirement; vacancy.SalaryAndBenefit = SalaryAndBenefit; //General and Specific if (isGeneralOrGSpecific == 1) { vacancy.YearRequiredforGeneral = yearReqGen; vacancy.YearRequiredforSpec = yearReqSpec; vacancy.SpecificWrkExprPercent = relatedWorkExp4specPerc; vacancy.GeneralWrkExprPercent = relatedWorkExp4genPerc; vacancy.ManagerRecPercent = managerRecPerc; vacancy.RelatedWrkExprPercent = "0"; vacancy.ExaminationPercent = "0"; } //General Only else if (isGeneralOrGSpecific == 2) { vacancy.YearRequiredforGeneral = yearReqGen; vacancy.RelatedWrkExprPercent = relatedWorkExpPerc; vacancy.ExaminationPercent = examPerc; //for general only, we don't need "Specific & General" stuff so put zero for both of them. vacancy.YearRequiredforSpec = "0"; vacancy.SpecificWrkExprPercent = "0"; vacancy.GeneralWrkExprPercent = "0"; vacancy.ManagerRecPercent = "0"; } return trackAll; }
private void getApplicantList(Vacancy vacancy) { TransactionResponse response = null; response = VacancyRegistrationAndEvaluationManager.getApplicantDetialforProfileRequest(vacancy); DataTable result = (DataTable)response.Data; if (result != null) { ApplicantDetialGV.DataSource = result; ApplicantDetialGV.DataBind(); } }