예제 #1
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            IFeatureLayer theNeatlineLayer = this.NeatlineLayer;
            if (theNeatlineLayer == null)
                theMessages.Add("neatline-layer not found in layers passed to " + this.Name);

            if (this.LayerCount <= 0)
                theMessages.Add("No layers passed to " + this.Name);
            else if (this.ConstrainToSelection)
            {
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);
                    if (theFLayer != theNeatlineLayer)
                    {
                        IFeatureSelection theFSel = (IFeatureSelection)theFLayer;
                        if (theFSel.SelectionSet.Count == 0)
                            theMessages.Add("Test " + this.Name + " is constrained to selection, but layer " + theFLayer.Name + " has no selected features");
                    }
                }
            }

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            for (int i = 0; i < this.LayerCount; i++)
            {
                IFeatureLayer theFLayer = this.get_Layer(i);
                if (this.SupportsGeometryType(theFLayer.FeatureClass.ShapeType) == false)
                    theMessages.Add("Geometry type " + theFLayer.FeatureClass.ShapeType + " of layer " + theFLayer.Name + " not supported by " + this.Name);
            }

            int idx = this.FindParameter("search-radius");
            DoubleParameterInfo theInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theInfo.ParamValue <= 0)
                theMessages.Add("Zero or negative value passed as search radius for " + this.Name);

            idx = this.FindParameter("aspect-ratio-limit");
            theInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theInfo.ParamValue <= 1)
                theMessages.Add("Segment length ratio should be over 1.0 for " + this.Name);

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #2
0
파일: EditLogger.cs 프로젝트: EAWCS1/SUITT
        internal EditLogger(ISDUTExtension ext, Transaction current, TransactionConfig config, QAManager qaManager)
        {
            chg_evnt = new IEditEvents_OnChangeFeatureEventHandler(LogFeatureUpdate);
            crt_evnt = new IEditEvents_OnCreateFeatureEventHandler(LogFeatureInsert);
            del_evnt = new IEditEvents_OnDeleteFeatureEventHandler(LogFeatureDelete);

            transaction = current;
            this.config = config;
            this.qaManager = qaManager;

            editor = ext.Editor;

            ((IEditEvents_Event)editor).OnChangeFeature += chg_evnt;
            ((IEditEvents_Event)editor).OnCreateFeature += crt_evnt;
            ((IEditEvents_Event)editor).OnDeleteFeature += del_evnt;
        }
예제 #3
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0 || this.LayerCount % 2 != 0)
                theMessages.Add("Use Special Config - Interleave option for: " + this.Name);
                //theMessages.Add("Need to pass an even number of layers to " + this.Name);

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #4
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            IFeatureLayer theRefLayer = this.ReferenceLayer;
            if (theRefLayer == null)
                theMessages.Add("reference-layer not found in layers passed to " + this.Name);

            if (this.LayerCount <= 0)
                theMessages.Add("No layers passed to " + this.Name);
            else if (this.ConstrainToSelection)
            {
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);
                    if (theFLayer != theRefLayer)
                    {
                        IFeatureSelection theFSel = (IFeatureSelection)theFLayer;
                        if (theFSel.SelectionSet.Count == 0)
                            theMessages.Add("Test " + this.Name + " is constrained to selection, but layer " + theFLayer.Name + " has no selected features");
                    }
                }
            }

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            for (int i = 0; i < this.LayerCount; i++)
            {
                IFeatureLayer theFLayer = this.get_Layer(i);
                if (this.SupportsGeometryType(theFLayer.FeatureClass.ShapeType) == false)
                    theMessages.Add("Geometry type " + theFLayer.FeatureClass.ShapeType + " of layer " + theFLayer.Name + " not supported by " + this.Name);
            }

            int idx = this.FindParameter("minimum-arc-proportional");
            DoubleParameterInfo theDInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theDInfo.ParamValue <= 1)
                theMessages.Add("minimum-arc-proportional value less than or equal to 1 passed to " + this.Name);

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #5
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 1 || this.LayerCount % 2 != 0)
                theMessages.Add("Use Special Config - Interleave option for: " + this.Name);

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            // Added: put projection errors up front
            // Compare the shape type of the odd layers with the evens.
            // If the user has used the magic wand tool, this should be right
            for (int layerIdx = 0; layerIdx < this.LayerCount; layerIdx += 2)
            {
                IFeatureLayer theFLayer1 = this.get_Layer(layerIdx);
                IFeatureLayer theFLayer2 = this.get_Layer(layerIdx + 1);

                if (theFLayer1 == null || theFLayer2 == null
                    || theFLayer1.Valid == false || theFLayer2.Valid == false
                    || theFLayer1.FeatureClass == null || theFLayer2.FeatureClass == null)
                {
                    theMessages.Add("At least one invalid layer passed to " + this.Name + ".");
                    break;
                }

                IGeoDataset theGeoDS1 = theFLayer1.FeatureClass as IGeoDataset;
                IGeoDataset theGeoDS2 = theFLayer2.FeatureClass as IGeoDataset;
                IDataset theDataset1 = (IDataset)theGeoDS1;
                IDataset theDataset2 = (IDataset)theGeoDS2;
                if (SpatialReferenceHelper.AreProjectionsSame(theGeoDS1.SpatialReference, theGeoDS2.SpatialReference) == false)
                {
                    theMessages.Add("Projection of " + theDataset1.Name + " is not the same as that of " + theDataset2.Name + " passed to " + this.Name + ".");
                    break;
                }
            }

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #6
0
파일: DBValidSID.cs 프로젝트: EAWCS1/SUITT
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0)
                theMessages.Add("Need to pass at least one layer to " + this.Name);
            if (this.TableCount <= 0)
                theMessages.Add("Need to pass at least one table to " + this.Name);

            if (this.LayerCount > 0 && this.TableCount > 0)
            {
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);

                    if (i < this.TableCount)
                    {
                        string theSidField = this.get_PairedSIDFieldName(i);
                        if (theSidField == "")
                            theMessages.Add("Could not find SID field/OSDB link for " + theFLayer.Name);
                    }
                    else
                    {
                        string theSidField = this.get_SIDFieldName(i);
                        if (theSidField == "")
                            theMessages.Add("Could not find SID field for " + theFLayer.Name);
                    }

                    if (this.ConstrainToSelection && ((IFeatureSelection)theFLayer).SelectionSet.Count == 0)
                        theMessages.Add("Test " + this.Name + " is constrained to selection, but layer " + theFLayer.Name + " has no selected features");
                }
            }

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #7
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            TxID = currentTransaction.TxId;

            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0)
                theMessages.Add("No layers passed to " + this.Name);

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            IFeatureLayer theSeeLayer = this.SEELayer;
            if (theSeeLayer == null)
                theMessages.Add("SEE Layer not passed to " + this.Name);
            else
            {
                // Try to select the SEE polygon
                string theTxID = this.TxID;
                IQueryFilter theQF = new QueryFilterClass();
                theQF.WhereClause = SEE_ID_FIELD_NAME + " = '" + theTxID + "'";
                IFeatureCursor theFCursor = theSeeLayer.Search(theQF, false);
                IFeature theSee = theFCursor.NextFeature();
                if (theSee == null)
                {
                    theMessages.Add("Could not locate a SEE with TxID " + theTxID + " for test " + this.Name);
                }
                Marshal.ReleaseComObject(theFCursor);
                theFCursor = null;
            }

            if (this._eDao == null)
            {
                theMessages.Add("Edits Data Access Object not passed to test " + this.Name);
            }
            //else if (this._tmConfig == null)
            //{
            //    theMessages.Add("Transaction Config object not passed to test " + this.Name);
            //}
            else
            {
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);
                    if (this.SupportsGeometryType(theFLayer.FeatureClass.ShapeType) == false)
                        theMessages.Add("Geometry type " + theFLayer.FeatureClass.ShapeType + " of layer " + theFLayer.Name + " not supported by " + this.Name);
                    else
                    {
                        if (theFLayer != theSeeLayer)
                        {
                            string dsName = ((IDataset)theFLayer.FeatureClass).Name;
                            string layerName = theFLayer.Name;

                            //string theLayerKey = this._tmConfig.get_KeyFromWorking(((IDataset)theFLayer.FeatureClass).Name);
                            if (layerName == null)
                                theMessages.Add("Layer " + theFLayer.Name + " is not a transaction working layer " + this.Name);
                        }
                    }
                }
            }

            int idx = this.FindParameter("ignore-shift-smaller-than");
            DoubleParameterInfo theMinInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theMinInfo.ParamValue < 0)
                theMessages.Add("Negative value passed as lower limit for " + this.Name);

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #8
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            bool bSingleLayer = Convert.ToBoolean(this.get_ParameterValue(this.FindParameter("single-layer")));
            ChooseFieldsParameterInfo theCFParamInfo = (ChooseFieldsParameterInfo)this._params[this.FindParameter("constrained-fields")];
            FeatureClassField[] theFields = theCFParamInfo.ParamValueArray;

            if (this.LayerCount <= 0)
                theMessages.Add("Need to pass at least one layer to " + this.Name);
            else if (theFields.Length == 0)
                theMessages.Add("Need to specify at least one constrained field for " + this.Name);
            else
            {
                foreach (FeatureClassField fcf in theFields)
                {
                    int layerIdx; int fieldIdx;
                    bool bFound = FindFeatureClassField(fcf, out layerIdx, out fieldIdx);
                    if (!bFound)
                        theMessages.Add("Feature class " + fcf.FeatureClassName + ", field " + fcf.FieldName + " not found in layers passed to " + this .Name);
                }
                if (!bSingleLayer)
                {
                    ChooseFieldsParameterInfo theFKParamInfo = (ChooseFieldsParameterInfo)this._params[this.FindParameter(ParameterInfo.PARAM_REQUIREDLAYERSFKEYS)];
                    FeatureClassField[] theFkeys = theFKParamInfo.ParamValueArray;

                    if (this.LayerCount % 2 != 0)
                    {
                        theMessages.Add("Use Special Config - Interleave option for: " + this.Name);
                        //theMessages.Add("Need to pass an even number of layers to " + this.Name);
                    }
                    else if (this.LayerCount / 2 != theFkeys.Length)
                    {
                        theMessages.Add("Need to pass one foreign key for each pair of layers passed to " + this.Name);
                    }
                    else
                    {
                        for (int i = 0; i < this.LayerCount; i += 2)
                        {
                            IFeatureLayer theWorkLayer = this.get_Layer(i);
                            IFeatureLayer theOsdbLayer = this.get_Layer(i + 1);

                            foreach (FeatureClassField fcf in theFields)
                            {
                                if (fcf.FeatureClassName == ((IDataset)theWorkLayer.FeatureClass).Name)
                                {
                                    int idxWork; int idxOsdb;
                                    if (!FindUniqueFieldPair(fcf.FieldName, theWorkLayer.FeatureClass, theOsdbLayer.FeatureClass, out idxWork, out idxOsdb))
                                        theMessages.Add("Could not find " + fcf.FieldName + ", in layers " + theWorkLayer.Name + " and " + theOsdbLayer.Name + " passed to " + this.Name);
                                }
                            }
                        }
                    }
                }
            }

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #9
0
파일: BaseTest.cs 프로젝트: EAWCS1/SUITT
 public abstract string CheckConfig(Transaction currentTransation);
예제 #10
0
        private void persist(ICollection conflicts, Transaction transaction, string key)
        {
            for(IEnumerator enumerator = conflicts.GetEnumerator();enumerator.MoveNext();)
            {
                Conflict conflict = (Conflict)enumerator.Current;
                //TransactionConfig.LayerConfig lc = this.transactionManager.transactionConfig().get_LayerConfig(conflict.ConfigKey);

                IFeatureClass con_fc = null;
                try
                {
                    con_fc = ((IFeatureWorkspace)transaction.PGDBConnection).OpenFeatureClass("C_" + key);
                }
                catch(Exception e)
                {
                    MessageBox.Show("PGDB Feature Class " + "C_" + key + " Not Found",
                        "EXCEPTION", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    throw new HandledException(e);
                }

                string[] keys = new string[] { "ACQUISITION_SID", "ADMIN_AREA_SID", "INTRID_SID", "TA_REVERSIONS", "REVERSION_SID", "PIN_SID", "MAJOR_TRANS_SID", "WELLSITE_SID", con_fc.Fields.get_Field(0).Name };

                IQueryFilter pk_filter = new QueryFilterClass();
                string whereClause = "";

                for (int i = 0; i < keys.Length; i++)
                {
                    int index = con_fc.FindField(keys[i]);
                    if (index != -1)
                    {
                        string cond = keys[i] + " = " + conflict.PrimaryKeyValues[i];
                        whereClause = cond;
                        break;
                    }
                }

                pk_filter.WhereClause = whereClause;

                IFeatureCursor cursor = null;
                try
                {
                    // is this an insert or update?
                    cursor = con_fc.Update(pk_filter, true);

                    IFeature feature = cursor.NextFeature();
                    int index = -1;
                    if(feature != null)
                    {
                        if (!same(conflict, feature, keys))
                        {
                            // update -- in all cases this represents newer information, so store it

                            Logger.Write("Updating Conflict " + feature.OID);
                            IGeometry geom = conflict.Shape;
                            if (geom != null)
                            {
                                if (geom is ITopologicalOperator2)
                                {
                                    ITopologicalOperator2 geomtopo = (ITopologicalOperator2)geom;
                                    geomtopo.IsKnownSimple_2 = false;
                                    try
                                    {
                                        geomtopo.Simplify();
                                    }
                                    catch (Exception e)
                                    {
                                        Logger.Warn(e);
                                    }
                                }

                                // need to reproject here!
                                geom.Project(((IGeoDataset)con_fc).SpatialReference);
                                geom.SnapToSpatialReference();
                            }
                            feature.Shape = geom;

                            index = feature.Fields.FindField(CONFLICT_STATE);
                            if(index>-1)
                            {
                                switch(conflict.State)
                                {
                                    case ConflictState.Open:
                                        feature.set_Value(index,CONFLICT_STATE_OPEN);
                                        break;
                                    case ConflictState.Resolved:
                                        feature.set_Value(index,CONFLICT_STATE_RESOLVED);
                                        break;
                                }
                            }

                            index = feature.Fields.FindField(CONFLICT_TYPE);
                            if(index>-1)
                            {
                                switch(conflict.Type)
                                {
                                    case ConflictType.Delete_Update:
                                        feature.set_Value(index,CONFLICT_TYPE_DU);
                                        break;
                                    case ConflictType.Insert_Insert:
                                        feature.set_Value(index,CONFLICT_TYPE_II);
                                        break;
                                    case ConflictType.Insert_Update:
                                        feature.set_Value(index,CONFLICT_TYPE_IU);
                                        break;
                                    case ConflictType.Update_Delete:
                                        feature.set_Value(index,CONFLICT_TYPE_UD);
                                        break;
                                    case ConflictType.Update_Insert:
                                        feature.set_Value(index,CONFLICT_TYPE_UI);
                                        break;
                                    case ConflictType.Update_Update:
                                        feature.set_Value(index,CONFLICT_TYPE_UU);
                                        break;
                                }
                            }

                            index = feature.Fields.FindField(CONFLICT_USER);
                            if(index>-1)
                            {
                                feature.set_Value(index,conflict.User);
                            }

                            index = feature.Fields.FindField(CONFLICT_DATE);
                            if(index>-1)
                            {
                                feature.set_Value(index,conflict.Date);
                            }

                            cursor.UpdateFeature(feature);
                            if(cursor.NextFeature() != null)
                            {
                                throw new Exception("Error Storing Conflict for "+conflict.ConfigKey);
                            }
                        }
                    }
                    else
                    {
                        // insert
                        Logger.Write("Inserting Conflict");
                        Utils.Release(cursor);

                        cursor = con_fc.Insert(false);
                        IFeatureBuffer buffer = con_fc.CreateFeatureBuffer();

                        string[] values = conflict.PrimaryKeyValues;

                        for(int i=0;i<keys.Length;i++)
                        {
                            index = buffer.Fields.FindField(keys[i]);
                            if(index>-1){
                                buffer.set_Value(index,values[i]);
                                break;
                            }
                        }

                        IGeometry geom = conflict.Shape;
                        if (geom != null)
                        {
                            if (geom is ITopologicalOperator2)
                            {
                                ITopologicalOperator2 geomtopo = (ITopologicalOperator2)geom;
                                geomtopo.IsKnownSimple_2 = false;
                                try
                                {
                                    geomtopo.Simplify();
                                }
                                catch (Exception e)
                                {
                                    Logger.Warn(e);
                                }
                            }

                            // need to reproject here!
                            geom.Project(((IGeoDataset)con_fc).SpatialReference);
                            geom.SnapToSpatialReference();
                        }
                        buffer.Shape = geom;

                        index = buffer.Fields.FindField(CONFLICT_STATE);
                        if(index>-1)
                        {
                            switch(conflict.State)
                            {
                                case ConflictState.Open:
                                    buffer.set_Value(index,CONFLICT_STATE_OPEN);
                                    break;
                                case ConflictState.Resolved:
                                    buffer.set_Value(index,CONFLICT_STATE_RESOLVED);
                                    break;
                            }
                        }

                        index = buffer.Fields.FindField(CONFLICT_TYPE);
                        if(index>-1)
                        {
                            switch(conflict.Type)
                            {
                                case ConflictType.Delete_Update:
                                    buffer.set_Value(index,CONFLICT_TYPE_DU);
                                    break;
                                case ConflictType.Insert_Insert:
                                    buffer.set_Value(index,CONFLICT_TYPE_II);
                                    break;
                                case ConflictType.Insert_Update:
                                    buffer.set_Value(index,CONFLICT_TYPE_IU);
                                    break;
                                case ConflictType.Update_Delete:
                                    buffer.set_Value(index,CONFLICT_TYPE_UD);
                                    break;
                                case ConflictType.Update_Insert:
                                    buffer.set_Value(index,CONFLICT_TYPE_UI);
                                    break;
                                case ConflictType.Update_Update:
                                    buffer.set_Value(index,CONFLICT_TYPE_UU);
                                    break;
                            }
                        }

                        index = buffer.Fields.FindField(CONFLICT_USER);
                        if(index>-1)
                        {
                            buffer.set_Value(index,conflict.User);
                        }

                        index = buffer.Fields.FindField(CONFLICT_DATE);
                        if(index>-1)
                        {
                            buffer.set_Value(index,conflict.Date);
                        }

                        cursor.InsertFeature(buffer);
                    }
                }
                finally
                {
                    if (pk_filter != null)
                    {
                        Utils.Release(pk_filter);
                    }
                    if(cursor != null)
                    {
                        Utils.Release(cursor);
                    }
                }
            }
        }
예제 #11
0
        private ICollection compute(string key, Transaction transaction)
        {
            Hashtable conflicts = new Hashtable();

            Logger.Write("Computing " + key);

            string prefix = null;
            switch(transaction.TransactionBusinessArea)
            {
                case BusinessArea.ForAdmBound:
                    prefix = this.transactionManager.extension().get_SystemValue(DAOUtils.FADM_SCHEMA_KEY);
                    break;
                case BusinessArea.Tantalis:
                    prefix = this.transactionManager.extension().get_SystemValue(DAOUtils.TANT_SCHEMA_KEY);
                    break;
            }
            if(prefix != null && !prefix.EndsWith("."))
            {
                prefix = prefix+".";
            }

            //TransactionConfig.LayerConfig lc = this.transactionManager.transactionConfig().get_LayerConfig(key);

            //if ((lc.UpdateTimeField == null || "".Equals(lc.UpdateTimeField)) &&
            //	(lc.CreateTimeField == null) || "".Equals(lc.CreateTimeField))
            //	return conflicts;

            IFeatureClass editing_fc = null;
            try
            {
                editing_fc = ((IFeatureWorkspace)transaction.PGDBConnection)
                    .OpenFeatureClass("E_" + key);
            }
            catch(Exception e)
            {
                MessageBox.Show("Feature Class " + "E_" + key + " Not Found in PGDB",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }
            IFeatureCursor editingCursor = null;

            IFeatureClass pristine_fc = null;
            try
            {
                pristine_fc = ((IFeatureWorkspace)transaction.PGDBConnection)
                    .OpenFeatureClass("P_" + key);
            }
            catch(Exception e)
            {
                MessageBox.Show("Feature Class " + "P_" + key + " Not Found in PGDB",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }
            IFeatureCursor pristineCursor = null;

            IFeatureCursor osdbCursor = null;

            Logger.Write("Opening " + prefix + key);
            IFeatureWorkspace osdb = null;
            try
            {
                //osdb = (IFeatureWorkspace)this.transactionManager.ConnectionManager.getConnection(transaction.TransactionBusinessArea);
                osdb = (IFeatureWorkspace)this.transactionManager.ConnectionManager.DirectConnect;
            }
            catch(Exception e)
            {
                MessageBox.Show("OSDB Connection Not Found",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }

            IFeatureClass osdb_fc = null;
            try
            {
                osdb_fc = osdb.OpenFeatureClass(prefix + key);
            }
            catch(Exception e)
            {
                MessageBox.Show("Feature Class " + prefix + key + " Not Found in OSDB",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }
            string[] keys = new string[] { "ACQUISITION_SID", "ADMIN_AREA_SID", "INTRID_SID", "TA_REVERSIONS", "REVERSION_SID", "PIN_SID", "MAJOR_TRANS_SID", "WELLSITE_SID", osdb_fc.Fields.get_Field(0).Name };

            string primaryKey = "";

            if (key.Equals("TA_ACQUISITION_SHAPES")) primaryKey = "ACQUISITION_SID";
            else if (key.Equals("TA_ADMIN_AREA_SHAPES")) primaryKey = "ADMIN_AREA_SID";
            else if (key.Equals("TA_INTEREST_PARCEL_SHAPES")) primaryKey = "INTRID_SID";
            else if (key.Equals("TA_REVERSION_SHAPES")) primaryKey = "REVERSION_SID";
            else if (key.Equals("TA_SURVEY_PARCEL_SHAPES")) primaryKey = "PIN_SID";
            else if (key.Equals("TA_SURVEYED_TRANSPORT_SHAPES")) primaryKey = "MAJOR_TRANS_SID";
            else if (key.Equals("TA_WELLSITE_SHAPES")) primaryKey = "WELLSITE_SID";
            else primaryKey = osdb_fc.Fields.get_Field(0).Name;

            IQueryFilter query = new QueryFilterClass();

            //query.AddField(osdb_fc.ShapeFieldName);
            //query.AddField(primaryKey);
            //query.AddField("LAST_UPDATE_DAT");
            //query.AddField("CREATE_DAT");
            //query.AddField("LAST_UPDT_UI_CHR");
            //query.AddField("CREATE_UI_CHR");

            query.WhereClause = "LAST_UPDATE_DAT > to_date('" + transaction.ConflictDate.ToString("MM/dd/yyyy h:mm:ss") + "', 'mm/dd/yyyy HH24:MI:SS')";
            query.SubFields.Insert(0, "LAST_UPDATE_DAT");

            string connectionString = "Provider=MSDataShape;Data Provider=MSDAORA;Data Source=" + this.transactionManager.extension().get_SystemValue(DAOUtils.DIRECT_CONNECT_DB).Trim() + ";User ID=" + this.transactionManager.extension().get_SystemValue(DAOUtils.DIRECT_CONNECT_USER).Trim() + ";Password="******";";
            OleDbConnection conn = new OleDbConnection(connectionString);
            conn.Open();

            string where = "LAST_UPDATE_DAT > to_date('" + transaction.ConflictDate.ToString("MM/dd/yyyy H:mm:ss") + "', 'MM/DD/YYYY HH24:MI:SS')";

            Logger.Write("INSERT / UPDATE DETECT " + where);

            try
            {
                //check edits
                IQueryFilter theQF = new QueryFilterClass();
                theQF.WhereClause = "";

                editingCursor = editing_fc.Search(theQF, true);
                IFeature theFeature = editingCursor.NextFeature();

                while (theFeature != null)
                {
                    OleDbCommand cmd = new OleDbCommand();

                    string pk = theFeature.get_Value(theFeature.Fields.FindField(primaryKey.ToUpper())).ToString();

                    if(!string.IsNullOrEmpty(pk))
                    {
                        cmd.Connection = conn;
                        cmd.CommandText = "SELECT " + primaryKey + ", CREATE_DAT, LAST_UPDATE_DAT, CREATE_UI_CHR, LAST_UPDT_UI_CHR FROM " + prefix + key + " WHERE " + where + " AND " + primaryKey.ToUpper() + " = " + pk;
                        OleDbDataReader reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            Logger.Write("INS / UPD Edit query: " + where + "AND " + primaryKey.ToUpper() + " = " + theFeature.get_Value(theFeature.Fields.FindField(primaryKey.ToUpper())).ToString());

                            string updateUser = reader["LAST_UPDT_UI_CHR"].ToString();
                            string createUser = reader["CREATE_UI_CHR"].ToString();
                            string updateDate = reader["LAST_UPDATE_DAT"].ToString();
                            string createDate = reader["CREATE_DAT"].ToString();

                            DateTime updateTime = transaction.CreationDate;

                            QueryFilterClass pkfilter2 = new QueryFilterClass();
                            pkfilter2.WhereClause = primaryKey.ToUpper() + " = " + reader[primaryKey];

                            pristineCursor = pristine_fc.Search(pkfilter2, true);
                            IFeature pft = pristineCursor.NextFeature();
                            if (pft == null)
                            {
                                // was inserted remotely
                                if (((string)theFeature.get_Value(theFeature.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                                {
                                    Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, theFeature, ConflictType.Update_Insert, updateUser, updateTime);
                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                                }
                                else
                                {
                                    Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, theFeature, ConflictType.Insert_Insert, updateUser, updateTime);
                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                                }
                            }
                            else
                            {
                                // was updated remotely
                                if (((string)theFeature.get_Value(theFeature.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                                {
                                    Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, theFeature, ConflictType.Update_Update, updateUser, updateTime);
                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                                }
                                else
                                {
                                    Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, theFeature, ConflictType.Insert_Update, updateUser, updateTime);
                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                                }
                            }

                            Utils.Release(pristineCursor);
                            Utils.Release(pkfilter2);
                            Utils.Release(pft);
                        }
                    }

                    theFeature = editingCursor.NextFeature();
                }

                Utils.Release(theQF);
                Utils.Release(editingCursor);
                Utils.Release(theFeature);

                //    OleDbCommand cmd = new OleDbCommand();
                //    cmd.Connection = conn;
                //    cmd.CommandText = "SELECT " + primaryKey + ", CREATE_DAT, LAST_UPDATE_DAT, CREATE_UI_CHR, LAST_UPDT_UI_CHR FROM " + prefix + key + " WHERE " + where;
                //    OleDbDataReader reader = cmd.ExecuteReader();

                //    while (reader.Read())
                //    {
                //        IQueryFilter pkfilter = new QueryFilterClass();
                //        pkfilter.WhereClause = primaryKey.ToUpper() + " = " + reader[primaryKey] + " AND " + EditsDAO.EDIT_STATE + " <> '" + EditsDAO.DEL + "'";

                //        Logger.Write("INS / UPD Edit query: " + pkfilter.WhereClause);

                //        string updateUser = reader["LAST_UPDT_UI_CHR"].ToString();
                //        string createUser = reader["CREATE_UI_CHR"].ToString();
                //        string updateDate = reader["LAST_UPDATE_DAT"].ToString();
                //        string createDate = reader["CREATE_DAT"].ToString();

                //        DateTime updateTime = transaction.CreationDate;

                //        try
                //        {
                //            editingCursor = editing_fc.Search(pkfilter, true);
                //            IFeature eft = editingCursor.NextFeature();

                //            if (eft != null)
                //            {
                //                // been updated or inserted locally
                //                IQueryFilter pkfilter2 = null;

                //                try
                //                {
                //                    pkfilter2 = new QueryFilterClass();
                //                    pkfilter2.WhereClause = primaryKey.ToUpper() + " = " + reader[primaryKey];

                //                    if (pkfilter2 != null)
                //                    {
                //                        pristineCursor = pristine_fc.Search(pkfilter2, true);
                //                        IFeature pft = pristineCursor.NextFeature();
                //                        if (pft == null)
                //                        {
                //                            // was inserted remotely
                //                            if (((string)eft.get_Value(eft.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                //                            {
                //                                Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, eft, ConflictType.Update_Insert, updateUser, updateTime);
                //                                conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                            }
                //                            else
                //                            {
                //                                Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, eft, ConflictType.Insert_Insert, updateUser, updateTime);
                //                                conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                            }
                //                        }
                //                        else
                //                        {
                //                            // was updated remotely
                //                            if (((string)eft.get_Value(eft.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                //                            {
                //                                Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, eft, ConflictType.Update_Update, updateUser, updateTime);
                //                                conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                            }
                //                            else
                //                            {
                //                                Conflict c = create(key, key + " " + primaryKey + ": " + reader[primaryKey], keys, eft, ConflictType.Insert_Update, updateUser, updateTime);
                //                                conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                            }
                //                        }
                //                    }
                //                }
                //                finally
                //                {
                //                    if (pkfilter2 != null)
                //                    {
                //                        Utils.Release(pkfilter2);
                //                    }
                //                    if (pristineCursor != null)
                //                    {
                //                        Utils.Release(pristineCursor);
                //                    }
                //                }
                //            }
                //        }
                //        finally
                //        {
                //            if (pkfilter != null)
                //            {
                //                Utils.Release(pkfilter);
                //            }
                //            if (editingCursor != null)
                //            {
                //                Utils.Release(editingCursor);
                //            }
                //        }
                //    }
                //}
                //finally
                //{
                //    if (query != null)
                //    {
                //        Utils.Release(query);
                //    }
                //    if(osdbCursor != null)
                //    {
                //        Utils.Release(osdbCursor);
                //    }
                //}

                //    // these are the new conflicts!
                //    try
                //    {
                //        osdbCursor = osdb_fc.Search(query, true);
                //    }
                //    catch (Exception e)
                //    {
                //        // the query where clause failed? Select all results then.
                //        osdbCursor = osdb_fc.Search(null, true);
                //    }

                //    Logger.Write("Search Done");
                //    for(IFeature ft = osdbCursor.NextFeature(); ft != null; ft = osdbCursor.NextFeature())
                //    {
                //        // only a conflict if found in edits!
                //        IQueryFilter pkfilter = DAOUtils.setupFilter(ft, keys);
                //        // wont pass QA if null
                //        if (pkfilter != null)
                //        {
                //            pkfilter.WhereClause = pkfilter.WhereClause + " AND " + EditsDAO.EDIT_STATE + " <> '" + EditsDAO.DEL + "'";

                //            Logger.Write("INS / UPD Edit query: " + pkfilter.WhereClause);
                //            try
                //            {
                //                string updateUser = null;
                //                int index = ft.Fields.FindField("LAST_UPDT_UI_CHR");
                //                if (index > -1)
                //                {
                //                    updateUser = (string)(ft.get_Value(index) is DBNull ? null : ft.get_Value(index));
                //                    if (updateUser == null || updateUser.Trim() == null || updateUser.Trim().Equals(""))
                //                    {
                //                        // create user field
                //                        index = ft.Fields.FindField("CREATE_UI_CHR");
                //                        if (index > -1)
                //                        {
                //                            updateUser = (string)(ft.get_Value(index) is DBNull ? null : ft.get_Value(index));
                //                        }
                //                    }
                //                }
                //                else
                //                {
                //                    index = ft.Fields.FindField("CREATE_UI_CHR");
                //                    if (index > -1)
                //                    {
                //                        updateUser = (string)(ft.get_Value(index) is DBNull ? null : ft.get_Value(index));
                //                    }
                //                }

                //                DateTime updateTime = transaction.CreationDate;
                //                index = ft.Fields.FindField("LAST_UPDATE_DAT");
                //                if (index > -1)
                //                {
                //                    object o = ft.get_Value(index);
                //                    if (o == null || o is DBNull)
                //                    {
                //                        // create user field
                //                        index = ft.Fields.FindField("CREATE_DAT");
                //                        if (index > -1)
                //                        {
                //                            o = ft.get_Value(index);
                //                            if (o != null && !(o is DBNull))
                //                            {
                //                                updateTime = (DateTime)o;
                //                            }
                //                        }
                //                    }
                //                    else
                //                    {
                //                        updateTime = (DateTime)o;
                //                    }
                //                }
                //                else
                //                {
                //                    index = ft.Fields.FindField("CREATE_DAT");
                //                    if (index > -1)
                //                    {
                //                        object o = ft.get_Value(index);
                //                        if (o != null && !(o is DBNull))
                //                        {
                //                            updateTime = (DateTime)o;
                //                        }
                //                    }
                //                }

                //                editingCursor = editing_fc.Search(pkfilter, true);
                //                IFeature eft = editingCursor.NextFeature();
                //                if (eft != null)
                //                {
                //                    // been updated or inserted locally
                //                    IQueryFilter pkfilter2 = null;
                //                    try
                //                    {
                //                        pkfilter2 = DAOUtils.setupFilter(ft, keys);
                //                        if (pkfilter2 != null)
                //                        {
                //                            pristineCursor = pristine_fc.Search(pkfilter2, true);
                //                            IFeature pft = pristineCursor.NextFeature();
                //                            Logger.Write("Determining Conflict Type for " + ft.OID);
                //                            if (pft == null)
                //                            {
                //                                // was inserted remotely
                //                                if (((string)eft.get_Value(eft.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                //                                {
                //                                    Conflict c = create(key, "Conflict", keys, ft, ConflictType.Update_Insert, updateUser, updateTime);
                //                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                                }
                //                                else
                //                                {
                //                                    Conflict c = create(key, "Conflict", keys, ft, ConflictType.Insert_Insert, updateUser, updateTime);
                //                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                                }
                //                            }
                //                            else
                //                            {
                //                                // was updated remotely
                //                                if (((string)eft.get_Value(eft.Fields.FindField(EditsDAO.EDIT_STATE))) == EditsDAO.UPD)
                //                                {
                //                                    Conflict c = create(key, "Conflict", keys, ft, ConflictType.Update_Update, updateUser, updateTime);
                //                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                                }
                //                                else
                //                                {
                //                                    Conflict c = create(key, "Conflict", keys, ft, ConflictType.Insert_Update, updateUser, updateTime);
                //                                    conflicts.Add(concat(c.PrimaryKeyValues), c);
                //                                }
                //                            }
                //                        }
                //                    }
                //                    finally
                //                    {
                //                        if (pkfilter2 != null)
                //                        {
                //                            Utils.Release(pkfilter2);
                //                        }
                //                        if (pristineCursor != null)
                //                        {
                //                            Utils.Release(pristineCursor);
                //                        }
                //                    }
                //                }
                //            }
                //            finally
                //            {
                //                if (pkfilter != null)
                //                {
                //                    Utils.Release(pkfilter);
                //                }
                //                if (editingCursor != null)
                //                {
                //                    Utils.Release(editingCursor);
                //                }
                //            }
                //        }
                //    }
                //}
                //finally
                //{
                //    if (query != null)
                //    {
                //        Utils.Release(query);
                //    }
                //    if(osdbCursor != null)
                //    {
                //        Utils.Release(osdbCursor);
                //    }
                //}
            }
            catch (Exception ex)
            {
                Logger.Write("Error during conflict detection query: " + ex.Message);
                throw ex;
            }

            IQueryFilter nonDelQuery = null;

            // Check for updates that don't have a corresponding record in the OSDB
            // If there is no record in the OSDB then generate a conflict message
            try
            {
                nonDelQuery = new QueryFilterClass();
                nonDelQuery.WhereClause = EditsDAO.EDIT_STATE + " = '" + EditsDAO.UPD + "'";   // Apr 22, 2008  where clause to look for updates

                Logger.Write("DELETE DETECT "+ nonDelQuery.WhereClause);

                editingCursor = editing_fc.Search(nonDelQuery, true);

                for(IFeature ft = editingCursor.NextFeature(); ft != null; ft = editingCursor.NextFeature())
                {
                    Logger.Write("Checking Delete Conflict for " + ft.OID);
                    Conflict c = create(key, key + " " + primaryKey + ": ", keys, ft, ConflictType.Update_Delete, null, transaction.CreationDate);

                    if(!conflicts.ContainsKey(concat(c.PrimaryKeyValues))) // pre-check in memory before hitting the PGDB
                    {
                        IQueryFilter pkfilter = new QueryFilterClass(); // DAOUtils.setupFilter(ft, keys);

                        string keyValue = ft.get_Value(ft.Fields.FindField(primaryKey.ToUpper())).ToString();
                        c.ConflictLabel = key + " " + primaryKey + ": " + keyValue;

                        if (!string.IsNullOrEmpty(keyValue) && !keyValue.Equals("0"))
                        {
                            OleDbCommand cmd = new OleDbCommand();
                            cmd.Connection = conn;
                            cmd.CommandText = "SELECT " + primaryKey + " FROM " + key + " WHERE " + primaryKey.ToUpper() + " = " + ft.get_Value(ft.Fields.FindField(primaryKey.ToUpper())).ToString();

                            OleDbDataReader reader = cmd.ExecuteReader();
                            if (!reader.HasRows)
                            {
                                // feature does not exist in osdb, but an update is being attempted
                                conflicts.Add(concat(c.PrimaryKeyValues), c);
                            }
                        }
                    }
                }
            }
            finally
            {
                if (nonDelQuery != null)
                {
                    Utils.Release(nonDelQuery);
                }
                if(editingCursor != null)
                {
                    Utils.Release(editingCursor);
                }
            }

            conn.Close();
            conn = null;

            GC.Collect();
            return conflicts.Values;
        }
예제 #12
0
파일: DBAreaMatch.cs 프로젝트: EAWCS1/SUITT
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0)
                theMessages.Add("Need to pass at least one layer to " + this.Name);

            string[] theRelateKeys = this.RelateFieldNames;
            bool bRelated = theRelateKeys.Length > 0;
            string[] theAreaFieldNames = this.AreaFieldNames;

            if (bRelated)
            {
                if (this.TableCount != this.LayerCount)
                    theMessages.Add("Need to pass same number of tables as layers to " + this.Name);
                else
                {
                    // Look for the area fields in the related table
                    for (int i = 0; i < this.LayerCount; i++)
                    {
                        ITable theTable = this.get_Table(i);
                        bool bFound = false;
                        for (int j = 0; j < theAreaFieldNames.Length; j++)
                        {
                            int idx = theTable.FindField(theAreaFieldNames[j]);
                            if (idx > -1)
                            {
                                bFound = true;
                                break;
                            }
                        }
                        if (!bFound)
                            theMessages.Add("Area field not found in table " + ((IDataset)theTable).Name);
                    }
                }
            }
            else
            {
                if (this.TableCount > 0)
                    theMessages.Add("Tables passed to " + this.Name + " will be ignored");

                // Look for the area fields in the layer
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);
                    IFeatureClass theFClass = theFLayer.FeatureClass;
                    bool bFound = false;
                    for (int j = 0; j < theAreaFieldNames.Length; j++)
                    {
                        int idx = theFClass.FindField(theAreaFieldNames[j]);
                        if (idx > -1)
                        {
                            bFound = true;
                            break;
                        }
                    }
                    if (!bFound)
                        theMessages.Add("Area field not found in featureclass " + ((IDataset)theFClass).Name);
                }
            }

            for (int i = 0; i < this.LayerCount; i++)
            {
                IFeatureLayer theFLayer = this.get_Layer(i);
                if (this.ConstrainToSelection && ((IFeatureSelection)theFLayer).SelectionSet.Count == 0)
                    theMessages.Add("Test " + this.Name + " is constrained to selection, but layer " + theFLayer.Name + " has no selected features");
            }

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #13
0
파일: GeometryGap.cs 프로젝트: EAWCS1/SUITT
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0)
                theMessages.Add("No layers passed to " + this.Name);

            if (this.TableCount > 0)
                theMessages.Add("Tables passed to " + this.Name + " are not required, will be ignored.");

            for (int i = 0; i < this.LayerCount; i++)
            {
                IFeatureLayer theFLayer = this.get_Layer(i);
                IFeatureClass theFClass = theFLayer.FeatureClass;
                IDataset theDataset = (IDataset)theFClass;

                if (!this.SupportsGeometryType(theFClass.ShapeType))
                {
                    theMessages.Add("Geometry type " + theFLayer.FeatureClass.ShapeType + " of layer " + theFLayer.Name + " not supported by " + this.Name);
                }
                else if (theFClass.FeatureDataset == null)
                {
                    theMessages.Add("Featureclass " + theDataset.Name + " is not in a topology");
                }
                else
                {
                    ITopology theTopology = null;
                    ITopologyRule theTopoRule = null;
                    IEnumDataset theDatasetEnum = theFClass.FeatureDataset.Subsets;

                    IDataset theSiblingDS = theDatasetEnum.Next();
                    while (theSiblingDS != null)
                    {
                        if (theSiblingDS.Type == esriDatasetType.esriDTTopology)
                        {
                            // Look for a gap rule featuring theFClass
                            theTopology = (ITopology)theSiblingDS;
                            ITopologyRuleContainer theTRContainer = (ITopologyRuleContainer)theTopology;
                            IEnumRule theRules = theTRContainer.get_RulesByClass(theFClass.FeatureClassID);

                            theTopoRule = (ITopologyRule)theRules.Next();
                            while (theTopoRule != null)
                            {
                                if (theTopoRule.TopologyRuleType == esriTopologyRuleType.esriTRTAreaNoGaps)
                                    break;
                                theTopoRule = (ITopologyRule)theRules.Next();
                            }
                        }
                        theSiblingDS = theDatasetEnum.Next();
                    }

                    if (theTopology == null || theTopoRule == null)
                    {
                        theMessages.Add("Featureclass " + theDataset.Name + " is not part of a Gap topology rule");
                    }
                    //else if (theTopology.State == esriTopologyState.esriTSUnanalyzed)
                    //{
                    //	theMessages.Add("The topology " + ((IDataset)theTopology).Name + " has not been validated");
                    //}
                }
            }

            int idx = this.FindParameter("ignore-gap-smaller-than");
            DoubleParameterInfo theMinInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theMinInfo.ParamValue < 0)
                theMessages.Add("Negative value passed as lower limit for " + this.Name);

            idx = this.FindParameter("ignore-gap-larger-than");
            DoubleParameterInfo theMaxInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theMaxInfo.ParamValue < 0)
                theMessages.Add("Negative value passed as upper limit for " + this.Name);

            if ((double)theMinInfo.ParamValue >= (double)theMaxInfo.ParamValue)
                theMessages.Add("Lower limit is higher than or equal to the upper limit for " + this.Name);

            idx = this.FindParameter("angle-tolerance-degrees");
            DoubleParameterInfo theAngleInfo = (DoubleParameterInfo)this._params[idx];
            if ((double)theAngleInfo.ParamValue < 0 || (double)theAngleInfo.ParamValue >= 90)
                theMessages.Add("Angle tolerance should be between 0 and 90 for " + this.Name);

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }
예제 #14
0
        public override string CheckConfig(Transaction currentTransaction)
        {
            ArrayList theMessages = new ArrayList();

            if (this.LayerCount <= 0)
                theMessages.Add("Need to pass at least one layer to " + this.Name);
            if (this.TableCount <= 0)
                theMessages.Add("Need to pass at least one table to " + this.Name);

            if (this.LayerCount > 0 && this.TableCount > 0)
            {
                for (int i = 0; i < this.LayerCount; i++)
                {
                    IFeatureLayer theFLayer = this.get_Layer(i);

                    string theFTField = this.get_FTFieldName(i);
                    if (theFTField == "")
                        theMessages.Add("Could not find feature type field link for " + theFLayer.Name);

                    if (this.ConstrainToSelection && ((IFeatureSelection)theFLayer).SelectionSet.Count == 0)
                        theMessages.Add("Test " + this.Name + " is constrained to selection, but layer " + theFLayer.Name + " has no selected features");
                }

                ITable theFTTable = this.FeatureTypeTable;
                if (theFTTable == null)
                {
                    theMessages.Add("Feature type table not passed to " + this.Name);
                }
                else
                {
                    string theTableMessages = this.CheckFeatureTypeTable();
                    if (theTableMessages != null && theTableMessages.Length > 0)
                        theMessages.Add(theTableMessages);
                }
            }

            string configMessage = "";
            for (int i = 0; i < theMessages.Count; i++)
                configMessage += (string)theMessages[i] + Environment.NewLine;

            return configMessage;
        }