コード例 #1
0
        public static AttributeGroup CreateAttributeGroup(string groupName)
        {
            AttributeGroup attributeGroup = new AttributeGroup();

            attributeGroup.GroupName = groupName;
            return(attributeGroup);
        }
コード例 #2
0
 public NodeNameAttributeDefinition(AttributeGroup group)
 {
     this.Setup(AliasValue, "Node Name");
     this.AttributeType = AttributeTypeRegistry.Current.GetAttributeType(NodeNameAttributeType.AliasValue) ?? new NodeNameAttributeType();
     //this.AttributeType = new NodeNameAttributeType();
     this.AttributeGroup = group;
 }
コード例 #3
0
        public async static Task <IDTO> AddUpdateMode(AttributeGroup busnies)
        {
            string SPName  = "";
            string message = "";
            OracleDynamicParameters oracleParams = new OracleDynamicParameters();
            ComplateOperation <int> complate     = new ComplateOperation <int>();

            if (busnies.ID.HasValue)
            {
                oracleParams.Add(AttributesGroupSpParams.PARAMETER_ID, OracleDbType.Int64, ParameterDirection.Input, (object)busnies.ID ?? DBNull.Value);
                SPName  = AttributeGroupsPName.SP_UPADTE_AttributeGroup;
                message = "Updated Successfully";
            }
            else
            {
                oracleParams.Add(AttributesGroupSpParams.PARAMETER_ID, OracleDbType.Int64, ParameterDirection.Output);
                SPName  = AttributeGroupsPName.SP_INSERT_AttributeGroup;
                message = "Inserted Successfully";
            }
            oracleParams.Add(AttributesGroupSpParams.PARAMETER_ATTRIBUTE_GROUP, OracleDbType.Long, ParameterDirection.Input, (object)busnies.ATT_GRP_ID ?? DBNull.Value, 1000);
            oracleParams.Add(AttributesGroupSpParams.PARAMETER_SERVICE_ID, OracleDbType.Varchar2, ParameterDirection.Input, (object)busnies.SRVCS_ID ?? DBNull.Value, 1000);
            if (await NonQueryExecuter.ExecuteNonQueryAsync(SPName, oracleParams) == -1)
            {
                complate.message = message;
            }
            else
            {
                complate.message = "Operation Failed";
            }

            return(complate);
        }
コード例 #4
0
 public static AttributeGroup FixedDates(this AttributeGroup group)
 {
     group.UtcCreated       = FixedSystemDate;
     group.UtcModified      = FixedSystemDate;
     group.UtcStatusChanged = FixedSystemDate;
     return(group);
 }
コード例 #5
0
        public OperationDetails AddAttributeGroup(AttributeGroupDTO dto)
        {
            AttributeGroup group = new AttributeGroup();

            group.SortOrder    = dto.SortOrder;
            group.DateAdded    = DateTime.Now;
            group.DateModefied = DateTime.Now;
            group = _unitOfWork.AttributeGroupRepsitory.Insert(group);

            AttributeGroupDescription arabicDescription  = new AttributeGroupDescription();
            AttributeGroupDescription englishDescription = new AttributeGroupDescription();

            arabicDescription.GroupId      = group.Id;
            arabicDescription.Text         = dto.ArabicName;
            arabicDescription.LanguageId   = (long)Langs.Arabic;
            arabicDescription.DateAdded    = DateTime.Now;
            arabicDescription.DateModefied = DateTime.Now;

            englishDescription.GroupId      = group.Id;
            englishDescription.Text         = dto.EnglishName;
            englishDescription.LanguageId   = (long)Langs.English;
            englishDescription.DateAdded    = DateTime.Now;
            englishDescription.DateModefied = DateTime.Now;
            _unitOfWork.AttributeGroupDescriptionRepsitory.Insert(arabicDescription);
            _unitOfWork.AttributeGroupDescriptionRepsitory.Insert(englishDescription);

            _unitOfWork.Save();
            return(new OperationDetails(true, "تمت إضافة مجموعة الواصفات بنجاح", ""));
        }
コード例 #6
0
 public NodeNameAttribute(string nodeName, AttributeGroup group)
     : base(new NodeNameAttributeDefinition(group))
 {
     //the node name by default needs to go into the 'Name' portion of the values colleciton
     Values["Name"]    = nodeName;
     Values["UrlName"] = "";
 }
コード例 #7
0
        public OperationDetails EditAttributeGroup(AttributeGroupDTO dto)
        {
            AttributeGroup group = _unitOfWork.AttributeGroupRepsitory.Get(c => c.Id == dto.Id).FirstOrDefault();

            group.SortOrder    = dto.SortOrder;
            group.DateAdded    = DateTime.Now;
            group.DateModefied = DateTime.Now;
            _unitOfWork.AttributeGroupRepsitory.Update(group);

            long arabicLang  = (long)Langs.Arabic;
            long englishLang = (long)Langs.English;

            AttributeGroupDescription arabicDescription = _unitOfWork.AttributeGroupDescriptionRepsitory.Get(c => c.GroupId == dto.Id && c.LanguageId == arabicLang).FirstOrDefault();

            AttributeGroupDescription englishDescription = _unitOfWork.AttributeGroupDescriptionRepsitory.Get(c => c.GroupId == dto.Id && c.LanguageId == englishLang).FirstOrDefault();


            arabicDescription.Text         = dto.ArabicName;
            arabicDescription.LanguageId   = (long)Langs.Arabic;
            arabicDescription.DateModefied = DateTime.Now;


            englishDescription.Text         = dto.EnglishName;
            englishDescription.DateModefied = DateTime.Now;

            _unitOfWork.AttributeGroupDescriptionRepsitory.Update(arabicDescription);
            _unitOfWork.AttributeGroupDescriptionRepsitory.Update(englishDescription);

            _unitOfWork.Save();
            return(new OperationDetails(true, "تمت تعديل مجموعة الواصفات بنجاح", ""));
        }
コード例 #8
0
        public OperationDetails DeleteAttribGroup(long groupId)
        {
            AttributeGroup attribGroup = _unitOfWork.AttributeGroupRepsitory.GetByID(groupId);

            if (attribGroup == null)
            {
                return(new OperationDetails(false, "المجموعة غير موجودة", ""));
            }

            if (attribGroup.Attributes.Any())
            {
                return(new OperationDetails(false, "لا يمكن حذف المجموعة لوجود واصفات مرتبطة", ""));
            }

            if (attribGroup.AttributeGroupDescriptions.Any())
            {
                List <AttributeGroupDescription> descs = _unitOfWork.AttributeGroupDescriptionRepsitory
                                                         .Get(c => c.GroupId == groupId).ToList();
                foreach (AttributeGroupDescription descr in descs)
                {
                    _unitOfWork.AttributeGroupDescriptionRepsitory.Delete(descr);
                    _unitOfWork.Save();
                }
            }
            _unitOfWork.AttributeGroupRepsitory.Delete(attribGroup);
            _unitOfWork.Save();
            return(new OperationDetails(true, "تمت عملية الحذف", ""));
        }
コード例 #9
0
 public SelectedTemplateAttributeDefinition(AttributeGroup group)
 {
     this.Setup(AliasValue, "Selected template");
     this.AttributeType = AttributeTypeRegistry.Current.GetAttributeType(SelectedTemplateAttributeType.AliasValue) ?? new SelectedTemplateAttributeType();
     //this.AttributeType = new SelectedTemplateAttributeType();
     this.AttributeGroup = group;
 }
コード例 #10
0
        // Delete the attribute group with the specified attribute group id.
        private static void DeleteAttributeGroup(Guid attributeGroupId)
        {
            try
            {
                // Create the request object for attribute group deletion.
                MetadataDeleteRequest deleteRequest = new MetadataDeleteRequest();
                deleteRequest.Metadata = new Metadata();
                deleteRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection <AttributeGroup> {
                };
                AttributeGroup anAttributeGroup = new AttributeGroup();
                // Set attribute group id.
                anAttributeGroup.Identifier = new MemberTypeContextIdentifier {
                    Id = attributeGroupId
                };
                deleteRequest.Metadata.AttributeGroups.Add(anAttributeGroup);

                // Delete the specified attribute group.
                MetadataDeleteResponse deleteResponse = clientProxy.MetadataDelete(deleteRequest);

                HandleOperationErrors(deleteResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #11
0
ファイル: People.cs プロジェクト: RefreshCache/arena-ccv-pco
        public static Arena.Core.Attribute GetPcoAttribute(AttributeGroup attributeGroup, string attributeName, DataType attributeType)
        {
            Arena.Core.Attribute pcoAttribute = attributeGroup.Attributes.FindByName(attributeName);

            if (pcoAttribute == null || pcoAttribute.AttributeId == -1)
            {
                Arena.DataLayer.Organization.OrganizationData oData = new Arena.DataLayer.Organization.OrganizationData();

                string sql = string.Format(
                    "SELECT ISNULL(MAX(attribute_order),-1) FROM core_attribute WHERE attribute_group_id = {0}",
                    attributeGroup.AttributeGroupId.ToString());
                int groupOrder = (int)oData.ExecuteScalar(sql);

                Guid attributeGuid = Guid.NewGuid();

                sql = string.Format(
                    "insert into core_attribute (guid, attribute_group_id, attribute_name, attribute_type, attribute_order) values ('{0}', {1}, '{2}', '{3}', (({4})+2))",
                    attributeGuid.ToString(),
                    attributeGroup.AttributeGroupId.ToString(),
                    attributeName,
                    Enum.Format(typeof(DataType), attributeType, "D"),
                    groupOrder.ToString());

                oData.ExecuteNonQuery(sql);

                pcoAttribute = new Arena.Core.Attribute(attributeGuid);
                attributeGroup.Attributes.Add(pcoAttribute);
            }

            return(pcoAttribute);
        }
コード例 #12
0
        public static AttributeDefinitionGroup MapAttributeDefinitionGroup(AttributeGroup attributeGroup, AbstractLookupHelper lookupHelper, AbstractMappingEngine masterMapper)
        {
            var mapped = GetObjectReference(attributeGroup.Id, lookupHelper, () => new AttributeDefinitionGroup());

            MapAttributeDefinitionGroup(attributeGroup, mapped, lookupHelper, masterMapper);
            return(mapped);
        }
コード例 #13
0
ファイル: People.cs プロジェクト: RefreshCache/arena-ccv-pco
        public void Disable(List <int> validUsers)
        {
            XDocument xdocResults = GetPeople();

            if (xdocResults != null)
            {
                AttributeGroup       pcoAttrGroup = GetPcoAttributeGroup(_organizationId, _pcoAccount);
                Arena.Core.Attribute pcoIDAttr    = GetPcoAttribute(pcoAttrGroup, "PCO_ID", Enums.DataType.String);
                Arena.DataLayer.Organization.OrganizationData oData = new DataLayer.Organization.OrganizationData();

                foreach (XElement xPerson in xdocResults.Descendants("person"))
                {
                    try
                    {
                        string pcoID = xPerson.Descendants("id").First().Value;
                        string sql   = string.Format("SELECT person_id FROM core_person_attribute WHERE attribute_id = {0} AND int_value = {1}",
                                                     pcoIDAttr.AttributeId.ToString(), pcoID);

                        System.Data.SqlClient.SqlDataReader rdr = oData.ExecuteReader(sql);
                        if (rdr.Read())
                        {
                            if (!validUsers.Contains((int)rdr["person_id"]))
                            {
                                Disable(pcoID);
                            }
                        }
                        rdr.Close();
                    }
                    catch { }
                }
            }
        }
コード例 #14
0
 public NodeNameAttributeDefinition(AttributeGroup group)
 {
     this.Setup(AliasValue, "Node Name");
     this.AttributeType = AttributeTypeRegistry.Current.GetAttributeType(NodeNameAttributeType.AliasValue) ?? new NodeNameAttributeType();
     //this.AttributeType = new NodeNameAttributeType();
     this.AttributeGroup = group;
 }
コード例 #15
0
        // Adds attribute groups to DB
        public int CreateAttributeGroup(MainPageViewModel vm)
        {
            if (vm.AttributeGroupName != null)
            {
                var part = vm.AttributeGroupName.Split("%");

                var groupName        = part[0];
                var GroupDescription = part[1];

                // If it exists already, don't save
                int id           = 0;
                var ctxAttrGroup = ctx.AttributeGroups.FirstOrDefault(x => x.Name.Equals(groupName));
                if (vm.Id == 0 && ctxAttrGroup == null)
                {
                    var newAttrGroup = new AttributeGroup
                    {
                        Name              = groupName,
                        Description       = GroupDescription,
                        ProductAttributes = null
                    };
                    ctx.AttributeGroups.Add(newAttrGroup);

                    ctx.SaveChanges();
                    id = newAttrGroup.Id;
                }
                else
                {
                    id = ctxAttrGroup.Id;
                }
                return(id);
            }
            return(0);
        }
コード例 #16
0
        public ActionResult Attributes(AttributeGroupViewModel postAttribute)
        {
            if (ModelState.IsValid)
            {
                var form = postAttribute.Form;
                if (form.NewGroup != null)
                {
                    var group = new AttributeGroup()
                    {
                        AttributeGroupName = form.NewGroup
                    };
                    _context.AttributeGroups.Add(group);
                    _context.SaveChanges();
                }
                else if (form.SelectGroup != null && form.AttributeName != null)
                {
                    var attribute = new Models.Attribute()
                    {
                        AttributeGroupId = form.SelectGroup, Name = form.AttributeName, ValueType = form.ValueType
                    };
                    _context.Attributes.Add(attribute);
                    _context.SaveChanges();
                }
            }

            return(RedirectToAction(nameof(AttributesController.Attributes), "Attributes"));
        }
コード例 #17
0
 public SelectedTemplateAttributeDefinition(AttributeGroup group)
 {
     this.Setup(AliasValue, "Selected template");
     this.AttributeType = AttributeTypeRegistry.Current.GetAttributeType(SelectedTemplateAttributeType.AliasValue) ?? new SelectedTemplateAttributeType();
     //this.AttributeType = new SelectedTemplateAttributeType();
     this.AttributeGroup = group;
 }
コード例 #18
0
        // Create an attribute group with a specified name.
        private static void CreateAttributeGroup(Guid modelId, Guid entityId, string attributeGroupName)
        {
            try
            {
                // Create the request object for attribute group creation.
                MetadataCreateRequest createRequest = new MetadataCreateRequest();
                createRequest.Metadata = new Metadata();
                createRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection <AttributeGroup> {
                };
                AttributeGroup newAttributeGroup = new AttributeGroup();
                // Set model id, entity id, and attribute group name.
                newAttributeGroup.Identifier = new MemberTypeContextIdentifier {
                    Name = attributeGroupName, ModelId = new Identifier {
                        Id = modelId
                    }, EntityId = new Identifier {
                        Id = entityId
                    }, MemberType = MemberType.Leaf
                };
                newAttributeGroup.FullName = attributeGroupName;
                createRequest.Metadata.AttributeGroups.Add(newAttributeGroup);

                // Create a new attribute group.
                MetadataCreateResponse createResponse = clientProxy.MetadataCreate(createRequest);

                HandleOperationErrors(createResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #19
0
        // Create an attribute group with a specified name.
        private static void CreateAttributeGroup(Guid modelId, Guid entityId, string attributeGroupName)
        {
            try
            {
                // Create the request object for attribute group creation.
                MetadataCreateRequest createRequest = new MetadataCreateRequest();
                createRequest.Metadata = new Metadata();
                createRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection<AttributeGroup> { };
                AttributeGroup newAttributeGroup = new AttributeGroup();
                // Set model id, entity id, and attribute group name.
                newAttributeGroup.Identifier = new MemberTypeContextIdentifier { Name = attributeGroupName, ModelId = new Identifier { Id = modelId }, EntityId = new Identifier { Id = entityId }, MemberType = MemberType.Leaf };
                newAttributeGroup.FullName = attributeGroupName;
                createRequest.Metadata.AttributeGroups.Add(newAttributeGroup);

                // Create a new attribute group.
                MetadataCreateResponse createResponse = clientProxy.MetadataCreate(createRequest);

                HandleOperationErrors(createResponse.OperationResult);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #20
0
        public HttpStatusCode UpdateAttribute(int attributeId, UpdateAttributeDto updateAttributeDto)
        {
            if (updateAttributeDto.AttributeGroupId <= 0)
            {
                return(HttpStatusCode.NotFound);
            }

            DAL.Models.Attribute attribute = _ctx.Attributes.FirstOrDefault(f => f.Id == attributeId);
            attribute.Name             = updateAttributeDto.AttributeName;
            attribute.Value            = EnumHelper.GetValueType(updateAttributeDto.ValueTypeId);
            attribute.LastModifiedDate = DateTime.Now;

            AttributeGroup attributeGroup = _ctx.AttributeGroups.FirstOrDefault(f => f.Id == updateAttributeDto.AttributeGroupId);

            attribute.AttributeGroup   = attributeGroup;
            attribute.AttributeGroupId = attributeGroup.Id;

            try
            {
                _ctx.Entry(attribute).State = EntityState.Modified;
                _ctx.SaveChanges();

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return(HttpStatusCode.InternalServerError);
            }
        }
コード例 #21
0
        public AttributeGroupViewModel GetAttributeGroupById(int attributeGroupId)
        {
            AttributeGroup          attributeGroup          = _ctx.AttributeGroups.FirstOrDefault(f => f.Id == attributeGroupId);
            AttributeGroupViewModel attributeGroupViewModel = AttributeGroupFactory.AttributeGroupToViewModel(attributeGroup);

            return(attributeGroupViewModel);
        }
コード例 #22
0
        public ActionResult UpdateGroupAttr(AttributeGroup group)
        {
            dynamic result = new ExpandoObject();

            if (String.IsNullOrEmpty(group.AttrGroupName) || group.AttrGroupID == 0)
            {
                result.status  = "error";
                result.title   = "Chỉnh sửa thất bại";
                result.message = "Tên nhóm thuộc tính hoặc mã nhóm thuộc tính không tồn tại";
                return(Content(JsonConvert.SerializeObject(result), "application/json"));
            }
            var repo     = Repository.Create <AttributeGroup>();
            var oldGroup = repo.FindById(group.AttrGroupID);

            if (oldGroup == null)
            {
                result.status  = "error";
                result.title   = "Chỉnh sửa thất bại";
                result.message = "Nhóm thuộc tính này không tồn tại trong hệ thống";
                return(Content(JsonConvert.SerializeObject(result), "application/json"));
            }
            oldGroup.AttrGroupName = group.AttrGroupName;
            repo.SaveChanges();
            result.status  = "success";
            result.title   = "Chỉnh sửa thành công";
            result.message = "Chúc mừng bạn đã thay đổi thành công thông tin nhóm thuộc tính";
            return(Content(JsonConvert.SerializeObject(result), "application/json"));
        }
コード例 #23
0
ファイル: ComplexType.cs プロジェクト: xbrlware/gepsio
 //--------------------------------------------------------------------------------------------------------
 // This constructor is used to construct built-in complex types defined in the XBRL specification.
 //--------------------------------------------------------------------------------------------------------
 internal ComplexType(string Name, AnySimpleType BaseSimpleType, AttributeGroup AttrGroup)
 {
     thisAttributeGroup    = AttrGroup;
     thisComplexTypeNode   = null;
     thisName              = Name;
     thisSimpleContentType = BaseSimpleType;
 }
コード例 #24
0
        private static void SaveGroups(EditAttribute editAttribute, int attributeID)
        {
            var curList = AttributeGroups.GetByAttributeID(attributeID);

            foreach (var groupID in editAttribute.Groups)
            {
                if (!curList.Any(item => item.GroupID == groupID))
                {
                    var attributeGroup = new AttributeGroup();

                    attributeGroup.AttributeID = attributeID;
                    attributeGroup.GroupID     = groupID;

                    AttributeGroups.Insert(attributeGroup);
                }
                else
                {
                    curList.Remove(curList.Single(cls => cls.GroupID == groupID));
                }
            }

            foreach (var item in curList)
            {
                AttributeGroups.Delete(item.ID);
            }
        }
コード例 #25
0
        public static ISchemaBuilderStep <T, TProviderFilter> Define <T, TProviderFilter>(
            this ISchemaBuilderStep <T, TProviderFilter> builder,
            string propertyAlias,
            string typeAlias,
            string groupAlias,
            string groupName = null)
            where TProviderFilter : class, IProviderTypeFilter
            where T : EntitySchema, new()
        {
            // Try to get the group from the existing builder's schema
            AttributeGroup group = null;

            if (builder.Item != null)
            {
                group = builder.Item.AttributeGroups.FirstOrDefault(x => x.Alias == groupAlias);
                if (group == null)
                {
                    // See if it's a composite schema and try to get an inherited group
                    var composite = builder.Item as CompositeEntitySchema;
                    if (composite != null)
                    {
                        group = composite.InheritedAttributeGroups.FirstOrDefault(x => x.Alias == groupAlias);
                    }
                }
            }
            if (group == null)
            {
                // Create a group
                groupName = groupName ?? groupAlias;
                group     = new AttributeGroup(groupAlias, groupName, 0);
            }

            return(Define(builder, propertyAlias, type => type.UseExistingType(typeAlias), group));
        }
コード例 #26
0
 private void AddAttributes(AttributeGroup group)
 {
     foreach (Arena.Core.Attribute attr in group.Attributes)
     {
         ListItem item = new ListItem(attr.AttributeName, attr.AttributeId.ToString());
         drpAttribute.Items.Add(item);
     }
 }
コード例 #27
0
 private void AddAttributes(AttributeGroup group)
 {
     foreach (Arena.Core.Attribute attr in group.Attributes)
     {
         ListItem item = new ListItem(attr.AttributeName, attr.AttributeId.ToString());
         drpAttribute.Items.Add(item);
     }
 }
コード例 #28
0
 public static void MapAttributeDefinitionGroup(AttributeGroup source, AttributeDefinitionGroup destination, AbstractLookupHelper lookupHelper, AbstractMappingEngine masterMapper)
 {
     destination.Alias       = source.Alias;
     destination.Id          = (Guid)source.Id.Value;
     destination.Name        = source.Name;
     destination.DateCreated = source.UtcCreated;
     destination.Ordinal     = source.Ordinal;
 }
コード例 #29
0
        public void Initialize(int id, string name, string source, string destination, string extensionRegex, string nameRegex,
                               string attributeMatch, string format, string perform, int fileType, bool enabled)
        {
            try {
                ID             = id;
                Name           = name;
                Source         = new DirectoryInfo(source);
                Destination    = new DirectoryInfo(destination);
                ExtensionRegex = new Regex(extensionRegex);
                NameRegex      = new Regex(nameRegex);
                Format         = format;
                perform        = perform.ToLower();
                FileTypeIndex  = fileType;
                Enabled        = enabled;
                switch (perform)
                {
                case "copy":
                    PerformType = PerformTaskType.Copy;
                    break;

                case "move":
                    PerformType = PerformTaskType.Move;
                    break;

                case "rename":
                    PerformType = PerformTaskType.Rename;
                    break;

                case "delete":
                    PerformType = PerformTaskType.Delete;
                    break;

                default:
                    PerformType = PerformTaskType.Copy;
                    break;
                }
                if (attributeMatch.Length > 0)
                {
                    AttributeMatchList = new List <FileTag>();
                    List <string> AttributeGroups = new List <string>(attributeMatch.Split('|'));
                    string[]      AttributeField;
                    foreach (string AttributeGroup in AttributeGroups)
                    {
                        if (AttributeGroup.Length > 0)
                        {
                            AttributeField = AttributeGroup.Split('?');
                            if (AttributeField.Length == 2)
                            {
                                AttributeMatchList.Add(new FileTag(AttributeField[0], AttributeField[1]));
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                Log.Write("Task::Initialize() Error -> " + ex.Message);
            }
        }
コード例 #30
0
        public IHttpActionResult Put([FromBody] AttributeGroup attrGroup)
        {
            Repository.Update(attrGroup);
            Repository.Save();
            var message = "The Attribute \"" + attrGroup.ShortName + "\" has been Updated";

            Log.MonitoringLogger.Info(message);
            return(Ok(message));
        }
コード例 #31
0
        public AttributeViewModel GetAttributeById(int attributeId)
        {
            DAL.Models.Attribute attribute      = _ctx.Attributes.FirstOrDefault(f => f.Id == attributeId);
            AttributeGroup       attributeGroup = _ctx.AttributeGroups.FirstOrDefault(f => f.Id == attribute.AttributeGroupId);

            AttributeViewModel attributeViewModel = AttributeFactory.AttributeToViewModel(attribute, attributeGroup.Name);

            return(attributeViewModel);
        }
コード例 #32
0
        public static AttributeGroup AttributeGroupToDbo(CreateAttributeGroupDto createAttributeGroupDto)
        {
            var model = new AttributeGroup()
            {
                Name         = createAttributeGroupDto.AttributeGroupName,
                CreationDate = DateTime.Now
            };

            return(model);
        }
コード例 #33
0
        public InheritedAttributeGroup(AttributeGroup attributeGroup, EntitySchema schema)
            : base(attributeGroup.Alias, attributeGroup.Name, attributeGroup.Ordinal)
        {
            Id = attributeGroup.Id;
            UtcCreated = attributeGroup.UtcCreated;
            UtcModified = attributeGroup.UtcModified;
            UtcStatusChanged = attributeGroup.UtcStatusChanged;

            Schema = schema;
        }
コード例 #34
0
        public AttributeGroup MapAttributeGroupDefinition(AttributeDefinitionGroup attributeDefinitionGroup, AbstractLookupHelper lookupHelper, AbstractMappingEngine masterMapper)
        {
            // TODO:
            // - Attributes and AttributeDefinitions navigator on the stack model will be tricky to track changes
            // - Add Ordinal to Rdbms model
            var mapped = new AttributeGroup();

            MapAttributeGroupDefinition(attributeDefinitionGroup, mapped, lookupHelper, masterMapper);
            return(mapped);
        }
コード例 #35
0
 public static ISchemaBuilderStep <T, TProviderFilter> Define <T, TProviderFilter>(
     this ISchemaBuilderStep <T, TProviderFilter> builder,
     string propertyAlias,
     string typeAlias,
     AttributeGroup group)
     where TProviderFilter : class, IProviderTypeFilter
     where T : EntitySchema, new()
 {
     return(Define(builder, propertyAlias, type => type.UseExistingType(typeAlias), group));
 }
コード例 #36
0
 public SelectedTemplateAttributeDefinition(AttributeGroup group)
     : this()
 {
     this.AttributeGroup = group;
 }
コード例 #37
0
        public void DocumentTypeEditorControllerTests_Tab_Definitions_Bound_And_Invalidated()
        {
            //Arrange

            var schema = CreateNewSchema();
            var grp1 = new AttributeGroup("testtab1", "Tab 1", 0);
            var grp2 = new AttributeGroup("testtab2", "Tab 2", 1);
            schema.AttributeGroups.Add(grp1);
            schema.AttributeGroups.Add(grp2);
            RebelApplicationContext.AddPersistenceData(schema);

            grp1 = schema.AttributeGroups.FirstOrDefault(x => x.Alias == "testtab1");
            grp2 = schema.AttributeGroups.FirstOrDefault(x => x.Alias == "testtab2");

            var controller = new DocumentTypeEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(new Dictionary<string, string>(), new Dictionary<string, string>
                                              {
                                                  {string.Format("{0}.Name", grp1.Id.GetHtmlId()), ""},
                                                  {string.Format("{0}.SortOrder", grp1.Id.GetHtmlId()), "100"},
                                                  {string.Format("{0}.Name", grp2.Id.GetHtmlId()), ""},
                                                  {string.Format("{0}.SortOrder", grp2.Id.GetHtmlId()), "200"},
                                              }, GetBackOfficeRequestContext());

            //Act

            var result = (ViewResult)controller.EditForm(schema.Id);
            var model = (DocumentTypeEditorModel)result.Model;

            //Assert

            var tab1 = model.DefinedTabs.Single(x => x.Id == grp1.Id);
            var tab2 = model.DefinedTabs.Single(x => x.Id == grp2.Id);
            Assert.AreEqual(100, tab1.SortOrder);
            Assert.AreEqual(200, tab2.SortOrder);
            Assert.IsFalse(controller.ModelState.IsValidField(string.Format("{0}.Name", grp1.Id.GetHtmlId())));
            Assert.IsFalse(controller.ModelState.IsValidField(string.Format("{0}.Name", grp2.Id.GetHtmlId())));
        }
コード例 #38
0
 public NodeNameAttributeDefinition(AttributeGroup group)
     : this()
 {
     this.AttributeGroup = group;
 }
コード例 #39
0
        // Delete the attribute group with the specified attribute group id.
        private static void DeleteAttributeGroup(Guid attributeGroupId)
        {
            try
            {
                // Create the request object for attribute group deletion.
                MetadataDeleteRequest deleteRequest = new MetadataDeleteRequest();
                deleteRequest.Metadata = new Metadata();
                deleteRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection<AttributeGroup> { };
                AttributeGroup anAttributeGroup = new AttributeGroup();
                // Set attribute group id.
                anAttributeGroup.Identifier = new MemberTypeContextIdentifier { Id = attributeGroupId };
                deleteRequest.Metadata.AttributeGroups.Add(anAttributeGroup);

                // Delete the specified attribute group.
                MetadataDeleteResponse deleteResponse = clientProxy.MetadataDelete(deleteRequest);

                HandleOperationErrors(deleteResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #40
0
        // Update the attribute group name and add an attribute to it.
        private static void UpdateAttributeGroup(Guid modelId, Guid entityId, Guid attributeGroupId, string newAttributeGroupName, Guid attributeId)
        {
            try
            {
                // Create the request object for updating attribute group information.
                MetadataUpdateRequest updateRequest = new MetadataUpdateRequest();
                updateRequest.Metadata = new Metadata();
                updateRequest.Metadata.AttributeGroups = new System.Collections.ObjectModel.Collection<AttributeGroup> { };
                // Set model id, entity id, attribute group id, and new attribute group name.
                AttributeGroup anAttributeGroup = new AttributeGroup { Identifier = new MemberTypeContextIdentifier { Name = newAttributeGroupName, Id = attributeGroupId, ModelId = new Identifier { Id = modelId }, EntityId = new Identifier { Id = entityId }, MemberType = MDSTestService.MemberType.Leaf } };
                // Add the attribute object with the attribute id.
                anAttributeGroup.Attributes = new System.Collections.ObjectModel.Collection<MetadataAttribute> { };
                MetadataAttribute anAttribute = new MetadataAttribute { Identifier = new MemberTypeContextIdentifier { Id = attributeId } };
                anAttributeGroup.Attributes.Add(anAttribute);
                updateRequest.Metadata.AttributeGroups.Add(anAttributeGroup);

                // Update the attribute group information.
                MetadataUpdateResponse updateResponse = clientProxy.MetadataUpdate(updateRequest);

                HandleOperationErrors(updateResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
コード例 #41
0
 public ListGroupItem(string text, AttributeGroup attributeGroup)
 {
     Text = text;
     Group = attributeGroup;
 }