Exemplo n.º 1
0
        public DateTime?LastMaintainedDateTime()
        {
            if (!MaintenanceRecords.Any())
            {
                return(null);
            }

            return(MaintenanceRecords.Max(x => x.GetMaintenanceRecordDate()));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (CustomAttributes.Any())
            {
                dependentObjects.Add(typeof(CustomAttribute).Name);
            }

            if (MaintenanceRecords.Any())
            {
                dependentObjects.Add(typeof(MaintenanceRecord).Name);
            }

            if (MaintenanceRecordObservations.Any())
            {
                dependentObjects.Add(typeof(MaintenanceRecordObservation).Name);
            }

            if (QuickBMPs.Any())
            {
                dependentObjects.Add(typeof(QuickBMP).Name);
            }

            if (TreatmentBMPs.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMP).Name);
            }

            if (TreatmentBMPAssessments.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPAssessment).Name);
            }

            if (TreatmentBMPBenchmarkAndThresholds.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPBenchmarkAndThreshold).Name);
            }

            if (TreatmentBMPObservations.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPObservation).Name);
            }

            if (TreatmentBMPTypeAssessmentObservationTypes.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPTypeAssessmentObservationType).Name);
            }

            if (TreatmentBMPTypeCustomAttributeTypes.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPTypeCustomAttributeType).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
        public ActionResult MaintenancePaidStore(int ID, string stat)
        {
            MaintenanceRecords mr = new MaintenanceRecords();

            mr.UnitID      = ID;
            mr.PaymentDate = DateTime.Now;
            mr.Status      = stat;
            mr.Month       = DateTime.Now.ToString("MMMM");
            mr.Insert();
            return(View());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Dependent type names of this entity
        /// </summary>
        public void DeleteChildren(DatabaseEntities dbContext)
        {
            foreach (var x in MaintenanceRecords.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPAssessments.ToList())
            {
                x.DeleteFull(dbContext);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Dependent type names of this entity
        /// </summary>
        public void DeleteChildren(DatabaseEntities dbContext)
        {
            foreach (var x in CustomAttributes.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in MaintenanceRecords.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in MaintenanceRecordObservations.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in QuickBMPs.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPs.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPAssessments.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPBenchmarkAndThresholds.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPObservations.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPTypeAssessmentObservationTypes.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPTypeCustomAttributeTypes.ToList())
            {
                x.DeleteFull(dbContext);
            }
        }
Exemplo n.º 6
0
        private void ExecuteDeleteMaintenance(object parameter)
        {
            IMessageBoxService msg = new MessageBoxService();

            if (parameter != null)
            {
                if (msg.ShowMessage("Are you sure you want to delete this maintenance record?", "Deleting Maintenance Record", GenericMessageBoxButton.YesNo, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.Yes))
                {
                    MaintenanceRecords.Remove((MaintenanceRecordModel)parameter);
                    DeleteItem(((MaintenanceRecordModel)parameter).ID, "MaintenanceRecords");
                }
            }
            msg = null;
        }
Exemplo n.º 7
0
        private void ExecuteAddMaintenance(object parameter)
        {
            MaintenanceRecordModel mm = new MaintenanceRecordModel()
            {
                AssetID         = Asset.ID,
                Name            = string.Empty,
                MaintenanceDate = DateTime.Now,
                MaintainedBy    = string.Empty,
                Completed       = true
            };

            mm.ID = AddMaintenanceRecord(mm);
            MaintenanceRecords.Add(mm);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(CustomAttributes.Any() || MaintenanceRecords.Any() || MaintenanceRecordObservations.Any() || QuickBMPs.Any() || TreatmentBMPs.Any() || TreatmentBMPAssessments.Any() || TreatmentBMPBenchmarkAndThresholds.Any() || TreatmentBMPObservations.Any() || TreatmentBMPTypeAssessmentObservationTypes.Any() || TreatmentBMPTypeCustomAttributeTypes.Any());
 }
Exemplo n.º 9
0
        /// <summary>
        /// Dependent type names of this entity
        /// </summary>
        public void DeleteChildren(DatabaseEntities dbContext)
        {
            foreach (var x in CustomAttributes.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in Delineations.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in FieldVisits.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in FundingEvents.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in MaintenanceRecords.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in RegionalSubbasinRevisionRequests.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPsWhereYouAreTheUpstreamBMP.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPAssessments.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPBenchmarkAndThresholds.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPDocuments.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPImages.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPModelingAttributes.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in TreatmentBMPModelingAttributesWhereYouAreTheUpstreamTreatmentBMP.ToList())
            {
                x.DeleteFull(dbContext);
            }

            foreach (var x in WaterQualityManagementPlanVerifyTreatmentBMPs.ToList())
            {
                x.DeleteFull(dbContext);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (CustomAttributes.Any())
            {
                dependentObjects.Add(typeof(CustomAttribute).Name);
            }

            if ((Delineation != null))
            {
                dependentObjects.Add(typeof(Delineation).Name);
            }

            if (FieldVisits.Any())
            {
                dependentObjects.Add(typeof(FieldVisit).Name);
            }

            if (FundingEvents.Any())
            {
                dependentObjects.Add(typeof(FundingEvent).Name);
            }

            if (MaintenanceRecords.Any())
            {
                dependentObjects.Add(typeof(MaintenanceRecord).Name);
            }

            if (RegionalSubbasinRevisionRequests.Any())
            {
                dependentObjects.Add(typeof(RegionalSubbasinRevisionRequest).Name);
            }

            if (TreatmentBMPsWhereYouAreTheUpstreamBMP.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMP).Name);
            }

            if (TreatmentBMPAssessments.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPAssessment).Name);
            }

            if (TreatmentBMPBenchmarkAndThresholds.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPBenchmarkAndThreshold).Name);
            }

            if (TreatmentBMPDocuments.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPDocument).Name);
            }

            if (TreatmentBMPImages.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPImage).Name);
            }

            if ((TreatmentBMPModelingAttribute != null))
            {
                dependentObjects.Add(typeof(TreatmentBMPModelingAttribute).Name);
            }

            if (TreatmentBMPModelingAttributesWhereYouAreTheUpstreamTreatmentBMP.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMPModelingAttribute).Name);
            }

            if (WaterQualityManagementPlanVerifyTreatmentBMPs.Any())
            {
                dependentObjects.Add(typeof(WaterQualityManagementPlanVerifyTreatmentBMP).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
Exemplo n.º 11
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(CustomAttributes.Any() || (Delineation != null) || FieldVisits.Any() || FundingEvents.Any() || MaintenanceRecords.Any() || RegionalSubbasinRevisionRequests.Any() || TreatmentBMPsWhereYouAreTheUpstreamBMP.Any() || TreatmentBMPAssessments.Any() || TreatmentBMPBenchmarkAndThresholds.Any() || TreatmentBMPDocuments.Any() || TreatmentBMPImages.Any() || (TreatmentBMPModelingAttribute != null) || TreatmentBMPModelingAttributesWhereYouAreTheUpstreamTreatmentBMP.Any() || WaterQualityManagementPlanVerifyTreatmentBMPs.Any());
 }