Exemple #1
0
 public EditViewModel(Models.CustomAttributeType customAttributeType)
 {
     CustomAttributeTypeID            = customAttributeType.CustomAttributeTypeID;
     CustomAttributeTypeName          = customAttributeType.CustomAttributeTypeName;
     CustomAttributeDataTypeID        = customAttributeType.CustomAttributeDataTypeID;
     MeasurementUnitTypeID            = customAttributeType.MeasurementUnitTypeID;
     CustomAttributeTypeOptionsSchema = customAttributeType.CustomAttributeTypeOptionsSchema;
     IsRequired = customAttributeType.IsRequired;
     CustomAttributeTypePurposeID  = customAttributeType.CustomAttributeTypePurposeID;
     CustomAttributeTypeDesription = customAttributeType.CustomAttributeTypeDescription;
 }
Exemple #2
0
        public void UpdateModel(Models.CustomAttributeType customAttributeType, Person currentPerson)
        {
            customAttributeType.CustomAttributeTypeName   = CustomAttributeTypeName;
            customAttributeType.CustomAttributeDataTypeID = CustomAttributeDataTypeID.Value;
            customAttributeType.MeasurementUnitTypeID     = MeasurementUnitTypeID;
            customAttributeType.IsRequired = IsRequired.GetValueOrDefault();
            customAttributeType.CustomAttributeTypePurposeID   = CustomAttributeTypePurposeID.GetValueOrDefault();
            customAttributeType.CustomAttributeTypeDescription = CustomAttributeTypeDesription;

            var customAttributeDataType = CustomAttributeDataType.AllLookupDictionary[CustomAttributeDataTypeID.Value];

            if (customAttributeDataType.HasOptions())
            {
                customAttributeType.CustomAttributeTypeOptionsSchema = CustomAttributeTypeOptionsSchema;
            }
            else
            {
                customAttributeType.CustomAttributeTypeOptionsSchema = null;
            }
        }
Exemple #3
0
        public EditViewData(Person currentPerson, List <MeasurementUnitType> measurementUnitTypes,
                            List <CustomAttributeDataType> customAttributeDataTypes, string submitUrl,
                            Models.NeptunePage instructionsNeptunePage, Models.NeptunePage customAttributeInstructionsNeptunePage,
                            Models.CustomAttributeType customAttributeType) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            EntityName = "Attribute Type";
            EntityUrl  = SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(x => x.Manage());

            PageTitle =
                $"{(customAttributeType != null ? "Edit" : "New")} Attribute Type";

            if (customAttributeType != null)
            {
                SubEntityName = customAttributeType.CustomAttributeTypeName;
                SubEntityUrl  = customAttributeType.GetDetailUrl();
            }

            YesNos = BooleanFormats.GetYesNoSelectList();
            CustomAttributeDataTypes = customAttributeDataTypes.ToSelectListWithDisabledEmptyFirstRow(
                x => x.CustomAttributeDataTypeID.ToString(), x => x.CustomAttributeDataTypeDisplayName);
            MeasurementUnitTypes = measurementUnitTypes.OrderBy(x => x.MeasurementUnitTypeDisplayName).ToSelectListWithEmptyFirstRow(
                x => x.MeasurementUnitTypeID.ToString(), x => x.MeasurementUnitTypeDisplayName, ViewUtilities.NoneString);
            CustomAttributeTypePurposes =
                CustomAttributeTypePurpose.All.ToSelectListWithDisabledEmptyFirstRow(
                    x => x.CustomAttributeTypePurposeID.ToString(CultureInfo.InvariantCulture),
                    x => x.CustomAttributeTypePurposeDisplayName);

            CustomAttributeTypeIndexUrl =
                SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(x => x.Manage());

            SubmitUrl = submitUrl;

            ViewInstructionsNeptunePage = new ViewPageContentViewData(instructionsNeptunePage, currentPerson);
            ViewCustomAttributeInstructionsNeptunePage =
                new ViewPageContentViewData(customAttributeInstructionsNeptunePage, currentPerson);

            ViewDataForAngular = new ViewDataForAngular(customAttributeDataTypes);
        }
Exemple #4
0
        public DetailViewData(Person currentPerson,
                              Models.CustomAttributeType customAttributeType) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            CustomAttributeType = customAttributeType;
            EntityName          = FieldDefinitionType.CustomAttributeType.GetFieldDefinitionLabelPluralized();
            PageTitle           = customAttributeType.CustomAttributeTypeName;

            UserHasCustomAttributeTypeManagePermissions = new NeptuneAdminFeature().HasPermissionByPerson(currentPerson);

            if (UserHasCustomAttributeTypeManagePermissions)
            {
                EntityUrl = SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(c => c.Manage());
            }

            TreatmentBMPTypeGridSpec = new TreatmentBMPTypeGridSpec(currentPerson)
            {
                ObjectNameSingular  = $"{FieldDefinitionType.TreatmentBMPType.GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionType.TreatmentBMPType.GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            TreatmentBMPTypeGridName    = "treatmentBMPTypeGridForAttribute";
            TreatmentBMPTypeGridDataUrl = SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(tc => tc.TreatmentBMPTypeGridJsonData(customAttributeType));
        }