Ejemplo n.º 1
0
        public void close(Transaction current, string comment)
        {
            IFeatureClass fc = null;
            try
            {
                fc = osdb.OpenFeatureClass(OSDB_SEE_NAME);
            }
            catch(Exception e)
            {
                MessageBox.Show("OSDB Feature Class " + OSDB_SEE_NAME + " Not Found in SUITT",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }
            IFeatureCursor fcrs = null;
            IQueryFilter filter = null;

            try
            {

                MetadataDAO mdao = new MetadataDAO((IFeatureWorkspace)current.PGDBConnection);

                filter = new QueryFilterClass();
                filter.WhereClause = SEE_ID_COL+" = " + mdao.getTransactionID();

                fcrs = fc.Update(filter,false);
                IFeature buffer = fcrs.NextFeature();

                if(buffer == null)
                {
                    Logger.Write("Transaction not found");
                    return;
                }

                // load it up
                buffer.set_Value(fcrs.FindField(PGDB_PATH_COL),current.PGDB.FullName);
                buffer.set_Value(fcrs.FindField(CLOSE_DATE_COL),DateTime.Now);
                buffer.set_Value(fcrs.FindField(EDIT_COMMENTS_COL),comment);

                fcrs.UpdateFeature(buffer);
            }
            finally
            {
                if (filter != null)
                {
                    Utils.Release(filter);
                }
                if(fcrs != null)
                {
                    Utils.Release(fcrs);
                }
            }
        }
Ejemplo n.º 2
0
        public void delete(Transaction current)
        {
            IFeatureClass fc = null;
            try
            {
                fc = osdb.OpenFeatureClass(OSDB_SEE_NAME);
            }
            catch(Exception e)
            {
                MessageBox.Show("OSDB Feature Class " + OSDB_SEE_NAME + " Not Found in SUITT",
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }

            IFeatureCursor fcrs = null;
            IQueryFilter filter = null;

            try
            {

                MetadataDAO mdao = new MetadataDAO((IFeatureWorkspace)current.PGDBConnection);
                int tid = mdao.getTransactionID();

                filter = new QueryFilterClass();
                filter.WhereClause = SEE_ID_COL+" = " + tid;

                fcrs = fc.Update(filter,false);
                IFeature buffer = fcrs.NextFeature();

                if(buffer == null)
                {
                    Logger.Write("Transaction ("+tid+") not found");
                    return;
                }

                fcrs.DeleteFeature();
            }
            finally
            {
                if (filter != null)
                {
                    Utils.Release(filter);
                }
                if(fcrs != null)
                {
                    Utils.Release(fcrs);
                }
            }
        }