public override IActionResult Details(Guid id) { var networkNumber = Service.GetById(id); ViewBag.Departements = departement.GetById(networkNumber.DepartmentId); ViewBag.Project = projects.GetById(networkNumber.ProjectId); ViewBag.LineManagers = _userHelper.GetUserProfile(networkNumber.LineManagerId); ViewBag.ProjectManagers = _userHelper.GetUserProfile(networkNumber.ProjectManagerId); ViewBag.AccountNames = accountName.GetById(networkNumber.AccountNameId); return(base.Details(id)); }
public string PieChartAccountNameBySrf(int Id, ClaimsPrincipal User) { Expression <Func <SrfRequest, object> >[] Includes = new Expression <Func <SrfRequest, object> > [6]; Includes[0] = pack => pack.Candidate; Includes[1] = pack => pack.Candidate.Agency; Includes[2] = pack => pack.Candidate.Vacancy; Includes[3] = pack => pack.Candidate.Vacancy.JobStage; Includes[4] = pack => pack.Candidate.Vacancy.PackageType; Includes[5] = pack => pack.Candidate.Account; var FirstDateYear = new DateTime(DateTime.Now.Year, 1, 1); var AccountId = _repository .GetAll(Includes) .Where(x => x.IsActive == true && x.IsLocked == false && x.Candidate.IsUser == true && x.SrfEnd.HasValue && x.SrfEnd.Value <= DateTime.Now && x.Candidate.Account.IsBlacklist == false && x.Candidate.Account.IsTerminate == false) .Select(x => x.AccountId) .ToList(); var Result = _account.GetAll().Where(x => AccountId.Contains(x.Id)).ToList(); var random = new Random(); object[] PieChart = new object[Result.Count()]; if (Result != null) { int i = 0; foreach (var row in Result) { var color = String.Format("#{0:X6}", random.Next(0x1000000)); var Account = _account.GetById(row.Id); var CountAccount = CountPieChartAppover(row.Id, Id, User); PieChart[i] = new Dictionary <string, object> { { "provider", Account.Name }, { "allocation", CountAccount }, { "color", color.ToString() } }; i++; } } else { var color = String.Format("#{0:X6}", random.Next(0x1000000)); PieChart[0] = new Dictionary <string, object> { { "provider", "No Account Name" }, { "allocation", 0 }, { "color", color.ToString() } }; } return(JsonConvert.SerializeObject(PieChart)); }