Ejemplo n.º 1
0
        public void RemoveCodedValue(DomainCodedValueRow codedValue)
        {
            // Get Index
            int index = this.Rows.IndexOf(codedValue);

            if (index == -1)
            {
                return;
            }

            // Remove
            this.Rows.RemoveAt(index);

            // Select Next Coded Value
            if (this.Rows.Count == 0)
            {
                return;
            }
            if (index != this.Rows.Count)
            {
                this.SelectedItem = this.Rows[index];
            }
            else
            {
                this.SelectedItem = this.Rows[this.Rows.Count - 1];
            }
        }
        //
        // CONSTRUCTOR
        //
        public DomainCodedValue(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();
            XPathNodeIterator interatorCodedValue = navigator.Select("CodedValues/CodedValue");

            // Add Coded Value Rows
            while (interatorCodedValue.MoveNext()) {
                XPathNavigator navigatorCodedValue = interatorCodedValue.Current;
                DomainCodedValueRow row = new DomainCodedValueRow(navigatorCodedValue);
                this.Rows.Add(row);
            }
        }
Ejemplo n.º 3
0
        //
        // CONSTRUCTOR
        //
        public DomainCodedValue(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator    navigator           = path.CreateNavigator();
            XPathNodeIterator interatorCodedValue = navigator.Select("CodedValues/CodedValue");

            // Add Coded Value Rows
            while (interatorCodedValue.MoveNext())
            {
                XPathNavigator      navigatorCodedValue = interatorCodedValue.Current;
                DomainCodedValueRow row = new DomainCodedValueRow(navigatorCodedValue);
                this.Rows.Add(row);
            }
        }
        public void RemoveCodedValue(DomainCodedValueRow codedValue) {
            // Get Index
            int index = this.Rows.IndexOf(codedValue);
            if (index == -1) { return; }

            // Remove
            this.Rows.RemoveAt(index);

            // Select Next Coded Value
            if (this.Rows.Count == 0) {return;}
            if (index != this.Rows.Count) {
                this.SelectedItem = this.Rows[index];
            }
            else {
                this.SelectedItem = this.Rows[this.Rows.Count - 1];
            }
        }
 public void AddCodedValue(DomainCodedValueRow codedValue) {
     this.Rows.Add(codedValue);
     this.SelectedItem = codedValue;
 }
Ejemplo n.º 6
0
 public void AddCodedValue(DomainCodedValueRow codedValue)
 {
     this.Rows.Add(codedValue);
     this.SelectedItem = codedValue;
 }
Ejemplo n.º 7
0
        public override void Errors(List <Error> list)
        {
            // Get Base Errors
            base.Errors(list);

            // Check Field Type
            switch (this.FieldType)
            {
            case esriFieldType.esriFieldTypeSmallInteger:
            case esriFieldType.esriFieldTypeInteger:
            case esriFieldType.esriFieldTypeSingle:
            case esriFieldType.esriFieldTypeDouble:
            case esriFieldType.esriFieldTypeString:
            case esriFieldType.esriFieldTypeDate:
                break;

            default:
                list.Add(new ErrorTable(this, string.Format("Field Type Cannot be {0}", this.FieldType.ToString()), ErrorType.Error));
                break;
            }

            // Warn if domain does not contain any coded value items
            if (this.Rows.Count == 0)
            {
                list.Add(new ErrorTable(this, "Domain does not contain any coded values", ErrorType.Warning));
            }

            // Add Coded Value Domain Item Errors
            foreach (DomainCodedValueRow codedValue in this.Rows)
            {
                codedValue.Errors(list);
            }

            // Check for duplicate coded value codes
            Dictionary <string, DomainCodedValueRow> dictionary = new Dictionary <string, DomainCodedValueRow>();

            foreach (DomainCodedValueRow codedValue in this.Rows)
            {
                if (string.IsNullOrEmpty(codedValue.Code))
                {
                    continue;
                }
                DomainCodedValueRow c = null;
                if (dictionary.TryGetValue(codedValue.Code, out c))
                {
                    string message1 = string.Format("Domain coded value code [{0}] is duplicated", codedValue.Code);
                    string message2 = string.Format("Domain coded value code [{0}] is duplicated", c.Code);
                    list.Add(new ErrorTableRow(codedValue, message1, ErrorType.Error));
                    list.Add(new ErrorTableRow(c, message2, ErrorType.Error));
                }
                else
                {
                    dictionary.Add(codedValue.Code, codedValue);
                }
            }

            // Check for duplicate code value descriptions (warning only)
            Dictionary <string, DomainCodedValueRow> dictionary2 = new Dictionary <string, DomainCodedValueRow>();

            foreach (DomainCodedValueRow codedValue in this.Rows)
            {
                if (string.IsNullOrEmpty(codedValue.Name))
                {
                    continue;
                }
                DomainCodedValueRow c = null;
                if (dictionary2.TryGetValue(codedValue.Name, out c))
                {
                    string message1 = string.Format("Domain coded value name [{0}] is duplicated", codedValue.Name);
                    string message2 = string.Format("Domain coded value name [{0}] is duplicated", c.Name);
                    list.Add(new ErrorTableRow(codedValue, message1, ErrorType.Warning));
                    list.Add(new ErrorTableRow(c, message2, ErrorType.Warning));
                }
                else
                {
                    dictionary2.Add(codedValue.Name, codedValue);
                }
            }
        }
 public DomainCodedValueRow(DomainCodedValueRow prototype) : base(prototype) {
     this._code = prototype.Code;
     this._name = prototype.Name;
     this.UpdateText();
 }
Ejemplo n.º 9
0
 public DomainCodedValueRow(DomainCodedValueRow prototype) : base(prototype)
 {
     this._code = prototype.Code;
     this._name = prototype.Name;
     this.UpdateText();
 }