private void Activation() { var AllSrf = _srf.GetAll().ToList(); var AllUser = _userProfile.GetAll().ToList(); var AllVacancy = _vacancy.GetAll().ToList(); var AllCandidate = _candidate.GetAll().ToList(); var AllEscalation = _escalation.GetAll().ToList(); var GetLastSrf = _srf.GetAll().OrderByDescending(x => x.CreatedAt).GroupBy(x => x.CandidateId).Select(x => x.Key).ToArray(); var SrfCandidate = _srf.GetAll().Where(x => GetLastSrf.Contains(x.CandidateId)).ToArray(); foreach (var srf in SrfCandidate) { // Set Active Srf To User var _temp = _srf.GetById(srf.Id); _temp.IsActive = true; // Set Terminate if (!string.IsNullOrEmpty(srf.TeriminateNote)) { var Candidate = _candidate.GetById(srf.CandidateId); if (Candidate.Account != null) { var pro = _userProfile.GetById(Candidate.AccountId); pro.IsBlacklist = false; pro.IsTerminate = true; _userProfile.Update(pro); } _temp.Status = SrfStatus.Terminate; } _srf.Update(_temp); } // Generate SRF NUMBER //foreach (var row in AllSrf) //{ // String SrfNumber = null; // if (string.IsNullOrEmpty(row.Number)) // { // SrfNumber = "0000"; // } // else // { // if (row.Number.Length > 4) // { // SrfNumber = row.Number.Substring(0, 4); // } // else // { // SrfNumber = row.Number; // } // } // var _temp = _srf.GetById(row.Id); // _temp.Number = SrfNumber; // _srf.Update(_temp); //} }
// GET: /<controller>/ public IActionResult Index() { var user = _userHelper.GetUser(User); var roles = _userManager .GetRolesAsync(user) .Result .ToList(); if (User.IsInRole("Contractor")) { var srf = _userHelper.GetCurrentSrfByLogin(User); var ContractorInfo = _candidate.GetById(srf.CandidateId); var Vacancy = _vacancy.GetById(ContractorInfo.VacancyId); ViewBag.Srf = srf; ViewBag.ContractorInfo = ContractorInfo; ViewBag.Departement = _department.GetById(srf.DepartmentId); ViewBag.DepartmentSub = _departmentSub.GetById(srf.DepartmentSubId); ViewBag.LineManager = _userHelper.GetUserProfile(srf.ApproveOneId.Value); ViewBag.ProjectManager = _userHelper.GetUserProfile(srf.ProjectManagerId); ViewBag.SSOW = _ssow.GetById(Vacancy.ServicePackId); if (ContractorInfo.HomeBaseId.HasValue) { ViewBag.HomeBase = _city.GetById(ContractorInfo.HomeBaseId).Name; } else { ViewBag.HomeBase = "-"; } } else { ViewBag.Srf = null; ViewBag.ContractorInfo = null; ViewBag.Departement = null; ViewBag.DepartmentSub = null; ViewBag.LineManager = null; } ViewBag.ModelForm = _mapper.Map <UpdateProfileForm>(user); ViewBag.CurretRoles = roles; return(View(_mapper.Map <ApplicationUserViewModel>(user))); }
public IActionResult Add(Guid id) { try { var srf = Service.GetById(id); var Candidate = _candidate.GetById(srf.CandidateId); var Vacancy = _vacancy.GetById(Candidate.VacancyId); var CurrentSSO = _ssow.GetById(Vacancy.ServicePackId); var Departement = _department.GetById(Vacancy.DepartmentId); ViewBag.Candidate = Candidate; ViewBag.Vacancy = Vacancy; ViewBag.Departement = Departement; ViewBag.SSOW = CurrentSSO; ViewBag.SCategory = _ssowCategory.GetById(CurrentSSO.ServicePackCategoryId); ViewBag.JobsStage = _jobStage.GetById(Vacancy.JobStageId); ViewBag.ListDepartement = _department.GetAll().ToList(); if (Departement.OperateOrNon == 1) { ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Operation").ToList(); } else { ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Non Operation").ToList(); } ViewBag.ListServiceLine = _userHelper.GetByRoleName("Head Of Service Line").ToList(); ViewBag.ListServiceCordinator = _userHelper.GetByRoleName("Service Coordinator").ToList(); ViewBag.ListHeadOperation = _userHelper.GetByRoleName("Head Of Operation").ToList(); ViewBag.ListHeadNonOperation = _userHelper.GetByRoleName("Head Of Non Operation").ToList(); ViewBag.ListHeadSourcing = _userHelper.GetByRoleName("Head Of Sourcing").ToList(); ViewBag.ListAccount = _account.GetAll().ToList(); ViewBag.ListSubDepartment = _departmentSub.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList(); ViewBag.ListCostCenter = _costCenter.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList(); ViewBag.ListNetwork = _network.GetAll().Where(x => x.DepartmentId.Equals(srf.DepartmentId)).ToList(); //ViewBag.ListSSOW = _ssow.GetAll().Where(x => x.Type.Equals(CurrentSSO.Type)).ToList(); ViewBag.PackageType = _packageType.GetAll().ToList(); ViewBag.ServicePackCategory = _ssowCategory.GetAll().ToList(); ViewBag.BasicServiceLevel = new List <int>(new int[] { 0, 20, 30, 40 }).Select(x => new { Id = x, Name = x.ToString() }); Dictionary <string, bool> ws = new Dictionary <string, bool>(); ws.Add("No", false); ws.Add("Yes", true); Dictionary <string, bool> com = new Dictionary <string, bool>(); com.Add("No USIM", false); com.Add("USIM", true); ViewBag.WorkstationService = ws.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); ViewBag.CommunicationService = com.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); var ProfileId = _userHelper.GetLoginUser(User).Id; ViewBag.ProfileId = ProfileId; if (srf != null) { var Model = new EscalationModelForm(); Model.Srf = Mapper.Map <SrfRequestModelForm>(srf); Model.SrfId = id; return(View(Model)); } } catch (Exception e) { return(Content(e.ToString())); } return(NoContent()); }
public override IActionResult Edit(Guid id) { try { var item = Service.GetById(id); var Vacancy = _vacancy.GetById(_candidate.GetById(item.CandidateId).VacancyId); var Departement = _department.GetById(item.DepartmentId); var PackageType = _packageType.GetById(Vacancy.PackageTypeId); ViewBag.PriceType = PackageType.Name; ViewBag.Vacancy = Vacancy; ViewBag.Candidate = _candidate.GetById(item.CandidateId); ViewBag.Departement = _department.GetById(item.DepartmentId); ViewBag.SSOW = _ssow.GetById(item.ServicePackId); ViewBag.SCategory = _ssowCategory.GetById(_ssow.GetById(item.ServicePackId).ServicePackCategoryId); ViewBag.JobsStage = _jobStage.GetById(Vacancy.JobStageId); ViewBag.ListDepartement = _department.GetAll().ToList(); if (Departement.OperateOrNon == 1) { ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Operation").ToList(); } else { ViewBag.HeadOperation = _userHelper.GetByRoleName("Head Of Non Operation").ToList(); } ViewBag.isOperation = Departement.OperateOrNon; ViewBag.ListServiceLine = _userHelper.GetByRoleName("Head Of Service Line").ToList(); ViewBag.ListServiceCordinator = _userHelper.GetByRoleName("Service Coordinator").ToList(); ViewBag.ListAccount = _account.GetAll().ToList(); ViewBag.ListSubDepartment = _departmentSub.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId)).ToList(); ViewBag.ListCostCenter = _costCenter.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId)).ToList(); ViewBag.ListNetwork = _network.GetAll().Where(x => x.DepartmentId.Equals(item.DepartmentId) && x.IsClosed == false).ToList(); ViewBag.Id = id; ViewBag.isOperation = Departement.OperateOrNon; ViewBag.txtOperaion = (Departement.OperateOrNon == 1) ? "Operational" : "Non Operational"; ViewBag.FormDisable = 1; ViewBag.SrfNumber = Service.GenerateNumnber(); ViewBag.NowYear = DateTime.Now.Year.ToString("yy"); // Aditional Dictionary<string, int> ws = new Dictionary<string, int>(); ws.Add("No", 0); ws.Add("Yes", 1); Dictionary<string, bool> com = new Dictionary<string, bool>(); com.Add("No USIM", false); com.Add("USIM", true); Dictionary<string, bool> sign = new Dictionary<string, bool>(); sign.Add("Non-HRMS", false); sign.Add("HRMS", true); Dictionary<string, bool> manager = new Dictionary<string, bool>(); manager.Add("Manager", true); manager.Add("Non Manager", false); ViewBag.PackageType = _packageType.GetAll().ToList(); ViewBag.ServicePackCategory = _ssowCategory.GetAll().ToList(); ViewBag.ServicePack = _ssow.GetAll().Where(x => x.Type == (PackageTypes)Enum.Parse(typeof(PackageTypes), PackageType.Name)).ToList(); ViewBag.BasicServiceLevel = new List<int>(new int[] { 0, 20, 30, 40 }).Select(x => new { Id = x, Name = x.ToString() }); ViewBag.WorkstationService = ws.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); ViewBag.CommunicationService = com.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); ViewBag.Signum = sign.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); ViewBag.IsManager = manager.Select(x => new { Id = x.Value, Name = x.Key.ToString() }).ToList(); ViewBag.Jobstage = _jobStage.GetAll().Where(x => !string.IsNullOrEmpty(x.Description)).ToList(); ViewBag.ListAgency = _userHelper.GetByRoleName("HR Agency").ToList(); ViewBag.ListActivity = _activity.GetAll().ToList(); ViewBag.ListExtended = Service.GetAll().Where(x => x.CandidateId.Equals(item.CandidateId) && x.SrfEnd >= item.SrfBegin).ToList(); ViewBag.ListLineManager = _userHelper.GetByRoleName("Line Manager").ToList(); ViewBag.ListHeadOfSourcing = _userHelper.GetByRoleName("Head Of Sourcing").ToList(); ViewBag.ListSrfStatus = new List<SrfApproveStatus>(new SrfApproveStatus[] { SrfApproveStatus.Waiting, SrfApproveStatus.Approved }).Select(x => new { Id = x, Name = x.ToString() }); ViewBag.ListTypeSRF = new List<SrfType>(new SrfType[] { SrfType.New, SrfType.Extension }).Select(x => new { Id = x, Name = x.ToString() }); ViewBag.LisStatusSrf = new List<SrfStatus>(new SrfStatus[] { SrfStatus.Done,SrfStatus.Terminate,SrfStatus.Blacklist }).Select(x => new { Id = x, Name = x.ToString() }); var Model = Mapper.Map<SrfRequestModelForm>(item); Model.FormVacancy = Mapper.Map<VacancyListFormModel>(Vacancy); if(item.Status == SrfStatus.Waiting) { Model.Status = SrfStatus.Done; } var CandidateInfo = _candidate.GetById(item.CandidateId); if(CandidateInfo!=null) { Model.AgencyId = CandidateInfo.AgencyId.Value; } var Esc = _escalation.GetAll().Where(x => x.SrfId.Equals(id)).FirstOrDefault(); if(Esc==null) { ViewBag.IsEscalation = false; } else { ViewBag.IsEscalation = true; } return View(Model); } catch (Exception e) { return Content(e.ToString()); } }
public override IActionResult Edit(Guid id) { try { var item = Service.GetById(id); var Contractor = _contractor.GetById(item.CandidateId); var Vacancy = _vacancy.GetById(Contractor.VacancyId); var PackageType = _packageType.GetById(Vacancy.PackageTypeId); var Ssow = _servicePack.GetById(item.ServicePackId); var UserProfile = _userProfile.GetById(Contractor.AccountId); if (item == null) { return(NotFound()); } else { var GenderOption = from Gender g in Enum.GetValues(typeof(Gender)) select new { Id = (int)g, Name = g.ToString() }; var MartialOpt = from Martial g in Enum.GetValues(typeof(Martial)) select new { Id = (int)g, Name = g.ToString() }; var PricelistType = from PackageTypes g in Enum.GetValues(typeof(PackageTypes)) select new { Id = (int)g, Name = g.ToString() }; var User = _userManager.FindByIdAsync(UserProfile.ApplicationUserId).Result; // Dropdown List ViewBag.ServiceWorkPackage = _servicePackCategory.GetAll().ToList(); ViewBag.HomeBase = _city.GetAll().ToList(); ViewBag.LineManager = _userHelper.GetByRoleName("Line Manager").ToList(); ViewBag.ProjectManager = _userHelper.GetByRoleName("Project Manager").ToList(); ViewBag.Gender = GenderOption.ToList(); ViewBag.Martial = MartialOpt.ToList(); ViewBag.PricelistType = PricelistType.ToList(); ViewBag.ContractorId = item.CandidateId; ViewBag.UserProfile = UserProfile; // Set Data var PackageTy = (PackageTypes)Enum.Parse(typeof(PackageTypes), PackageType.Name); ContractorModelForm model = new ContractorModelForm(); model.AhID = UserProfile.AhId; model.SrfNumber = item.Number; model.ContrctorName = Contractor.Name; model.PricelistType = PackageTy; model.ServicePackId = item.ServicePackId; model.ServicePackCategoryId = Ssow.ServicePackCategoryId; model.SrfBegin = item.SrfBegin.Value; model.SrfEnd = item.SrfEnd.Value; if (Contractor.HomeBaseId.HasValue) { model.HomeBaseId = Contractor.HomeBaseId.Value; } model.LineManagerId = item.ApproveOneId.Value; model.ProjectManagerId = item.ProjectManagerId; model.HomePhoneNumber = Contractor.HomePhoneNumber; model.MobilePhoneNumber = Contractor.MobilePhoneNumber; model.IdNumber = Contractor.IdNumber; model.Email = User.Email; model.Nationality = Contractor.Nationality; model.DateOfBirth = Contractor.DateOfBirth; model.PlaceOfBirth = Contractor.PlaceOfBirth; model.Address = Contractor.Address; model.Gender = Contractor.Gender; model.Martial = Contractor.Martial.Value; model.ApplicationUserId = User.Id; model.Username = User.UserName; model.Notes = UserProfile.Description; model.SrfId = id; return(View(model)); } } catch (Exception e) { return(Content(e.ToString())); } }