Пример #1
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     yield return(new FieldVisitSubsectionData
     {
         SubsectionName = "Edit Maintenance Record",
         SubsectionUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.EditMaintenanceRecord(fieldVisit))
     });
 }
Пример #2
0
        public static HtmlString GetStatusAsWorkflowUrl(this FieldVisit fieldVisit)
        {
            var fieldVisitStatus = fieldVisit.FieldVisitStatus;

            return(fieldVisitStatus != FieldVisitStatus.InProgress
                ? new HtmlString(fieldVisitStatus.FieldVisitStatusDisplayName)
                : UrlTemplate.MakeHrefString(WorkflowUrlTemplate.ParameterReplace(fieldVisit.FieldVisitID),
                                             fieldVisitStatus.FieldVisitStatusDisplayName));
        }
Пример #3
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     return(new[]
     {
         new FieldVisitSubsectionData
         {
             SubsectionName = "Location",
             SubsectionUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.Location(fieldVisit))
         },
         new FieldVisitSubsectionData
         {
             SubsectionName = "Photos",
             SubsectionUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.Photos(fieldVisit))
         },
         new FieldVisitSubsectionData
         {
             SubsectionName = "Attributes",
             SubsectionUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.Attributes(fieldVisit))
         }
     });
 }
Пример #4
0
 public abstract IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit);
Пример #5
0
 public abstract string GetSectionUrl(FieldVisit fieldVisit);
Пример #6
0
        public static IEnumerable <FieldVisitSubsectionData> GetAssessmentSubsections(FieldVisit fieldVisit, TreatmentBMPAssessmentTypeEnum treatmentBMPAssessmentTypeEnum)
        {
            var treatmentBMP           = fieldVisit.TreatmentBMP;
            var treatmentBMPAssessment = fieldVisit.GetAssessmentByType(treatmentBMPAssessmentTypeEnum);

            var assessmentSubsections = new List <FieldVisitSubsectionData>
            {
                new FieldVisitSubsectionData
                {
                    SubsectionName = "Observations",
                    SubsectionUrl  =
                        SitkaRoute <FieldVisitController> .BuildUrlFromExpression(c =>
                                                                                  c.Observations(fieldVisit, treatmentBMPAssessmentTypeEnum)),
                    SectionCompletionStatusIndicator =
                        treatmentBMP.TreatmentBMPType.TreatmentBMPTypeAssessmentObservationTypes.All(x =>
                                                                                                     treatmentBMPAssessment.IsObservationComplete(x.TreatmentBMPAssessmentObservationType))
                            ? new HtmlString("<span class='glyphicon glyphicon-ok field-validation-success text-left' style='color: #5cb85c; margin-right: 4px'></span>")
                            : new HtmlString("<span class='glyphicon glyphicon-exclamation-sign field-validation-warning text-left' style='margin-right: 4px'></span>")
                },
                new FieldVisitSubsectionData
                {
                    SubsectionName = "Photos",
                    SubsectionUrl  = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(c =>
                                                                                               c.AssessmentPhotos(fieldVisit, treatmentBMPAssessmentTypeEnum)),
                    SectionCompletionStatusIndicator = treatmentBMPAssessment.TreatmentBMPAssessmentPhotos.Any()
                        ? new HtmlString(
                        "<span class='glyphicon glyphicon-ok field-validation-success text-left' style='color: #5cb85c; margin-right: 4px'></span>")
                        : new HtmlString("<span style=\"width: 19px; display: inline-block;\"></span>")
                }
            };

            return(assessmentSubsections);
        }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static MaintenanceRecord CreateNewBlank(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit)
 {
     return(new MaintenanceRecord(treatmentBMP, treatmentBMPType, fieldVisit));
 }
Пример #8
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TreatmentBMPAssessment(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit, TreatmentBMPAssessmentType treatmentBMPAssessmentType, bool isAssessmentComplete) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TreatmentBMPAssessmentID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID           = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP             = treatmentBMP;
     treatmentBMP.TreatmentBMPAssessments.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.TreatmentBMPAssessments.Add(this);
     this.FieldVisitID = fieldVisit.FieldVisitID;
     this.FieldVisit   = fieldVisit;
     fieldVisit.TreatmentBMPAssessments.Add(this);
     this.TreatmentBMPAssessmentTypeID = treatmentBMPAssessmentType.TreatmentBMPAssessmentTypeID;
     this.IsAssessmentComplete         = isAssessmentComplete;
 }
Пример #9
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     return(FieldVisitSectionImpl.GetAssessmentSubsections(fieldVisit, TreatmentBMPAssessmentTypeEnum.Initial));
 }
Пример #10
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.InventoryUpdated);
 }
Пример #11
0
 public static void DeleteFieldVisit(this IQueryable <FieldVisit> fieldVisits, FieldVisit fieldVisitToDelete)
 {
     DeleteFieldVisit(fieldVisits, new List <FieldVisit> {
         fieldVisitToDelete
     });
 }
Пример #12
0
 public static string GetDetailUrl(this FieldVisit fieldVisit)
 {
     return(DetailUrlTemplate.ParameterReplace(fieldVisit.FieldVisitID));
 }
Пример #13
0
 public static string GetEditUrl(this FieldVisit fieldVisit)
 {
     return(WorkflowUrlTemplate.ParameterReplace(fieldVisit.FieldVisitID));
 }
Пример #14
0
 public static TreatmentBMPAssessment GetPostMaintenanceAssessment(this FieldVisit fieldVisit)
 {
     return(fieldVisit.TreatmentBMPAssessments.SingleOrDefault(x => x.TreatmentBMPAssessmentType == TreatmentBMPAssessmentType.PostMaintenance));
 }
Пример #15
0
 public static TreatmentBMPAssessment GetInitialAssessment(this FieldVisit fieldVisit)
 {
     return(fieldVisit.TreatmentBMPAssessments.SingleOrDefault(x => x.TreatmentBMPAssessmentType == TreatmentBMPAssessmentType.Initial));
 }
Пример #16
0
 public abstract bool ExpandMenu(FieldVisit fieldVisit);
Пример #17
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.MaintenanceRecord != null);
 }
Пример #18
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.GetPostMaintenanceAssessment() != null);
 }
Пример #19
0
 public override string GetSectionUrl(FieldVisit fieldVisit)
 {
     return(SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.Assessment(fieldVisit)));
 }
Пример #20
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     return(new List <FieldVisitSubsectionData>());
 }
Пример #21
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.GetInitialAssessment() != null);
 }
Пример #22
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(false);
 }
Пример #23
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static TreatmentBMPAssessment CreateNewBlank(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit, TreatmentBMPAssessmentType treatmentBMPAssessmentType)
 {
     return(new TreatmentBMPAssessment(treatmentBMP, treatmentBMPType, fieldVisit, treatmentBMPAssessmentType, default(bool)));
 }
Пример #24
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public MaintenanceRecord(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.MaintenanceRecordID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID      = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP        = treatmentBMP;
     treatmentBMP.MaintenanceRecords.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.MaintenanceRecords.Add(this);
     this.FieldVisitID = fieldVisit.FieldVisitID;
     this.FieldVisit   = fieldVisit;
 }