Esempio n. 1
0
        public void DeleteRoleMap(TemplateMap templateMap, string roleId)
        {
            RoleMap roleMap = templateMap.roleMaps.Where(c => c.roleId == roleId).FirstOrDefault();

            if (roleMap != null)
            {
                if (roleMap.classMap != null)
                {
                    DeleteClassMap(roleMap.classMap.classId);
                    roleMap.classMap = null;
                }
            }
        }
Esempio n. 2
0
 public RoleMap(RoleMap roleMap)
 {
     type             = roleMap.type;
     roleId           = roleMap.roleId;
     name             = roleMap.name;
     dataType         = roleMap.dataType;
     propertyName     = roleMap.propertyName;
     value            = roleMap.value;
     valueList        = roleMap.valueList;
     classMap         = roleMap.classMap;
     numberOfDecimals = roleMap.numberOfDecimals;
     precision        = roleMap.precision;
     scale            = roleMap.scale;
 }
Esempio n. 3
0
        // roleMap is not required for root node
        public void AddClassMap(RoleMap roleMap, ClassMap classMap)
        {
            KeyValuePair <ClassMap, List <TemplateMap> > classTemplateListMap = GetClassTemplateListMap(classMap.classId);

            if (classTemplateListMap.Key == null)
            {
                classTemplateListMaps.Add(classMap, new List <TemplateMap>());

                if (roleMap != null)
                {
                    roleMap.classMap = classMap;
                }
            }
        }
Esempio n. 4
0
        // roleId is unique within templateMap scope
        public void AddRoleMap(RoleMap roleMap)
        {
            bool found = false;

            foreach (RoleMap role in roleMaps)
            {
                if (role.roleId == roleMap.roleId)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                roleMaps.Add(roleMap);
            }
        }
Esempio n. 5
0
        public void DeleteClassMap(string classId)
        {
            KeyValuePair <ClassMap, List <TemplateMap> > classTemplateListMap = GetClassTemplateListMap(classId);

            if (classTemplateListMap.Key != null)
            {
                List <TemplateMap> templateMaps = classTemplateListMap.Value;
                foreach (TemplateMap templateMap in templateMaps)
                {
                    RoleMap classRole = templateMap.roleMaps.Where(c => c.classMap != null).FirstOrDefault();
                    if (classRole != null)
                    {
                        DeleteClassMap(classRole.classMap.classId);
                        classRole.classMap = null;
                    }
                }
                templateMaps.Clear();
                classTemplateListMaps.Remove(classTemplateListMap.Key);
            }
        }
Esempio n. 6
0
 public TemplateMap(TemplateMap templateMap, RoleMap roleMap)
     : this(templateMap)
 {
     AddRoleMap(roleMap);
 }