Beispiel #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))
     });
 }
Beispiel #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));
        }
Beispiel #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))
         }
     });
 }
Beispiel #4
0
 public abstract IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit);
Beispiel #5
0
 public abstract string GetSectionUrl(FieldVisit fieldVisit);
Beispiel #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));
 }
Beispiel #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;
 }
Beispiel #9
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     return(FieldVisitSectionImpl.GetAssessmentSubsections(fieldVisit, TreatmentBMPAssessmentTypeEnum.Initial));
 }
Beispiel #10
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.InventoryUpdated);
 }
Beispiel #11
0
 public static void DeleteFieldVisit(this IQueryable <FieldVisit> fieldVisits, FieldVisit fieldVisitToDelete)
 {
     DeleteFieldVisit(fieldVisits, new List <FieldVisit> {
         fieldVisitToDelete
     });
 }
Beispiel #12
0
 public static string GetDetailUrl(this FieldVisit fieldVisit)
 {
     return(DetailUrlTemplate.ParameterReplace(fieldVisit.FieldVisitID));
 }
Beispiel #13
0
 public static string GetEditUrl(this FieldVisit fieldVisit)
 {
     return(WorkflowUrlTemplate.ParameterReplace(fieldVisit.FieldVisitID));
 }
Beispiel #14
0
 public static TreatmentBMPAssessment GetPostMaintenanceAssessment(this FieldVisit fieldVisit)
 {
     return(fieldVisit.TreatmentBMPAssessments.SingleOrDefault(x => x.TreatmentBMPAssessmentType == TreatmentBMPAssessmentType.PostMaintenance));
 }
Beispiel #15
0
 public static TreatmentBMPAssessment GetInitialAssessment(this FieldVisit fieldVisit)
 {
     return(fieldVisit.TreatmentBMPAssessments.SingleOrDefault(x => x.TreatmentBMPAssessmentType == TreatmentBMPAssessmentType.Initial));
 }
Beispiel #16
0
 public abstract bool ExpandMenu(FieldVisit fieldVisit);
Beispiel #17
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.MaintenanceRecord != null);
 }
Beispiel #18
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.GetPostMaintenanceAssessment() != null);
 }
Beispiel #19
0
 public override string GetSectionUrl(FieldVisit fieldVisit)
 {
     return(SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.Assessment(fieldVisit)));
 }
Beispiel #20
0
 public override IEnumerable <FieldVisitSubsectionData> GetSubsections(FieldVisit fieldVisit)
 {
     return(new List <FieldVisitSubsectionData>());
 }
Beispiel #21
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(fieldVisit.GetInitialAssessment() != null);
 }
Beispiel #22
0
 public override bool ExpandMenu(FieldVisit fieldVisit)
 {
     return(false);
 }
Beispiel #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)));
 }
 /// <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;
 }