예제 #1
0
        public async Task <IActionResult> PostContextAsync([FromBody] Models.Classification model)
        {
            try
            {
                if (await context.Classifications.AsNoTracking().AnyAsync(o => o.Code.Equals(model.Code) && o.Index.Equals(model.Index)))
                {
                    if (context.Classifications.AsNoTracking().Single(o => o.Code.Equals(model.Code) && o.Index.Equals(model.Index)).Title.Equals(model.Title))
                    {
                        return(NoContent());
                    }

                    else
                    {
                        context.Classifications.Find(model.Code, model.Index).Title = model.Title;
                    }
                }
                else
                {
                    context.Classifications.Add(model);
                }

                return(Ok(context.SaveChanges()));
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{GetType()}\n{ex.Message}\n{nameof(this.PostContextAsync)}");
            }
            return(BadRequest());
        }
예제 #2
0
 public void UpdateClassification(Models.Classification classification)
 {
     ExecuteProcedure(
         "UpdateClassification",
         new string[] { "@ClassificationId", "@Type", "@Base" },
         new object[] { classification.Id, classification.Type, classification.Base }
         );
 }
예제 #3
0
 public EditViewModel(Models.Classification classification)
 {
     ClassificationID          = classification.ClassificationID;
     DisplayName               = classification.DisplayName;
     ClassificationDescription = classification.ClassificationDescription;
     GoalStatement             = classification.GoalStatement;
     ThemeColor = classification.ThemeColor;
 }
        private void SelectClassification(int classificationId)
        {
            _classification = Models.Classification
                              .CreateClassification(_sqlClient.FindClassification(classificationId));

            ClassificationTypeComboBox.Text = _classification.Type;
            ConceptsRootTextBox.Text        = GetConceptName(_classification.ConceptRootId);
            ClassificationBaseTextBox.Text  = _classification.Base;
        }
예제 #5
0
        public void UpdateModel(Models.Classification classification, Person currentPerson)
        {
            classification.DisplayName = DisplayName;
            classification.ClassificationDescription = ClassificationDescription;
            classification.GoalStatement             = GoalStatement;

            if (KeyImageFileResourceData != null)
            {
                classification.KeyImageFileResource = FileResource.CreateNewFromHttpPostedFileAndSave(KeyImageFileResourceData, currentPerson);
            }
            classification.ThemeColor = ThemeColor;
        }
예제 #6
0
        public DetailViewData(Person currentPerson, Models.Classification classification)
            : base(currentPerson)
        {
            Classification        = classification;
            PageTitle             = classification.ClassificationSystem.ClassificationSystemNamePluralized;
            EditClassificationUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(c => c.Edit(classification));

            IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.ClassificationSystem(classification.ClassificationSystem));

            UserHasClassificationManagePermissions = new PerformanceMeasureManageFeature().HasPermissionByPerson(currentPerson);
            ClassificationDisplayNamePluralized    = classification.ClassificationSystem.ClassificationSystemNamePluralized;
            ClassificationDisplayName = classification.ClassificationSystem.ClassificationSystemName;

            BasicProjectInfoGridName = "geospatialAreaProjectListGrid";
            BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, false)
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} associated with the {ClassificationDisplayName} {classification.DisplayName}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} associated with the {ClassificationDisplayName} {classification.DisplayName}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(classification));
        }
 public void Update(UpdateClassificationInput input)
 {
     Models.Classification output = Mapper.Map <UpdateClassificationInput, Models.Classification>(input);
     _ClassificationManager.Update(output);
 }
 public async Task Create(CreateClassificationInput input)
 {
     Models.Classification output = Mapper.Map <CreateClassificationInput, Models.Classification>(input);
     await _ClassificationManager.Create(output);
 }