Exemplo n.º 1
0
        private bool FillRow(List <Attribute> atts, DataRow r)
        {
            var isInserting = true;

            foreach (var attribute in atts)
            {
                var vA = new ValidatedAttribute(attribute);
                if (!vA.IsValidatedAttribute)
                {
                    continue;
                }

                // check for table columns
                var sName = attribute.Name;
                if (!AttributesGrid.Columns.Contains(sName))
                {
                    isInserting = false;
                    AttributesGrid.Columns.Add(new DataColumn(attribute.Name, typeof(ValidatedAttribute))
                    {
                        Namespace = attribute.PropertySetName
                    });
                }
                if (!isInserting || attribute.Value == null)
                {
                    continue;
                }

                r[sName] = vA;
            }
            return(isInserting);
        }
Exemplo n.º 2
0
        private bool FillRow(Document doc, DataRow r)
        {
            var isInserting = true;

            foreach (var attribute in doc.Attributes)
            {
                var vA = new ValidatedAttribute(attribute);
                if (attribute.ExternalEntity != "DPoW Attributes")
                {
                    continue;
                }

                // check for table columns
                var sName = attribute.Name;
                if (!AttributesGrid.Columns.Contains(sName))
                {
                    isInserting = false;
                    AttributesGrid.Columns.Add(new DataColumn(attribute.Name, typeof(ValidatedAttribute))
                    {
                        Namespace = attribute.PropertySetName
                    });
                }
                if (!isInserting || attribute.Value == null)
                {
                    continue;
                }

                r[sName] = vA;
            }
            if (!AttributesGrid.Columns.Contains("DPoW_Directory"))
            {
                AttributesGrid.Columns.Add(new DataColumn("DPoW_Directory", typeof(VisualValue)));
                AttributesGrid.Columns.Add(new DataColumn("DPoW_File", typeof(VisualValue)));
                return(false);
            }

            var status = doc.ValidationResult() == StatusOptions.Passed
                ? VisualAttentionStyle.Green
                : VisualAttentionStyle.Red;

            var vDir = new VisualValue(doc.Directory)
            {
                AttentionStyle = status
            };
            var vFile = new VisualValue(doc.File)
            {
                AttentionStyle = status
            };

            r["DPoW_Directory"] = vDir;
            r["DPoW_File"]      = vFile;
            return(isInserting);
        }
        private bool FillRow(Document doc, DataRow r)
        {
            var isInserting = true;
            foreach (var attribute in doc.Attributes)
            {
                var vA = new ValidatedAttribute(attribute);
                if (attribute.ExternalEntity != "DPoW Attributes")
                    continue;

                // check for table columns
                var sName = attribute.Name;
                if (!AttributesGrid.Columns.Contains(sName))
                {
                    isInserting = false;
                    AttributesGrid.Columns.Add(new DataColumn(attribute.Name, typeof(ValidatedAttribute))
                    {
                        Namespace = attribute.PropertySetName
                    });
                }
                if (!isInserting || attribute.Value == null)
                    continue;

                r[sName] = vA;
            }
            if (!AttributesGrid.Columns.Contains("DPoW_Directory"))
            {
                AttributesGrid.Columns.Add(new DataColumn("DPoW_Directory", typeof(VisualValue)));
                AttributesGrid.Columns.Add(new DataColumn("DPoW_File", typeof(VisualValue)));
                return false;
            }

            var status = doc.ValidationResult() == StatusOptions.Passed
                ? VisualAttentionStyle.Green
                : VisualAttentionStyle.Red;

            var vDir = new VisualValue(doc.Directory) {AttentionStyle = status};
            var vFile = new VisualValue(doc.File) { AttentionStyle = status };

            r["DPoW_Directory"] = vDir;
            r["DPoW_File"] = vFile;
            return isInserting;
        }