Пример #1
0
        public AgreementIndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = MultiTenantHelpers.GetAgreementNamePluralized();

            HasAgreementManagePermissions = new AgreementManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            DisplayActionButtons          = HasAgreementManagePermissions;

            AgreementGridSpec = new AgreementGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = MultiTenantHelpers.GetAgreementName(),
                ObjectNamePlural    = MultiTenantHelpers.GetAgreementNamePluralized(),
                SaveFiltersInCookie = true
            };

            AgreementGridName    = "AgreementsGrid";
            AgreementGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(c => c.AgreementGridJsonData());

            AgreementIndexViewPageContentViewData = new ViewPageContentViewData(firmaPage, true);

            bool hasAgreementManagementRights = new AgreementManageFeature().HasPermissionByPerson(currentFirmaSession.Person);

            ShowAgreementEditingControls = FirmaWebConfiguration.FeatureAlevinAgreementCreationAndEditing && hasAgreementManagementRights;
            NewAgreementUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(t => t.NewAgreement());

            //AgreementGridSpec.CustomExcelDownloadLinkText = $"Download with {FieldDefinitionEnum.AgreementSubcategory.ToType().GetFieldDefinitionLabelPluralized()}";
            //AgreementGridSpec.CustomExcelDownloadUrl = SitkaRoute<AgreementController>.BuildUrlFromExpression(tc => tc.IndexExcelDownload());
        }
        public AgreementIndexViewData(Person currentPerson, Models.FirmaPage firmaPage, bool atLeastOneAgreementHasFile) : base(currentPerson, firmaPage)
        {
            PageTitle = $"Full Agreement List";

            AgreementGridSpec    = new AgreementGridSpec(currentPerson, atLeastOneAgreementHasFile, true, true);
            AgreementGridName    = "agreementsGridName";
            AgreementGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(tc => tc.AgreementGridJsonData());
        }
        /*
         * public ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; }
         * public string ObligationItemBudgetGridName { get; }
         * public string ObligationItemBudgetGridDataUrl { get; }
         */

        public CostAuthorityDetailViewData(FirmaSession currentFirmaSession,
                                           ProjectFirmaModels.Models.CostAuthority costAuthority) : base(currentFirmaSession)
        {
            CostAuthority = costAuthority;

            PageTitle  = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()}: {costAuthority.CostAuthorityWorkBreakdownStructure}";
            EntityName = $"{FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} Detail";

            UserHasCostAuthorityManagePermissions = new CostAuthorityManageFeature().HasPermissionByPerson(CurrentPerson);
            IsAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);

            IndexUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(ca => ca.CostAuthorityIndex());

            AgreementIndexUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(ac => ac.AgreementIndex());

            FieldDefinitionForAgreement = FieldDefinitionEnum.Agreement.ToType();
            FieldDefinitionForProject   = FieldDefinitionEnum.Project.ToType();
            FieldDefinitionForCostAuthorityWorkBreakdownStructure = FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType();

            BasicProjectInfoProjectGridName = "costAuthorityProjectListGrid";
            BasicProjectInfoGridSpec        = new BasicProjectInfoGridSpec(CurrentFirmaSession, true, CostAuthority)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                SaveFiltersInCookie = true
            };
            BasicProjectInfoProjectGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityProjectsGridJsonData(costAuthority));

            AgreementGridName = "costAuthorityAgreementListGrid";
            AgreementGridSpec = new AgreementGridSpec(CurrentFirmaSession)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabelPluralized()} associated with {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} {costAuthority.CostAuthorityWorkBreakdownStructure}",
                SaveFiltersInCookie = true
            };
            AgreementGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.CostAuthorityAgreementGridJsonData(costAuthority));

            HasPnBudgetViewPermission = new PnBudgetViewFeature().HasPermissionByFirmaSession(currentFirmaSession);

            PnBudgetGridName    = "PnBudgetsGrid";
            PnBudgetGridSpec    = new PnBudgetGridSpec(currentFirmaSession);
            PnBudgetGridDataUrl = SitkaRoute <PnBudgetController> .BuildUrlFromExpression(c => c.PnBudgetsForCostAuthorityGridJsonData(costAuthority.CostAuthorityWorkBreakdownStructure));

            HasObligationViewPermission = new ObligationViewFeature().HasPermissionByFirmaSession(currentFirmaSession);

            ContractualInvoiceGridName    = "contractualInvoiceGrid";
            ContractualInvoiceGridSpec    = new ContractualInvoiceGridSpec(currentFirmaSession);
            ContractualInvoiceGridDataUrl = SitkaRoute <CostAuthorityController> .BuildUrlFromExpression(cac => cac.ContractualInvoiceGridJsonData(costAuthority));

            //ObligationItemBudgetGridName = "obligationItemBudgets";
            //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession);
            //ObligationItemBudgetGridDataUrl = SitkaRoute<CostAuthorityController>.BuildUrlFromExpression(oc => oc.ObligationItemBudgetGridJsonData(costAuthority));
        }