//
        // CONSTRUCTOR
        //
        public DomainRange(IXPathNavigable path): base(path) {
            //
            XPathNavigator navigator = path.CreateNavigator();

            // Add Min/Max Row
            DomainRangeRow row = new DomainRangeRow(navigator);
            this.Rows.Add(row);
        }
Beispiel #2
0
        //
        // CONSTRUCTOR
        //
        public DomainRange(IXPathNavigable path) : base(path)
        {
            //
            XPathNavigator navigator = path.CreateNavigator();

            // Add Min/Max Row
            DomainRangeRow row = new DomainRangeRow(navigator);

            this.Rows.Add(row);
        }
 public DomainRangeRow(DomainRangeRow prototype) : base(prototype) {
     this._max = prototype.Max;
     this._min = prototype.Min;
     this.UpdateText();
 }
Beispiel #4
0
 public DomainRangeRow(DomainRangeRow prototype) : base(prototype)
 {
     this._max = prototype.Max;
     this._min = prototype.Min;
     this.UpdateText();
 }
Beispiel #5
0
        public override bool IsValid(string test, out string message)
        {
            // Get Domain Range Row
            DomainRangeRow row = (DomainRangeRow)this.Rows[0];

            //
            message = null;
            switch (this.FieldType)
            {
            case esriFieldType.esriFieldTypeSmallInteger: {
                short valueMin;
                short valueMax;
                short valueTest;
                bool  validMin  = short.TryParse(row.Min, out valueMin);
                bool  validMax  = short.TryParse(row.Max, out valueMax);
                bool  validTest = short.TryParse(test, out valueTest);

                if (validMin && validMax)
                {
                    if ((valueTest < valueMin) || (valueTest > valueMax))
                    {
                        message = "Value is outside the range domain";
                        return(false);
                    }
                }
                return(true);
            }

            case esriFieldType.esriFieldTypeInteger: {
                int  valueMin;
                int  valueMax;
                int  valueTest;
                bool validMin  = int.TryParse(row.Min, out valueMin);
                bool validMax  = int.TryParse(row.Max, out valueMax);
                bool validTest = int.TryParse(test, out valueTest);

                if (validMin && validMax)
                {
                    if ((valueTest < valueMin) || (valueTest > valueMax))
                    {
                        message = "Value is outside the range domain";
                        return(false);
                    }
                }
                return(true);
            }

            case esriFieldType.esriFieldTypeSingle: {
                float valueMin;
                float valueMax;
                float valueTest;
                bool  validMin  = float.TryParse(row.Min, out valueMin);
                bool  validMax  = float.TryParse(row.Max, out valueMax);
                bool  validTest = float.TryParse(test, out valueTest);

                if (validMin && validMax)
                {
                    if ((valueTest < valueMin) || (valueTest > valueMax))
                    {
                        message = "Value is outside the range domain";
                        return(false);
                    }
                }
                return(true);
            }

            case esriFieldType.esriFieldTypeDouble: {
                double valueMin;
                double valueMax;
                double valueTest;
                bool   validMin  = double.TryParse(row.Min, out valueMin);
                bool   validMax  = double.TryParse(row.Max, out valueMax);
                bool   validTest = double.TryParse(test, out valueTest);

                if (validMin && validMax)
                {
                    if ((valueTest < valueMin) || (valueTest > valueMax))
                    {
                        message = "Value is outside the range domain";
                        return(false);
                    }
                }
                return(true);
            }

            case esriFieldType.esriFieldTypeDate: {
                CultureInfo        cultureInfo        = CultureInfo.CurrentCulture;
                DateTimeFormatInfo dateTimeFormatInfo = cultureInfo.DateTimeFormat;
                DateTime           valueMin;
                DateTime           valueMax;
                DateTime           valueTest;
                bool validMin  = DateTime.TryParseExact(row.Min, dateTimeFormatInfo.SortableDateTimePattern, cultureInfo, DateTimeStyles.None, out valueMin);
                bool validMax  = DateTime.TryParseExact(row.Max, dateTimeFormatInfo.SortableDateTimePattern, cultureInfo, DateTimeStyles.None, out valueMax);
                bool validTest = DateTime.TryParseExact(test, dateTimeFormatInfo.SortableDateTimePattern, cultureInfo, DateTimeStyles.None, out valueTest);

                if (validMin && validMax)
                {
                    if ((valueTest < valueMin) || (valueTest > valueMax))
                    {
                        message = "Value is outside the range domain";
                        return(false);
                    }
                }
                return(true);
            }

            default:
                return(false);
            }
        }