Ejemplo n.º 1
0
 /// <summary>
 /// Create an instance of the SubmissionService.
 /// </summary>
 /// <param name="db">The database context containing the needed AbstractForms.</param>
 public SubmissionService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 2
0
 public TestSecurityService(CatfishDbContext db) : base(db)
 {
     Users = new Dictionary <string, TestUser>();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create an instance of the CollectionService.
 /// </summary>
 /// <param name="db">The database context containing the needed Collections.</param>
 public CollectionService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 4
0
        ////protected List<Option> CreateOptions(string newLineSeparatedPptions)
        ////{
        ////    List<Option> optList = new List<Option>();
        ////    if (!string.IsNullOrEmpty(newLineSeparatedPptions))
        ////    {
        ////        string[] options = newLineSeparatedPptions.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        ////        foreach (string opt in options)
        ////            optList.Add(new Option(opt, false));
        ////    }
        ////    return optList;
        ////}

        public override void UpdateDataModel(object dataModel, CatfishDbContext db)
        {
        }
Ejemplo n.º 5
0
 public EntityService(CatfishDbContext db) : base(db)
 {
 }
 public AccessGroupService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create an instance of the AggregationService.
 /// </summary>
 /// <param name="db">The database context containing the needed Items.</param>
 ///
 public AggregationService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 8
0
 public DataService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 9
0
 public SecurityService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 10
0
 public ServiceBase(CatfishDbContext db)
 {
     Db = db;
 }
Ejemplo n.º 11
0
 public UserListService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 12
0
 public UnitTestSecurityService(CatfishDbContext db) : base(db)
 {
 }
        public void UpdateViewModel(object dataModel, CatfishDbContext db)
        {
            CFEntityType model = dataModel as CFEntityType;

            Id   = model.Id;
            Name = model.Name;
            if (!string.IsNullOrEmpty(Name))
            {
                ErrorMessage = "";
            }
            Description = model.Description;
            // TargetType = model.TargetType.ToString();

            foreach (var tt in model.TargetTypesList)  //MR jan 15 2018
            {
                TargetType[(int)tt] = true;
            }

            CFTypeLabelAttribute att = Attribute.GetCustomAttribute(model.GetType(), typeof(CFTypeLabelAttribute)) as CFTypeLabelAttribute;

            TypeLabel = att == null?model.GetType().ToString() : att.Name;

            //populating the available metadata sets array
            MetadataService srv          = new MetadataService(db);
            var             metadataSets = srv.GetMetadataSets();

            AvailableMetadataSets.Clear();
            AvailableMetadataSets.Add(new MetadataSetListItem(0, ""));
            foreach (var ms in metadataSets)
            {
                if (!string.IsNullOrEmpty(ms.Name))
                {
                    AvailableMetadataSets.Add(new MetadataSetListItem(ms.Id, ms.Name));

                    List <string> addList = new List <string>();
                    addList.Add("");
                    addList = addList.Concat((ms.Fields.Select(f => f.Name).ToList())).ToList();

                    if (!MetadataSetFields.ContainsKey(ms.Id.ToString()))
                    {
                        MetadataSetFields.Add(ms.Id.ToString(), addList);
                    }
                }
            }

            //populating the associated metadata sets array
            AssociatedMetadataSets.Clear();
            foreach (var ms in model.MetadataSets)
            {
                AssociatedMetadataSets.Add(new MetadataSetListItem(ms.Id, ms.Name));
            }


            AttributeMappings.Clear();
            if (model.AttributeMappings.Count > 0)
            {
                foreach (CFEntityTypeAttributeMapping map in model.AttributeMappings)
                {
                    if (map.Name.Equals("Name Mapping"))// || map.Name.Equals("Description Mapping"))
                    {
                        map.Deletable = false;
                    }

                    AttributeMappings.Add(new AttributeMapping
                    {
                        Id    = map.Id,
                        Name  = map.Name,
                        Field = map.FieldName,
                        MetadataSetFieldId = map.MetadataSetId,
                        Label     = map.Label,
                        Deletable = map.Deletable
                    });
                }
            }
            else
            {
                AttributeMappings.Add(new AttributeMapping {
                    Id = 0, Name = "Name Mapping", Deletable = false
                });
                AttributeMappings.Add(new AttributeMapping {
                    Id = 0, Name = "Description Mapping", Deletable = true, ErrorMessage = ""
                });
            }
        }
        public override void UpdateDataModel(object dataModel, CatfishDbContext db)
        {
            CFEntityType model = dataModel as CFEntityType;

            model.Name        = Name;
            model.Description = Description;

            //Mr jan 15 2018

            var TargetTypesList = new List <CFEntityType.eTarget>();

            for (int i = 0; i < TargetType.Count; ++i)
            {
                if (TargetType[i])
                {
                    TargetTypesList.Add((CFEntityType.eTarget)i);
                }
            }
            model.TargetTypesList = TargetTypesList;

            List <int> dataModelMetadataSetIds = model.MetadataSets.Select(m => m.Id).ToList();
            List <int> viewModelMetadataSetIds = AssociatedMetadataSets.Select(m => m.Id).ToList();

            //Removing metadata sets that are already associated with the data model but not with the view model
            foreach (int id in dataModelMetadataSetIds)
            {
                if (!viewModelMetadataSetIds.Contains(id))
                {
                    model.MetadataSets.Remove(model.MetadataSets.Where(m => m.Id == id).FirstOrDefault());
                }
            }

            //Adding metadata sets that are in the view model but not in the data model to the data model.
            foreach (int id in viewModelMetadataSetIds)
            {
                if (!dataModelMetadataSetIds.Contains(id))
                {
                    CFMetadataSet ms = db.MetadataSets.Where(s => s.Id == id).FirstOrDefault();
                    if (ms != null)
                    {
                        model.MetadataSets.Add(ms);
                    }
                }
            }

            // Remvoe all the missing attribute mappings.
            model.AttributeMappings.Clear();
            foreach (var map in AttributeMappings)
            {
                CFEntityTypeAttributeMapping attrMapping = new CFEntityTypeAttributeMapping
                {
                    Id            = map.Id,
                    Name          = map.Name,
                    FieldName     = map.Field,
                    MetadataSetId = map.MetadataSetFieldId,
                    Label         = map.Label,
                    Deletable     = map.Deletable
                };

                if (map.Id > 0)
                {
                    CFEntityTypeAttributeMapping oldAttrMapping = db.EntityTypeAttributeMappings.Find(map.Id);

                    db.Entry(oldAttrMapping).CurrentValues.SetValues(attrMapping);

                    attrMapping = oldAttrMapping;
                }

                model.AttributeMappings.Add(attrMapping);
            }
        }
Ejemplo n.º 15
0
 public GoogleSheetService(string spreadsheetId, CatfishDbContext db)
     : base(db)
 {
     mColumnHeadings = new Dictionary <string, List <string> >();
     InitRead(spreadsheetId);
 }
Ejemplo n.º 16
0
 public IngestionService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Create an instance of the ItemService.
 /// </summary>
 /// <param name="db">The database context containing the needed Items.</param>
 ///
 public ItemService(CatfishDbContext db) : base(db)
 {
 }
Ejemplo n.º 18
0
 public abstract void UpdateDataModel(object dataModel, CatfishDbContext db);
Ejemplo n.º 19
0
        ////public void InitAssociatedEntitiesList(IEnumerable<Entity> entities)
        ////{
        ////    ChildEntities.Clear();
        ////    foreach (Entity e in entities)
        ////        ChildEntities.Add(new EntityViewModel(e));
        ////}

        ////public void InitAllEntitieLists(IEnumerable<Entity> entities)
        ////{
        ////    ForeignEntities.Clear();
        ////    foreach (Entity e in entities)
        ////        ForeignEntities.Add(new EntityViewModel(e));
        ////}

        public override void UpdateDataModel(object dataModel, CatfishDbContext db)
        {
            throw new NotImplementedException();
        }
Ejemplo n.º 20
0
 public SurveyService(CatfishDbContext db) : base(db)
 {
 }