Ejemplo n.º 1
0
        public static ZDChangeHistoryInfo CreateHistory(IFeature ifeature_0)
        {
            ZDChangeHistoryInfo zDChangeHistoryInfo = new ZDChangeHistoryInfo();

            zDChangeHistoryInfo.Feature    = ifeature_0;
            zDChangeHistoryInfo.OID        = ifeature_0.OID;
            zDChangeHistoryInfo.HisOID     = -1;
            zDChangeHistoryInfo.SouceInfos = new System.Collections.Generic.List <ZDChangeHistoryInfo>();
            zDChangeHistoryInfo.LoadParent();
            return(zDChangeHistoryInfo);
        }
Ejemplo n.º 2
0
 public void LoadParent()
 {
     this.IsLoad = true;
     try
     {
         ZDHistoryTable zDHistoryTable = new ZDHistoryTable();
         string         text           = (this.Feature.Class as IDataset).Name;
         string[]       array          = text.Split(new char[]
         {
             '.'
         });
         text = array[array.Length - 1];
         if (text.Length > 4)
         {
             string a = text.Substring(text.Length - 4).ToLower();
             if (a == "_his")
             {
                 text = text.Substring(0, text.Length - 4);
             }
         }
         string        historyZDFeatureName = ZDRegister.GetHistoryZDFeatureName(this.Feature.Class as IFeatureClass);
         string        registerZDGuid       = ZDRegister.GetRegisterZDGuid(this.Feature.Class as IFeatureClass);
         IFeatureClass ifeatureClass_       =
             ((this.Feature.Class as IDataset).Workspace as IFeatureWorkspace).OpenFeatureClass(
                 historyZDFeatureName);
         string whereClause = string.Format("{0}='{1}' and {2}={3}", new object[]
         {
             zDHistoryTable.ZDRegisterGuidName,
             registerZDGuid,
             zDHistoryTable.NewZDOIDName,
             this.OID
         });
         IQueryFilter queryFilter = new QueryFilter();
         queryFilter.WhereClause = whereClause;
         IWorkspace workspace = AppConfigInfo.GetWorkspace();
         ITable     table     = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName);
         ICursor    cursor    = table.Search(queryFilter, false);
         for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow())
         {
             ZDChangeHistoryInfo zDChangeHistoryInfo = new ZDChangeHistoryInfo();
             object fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChangeTypeFieldName);
             if (this.ChageType == ZDEditType.Unknown)
             {
                 this.ChageType = (ZDEditType)System.Convert.ToInt32(fieldValue);
             }
             fieldValue      = RowOperator.GetFieldValue(row, zDHistoryTable.ChageDateFieldName);
             this.ChangeDate = System.Convert.ToDateTime(fieldValue);
             fieldValue      = RowOperator.GetFieldValue(row, zDHistoryTable.OrigineZDOIDName);
             int oID = System.Convert.ToInt32(fieldValue);
             zDChangeHistoryInfo.Feature    = ZDChangeHistory.GetHisFeat(ifeatureClass_, oID);
             zDChangeHistoryInfo.OID        = oID;
             zDChangeHistoryInfo.TopFeat    = this.Feature;
             zDChangeHistoryInfo.SouceInfos = new System.Collections.Generic.List <ZDChangeHistoryInfo>();
             this.SouceInfos.Add(zDChangeHistoryInfo);
         }
         ComReleaser.ReleaseCOMObject(cursor);
     }
     catch (System.Exception)
     {
     }
 }