Esempio n. 1
0
        public ViewResult Detail(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var viewData      = new DetailViewData(CurrentPerson, fundingSource);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Esempio n. 2
0
        public PartialViewResult Edit(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var viewModel     = new EditViewModel(fundingSource);

            return(ViewEdit(viewModel));
        }
Esempio n. 3
0
        public PartialViewResult DeleteFundingSource(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var viewModel     = new ConfirmDialogFormViewModel(fundingSource.FundingSourceID);

            return(ViewDeleteFundingSource(fundingSource, viewModel));
        }
        public PartialViewResult EditFundingSourceCustomAttributesForFundingSource(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var viewModel     = new EditFundingSourceCustomAttributesViewModel(fundingSource);

            return(ViewEditFundingSourceCustomAttributes(fundingSource, viewModel));
        }
Esempio n. 5
0
        public ActionResult Edit(FundingSourcePrimaryKey fundingSourcePrimaryKey, EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }
            var fundingSource = fundingSourcePrimaryKey.EntityObject;

            viewModel.UpdateModel(fundingSource, CurrentPerson);
            return(new ModalDialogFormJsonResult());
        }
Esempio n. 6
0
        public ActionResult DeleteFundingSource(FundingSourcePrimaryKey fundingSourcePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteFundingSource(fundingSource, viewModel));
            }
            fundingSource.DeleteFull(HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult EditFundingSourceCustomAttributesForFundingSource(FundingSourcePrimaryKey fundingSourcePrimaryKey, EditFundingSourceCustomAttributesViewModel viewModel)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditFundingSourceCustomAttributes(fundingSource, viewModel));
            }

            return(UpdateFundingSourceCustomAttributes(viewModel, fundingSource));
        }
        public ActionResult DeleteFundingSource(FundingSourcePrimaryKey fundingSourcePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var name          = fundingSource.GetDisplayName();

            if (!ModelState.IsValid)
            {
                return(ViewDeleteFundingSource(fundingSource, viewModel));
            }

            fundingSource.DeleteFull(HttpRequestStorage.DatabaseEntities);

            SetMessageForDisplay($"{FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabel()} {name} successfully deleted.");
            return(new ModalDialogFormJsonResult());
        }
        public ViewResult Detail(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource  = fundingSourcePrimaryKey.EntityObject;
            var taxonomyTrunks = HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.ToList().SortByOrderThenName().ToList();

            const string chartTitle       = "Reported Expenditures";
            var          chartContainerID = chartTitle.Replace(" ", "");

            // If ProjectFundingSourceExpenditures is empty, ToGoogleChart returns null...
            var googleChart = fundingSource.ProjectFundingSourceExpenditures
                              .ToGoogleChart(x => x.Project.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName(),
                                             taxonomyTrunks.Select(x => x.GetDisplayName()).ToList(),
                                             x => x.Project.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName(),
                                             chartContainerID,
                                             fundingSource.GetDisplayName(),
                                             null);

            googleChart?.GoogleChartConfiguration.Legend.SetLegendPosition(GoogleChartLegendPosition.None);

            var projectFundingSourceBudgetGridSpec = new ProjectFundingSourceBudgetGridSpec()
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 350, false);

            var fundingSourceCustomAttributeTypes   = HttpRequestStorage.DatabaseEntities.FundingSourceCustomAttributeTypes.ToList().Where(x => x.HasViewPermission(CurrentFirmaSession));
            var projectCustomAttributeTypesViewData = new DisplayFundingSourceCustomAttributesViewData(
                fundingSourceCustomAttributeTypes.ToList(),
                new List <FundingSourceCustomAttribute>(fundingSource.FundingSourceCustomAttributes.ToList()));

            var viewData = new DetailViewData(CurrentFirmaSession, fundingSource, viewGoogleChartViewData, projectFundingSourceBudgetGridSpec, projectCustomAttributeTypesViewData);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
        public GridJsonNetJObjectResult <ProjectFundingSourceBudget> ProjectFundingSourceBudgetGridJsonData(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var projectFundingSourceBudgets = new List <ProjectFundingSourceBudget>();

            fundingSource.ProjectFundingSourceBudgets.GroupBy(x => x.ProjectID).ForEach(grouping =>
            {
                ProjectFundingSourceBudget aggregateProjectFundingSourceBudget = null;
                grouping.ForEach(x =>
                {
                    if (aggregateProjectFundingSourceBudget == null)
                    {
                        aggregateProjectFundingSourceBudget = x;
                    }
                    else
                    {
                        aggregateProjectFundingSourceBudget.SecuredAmount  += x.SecuredAmount;
                        aggregateProjectFundingSourceBudget.TargetedAmount += x.TargetedAmount;
                    }
                });
                projectFundingSourceBudgets.Add(aggregateProjectFundingSourceBudget);
            });
            var gridSpec = new ProjectFundingSourceBudgetGridSpec();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ProjectFundingSourceBudget>(projectFundingSourceBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public GridJsonNetJObjectResult <ProjectCalendarYearExpenditure> ProjectCalendarYearExpendituresGridJsonData(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var fundingSource = fundingSourcePrimaryKey.EntityObject;
            var projectFundingSourceExpenditures = fundingSource.ProjectFundingSourceExpenditures.ToList();
            var calendarYearRangeForExpenditures =
                projectFundingSourceExpenditures.CalculateCalendarYearRangeForExpenditures(fundingSource);
            var gridSpec = new ProjectCalendarYearExpendituresGridSpec(calendarYearRangeForExpenditures);
            var projectFundingSources = ProjectCalendarYearExpenditure.CreateFromProjectsAndCalendarYears(projectFundingSourceExpenditures,
                                                                                                          calendarYearRangeForExpenditures);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ProjectCalendarYearExpenditure>(projectFundingSources, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Esempio n. 12
0
        public GridJsonNetJObjectResult <WbsElementObligationItemBudget> ContractualInvoiceGridOnFundDetailJsonData(FundingSourcePrimaryKey fundingSourcePrimaryKey)
        {
            var gridSpec                 = new ContractualInvoiceGridSpec(CurrentFirmaSession);
            var fundingSource            = fundingSourcePrimaryKey.EntityObject;
            var obligationItemBudgets    = fundingSource.WbsElementObligationItemBudgets.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <WbsElementObligationItemBudget>(obligationItemBudgets, gridSpec);

            return(gridJsonNetJObjectResult);
        }