Пример #1
0
        private void method_1()
        {
            this.bool_0        = false;
            this.txtAlias.Text = this.ifieldEdit_0.AliasName;
            this.cboAllowNull.SelectedIndex       = Convert.ToInt32(this.ifieldEdit_0.IsNullable);
            this.txtDefault.Text                  = this.ifieldEdit_0.DefaultValue.ToString();
            this.txtPrecision.Text                = this.ifieldEdit_0.Precision.ToString();
            this.txtDefault.Properties.ReadOnly   = this.bool_1;
            this.txtPrecision.Properties.ReadOnly = this.bool_1;
            this.cboAllowNull.Enabled             = !this.bool_1;
            if (ObjectClassShareData.m_IsShapeFile)
            {
                this.txtAlias.Enabled = false;
            }
            string name = "";
            int    num2 = -1;

            if (this.ifieldEdit_0.Domain != null)
            {
                name = this.ifieldEdit_0.Domain.Name;
            }
            else if (NewObjectClassHelper.m_pObjectClassHelper != null)
            {
                if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomanIsExit(this.ifieldEdit_0))
                {
                    if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0] != null)
                    {
                        name = NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0].DomainID;
                    }
                }
                else if (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass != null)
                {
                    string str2 = (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass as IDataset).Name;
                    name = CodeDomainManage.GetDamainName(this.ifieldEdit_0.Name, str2);
                }
            }
            if (name.Length > 0)
            {
                for (int i = 0; i < this.cboDomain.Properties.Items.Count; i++)
                {
                    DomainWrap1 wrap = this.cboDomain.Properties.Items[i] as DomainWrap1;
                    if (this.ifieldEdit_0.Domain != null)
                    {
                        if ((wrap.Domain == null) || !(wrap.Domain.Name == name))
                        {
                            continue;
                        }
                        num2 = i;
                        break;
                    }
                    if ((wrap.DomainEx != null) && (wrap.DomainEx.DomainID == name))
                    {
                        num2 = i;
                        break;
                    }
                }
            }
            this.cboDomain.SelectedIndex = num2;
            this.bool_0 = true;
        }
Пример #2
0
 private void method_2(string string_2)
 {
     for (int i = 0; i < this.ifields_0.FieldCount; i++)
     {
         IField key = this.ifields_0.get_Field(i);
         if ((key.Editable &&
              ((((key.Type != esriFieldType.esriFieldTypeOID) &&
                 (key.Type != esriFieldType.esriFieldTypeGeometry)) &&
                (key.Type != esriFieldType.esriFieldTypeRaster)) && (key.Type != esriFieldType.esriFieldTypeBlob))) &&
             this.FieldDomains.ContainsKey(key))
         {
             CodeDomainEx ex = this.FieldDomains[key];
             if (ex != null)
             {
                 CodeDomainManage.AddFieldCodeDoaminMap(string_2, key.Name, ex.DomainID);
             }
             else
             {
                 CodeDomainManage.DeleteCodeDoaminMap(string_2, key.Name);
             }
         }
     }
 }
Пример #3
0
 public void ShowTable()
 {
     this.m_CanDo = false;
     this.m_pDataTable.Rows.Clear();
     this.m_pDataTable.Columns.Clear();
     this.m_CanDo = true;
     if (this.m_pCursor != null)
     {
         ComReleaser.ReleaseCOMObject(this.m_pCursor);
         this.m_pCursor = null;
     }
     if (this.m_pTable != null)
     {
         IQueryFilter queryFilter = null;
         System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
         if (this.m_strWhere.Length > 1)
         {
             queryFilter = new QueryFilterClass
             {
                 WhereClause = this.m_strWhere
             };
         }
         try
         {
             if (this.IsShowAll)
             {
                 this.m_RecordNum = this.m_pTable.RowCount(queryFilter);
                 this.m_pCursor   = this.m_pTable.Search(queryFilter, false);
             }
             else
             {
                 ComReleaser.ReleaseCOMObject(this.m_pCursor);
                 if (this.m_pTable is IFeatureLayer)
                 {
                 }
             }
             try
             {
                 this.AddFilesInfoToListViewColumn(this.m_pTable.Fields);
                 this.AddRecordToListView(false);
             }
             catch (Exception exception)
             {
                 MessageBox.Show(exception.ToString());
             }
             if (this.m_pTable.HasOID)
             {
             }
             this.m_pXtraGrid.SetDataBinding(this.dataGrid1, this.m_pDataTable);
             this.m_pXtraGrid.ReadOnly = true;
             for (int i = 0; i < this.m_pTable.Fields.FieldCount; i++)
             {
                 IList  list;
                 int    num2;
                 IField field = this.m_pTable.Fields.get_Field(i);
                 if (field.Domain != null)
                 {
                     if (field.Domain is ICodedValueDomain)
                     {
                         list = new ArrayList();
                         num2 = 0;
                         while (num2 < (field.Domain as ICodedValueDomain).CodeCount)
                         {
                             list.Add((field.Domain as ICodedValueDomain).get_Name(num2));
                             num2++;
                         }
                         this.m_pXtraGrid.SetColumnAttr(i, ColumnAttribute.CA_COMBOBOX, list);
                     }
                     else if ((field.Domain is IRangeDomain) &&
                              ((((field.Type == esriFieldType.esriFieldTypeDouble) ||
                                 (field.Type == esriFieldType.esriFieldTypeSingle)) ||
                                (field.Type == esriFieldType.esriFieldTypeSmallInteger)) ||
                               (field.Type == esriFieldType.esriFieldTypeInteger)))
                     {
                         this.m_pXtraGrid.SetColumnAttr(i, ColumnAttribute.CA_SPINEDIT,
                                                        (double)(field.Domain as IRangeDomain).MinValue,
                                                        (double)(field.Domain as IRangeDomain).MaxValue);
                     }
                 }
                 else
                 {
                     list = new ArrayList();
                     string       name         = (this.m_pTable as IDataset).Name;
                     CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(field.Name, name);
                     if (codeDomainEx != null)
                     {
                         if ((codeDomainEx.ParentIDFieldName == null) ||
                             (codeDomainEx.ParentIDFieldName.Length == 0))
                         {
                             NameValueCollection codeDomain = codeDomainEx.GetCodeDomain();
                             if (field.IsNullable)
                             {
                                 list.Add("<空>");
                             }
                             for (num2 = 0; num2 < codeDomain.Count; num2++)
                             {
                                 string str2 = codeDomain.Keys[num2];
                                 list.Add(str2);
                             }
                             this.m_pXtraGrid.SetColumnAttr(i, ColumnAttribute.CA_COMBOBOX, list);
                         }
                         else
                         {
                             this.m_pXtraGrid.SetColumnAttr(i, ColumnAttribute.CA_TREEVIEWCOMBOX, codeDomainEx);
                         }
                     }
                     else if ((((field.Type == esriFieldType.esriFieldTypeDouble) ||
                                (field.Type == esriFieldType.esriFieldTypeSingle)) ||
                               (field.Type == esriFieldType.esriFieldTypeSmallInteger)) ||
                              (field.Type == esriFieldType.esriFieldTypeInteger))
                     {
                         this.m_pXtraGrid.SetColumnAttr(i, ColumnAttribute.CA_SPINEDIT);
                     }
                 }
             }
         }
         catch
         {
         }
         System.Windows.Forms.Cursor.Current = Cursors.Default;
     }
 }
Пример #4
0
 private void m_pDataTable_ColumnChanged(object sender, DataColumnChangeEventArgs e)
 {
     if (this.m_InEditing && this.m_CanDo)
     {
         object[] itemArray = e.Row.ItemArray;
         try
         {
             IRow           row;
             int            num;
             IField         field;
             int            num2;
             IWorkspaceEdit workspace = (this.m_pTable as IDataset).Workspace as IWorkspaceEdit;
             if (itemArray[0] is DBNull)
             {
                 if (!(this.m_pTable is IFeatureClass))
                 {
                     workspace.StartEditOperation();
                     row = this.m_pTable.CreateRow();
                     num = row.Fields.FindFieldByAliasName(e.Column.ColumnName);
                     if (num != -1)
                     {
                         field = row.Fields.get_Field(num);
                         if (field.Domain is ICodedValueDomain)
                         {
                             for (num2 = 0; num2 < (field.Domain as ICodedValueDomain).CodeCount; num2++)
                             {
                                 if (e.ProposedValue.ToString() ==
                                     (field.Domain as ICodedValueDomain).get_Name(num2))
                                 {
                                     row.set_Value(num, (field.Domain as ICodedValueDomain).get_Value(num2));
                                     break;
                                 }
                             }
                         }
                         else
                         {
                             string       name         = (row.Table as IDataset).Name;
                             CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(field.Name, name);
                             if (codeDomainEx != null)
                             {
                                 row.set_Value(num, codeDomainEx.GetCodeByName(e.ProposedValue.ToString()));
                             }
                             else
                             {
                                 row.set_Value(num, e.ProposedValue);
                             }
                         }
                         row.Store();
                     }
                     workspace.StopEditOperation();
                     this.m_CanDo = false;
                     e.Row[this.m_pTable.OIDFieldName] = row.OID;
                     this.m_CanDo = true;
                 }
             }
             else
             {
                 int          num3        = Convert.ToInt32(itemArray[0]);
                 IQueryFilter queryFilter = new QueryFilterClass
                 {
                     WhereClause = this.m_pTable.OIDFieldName + " = " + num3.ToString()
                 };
                 ICursor o = this.m_pTable.Search(queryFilter, false);
                 row = o.NextRow();
                 if (row != null)
                 {
                     workspace.StartEditOperation();
                     num = row.Fields.FindFieldByAliasName(e.Column.ColumnName);
                     if (num != -1)
                     {
                         field = row.Fields.get_Field(num);
                         if (field.Domain is ICodedValueDomain)
                         {
                             for (num2 = 0; num2 < (field.Domain as ICodedValueDomain).CodeCount; num2++)
                             {
                                 if (e.ProposedValue.ToString() ==
                                     (field.Domain as ICodedValueDomain).get_Name(num2))
                                 {
                                     row.set_Value(num, (field.Domain as ICodedValueDomain).get_Value(num2));
                                     break;
                                 }
                             }
                         }
                         else
                         {
                             row.set_Value(num, e.ProposedValue);
                         }
                     }
                     row.Store();
                     workspace.StopEditOperation();
                 }
                 row = null;
                 ComReleaser.ReleaseCOMObject(o);
                 o = null;
             }
         }
         catch (COMException exception)
         {
             if (exception.ErrorCode == -2147467259)
             {
                 MessageBox.Show("输入数据大于字段长度");
             }
             else
             {
                 MessageBox.Show(exception.Message);
             }
             e.Row.CancelEdit();
         }
         catch (Exception exception2)
         {
             MessageBox.Show(exception2.Message);
             e.Row.CancelEdit();
         }
     }
 }
Пример #5
0
 private void AddRecordToListView(bool bAll)
 {
     try
     {
         if (bAll)
         {
             this.m_ShowRecNum = this.m_RecordNum - this.m_pDataTable.Rows.Count;
         }
         else
         {
             this.m_ShowRecNum = ((this.m_RecordNum - this.m_pDataTable.Rows.Count) > 300)
                 ? ((long)300)
                 : ((long)this.m_RecordNum);
         }
         IFields  fields = this.m_pCursor.Fields;
         int      num    = 0;
         IRow     row    = this.m_pCursor.NextRow();
         object[] values = new object[fields.FieldCount];
         while (row != null)
         {
             for (int i = 0; i < fields.FieldCount; i++)
             {
                 IField field = fields.get_Field(i);
                 if (field.Type == esriFieldType.esriFieldTypeGeometry)
                 {
                     values[i] = this.m_strGeometry;
                     continue;
                 }
                 if (field.Type == esriFieldType.esriFieldTypeBlob)
                 {
                     values[i] = "二进制数据";
                     continue;
                 }
                 object  obj2   = row.get_Value(i);
                 IDomain domain = field.Domain;
                 if (domain != null)
                 {
                     if (domain is ICodedValueDomain)
                     {
                         for (int j = 0; j < (field.Domain as ICodedValueDomain).CodeCount; j++)
                         {
                             if ((domain as ICodedValueDomain).get_Value(j).ToString() == obj2.ToString())
                             {
                                 obj2 = (domain as ICodedValueDomain).get_Name(j);
                                 break;
                             }
                         }
                     }
                 }
                 else
                 {
                     string       name         = (row.Table as IDataset).Name;
                     CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(field.Name, name);
                     if (codeDomainEx != null)
                     {
                         obj2 = codeDomainEx.FindName(obj2.ToString());
                     }
                 }
                 values[i] = obj2;
             }
             this.m_pDataTable.Rows.Add(values);
             num++;
             if (row.HasOID)
             {
                 this.m_MaxOID = row.OID;
             }
             if (num >= this.m_ShowRecNum)
             {
                 return;
             }
             row = this.m_pCursor.NextRow();
         }
     }
     catch
     {
     }
 }
Пример #6
0
        private void FieldTypeDateCtrl_Load(object sender, EventArgs e)
        {
            this.cboDomain.Properties.Items.Clear();
            try
            {
                int num = -1;
                this.cboDomain.Properties.Items.Add(new DomainWrap1());
                if (this.iworkspace_0 is IWorkspaceDomains)
                {
                    IEnumDomain domains = (this.iworkspace_0 as IWorkspaceDomains).Domains;
                    if (domains != null)
                    {
                        domains.Reset();
                        for (IDomain domain2 = domains.Next(); domain2 != null; domain2 = domains.Next())
                        {
                            if (domain2.FieldType == esriFieldType.esriFieldTypeDate)
                            {
                                this.cboDomain.Properties.Items.Add(new DomainWrap1(domain2));
                                if ((this.ifieldEdit_0.Domain != null) &&
                                    (this.ifieldEdit_0.Domain.Name == domain2.Name))
                                {
                                    num = this.cboDomain.Properties.Items.Count - 1;
                                }
                            }
                        }
                    }
                }
                string domainID = "";
                if (NewObjectClassHelper.m_pObjectClassHelper != null)
                {
                    if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomains.ContainsKey(this.ifieldEdit_0))
                    {
                        if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0] != null)
                        {
                            domainID =
                                NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0].DomainID;
                        }
                    }
                    else if (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass != null)
                    {
                        string name = (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass as IDataset).Name;
                        domainID = CodeDomainManage.GetDamainName(this.ifieldEdit_0.Name, name);
                    }
                }
                using (List <CodeDomainEx> .Enumerator enumerator = CodeDomainManage.CodeDomainExs.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        CodeDomainEx current = enumerator.Current;
                        if (current.FieldType == esriFieldType.esriFieldTypeDate)
                        {
                            this.cboDomain.Properties.Items.Add(new DomainWrap1(current));
                            if (domainID == current.DomainID)
                            {
                                goto Label_01F7;
                            }
                        }
                    }
                    goto Label_021F;
Label_01F7:
                    num = this.cboDomain.Properties.Items.Count - 1;
                }
Label_021F:
                this.cboDomain.SelectedIndex = num;
            }
            catch
            {
                this.cboDomain.Enabled = false;
            }
            this.method_1();
        }
Пример #7
0
 private void FieldTypeTextCtrl_Load(object sender, EventArgs e)
 {
     this.cboDomain.Properties.Items.Clear();
     try
     {
         int num = -1;
         this.cboDomain.Properties.Items.Add(new DomainWrap1());
         if (this.iworkspace_0 is IWorkspaceDomains)
         {
             IEnumDomain domains = (this.iworkspace_0 as IWorkspaceDomains).Domains;
             if (domains != null)
             {
                 domains.Reset();
                 for (IDomain domain2 = domains.Next(); domain2 != null; domain2 = domains.Next())
                 {
                     if (domain2.FieldType == esriFieldType.esriFieldTypeString)
                     {
                         this.cboDomain.Properties.Items.Add(new DomainWrap1(domain2));
                         if ((this.ifieldEdit_0.Domain != null) &&
                             (this.ifieldEdit_0.Domain.Name == domain2.Name))
                         {
                             num = this.cboDomain.Properties.Items.Count - 1;
                         }
                     }
                 }
             }
         }
         string domainID = "";
         if (NewObjectClassHelper.m_pObjectClassHelper != null)
         {
             if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomains.ContainsKey(this.ifieldEdit_0))
             {
                 if (NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0] != null)
                 {
                     domainID =
                         NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[this.ifieldEdit_0].DomainID;
                 }
             }
             else if (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass != null)
             {
                 string name = (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass as IDataset).Name;
                 domainID = CodeDomainManage.GetDamainName(this.ifieldEdit_0.Name, name);
             }
         }
         foreach (CodeDomainEx ex in CodeDomainManage.CodeDomainExs)
         {
             if (ex.FieldType == esriFieldType.esriFieldTypeString)
             {
                 this.cboDomain.Properties.Items.Add(new DomainWrap1(ex));
                 if (domainID == ex.DomainID)
                 {
                     num = this.cboDomain.Properties.Items.Count - 1;
                 }
             }
         }
         this.cboDomain.SelectedIndex = num;
     }
     catch
     {
         this.cboDomain.Enabled = false;
     }
     this.method_1();
 }
Пример #8
0
        private void Init()
        {
            this.gridControl1.Focus();
            this.m_pVertXtraGrid.Clear();
            int rowHandle = -1;

            if (this.m_pObject == null)
            {
                this.m_CanDo = true;
            }
            else
            {
                this.toolStripDropDownButton1.DropDownItemClicked +=
                    new ToolStripItemClickedEventHandler(this.toolStripDropDownButton1_DropDownItemClicked);
                try
                {
                    ITableAttachments attachments = (ITableAttachments)this.m_pObject.Class;
                    if (attachments != null)
                    {
                        if (attachments.HasAttachments)
                        {
                            this.toolStrip1.Visible = true;
                            this.InitAttachment();
                        }
                        else
                        {
                            this.toolStrip1.Visible = false;
                        }
                    }
                }
                catch
                {
                }
                IFields   fields   = this.m_pObject.Fields;
                string[]  strArray = new string[2];
                ISubtypes subtypes = this.m_pObject.Class as ISubtypes;
                IDomain   domain   = null;
                for (int i = 0; i < fields.FieldCount; i++)
                {
                    IField pField = fields.get_Field(i);
                    if (this.CheckFieldIsVisible(this.m_pFeatureLayer, pField))
                    {
                        strArray[0] = pField.AliasName;
                        if (pField.Type == esriFieldType.esriFieldTypeGeometry)
                        {
                            strArray[1] = this.GetShapeString(pField);
                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                        }
                        else if (pField.Type == esriFieldType.esriFieldTypeOID)
                        {
                            strArray[1] = this.m_pObject.OID.ToString();
                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                        }
                        else if (pField.Type == esriFieldType.esriFieldTypeBlob)
                        {
                            strArray[1] = "<二进制数据>";
                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                        }
                        else
                        {
                            int               num4;
                            double            minValue;
                            double            maxValue;
                            object            obj2    = this.m_pObject.get_Value(i);
                            ICodedValueDomain domain2 = null;
                            IList             list    = new ArrayList();
                            if ((subtypes != null) && subtypes.HasSubtype)
                            {
                                if (subtypes.SubtypeFieldName == pField.Name)
                                {
                                    int num3;
                                    try
                                    {
                                        strArray[1] =
                                            subtypes.get_SubtypeName((this.m_pObject as IRowSubtypes).SubtypeCode);
                                    }
                                    catch
                                    {
                                        strArray[1] = obj2.ToString();
                                    }
                                    IEnumSubtype subtype = subtypes.Subtypes;
                                    subtype.Reset();
                                    for (string str = subtype.Next(out num3); str != null; str = subtype.Next(out num3))
                                    {
                                        list.Add(str);
                                    }
                                    this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list,
                                                                     !this.FieldCanEdit(pField));
                                }
                                else
                                {
                                    domain = subtypes.get_Domain((this.m_pObject as IRowSubtypes).SubtypeCode,
                                                                 pField.Name);
                                    if (domain is ICodedValueDomain)
                                    {
                                        domain2 = domain as ICodedValueDomain;
                                        if (pField.IsNullable)
                                        {
                                            list.Add("<空>");
                                        }
                                        strArray[1] = obj2.ToString();
                                        num4        = 0;
                                        while (num4 < domain2.CodeCount)
                                        {
                                            list.Add(domain2.get_Name(num4));
                                            if (obj2.ToString() == domain2.get_Value(num4).ToString())
                                            {
                                                strArray[1] = domain2.get_Name(num4);
                                            }
                                            num4++;
                                        }
                                        this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list,
                                                                         !this.FieldCanEdit(pField));
                                    }
                                    else if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                               (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                              (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                             (pField.Type == esriFieldType.esriFieldTypeInteger))
                                    {
                                        minValue = 0.0;
                                        maxValue = 0.0;
                                        if (domain is IRangeDomain)
                                        {
                                            minValue = (double)(domain as IRangeDomain).MinValue;
                                            maxValue = (double)(domain as IRangeDomain).MaxValue;
                                        }
                                        if (pField.Editable)
                                        {
                                            this.m_pVertXtraGrid.AddSpinEdit(strArray[0], obj2, false, minValue,
                                                                             maxValue);
                                        }
                                        else
                                        {
                                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], obj2, true);
                                        }
                                    }
                                    else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                    {
                                        this.m_pVertXtraGrid.AddDateEdit(strArray[0], obj2, !this.FieldCanEdit(pField));
                                    }
                                    else
                                    {
                                        strArray[1] = obj2.ToString();
                                        this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1],
                                                                         !this.FieldCanEdit(pField));
                                    }
                                }
                            }
                            else
                            {
                                domain = pField.Domain;
                                if (domain != null)
                                {
                                    if (domain is ICodedValueDomain)
                                    {
                                        domain2 = domain as ICodedValueDomain;
                                        if (pField.IsNullable)
                                        {
                                            list.Add("<空>");
                                        }
                                        strArray[1] = obj2.ToString();
                                        num4        = 0;
                                        while (num4 < domain2.CodeCount)
                                        {
                                            list.Add(domain2.get_Name(num4));
                                            if (obj2.ToString() == domain2.get_Value(num4).ToString())
                                            {
                                                strArray[1] = domain2.get_Name(num4);
                                            }
                                            num4++;
                                        }
                                        this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list,
                                                                         !this.FieldCanEdit(pField));
                                    }
                                    else if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                               (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                              (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                             (pField.Type == esriFieldType.esriFieldTypeInteger))
                                    {
                                        minValue = 0.0;
                                        maxValue = 0.0;
                                        if (domain is IRangeDomain)
                                        {
                                            minValue = (double)(domain as IRangeDomain).MinValue;
                                            maxValue = (double)(domain as IRangeDomain).MaxValue;
                                        }
                                        if (pField.Editable)
                                        {
                                            this.m_pVertXtraGrid.AddSpinEdit(strArray[0], obj2, false, minValue,
                                                                             maxValue);
                                        }
                                        else
                                        {
                                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], obj2, true);
                                        }
                                    }
                                    else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                    {
                                        this.m_pVertXtraGrid.AddDateEdit(strArray[0], obj2, !this.FieldCanEdit(pField));
                                    }
                                    else
                                    {
                                        strArray[1] = obj2.ToString();
                                        this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1],
                                                                         !this.FieldCanEdit(pField));
                                    }
                                }
                                else
                                {
                                    string       name         = (this.m_pObject.Class as IDataset).Name;
                                    CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(pField.Name, name);
                                    if (codeDomainEx != null)
                                    {
                                        if ((codeDomainEx.ParentIDFieldName == null) ||
                                            (codeDomainEx.ParentIDFieldName.Length == 0))
                                        {
                                            NameValueCollection codeDomain = codeDomainEx.GetCodeDomain();
                                            if (pField.IsNullable)
                                            {
                                                list.Add("<空>");
                                            }
                                            strArray[1] = obj2.ToString();
                                            for (num4 = 0; num4 < codeDomain.Count; num4++)
                                            {
                                                string str3 = codeDomain.Keys[num4];
                                                list.Add(str3);
                                                if (obj2.ToString() == codeDomain[str3])
                                                {
                                                    strArray[1] = str3;
                                                }
                                            }
                                            this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list,
                                                                             !this.FieldCanEdit(pField));
                                        }
                                        else
                                        {
                                            strArray[1] = obj2.ToString();
                                            this.m_pVertXtraGrid.AddTreeviewComBoBox(strArray[0],
                                                                                     codeDomainEx.FindName(strArray[1]), codeDomainEx,
                                                                                     !this.FieldCanEdit(pField));
                                        }
                                    }
                                    else
                                    {
                                        if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                              (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                             (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                            (pField.Type == esriFieldType.esriFieldTypeInteger))
                                        {
                                            if (pField.Editable)
                                            {
                                                this.m_pVertXtraGrid.AddSpinEdit(strArray[0], obj2, false, 0.0, 0.0);
                                            }
                                            else
                                            {
                                                this.m_pVertXtraGrid.AddTextEdit(strArray[0], obj2, true);
                                            }
                                        }
                                        else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                        {
                                            this.m_pVertXtraGrid.AddDateEdit(strArray[0], obj2,
                                                                             !this.FieldCanEdit(pField));
                                        }
                                        else
                                        {
                                            strArray[1] = obj2.ToString();
                                            this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1],
                                                                             !this.FieldCanEdit(pField));
                                        }
                                        if (strArray[0] == this.m_EditFeildName)
                                        {
                                            rowHandle = i;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (rowHandle >= 0)
                {
                    this.gridView1.SelectRow(rowHandle);
                }
                this.gridView1.Focus();
                this.m_CanDo = true;
                base.Parent.Focus();
            }
        }
Пример #9
0
 private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
 {
     if (this.m_CanDo && (this.m_pObject != null))
     {
         object            obj2;
         IDomain           domain;
         ICodedValueDomain domain2;
         int            num3;
         ISubtypes      subtypes = this.m_pObject.Class as ISubtypes;
         GridEditorItem row      = this.gridView1.GetRow(e.RowHandle) as GridEditorItem;
         int            index    = this.m_pObject.Fields.FindFieldByAliasName(row.Name);
         IField         pField   = this.m_pObject.Fields.get_Field(index);
         this.m_EditFeildName = pField.AliasName;
         if ((subtypes != null) && subtypes.HasSubtype)
         {
             if (subtypes.SubtypeFieldName == pField.Name)
             {
                 IEnumSubtype subtype = subtypes.Subtypes;
                 subtype.Reset();
                 int subtypeCode = 0;
                 for (string str = subtype.Next(out subtypeCode);
                      str != null;
                      str = subtype.Next(out subtypeCode))
                 {
                     if (e.Value.ToString() == str)
                     {
                         this.UpdateFieldValue(pField, subtypeCode);
                         break;
                     }
                 }
             }
             else if (e.Value.ToString() == "<空>")
             {
                 obj2 = DBNull.Value;
                 this.UpdateFieldValue(pField, obj2);
             }
             else
             {
                 domain = subtypes.get_Domain((this.m_pObject as IRowSubtypes).SubtypeCode, pField.Name);
                 if (domain is ICodedValueDomain)
                 {
                     domain2 = domain as ICodedValueDomain;
                     for (num3 = 0; num3 < domain2.CodeCount; num3++)
                     {
                         if (domain2.get_Name(num3) == e.Value.ToString())
                         {
                             this.UpdateFieldValue(pField, domain2.get_Value(num3));
                             break;
                         }
                     }
                 }
                 else
                 {
                     this.UpdateFieldValue(pField, e.Value);
                 }
             }
         }
         else if (e.Value.ToString() == "<空>")
         {
             obj2 = DBNull.Value;
             this.UpdateFieldValue(pField, obj2);
         }
         else
         {
             string       name         = (this.m_pObject.Class as IDataset).Name;
             CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(pField.Name, name);
             if (codeDomainEx != null)
             {
                 if ((codeDomainEx.ParentIDFieldName == null) || (codeDomainEx.ParentIDFieldName.Length == 0))
                 {
                     NameValueCollection codeDomain = codeDomainEx.GetCodeDomain();
                     for (num3 = 0; num3 < codeDomain.Count; num3++)
                     {
                         string str3 = codeDomain.Keys[num3];
                         if (str3 == e.Value.ToString())
                         {
                             this.UpdateFieldValue(pField, codeDomain[str3]);
                             break;
                         }
                     }
                 }
                 else
                 {
                     this.UpdateFieldValue(pField, codeDomainEx.GetCodeByName(e.Value.ToString()));
                 }
             }
             else
             {
                 domain = pField.Domain;
                 if (domain is ICodedValueDomain)
                 {
                     domain2 = domain as ICodedValueDomain;
                     for (num3 = 0; num3 < domain2.CodeCount; num3++)
                     {
                         if (domain2.get_Name(num3) == e.Value.ToString())
                         {
                             this.UpdateFieldValue(pField, domain2.get_Value(num3));
                             break;
                         }
                     }
                 }
                 else if (this.UpdateFieldValue(pField, e.Value))
                 {
                     this.m_CanDo = false;
                     row.Value    = this.m_pObject.get_Value(index);
                     this.m_CanDo = true;
                 }
             }
         }
     }
 }
Пример #10
0
 private void cboLayer_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.m_pVertXtraGrid.Clear();
     if (this.cboLayer.SelectedIndex != -1)
     {
         LayerObject   selectedItem = this.cboLayer.SelectedItem as LayerObject;
         IFeatureLayer pLayer       = selectedItem.Layer as IFeatureLayer;
         this.m_pFeatLayer = pLayer;
         if (pLayer != null)
         {
             ICursor cursor;
             (pLayer as IFeatureSelection).SelectionSet.Search(null, false, out cursor);
             IList <IRow> pLists = new List <IRow>();
             for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow())
             {
                 pLists.Add(row);
             }
             ComReleaser.ReleaseCOMObject(cursor);
             IFields   fields       = pLayer.FeatureClass.Fields;
             string[]  strArray     = new string[2];
             ISubtypes featureClass = pLayer.FeatureClass as ISubtypes;
             IDomain   domain       = null;
             for (int i = 0; i < fields.FieldCount; i++)
             {
                 IField pField = fields.get_Field(i);
                 if (this.CheckFieldIsVisible(pLayer, pField))
                 {
                     strArray[0] = pField.AliasName;
                     if (pField.Type == esriFieldType.esriFieldTypeGeometry)
                     {
                         strArray[1] = this.GetShapeString(pField);
                         this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                     }
                     else if (pField.Type == esriFieldType.esriFieldTypeBlob)
                     {
                         strArray[1] = "<二进制数据>";
                         this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                     }
                     else if ((pField.Type != esriFieldType.esriFieldTypeOID) && pField.Editable)
                     {
                         int               num3;
                         double            minValue;
                         double            maxValue;
                         ICodedValueDomain domain2 = null;
                         IList             list2   = new ArrayList();
                         if ((featureClass != null) && featureClass.HasSubtype)
                         {
                             if (featureClass.SubtypeFieldName == pField.Name)
                             {
                                 int num2;
                                 if (this.CheckValueIsEqual(pLists, i))
                                 {
                                     object obj4 = pLists[0].get_Value(i);
                                     if (obj4 is DBNull)
                                     {
                                         strArray[1] = "<空>";
                                     }
                                     else
                                     {
                                         try
                                         {
                                             strArray[1] =
                                                 featureClass.get_SubtypeName(
                                                     (pLists[0] as IRowSubtypes).SubtypeCode);
                                         }
                                         catch
                                         {
                                             strArray[1] = obj4.ToString();
                                         }
                                     }
                                 }
                                 else
                                 {
                                     strArray[1] = "<空>";
                                 }
                                 IEnumSubtype subtypes = featureClass.Subtypes;
                                 subtypes.Reset();
                                 for (string str = subtypes.Next(out num2);
                                      str != null;
                                      str = subtypes.Next(out num2))
                                 {
                                     list2.Add(str);
                                 }
                                 this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list2,
                                                                  !pField.Editable);
                             }
                             else
                             {
                                 domain = featureClass.get_Domain((pLists[0] as IRowSubtypes).SubtypeCode,
                                                                  pField.Name);
                                 if (domain is ICodedValueDomain)
                                 {
                                     domain2 = domain as ICodedValueDomain;
                                     if (pField.IsNullable)
                                     {
                                         list2.Add("<空>");
                                     }
                                     if (this.CheckValueIsEqual(pLists, i))
                                     {
                                         strArray[1] = pLists[0].get_Value(i).ToString();
                                     }
                                     else
                                     {
                                         strArray[1] = "<空>";
                                     }
                                     num3 = 0;
                                     while (num3 < domain2.CodeCount)
                                     {
                                         list2.Add(domain2.get_Name(num3));
                                         if (strArray[1] == domain2.get_Value(num3).ToString())
                                         {
                                             strArray[1] = domain2.get_Name(num3);
                                         }
                                         num3++;
                                     }
                                     this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list2,
                                                                      !pField.Editable);
                                 }
                                 else
                                 {
                                     if (this.CheckValueIsEqual(pLists, i))
                                     {
                                         strArray[1] = pLists[0].get_Value(i).ToString();
                                     }
                                     else
                                     {
                                         strArray[1] = "<空>";
                                     }
                                     if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                           (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                          (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                         (pField.Type == esriFieldType.esriFieldTypeInteger))
                                     {
                                         minValue = 0.0;
                                         maxValue = 0.0;
                                         if (domain is IRangeDomain)
                                         {
                                             minValue = (double)(domain as IRangeDomain).MinValue;
                                             maxValue = (double)(domain as IRangeDomain).MaxValue;
                                         }
                                         if (pField.Editable)
                                         {
                                             this.m_pVertXtraGrid.AddSpinEdit(strArray[0], strArray[1], false,
                                                                              minValue, maxValue);
                                         }
                                         else
                                         {
                                             this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                                         }
                                     }
                                     else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                     {
                                         this.m_pVertXtraGrid.AddDateEdit(strArray[0], strArray[1],
                                                                          !pField.Editable);
                                     }
                                     else
                                     {
                                         if (this.CheckValueIsEqual(pLists, i))
                                         {
                                             strArray[1] = pLists[0].get_Value(i).ToString();
                                         }
                                         else
                                         {
                                             strArray[1] = "<空>";
                                         }
                                         this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1],
                                                                          !pField.Editable);
                                     }
                                 }
                             }
                         }
                         else
                         {
                             domain = pField.Domain;
                             if (domain != null)
                             {
                                 if (domain is ICodedValueDomain)
                                 {
                                     domain2 = domain as ICodedValueDomain;
                                     if (pField.IsNullable)
                                     {
                                         list2.Add("<空>");
                                     }
                                     if (this.CheckValueIsEqual(pLists, i))
                                     {
                                         strArray[1] = pLists[0].get_Value(i).ToString();
                                     }
                                     else
                                     {
                                         strArray[1] = "<空>";
                                     }
                                     num3 = 0;
                                     while (num3 < domain2.CodeCount)
                                     {
                                         list2.Add(domain2.get_Name(num3));
                                         if (strArray[1] == domain2.get_Value(num3).ToString())
                                         {
                                             strArray[1] = domain2.get_Name(num3);
                                         }
                                         num3++;
                                     }
                                     this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list2,
                                                                      !pField.Editable);
                                 }
                                 else
                                 {
                                     if (this.CheckValueIsEqual(pLists, i))
                                     {
                                         strArray[1] = pLists[0].get_Value(i).ToString();
                                     }
                                     else
                                     {
                                         strArray[1] = "<空>";
                                     }
                                     if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                           (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                          (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                         (pField.Type == esriFieldType.esriFieldTypeInteger))
                                     {
                                         minValue = 0.0;
                                         maxValue = 0.0;
                                         if (domain is IRangeDomain)
                                         {
                                             minValue = (double)(domain as IRangeDomain).MinValue;
                                             maxValue = (double)(domain as IRangeDomain).MaxValue;
                                         }
                                         if (pField.Editable)
                                         {
                                             this.m_pVertXtraGrid.AddSpinEdit(strArray[0], strArray[1], false,
                                                                              minValue, maxValue);
                                         }
                                         else
                                         {
                                             this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                                         }
                                     }
                                     else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                     {
                                         this.m_pVertXtraGrid.AddDateEdit(strArray[0], strArray[1],
                                                                          !pField.Editable);
                                     }
                                     else
                                     {
                                         this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1],
                                                                          !pField.Editable);
                                     }
                                 }
                             }
                             else
                             {
                                 if (this.CheckValueIsEqual(pLists, i))
                                 {
                                     strArray[1] = pLists[0].get_Value(i).ToString();
                                 }
                                 else
                                 {
                                     strArray[1] = "<空>";
                                 }
                                 string name = (pLayer.FeatureClass as IDataset).Name;
                                 NameValueCollection codeDomain = CodeDomainManage.GetCodeDomain(pField.Name,
                                                                                                 name);
                                 if (codeDomain.Count > 0)
                                 {
                                     if (pField.IsNullable)
                                     {
                                         list2.Add("<空>");
                                     }
                                     for (num3 = 0; num3 < codeDomain.Count; num3++)
                                     {
                                         string str3 = codeDomain.Keys[num3];
                                         list2.Add(str3);
                                         if (strArray[1] == codeDomain[str3])
                                         {
                                             strArray[1] = str3;
                                         }
                                     }
                                     this.m_pVertXtraGrid.AddComBoBox(strArray[0], strArray[1], list2,
                                                                      !pField.Editable);
                                 }
                                 else if ((((pField.Type == esriFieldType.esriFieldTypeSmallInteger) ||
                                            (pField.Type == esriFieldType.esriFieldTypeSingle)) ||
                                           (pField.Type == esriFieldType.esriFieldTypeDouble)) ||
                                          (pField.Type == esriFieldType.esriFieldTypeInteger))
                                 {
                                     if (pField.Editable)
                                     {
                                         this.m_pVertXtraGrid.AddSpinEdit(strArray[0], strArray[1], false, 0.0,
                                                                          0.0);
                                     }
                                     else
                                     {
                                         this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], true);
                                     }
                                 }
                                 else if (pField.Type == esriFieldType.esriFieldTypeDate)
                                 {
                                     this.m_pVertXtraGrid.AddDateEdit(strArray[0], strArray[1], !pField.Editable);
                                 }
                                 else
                                 {
                                     this.m_pVertXtraGrid.AddTextEdit(strArray[0], strArray[1], !pField.Editable);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #11
0
 private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
 {
     if (this.m_CanDo)
     {
         if (this.m_pFeatLayer == null)
         {
             LayerObject   selectedItem = this.cboLayer.SelectedItem as LayerObject;
             IFeatureLayer layer        = selectedItem.Layer as IFeatureLayer;
             this.m_pFeatLayer = layer;
         }
         if (this.m_pFeatLayer != null)
         {
             object         obj3;
             ISubtypes      featureClass = this.m_pFeatLayer.FeatureClass as ISubtypes;
             GridEditorItem row          = this.gridView1.GetRow(e.RowHandle) as GridEditorItem;
             int            index        = this.m_pFeatLayer.FeatureClass.Fields.FindFieldByAliasName(row.Name);
             IField         pField       = this.m_pFeatLayer.FeatureClass.Fields.get_Field(index);
             if ((featureClass != null) && featureClass.HasSubtype)
             {
                 if (featureClass.SubtypeFieldName == pField.Name)
                 {
                     IEnumSubtype subtypes = featureClass.Subtypes;
                     subtypes.Reset();
                     int subtypeCode = 0;
                     for (string str = subtypes.Next(out subtypeCode);
                          str != null;
                          str = subtypes.Next(out subtypeCode))
                     {
                         if (e.Value.ToString() == str)
                         {
                             this.UpdateFieldValue(pField, subtypeCode);
                             break;
                         }
                     }
                 }
                 else if (e.Value.ToString() == "<空>")
                 {
                     obj3 = DBNull.Value;
                     this.UpdateFieldValue(pField, obj3);
                 }
                 else
                 {
                     this.UpdateFieldValue(pField, e.Value);
                 }
             }
             else if (e.Value.ToString() == "<空>")
             {
                 obj3 = DBNull.Value;
                 this.UpdateFieldValue(pField, obj3);
             }
             else
             {
                 int    num3;
                 string name = (this.m_pFeatLayer.FeatureClass as IDataset).Name;
                 NameValueCollection codeDomain = CodeDomainManage.GetCodeDomain(pField.Name, name);
                 if (codeDomain.Count > 0)
                 {
                     for (num3 = 0; num3 < codeDomain.Count; num3++)
                     {
                         string str3 = codeDomain.Keys[num3];
                         if (str3 == e.Value.ToString())
                         {
                             this.UpdateFieldValue(pField, codeDomain[str3]);
                             break;
                         }
                     }
                 }
                 else
                 {
                     IDomain domain = pField.Domain;
                     if (domain is ICodedValueDomain)
                     {
                         ICodedValueDomain domain2 = domain as ICodedValueDomain;
                         for (num3 = 0; num3 < domain2.CodeCount; num3++)
                         {
                             if (domain2.get_Name(num3) == e.Value.ToString())
                             {
                                 this.UpdateFieldValue(pField, domain2.get_Value(num3));
                                 break;
                             }
                         }
                     }
                     else if (this.UpdateFieldValue(pField, e.Value))
                     {
                         this.m_CanDo = false;
                         this.m_CanDo = true;
                     }
                 }
             }
         }
     }
 }
Пример #12
0
        private string method_7(IRow irow_0, IField ifield_0, int int_0)
        {
            int               num;
            string            str     = irow_0.get_Value(int_0).ToString();
            ISubtypes         table   = irow_0.Table as ISubtypes;
            ICodedValueDomain domain  = null;
            IList             list    = new ArrayList();
            IDomain           domain2 = null;

            if ((table != null) && table.HasSubtype)
            {
                if (table.SubtypeFieldName == ifield_0.Name)
                {
                    try
                    {
                        str = table.get_SubtypeName((irow_0 as IRowSubtypes).SubtypeCode);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    domain2 = table.get_Domain((irow_0 as IRowSubtypes).SubtypeCode, ifield_0.Name);
                    if (domain2 is ICodedValueDomain)
                    {
                        domain = domain2 as ICodedValueDomain;
                        if (ifield_0.IsNullable)
                        {
                            list.Add("<空>");
                        }
                        num = 0;
                        while (num < domain.CodeCount)
                        {
                            if (str == domain.get_Value(num).ToString())
                            {
                                str = domain.get_Name(num);
                                break;
                            }
                            num++;
                        }
                    }
                }
            }
            domain2 = ifield_0.Domain;
            if (domain2 != null)
            {
                if (domain2 is ICodedValueDomain)
                {
                    domain = domain2 as ICodedValueDomain;
                    num    = 0;
                    while (num < domain.CodeCount)
                    {
                        if (str == domain.get_Value(num).ToString())
                        {
                            return(domain.get_Name(num));
                        }
                        num++;
                    }
                }
                return(str);
            }
            string       name         = (irow_0.Table as IDataset).Name;
            CodeDomainEx codeDomainEx = CodeDomainManage.GetCodeDomainEx(ifield_0.Name, name);

            if (codeDomainEx == null)
            {
                return(str);
            }
            if ((codeDomainEx.ParentIDFieldName == null) || (codeDomainEx.ParentIDFieldName.Length == 0))
            {
                NameValueCollection codeDomain = codeDomainEx.GetCodeDomain();
                for (num = 0; num < codeDomain.Count; num++)
                {
                    string str3 = codeDomain.Keys[num];
                    if (str == codeDomain[str3])
                    {
                        str = str3;
                    }
                }
                return(str);
            }
            return(codeDomainEx.FindName(str));
        }
Пример #13
0
        public bool Apply()
        {
            int num;

            if (!(!this.bool_2 || this.bool_3))
            {
                return(true);
            }
            this.bool_3 = false;
            if (NewObjectClassHelper.m_pObjectClassHelper.ObjectClass != null)
            {
                COMException exception;
                Exception    exception2;
                this.itable_0 = NewObjectClassHelper.m_pObjectClassHelper.ObjectClass as ITable;
                string name = (this.itable_0 as IDataset).Name;
                try
                {
                    IField       field;
                    CodeDomainEx ex;
                    try
                    {
                        for (num = 0; num < this.ifieldsEdit_1.FieldCount; num++)
                        {
                            IFields fields = this.itable_0.Fields;
                            field = this.ifieldsEdit_1.get_Field(num);
                            int index = this.itable_0.FindField(field.Name);
                            if (index != -1)
                            {
                                this.itable_0.DeleteField(fields.get_Field(index));
                                if ((NewObjectClassHelper.m_pObjectClassHelper != null) &&
                                    NewObjectClassHelper.m_pObjectClassHelper.FieldDomains.ContainsKey(field))
                                {
                                    ex = NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[field];
                                    if (ex != null)
                                    {
                                        CodeDomainManage.DeleteCodeDoaminMap(name, field.Name);
                                    }
                                }
                            }
                        }
                    }
                    catch (COMException exception1)
                    {
                        exception = exception1;
                        Logger.Current.Error("", exception, "");
                        MessageBox.Show(exception.Message);
                        return(false);
                    }
                    catch (Exception exception3)
                    {
                        exception2 = exception3;
                        Logger.Current.Error("", exception2, "");
                    }
                    try
                    {
                        for (num = 0; num < this.ifieldsEdit_0.FieldCount; num++)
                        {
                            IField key = this.ifieldsEdit_0.get_Field(num);
                            this.itable_0.AddField(this.ifieldsEdit_0.get_Field(num));
                            if ((NewObjectClassHelper.m_pObjectClassHelper != null) &&
                                NewObjectClassHelper.m_pObjectClassHelper.FieldDomains.ContainsKey(key))
                            {
                                ex = NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[key];
                                if (ex != null)
                                {
                                    CodeDomainManage.AddFieldCodeDoaminMap(name, key.Name, ex.DomainID);
                                }
                            }
                        }
                    }
                    catch (COMException exception4)
                    {
                        exception = exception4;
                        if (exception.ErrorCode == -2147220969)
                        {
                            MessageBox.Show("不是对象的所有者,无法修改对象!");
                        }
                        else if (exception.ErrorCode == -2147219887)
                        {
                            MessageBox.Show("无法添加字段!");
                        }
                        else
                        {
                            Logger.Current.Error("", exception, "");
                            MessageBox.Show(exception.Message);
                        }
                    }
                    catch (Exception exception5)
                    {
                        exception2 = exception5;
                        Logger.Current.Error("", exception2, "");
                    }
                    if (!ObjectClassShareData.m_IsShapeFile)
                    {
                        IClassSchemaEdit edit = this.itable_0 as IClassSchemaEdit;
                        num = 0;
                        while (num < this.ilist_0.Count)
                        {
                            field = this.ilist_0[num];
                            try
                            {
                                if (((FieldChangeType)this.ilist_1[num]) == FieldChangeType.FCTAlias)
                                {
                                    edit.AlterFieldAliasName(field.Name, field.AliasName);
                                }
                                else if (((FieldChangeType)this.ilist_1[num]) == FieldChangeType.FCTDomain)
                                {
                                    edit.AlterDomain(field.Name, field.Domain);
                                    if ((NewObjectClassHelper.m_pObjectClassHelper != null) &&
                                        NewObjectClassHelper.m_pObjectClassHelper.FieldDomains.ContainsKey(field))
                                    {
                                        ex = NewObjectClassHelper.m_pObjectClassHelper.FieldDomains[field];
                                        if (ex != null)
                                        {
                                            CodeDomainManage.AddFieldCodeDoaminMap(name, field.Name, ex.DomainID);
                                        }
                                        else
                                        {
                                            CodeDomainManage.DeleteCodeDoaminMap(name, field.Name);
                                        }
                                    }
                                }
                            }
                            catch (COMException exception6)
                            {
                                exception = exception6;
                                (field as IFieldEdit).AliasName_2 = field.Name;
                                if (exception.ErrorCode == -2147220969)
                                {
                                    MessageBox.Show("不是对象的所有者,无法修改字段[" + field.Name + "]!");
                                }
                                else if (exception.ErrorCode == -2147219887)
                                {
                                    MessageBox.Show("无法修改字段[" + field.Name + "]!");
                                }
                                else
                                {
                                    Logger.Current.Error("", exception, "");
                                    MessageBox.Show(exception.Message);
                                }
                                return(false);
                            }
                            catch (Exception exception7)
                            {
                                exception2 = exception7;
                                Logger.Current.Error("", exception2, "");
                            }
                            num++;
                        }
                    }
                    if (!ObjectClassShareData.m_IsShapeFile)
                    {
                        (this.itable_0 as ISchemaLock).ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
                    }
                    this.ifieldsEdit_1.DeleteAllFields();
                    this.ifieldsEdit_0.DeleteAllFields();
                    this.ilist_0.Clear();
                    this.ilist_1.Clear();
                    this.ifields_0 = (this.itable_0.Fields as IClone).Clone() as IFields;
                    this.method_2(this.listView2, this.ifields_0);
                    this.listView2.LockRowCount = this.ifields_0.FieldCount;
                    goto Label_0512;
                }
                catch (COMException exception8)
                {
                    exception = exception8;
                    if (exception.ErrorCode == -2147220969)
                    {
                        MessageBox.Show("不是对象的所有者,无法修改对象!");
                    }
                    else
                    {
                        Logger.Current.Error("", exception, "");
                        MessageBox.Show(exception.Message);
                    }
                    return(false);
                }
                catch (Exception exception9)
                {
                    exception2 = exception9;
                    Logger.Current.Error("", exception2, "");
                    MessageBox.Show(exception2.Message);
                    return(false);
                }
            }
            if (this.ifields_0 != null)
            {
                for (num = 0; num < this.ifieldsEdit_0.FieldCount; num++)
                {
                    (this.ifields_0 as IFieldsEdit).AddField(this.ifieldsEdit_0.get_Field(num));
                }
            }
Label_0512:
            return(true);
        }