コード例 #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);
        }
コード例 #7
0
 /// <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;
 }