コード例 #1
0
        public ViewResult Edit(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;
            var viewModel        = new EditViewModel(treatmentBMPType);

            return(ViewEdit(viewModel, treatmentBMPType));
        }
コード例 #2
0
        public PartialViewResult EditObservationTypesSortOrder(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey)
        {
            var treatmentBMPType             = treatmentBMPTypePrimaryKey.EntityObject;
            EditSortOrderViewModel viewModel = new EditSortOrderViewModel();

            return(ViewEditObservationTypesSortOrder(treatmentBMPType, viewModel));
        }
コード例 #3
0
        public PartialViewResult DeleteTreatmentBMPType(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;
            var viewModel        = new ConfirmDialogFormViewModel(treatmentBMPType.TreatmentBMPTypeID);

            return(ViewDeleteTreatmentBMPType(treatmentBMPType, viewModel));
        }
コード例 #4
0
        public ViewResult Detail(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;
            var viewData         = new DetailViewData(CurrentPerson, treatmentBMPType);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
コード例 #5
0
        public PartialViewResult EditAttributeTypesSortOrder(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey,
                                                             int attributeTypePurposeID)
        {
            var treatmentBMPType             = treatmentBMPTypePrimaryKey.EntityObject;
            EditSortOrderViewModel viewModel = new EditSortOrderViewModel();

            return(ViewEditAttributeTypesSortOrder(treatmentBMPType, viewModel, attributeTypePurposeID));
        }
コード例 #6
0
        public ActionResult EditAttributeTypesSortOrder(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey, int attributeTypePurposeID, EditSortOrderViewModel viewModel)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditAttributeTypesSortOrder(treatmentBMPType, viewModel, attributeTypePurposeID));
            }

            viewModel.UpdateModel(new List <IHaveASortOrder>(treatmentBMPType.TreatmentBMPTypeCustomAttributeTypes));
            SetMessageForDisplay("Successfully Updated Attribute Type Sort Order");
            return(new ModalDialogFormJsonResult());
        }
コード例 #7
0
        public ActionResult EditObservationTypesSortOrder(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey, EditSortOrderViewModel viewModel)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditObservationTypesSortOrder(treatmentBMPType, viewModel));
            }

            viewModel.UpdateModel(new List <IHaveASortOrder>(treatmentBMPType.TreatmentBMPTypeAssessmentObservationTypes));
            SetMessageForDisplay("Successfully Updated Observation Type Sort Order");
            return(new ModalDialogFormJsonResult());
        }
コード例 #8
0
        public ActionResult DeleteTreatmentBMPType(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteTreatmentBMPType(treatmentBMPType, viewModel));
            }

            var message = $"{FieldDefinitionType.TreatmentBMPType.GetFieldDefinitionLabel()} '{treatmentBMPType.TreatmentBMPTypeName}' successfully deleted!";

            treatmentBMPType.DeleteFull(HttpRequestStorage.DatabaseEntities);
            SetMessageForDisplay(message);
            return(new ModalDialogFormJsonResult());
        }
コード例 #9
0
        public ActionResult Edit(TreatmentBMPTypePrimaryKey treatmentBMPTypePrimaryKey, EditViewModel viewModel)
        {
            var treatmentBMPType = treatmentBMPTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, treatmentBMPType));
            }

            HttpRequestStorage.DatabaseEntities.TreatmentBMPTypeAssessmentObservationTypes.Load();
            var treatmentBMPTypeAssessmentObservationTypes    = treatmentBMPType.TreatmentBMPTypeAssessmentObservationTypes.ToList();
            var allTreatmentBMPTypeAssessmentObservationTypes = HttpRequestStorage.DatabaseEntities.TreatmentBMPTypeAssessmentObservationTypes.Local;

            HttpRequestStorage.DatabaseEntities.TreatmentBMPTypeCustomAttributeTypes.Load();
            var treatmentBMPTypeAttributeTypes          = treatmentBMPType.TreatmentBMPTypeCustomAttributeTypes.ToList();
            var allTreatmentBMPTypeCustomAttributeTypes = HttpRequestStorage.DatabaseEntities.TreatmentBMPTypeCustomAttributeTypes.Local;

            viewModel.UpdateModel(treatmentBMPType, treatmentBMPTypeAssessmentObservationTypes, allTreatmentBMPTypeAssessmentObservationTypes, treatmentBMPTypeAttributeTypes, allTreatmentBMPTypeCustomAttributeTypes);

            return(RedirectToAction(new SitkaRoute <TreatmentBMPTypeController>(c => c.Detail(treatmentBMPType.PrimaryKey))));
        }
コード例 #10
0
        public GridJsonNetJObjectResult <vTreatmentBMPDetailedWithTreatmentBMPEntity> TreatmentBMPsInTreatmentBMPTypeGridJsonData(TreatmentBMPTypePrimaryKey treatmentBmpTypePrimaryKey)
        {
            var treatmentBmpType = treatmentBmpTypePrimaryKey.EntityObject;
            var stormwaterJurisdictionIDsPersonCanView = CurrentPerson.GetStormwaterJurisdictionIDsPersonCanView();
            var showDelete    = new JurisdictionManageFeature().HasPermissionByPerson(CurrentPerson);
            var showEdit      = new JurisdictionEditFeature().HasPermissionByPerson(CurrentPerson);
            var gridSpec      = new TreatmentBMPsInTreatmentBMPTypeGridSpec(CurrentPerson, showDelete, showEdit, treatmentBmpType);
            var treatmentBMPs =
                HttpRequestStorage.DatabaseEntities.TreatmentBMPs
                .Include(x => x.WaterQualityManagementPlan)
                .Include(x => x.CustomAttributes)
                .Include(x => x.CustomAttributes.Select(y => y.CustomAttributeValues))
                .Where(x => stormwaterJurisdictionIDsPersonCanView.Contains(x.StormwaterJurisdictionID) && x.TreatmentBMPTypeID == treatmentBmpType.TreatmentBMPTypeID)
                .ToList()
                .Join(HttpRequestStorage.DatabaseEntities.vTreatmentBMPDetaileds,
                      x => x.TreatmentBMPID,
                      y => y.TreatmentBMPID,
                      (x, y) => new vTreatmentBMPDetailedWithTreatmentBMPEntity(x, y))
                .ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <vTreatmentBMPDetailedWithTreatmentBMPEntity>(treatmentBMPs, gridSpec);

            return(gridJsonNetJObjectResult);
        }