예제 #1
0
        public TypedValue CheckValue(object testValue)
        {
            MSCCodedValue mSCCodedValue = this.GetCodedValue(testValue);

            if (mSCCodedValue == null)
            {
                if (this.FauxNull == null)
                {
                    this.SetFauxNull(testValue);
                }
                mSCCodedValue = this.FauxNull;
            }
            return(CadField.CreateTypedValue(this.FieldType, mSCCodedValue.Value));
        }
예제 #2
0
        private void cbDomainValues_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataRowView dataRowView = (DataRowView)((FrameworkElement)sender).DataContext;

            System.Windows.Controls.ComboBox comboBox = (System.Windows.Controls.ComboBox)sender;
            if (comboBox.SelectedItem != null)
            {
                MSCCodedValue mSCCodedValue = (MSCCodedValue)comboBox.SelectedItem;
                if (dataRowView["Value"].ToString() != mSCCodedValue.Value.ToString())
                {
                    dataRowView["Value"] = mSCCodedValue.Value.ToString();
                }
            }
        }
예제 #3
0
 public MSCCodedValue GetCodedValue(object testValue)
 {
     foreach (MSCCodedValue current in this.CodedValues.Values)
     {
         if (current.Value.Equals(testValue))
         {
             MSCCodedValue result = current;
             return(result);
         }
     }
     if (this.FauxNull != null)
     {
         return(this.FauxNull);
     }
     return(null);
 }
예제 #4
0
 public void Write(Database db, Transaction t)
 {
     try
     {
         DBDictionary dBDictionary  = this.ParentDataset.Open(db, t, FieldDomain.DictionaryName, (OpenMode)1);
         DBDictionary dBDictionary2 = new DBDictionary();
         this.Id = dBDictionary.SetAt(this.Name, dBDictionary2);
         dBDictionary2.DisableUndoRecording(true);
         t.AddNewlyCreatedDBObject(dBDictionary2, true);
         this.WriteTypedValue(db, t, dBDictionary2, "KeyName", new TypedValue(1, this.Name));
         this.WriteTypedValue(db, t, dBDictionary2, "DisplayName", new TypedValue(1, this.DisplayName));
         this.WriteTypedValue(db, t, dBDictionary2, "DomainType", new TypedValue(1, this.DomainType));
         this.WriteTypedValue(db, t, dBDictionary2, "DomainFieldType", new TypedValue(90, this.FieldType));
         if (this.DomainType == "RangeDomain")
         {
             this.WriteTypedValue(db, t, dBDictionary2, "DomainMinimum", CadField.CreateTypedValue(this.MinValue));
             this.WriteTypedValue(db, t, dBDictionary2, "DomainMaximum", CadField.CreateTypedValue(this.MaxValue));
         }
         if (this.DomainType == "CodedValueDomain")
         {
             List <TypedValue> list = new List <TypedValue>();
             foreach (KeyValuePair <string, MSCCodedValue> keyValuePair in this.CodedValues)
             {
                 MSCCodedValue value = keyValuePair.Value;
                 list.Add(CadField.CreateTypedValue(value.DisplayName));
                 list.Add(CadField.CreateTypedValue(value.Value));
             }
             try
             {
                 ResultBuffer rb = new ResultBuffer(list.ToArray());
                 this.WriteResultBuffer(db, t, dBDictionary2, "CodedValues", rb);
             }
             catch (System.Exception)
             {
             }
         }
     }
     catch
     {
     }
 }
예제 #5
0
 public bool IsFauxNull(MSCCodedValue testValue)
 {
     return(testValue == null || (this.FauxNull != null && this.FauxNull.Value.Equals(testValue.Value)));
 }
예제 #6
0
        public MSCCodedValue GenerateFauxNull()
        {
            this.FauxNull = null;
            if (this.FieldType == CadField.CadFieldType.Integer)
            {
                int num = 0;
                while (true)
                {
                    MSCCodedValue codedValue = this.GetCodedValue(num);
                    if (codedValue == null)
                    {
                        break;
                    }
                    num--;
                    if (codedValue == null)
                    {
                        goto Block_3;
                    }
                }
                this.FauxNull = new MSCCodedValue(" ", num);
                return(this.FauxNull);

                Block_3 :;
            }
            else if (this.FieldType == CadField.CadFieldType.Double)
            {
                double num2 = 0.0;
                while (true)
                {
                    MSCCodedValue codedValue2 = this.GetCodedValue(num2);
                    if (codedValue2 == null)
                    {
                        break;
                    }
                    num2 -= 1.0;
                    if (codedValue2 == null)
                    {
                        goto Block_6;
                    }
                }
                this.FauxNull = new MSCCodedValue(" ", num2);
                return(this.FauxNull);

                Block_6 :;
            }
            else if (this.FieldType == CadField.CadFieldType.Short)
            {
                short num3 = 0;
                while (true)
                {
                    MSCCodedValue codedValue3 = this.GetCodedValue(num3);
                    if (codedValue3 == null)
                    {
                        break;
                    }
                    num3 -= 1;
                    if (codedValue3 == null)
                    {
                        goto Block_9;
                    }
                }
                this.FauxNull = new MSCCodedValue(" ", num3);
                return(this.FauxNull);

                Block_9 :;
            }
            else if (this.FieldType == CadField.CadFieldType.String)
            {
                string text = "null";
                if (this.GetCodedValue(text) == null)
                {
                    this.FauxNull = new MSCCodedValue(" ", text);
                    return(this.FauxNull);
                }
                text = "";
                if (this.GetCodedValue(text) == null)
                {
                    this.FauxNull = new MSCCodedValue(" ", text);
                    return(this.FauxNull);
                }
                int num4 = 1;
                while (true)
                {
                    text = Convert.ToString(num4);
                    MSCCodedValue codedValue4 = this.GetCodedValue(text);
                    if (codedValue4 == null)
                    {
                        break;
                    }
                    num4++;
                    if (num4 > 255)
                    {
                        goto Block_14;
                    }
                    if (codedValue4 == null)
                    {
                        goto IL_1A9;
                    }
                }
                this.FauxNull = new MSCCodedValue(" ", text);
                return(this.FauxNull);

Block_14:
                return(null);
            }
IL_1A9:
            return(null);
        }
예제 #7
0
 protected virtual void Read(ObjectId id, Transaction t)
 {
     try
     {
         DBDictionary dBDictionary = (DBDictionary)t.GetObject(this.Id, 0);
         if (dBDictionary.Contains("KeyName"))
         {
             Xrecord      xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("KeyName"), 0);
             TypedValue[] array   = xrecord.Data.AsArray();
             for (int i = 0; i < array.Length; i++)
             {
                 TypedValue typedValue = array[i];
                 string     name       = typedValue.Value.ToString();
                 this.Name = name;
             }
         }
         else
         {
             this.Name = "DomainName";
         }
         if (dBDictionary.Contains("DisplayName"))
         {
             Xrecord      xrecord2 = (Xrecord)t.GetObject(dBDictionary.GetAt("DisplayName"), 0);
             TypedValue[] array2   = xrecord2.Data.AsArray();
             for (int j = 0; j < array2.Length; j++)
             {
                 TypedValue typedValue2 = array2[j];
                 string     displayName = typedValue2.Value.ToString();
                 this.DisplayName = displayName;
             }
         }
         else
         {
             this.DisplayName = this.Name;
         }
         if (dBDictionary.Contains("DomainType"))
         {
             Xrecord      xrecord3 = (Xrecord)t.GetObject(dBDictionary.GetAt("DomainType"), 0);
             TypedValue[] array3   = xrecord3.Data.AsArray();
             for (int k = 0; k < array3.Length; k++)
             {
                 TypedValue typedValue3 = array3[k];
                 string     domainType  = typedValue3.Value.ToString();
                 this.DomainType = domainType;
             }
         }
         if (dBDictionary.Contains("DomainFieldType"))
         {
             Xrecord      xrecord4  = (Xrecord)t.GetObject(dBDictionary.GetAt("DomainFieldType"), 0);
             TypedValue[] array4    = xrecord4.Data.AsArray();
             int          fieldType = int.Parse(array4[0].Value.ToString());
             this.FieldType = (CadField.CadFieldType)fieldType;
         }
         if (this.DomainType == "RangeDomain")
         {
             Xrecord      xrecord5 = (Xrecord)t.GetObject(dBDictionary.GetAt("DomainMinimum"), 0);
             TypedValue[] array5   = xrecord5.Data.AsArray();
             this.MinValue = array5[0].Value;
             Xrecord      xrecord6 = (Xrecord)t.GetObject(dBDictionary.GetAt("DomainMaximum"), 0);
             TypedValue[] array6   = xrecord6.Data.AsArray();
             this.MaxValue = array6[0].Value;
         }
         else if (this.DomainType == "CodedValueDomain")
         {
             this.CodedValues = new ObservableDictionary <string, MSCCodedValue>();
             Xrecord      xrecord7 = (Xrecord)t.GetObject(dBDictionary.GetAt("CodedValues"), 0);
             TypedValue[] array7   = xrecord7.Data.AsArray();
             int          num      = array7.Length;
             for (int l = 0; l < num; l += 2)
             {
                 try
                 {
                     TypedValue    typedValue4   = array7[l];
                     TypedValue    typedValue5   = array7[l + 1];
                     MSCCodedValue mSCCodedValue = new MSCCodedValue(typedValue4.Value.ToString(), typedValue5.Value);
                     this.CodedValues.Add(mSCCodedValue.DisplayName, mSCCodedValue);
                 }
                 catch
                 {
                 }
             }
         }
     }
     catch (SystemException)
     {
     }
 }