Esempio n. 1
0
        public static bool IsPassingAllValidationRules(this ProjectUpdateBatch projectUpdateBatch)
        {
            bool areAllProjectGeospatialAreasValid = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.ToList().All(geospatialAreaType => projectUpdateBatch.IsProjectGeospatialAreaValid(geospatialAreaType));

            return(projectUpdateBatch.AreProjectBasicsValid() &&
                   projectUpdateBatch.AreContactsValid() &&
                   projectUpdateBatch.AreExpendituresValid() &&
                   projectUpdateBatch.AreReportedPerformanceMeasuresValid() &&
                   projectUpdateBatch.IsProjectLocationSimpleValid() &&
                   projectUpdateBatch.AreProjectCustomAttributesValid(HttpRequestStorage.FirmaSession) &&
                   areAllProjectGeospatialAreasValid);
        }
        public static bool IsPassingAllValidationRules(this ProjectUpdateBatch projectUpdateBatch)
        {
            bool areAllProjectGeospatialAreasValid = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.ToList().All(geospatialAreaType => projectUpdateBatch.IsProjectGeospatialAreaValid(geospatialAreaType));

            // 4/17/20 TK - We removed the ability to edit expenditures. No longer need to check for valid on them.
            // 5/28/2020 - SLG leaving in expenditures line for now to aid merges. We'll see if it helps.
            return(projectUpdateBatch.AreProjectBasicsValid() &&
                   projectUpdateBatch.AreContactsValid() &&
                   //projectUpdateBatch.AreExpendituresValid() &&
                   projectUpdateBatch.AreReportedPerformanceMeasuresValid() &&
                   projectUpdateBatch.IsProjectLocationSimpleValid() &&
                   projectUpdateBatch.AreProjectCustomAttributesValid(HttpRequestStorage.FirmaSession) &&
                   areAllProjectGeospatialAreasValid);
        }
        public static bool IsComplete(this ProjectUpdateSection projectUpdateSection, ProjectUpdateBatch projectUpdateBatch)
        {
            if (projectUpdateBatch == null)
            {
                return(false);
            }

            var currentFirmaSession = HttpRequestStorage.FirmaSession;

            switch (projectUpdateSection.ToEnum)
            {
            case ProjectUpdateSectionEnum.Basics:
                return(projectUpdateBatch.AreProjectBasicsValid());

            case ProjectUpdateSectionEnum.CustomAttributes:
                return(projectUpdateBatch.AreProjectCustomAttributesValid(currentFirmaSession));

            case ProjectUpdateSectionEnum.LocationSimple:
                return(projectUpdateBatch.IsProjectLocationSimpleValid());

            case ProjectUpdateSectionEnum.Organizations:
                return(projectUpdateBatch.AreOrganizationsValid());

            case ProjectUpdateSectionEnum.Contacts:
                return(projectUpdateBatch.AreContactsValid());

            case ProjectUpdateSectionEnum.LocationDetailed:
                return(true);

            case ProjectUpdateSectionEnum.ReportedAccomplishments:
                return(projectUpdateBatch.AreReportedPerformanceMeasuresValid());

            case ProjectUpdateSectionEnum.Budget:
                return(true);

            //case ProjectUpdateSectionEnum.Expenditures:
            //    return projectUpdateBatch.AreExpendituresValid();
            case ProjectUpdateSectionEnum.Photos:
                return(true);

            case ProjectUpdateSectionEnum.ExternalLinks:
                return(true);

            case ProjectUpdateSectionEnum.AttachmentsAndNotes:
                return(true);

            case ProjectUpdateSectionEnum.ExpectedAccomplishments:
                return(true);

            case ProjectUpdateSectionEnum.TechnicalAssistanceRequests:
                return(true);

            case ProjectUpdateSectionEnum.BulkSetSpatialInformation:
                return(true);

            case ProjectUpdateSectionEnum.PartnerFinder:
                return(true);

            case ProjectUpdateSectionEnum.Classifications:
                return(projectUpdateBatch.ValidateClassifications().IsValid);

            default:
                throw new ArgumentOutOfRangeException($"IsComplete(): Unhandled Project Update Section Enum: {projectUpdateSection.ToEnum}");
            }
        }
 public override bool IsComplete(ProjectUpdateBatch projectUpdateBatch)
 {
     return(projectUpdateBatch.AreContactsValid());
 }