Exemplo n.º 1
0
        public static void OpenTable(AxMapControl MapControl, ITableName pTName, DataTable dt = null)
        {
            try
            {
                MapControl.Map.ClearLayers();
                MapControl.SpatialReference = null;
                MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                IName  pName = pTName as IName;
                ITable pFc   = pName.Open() as ITable;

                if (null != dt)
                {
                    InitDataTable(pFc, dt);

                    ICursor pCursor = pFc.Search(null, false);
                    IRow    pfea    = pCursor.NextRow();
                    int     j       = 0;
                    while (pfea != null)
                    {
                        DataRow dataRow = dt.NewRow();

                        for (int i = 0; i < pfea.Fields.FieldCount; i++)
                        {
                            dataRow[i] = pfea.get_Value(i).ToString();
                        }

                        dt.Rows.Add(dataRow);
                        pfea = pCursor.NextRow();
                        j++;
                    }
                    ComReleaser.ReleaseCOMObject(pCursor);
                }
            }
            catch { }
        }
Exemplo n.º 2
0
 public JoinCondition(ITableName lhs, JoinClause jn, ITableName rhs, ITruthy comp)
 {
     Lhs  = lhs;
     Jn   = jn;
     Rhs  = rhs;
     Comp = comp;
 }
Exemplo n.º 3
0
        public OperationalDatasetCollection(IWorkspace osdbWorkspace)
        {
            if (osdbWorkspace == null)
                throw new System.ArgumentNullException("osdbWorkspace");

            // Find the table and determine if this user can edit it
            ITable theTable = null;
            string theTableName = "";
            try
            {
                util.SystemDefaults theDefaults = new util.SystemDefaults();
                theTableName = OperationalDatasetCollection.TABLE_NAME;
                theTable = ((IFeatureWorkspace)osdbWorkspace).OpenTable(theTableName);
            }
            catch (Exception) {}

            if (theTable == null)
                throw new Exception("Could not open the QA parameters table '" + theTableName + "'");

            IDataset theDataset = theTable as IDataset;

            this._canRead = false;
            this._canWrite = false;

            int privs = util.PermissionsAnalyzer.Analyze(theDataset);
            this._canWrite = (privs == util.PermissionsAnalyzer.READWRITE_PERMISSION);
            this._canRead = (privs == util.PermissionsAnalyzer.READONLY_PERMISSION) || this._canWrite;

            if (this._canRead)
            {
                this.LoadNames(theTable);
                OperationalDatasetCollection._lightWeight = (ITableName)theDataset.FullName;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Adds the table to ListBox.
 /// </summary>
 /// <param name="pWorkspace">The p workspace.</param>
 /// <param name="imageListBoxControl1">The image ListBox control1.</param>
 public static void AddTableToListBox(IWorkspace pWorkspace, ImageListBoxControl imageListBoxControl1)
 {
     if (pWorkspace != null)
     {
         IconType         iconType        = IconType.Table;
         IEnumDatasetName enumDatasetName = pWorkspace.get_DatasetNames(esriDatasetType.esriDTTable);
         try
         {
             enumDatasetName.Reset();
             IDatasetName datasetName;
             while ((datasetName = enumDatasetName.Next()) != null)
             {
                 ITableName tableName = datasetName as ITableName;
                 if (tableName != null)
                 {
                     ControlAPI.AddItemToListBox(iconType, datasetName.Name, imageListBoxControl1);
                 }
             }
         }
         finally
         {
             Marshal.ReleaseComObject(enumDatasetName);
         }
     }
 }
Exemplo n.º 5
0
 public SqlBuilder(T instance, SqlCommand command, IDb db, ICache cache, ITableName tableName = null)
 {
     this.instance  = instance;
     this.command   = command;
     this.db        = db;
     this.cache     = cache;
     this.tableName = tableName ?? new TableName_ClassName();
 }
        public override string BuildQueryString(int depth)
        {
            ITableName    tableName = null;
            IBigQueryable parent    = null;

            if (typedParent is ITableName)
            {
                parent    = (IBigQueryable)typedParent;
                tableName = (ITableName)typedParent;
            }
            else if (typedParent is ITableName)
            {
                parent    = (IBigQueryable)typedParent;
                tableName = (ITableName)typedParent;
            }

            if (tableName != null)
            {
                var sb = new StringBuilder();

                sb.Append(Indent(depth));
                sb.AppendLine("FROM");

                sb.Append(Indent(depth + 1));
                sb.Append("FLATTEN(");
                sb.Append(tableName.GetTableName());

                sb.Append(", ");
                sb.Append(BigQueryTranslateVisitor.BuildQuery(depth, parent.QueryContext.IndentSize, fieldSelector));

                sb.Append(")");

                return(sb.ToString());
            }

            var subquery = typedParent as SubqueryBigQueryable <T>;

            if (subquery != null)
            {
                var sb = new StringBuilder();

                sb.Append(Indent(depth));
                sb.AppendLine("FROM FLATTEN(");

                sb.Append(subquery.BuildQueryStringWithoutFrom(depth));

                sb.Append(", ");
                sb.Append(BigQueryTranslateVisitor.BuildQuery(depth, subquery.QueryContext.IndentSize, fieldSelector));

                sb.Append(")");

                return(sb.ToString());
            }

            throw new InvalidOperationException("Unexpected pattern, please report query to GitHub issues");
        }
Exemplo n.º 7
0
 public Db(
     IConnectionFactory connectionFactory,
     IRead reader,
     ICache cache,
     ITableName tableName = null
     )
 {
     this.reader                   = reader;
     this.connectionFactory        = connectionFactory;
     this.cache                    = cache;
     this.tableName                = tableName ?? new TableName_ClassName();
     this.getParameterNamesFromSql = new GetParameterNamesFromSql();
     this.parameters               = new List <(string name, object value)>();
 }
Exemplo n.º 8
0
        public static void OpenTable(AxMapControl MapControl,
                                     ITableName pTName, ListView listview1)
        {
            try
            {
                MapControl.Map.ClearLayers();
                MapControl.SpatialReference = null;
                MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                IName  pName = pTName as IName;
                ITable pFc   = pName.Open() as ITable;

                listview1.Items.Clear();
                listview1.Columns.Clear();
                LoadListView(pFc, listview1);

                ICursor pCursor = pFc.Search(null, false);
                IRow    pfea    = pCursor.NextRow();
                int     j       = 0;
                while (pfea != null)
                {
                    ListViewItem lv = new ListViewItem();

                    for (int i = 0; i < pfea.Fields.FieldCount; i++)
                    {
                        string sFieldName = pfea.Fields.get_Field(i).Name;
                        lv.SubItems.Add(FeatureHelper.GetRowValue(pfea, sFieldName).ToString());
                    }

                    lv.Tag = pfea;
                    if (j % 2 == 0)
                    {
                        lv.BackColor = System.Drawing.Color.GreenYellow;
                    }
                    listview1.Items.Add(lv);
                    pfea = pCursor.NextRow();
                    j++;
                }
                LSGISHelper.OtherHelper.ReleaseObject(pCursor);
            }
            catch { }
        }
Exemplo n.º 9
0
 public static ITableName Join(this ITableName lhs, JoinClause jn, ITableName rhs, ITruthy comp)
 {
     return(new JoinCondition(lhs, jn, rhs, comp));
 }
Exemplo n.º 10
0
 public static ITableName FullOuterJoin(this ITableName lhs, ITableName rhs, ITruthy comp)
 {
     return(new JoinCondition(lhs, JoinClause.FullOuter, rhs, comp));
 }
Exemplo n.º 11
0
 public static FromClause From(ITableName t)
 {
     return(new FromClause(t));
 }
Exemplo n.º 12
0
        public QATestCollection(IWorkspace osdbWorkspace, string operationalAreaName)
        {
            if (osdbWorkspace == null)
                throw new System.ArgumentNullException("osdbWorkspace");

            // Find the QA tests table and QA params table and determine if this user can edit them
            ITable theTestTable = null;
            ITable theParamTable = null;
            string theTTName = "";
            string thePTName = "";

            try
            {
                util.SystemDefaults theDefaults = new util.SystemDefaults();
                theTTName = QATestCollection.TABLE_NAME;
                theTestTable = ((IFeatureWorkspace)osdbWorkspace).OpenTable(theTTName);

                thePTName = QAParameterCollection.TABLE_NAME;
                theParamTable = ((IFeatureWorkspace)osdbWorkspace).OpenTable(thePTName);
            }
            catch (Exception) {}

            if (theTestTable == null)
                throw new Exception("Could not open the QA parameters table '" + theTTName + "'");

            if (theParamTable == null)
                throw new Exception("Could not open the QA parameters table '" + thePTName + "'");

            IDataset theQaTestDS = theTestTable as IDataset;
            IDataset theQaParamDS = theParamTable as IDataset;

            bool bCanReadTests = true;
            bool bCanReadParams = true;
            bool bCanWriteTests = true;
            bool bCanWriteParams = true;

            // no longer concerned about permissions. These are on an open PGDB format
            /*int privs = util.PermissionsAnalyzer.Analyze(theQaTestDS);
            bCanWriteTests = (privs == util.PermissionsAnalyzer.READWRITE_PERMISSION);
            bCanReadTests = (privs == util.PermissionsAnalyzer.READONLY_PERMISSION) || bCanWriteTests;

            privs = util.PermissionsAnalyzer.Analyze(theQaParamDS);
            bCanWriteParams = (privs == util.PermissionsAnalyzer.READWRITE_PERMISSION);
            bCanReadParams = (privs == util.PermissionsAnalyzer.READONLY_PERMISSION) || bCanWriteParams;
            */

            if (bCanReadTests && bCanReadParams)
            {
                this._canRead = true;
                this._canWrite = bCanWriteTests && bCanWriteParams;

                QAParameterCollection._lightWeight = (ITableName)theQaParamDS.FullName;
                QAParameterCollection._canRead = bCanReadParams;
                QAParameterCollection._canWrite = bCanWriteParams;

                this.LoadTests(theTestTable, theParamTable);

                QATestCollection._lightWeight = (ITableName)theQaTestDS.FullName;
            }
        }
Exemplo n.º 13
0
 public FromClause(ITableName tbl)
 {
     Tbl = tbl;
 }
Exemplo n.º 14
0
        public static void OpenTable(AxMapControl MapControl,
            ITableName pTName, ListView listview1)
        {
            try
            {
                MapControl.Map.ClearLayers();
                MapControl.SpatialReference = null;
                MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                IName pName = pTName as IName;
                ITable pFc = pName.Open() as ITable;

                listview1.Items.Clear();
                listview1.Columns.Clear();
                LoadListView(pFc, listview1);

                ICursor pCursor = pFc.Search(null, false);
                IRow pfea = pCursor.NextRow();
                int j = 0;
                while (pfea != null)
                {
                    ListViewItem lv = new ListViewItem();

                    for (int i = 0; i < pfea.Fields.FieldCount; i++)
                    {
                        string sFieldName = pfea.Fields.get_Field(i).Name;
                        lv.SubItems.Add(FeatureHelper.GetRowValue(pfea, sFieldName).ToString());
                    }

                    lv.Tag = pfea;
                    if (j % 2 == 0)
                    {
                        lv.BackColor = System.Drawing.Color.GreenYellow;
                    }
                    listview1.Items.Add(lv);
                    pfea = pCursor.NextRow();
                    j++;
                }
                LSGISHelper.OtherHelper.ReleaseObject(pCursor);
            }
            catch { }
        }