Exemplo n.º 1
0
        public void DefineMatxt(DbElement cata)
        {
            DbElement sect = cata.Members().SingleOrDefault(s => s.GetString(DbAttributeInstance.DESC) == "MaterialContainer");

            if (sect == null || sect.IsValid == false)
            {
                sect = cata.CreateLast(DbElementTypeInstance.SECTION);
                sect.SetAttributeValue(DbAttributeInstance.DESC, "MaterialContainer");
            }
            var smtes = new DBElementCollection(sect,
                                                new AndFilter(new TypeFilter(DbElementTypeInstance.SMTEXT),
                                                              new AttributeStringFilter(DbAttributeInstance.MTXX, FilterOperator.Equals, Matxt)));
            var smte = smtes.First();

            if (smte == null || !smte.IsValid)
            {
                smte = sect.CreateFirst(DbElementTypeInstance.SMTEXT);
                smte.SetAttribute(DbAttributeInstance.XTEX, Matxt);
            }
            Smte = smte;
        }