예제 #1
0
        async private void FormDataTable_Load(object sender, System.EventArgs e)
        {
            var value = _tableClass;

            _maxNewSelectedRows = 200;
            _selectedRowIndices = new List <int>();
            grid.DataSource     = null;

            _tableClass = value;
            if (_tableClass == null)
            {
                return;
            }

            grid.DefaultCellStyle.BackColor = Color.White;

            gView.Framework.Data.QueryFilter filter = new gView.Framework.Data.QueryFilter();
            foreach (IField field in _tableClass.Fields.ToEnumerable())
            {
                if (field.type == FieldType.binary || field.type == FieldType.Shape)
                {
                    continue;
                }
                filter.AddField(field.name);
            }
            //filter.SubFields="*";

            ICursor cursor = await _tableClass.Search(filter);

            if (cursor is IFeatureCursor)
            {
                _result = new FeatureTable((IFeatureCursor)cursor, _tableClass.Fields, _tableClass);
            }
            else if (cursor is IRowCursor)
            {
                _result = new RowTable((IRowCursor)cursor, _tableClass.Fields);
            }
            else
            {
                return;
            }

            _result.RowsAddedToTable -= new RowsAddedToTableEvent(RowsAddedToTable);

            progress1.Minimum = 0;
            progress1.Visible = true;
            progress1.Value   = 0;
            await _result.Fill(progress1.Maximum = 200);

            _result.RowsAddedToTable += new RowsAddedToTableEvent(RowsAddedToTable);

            _viewTable = null;         // in PrepareDataView neu anlegen...
            PrepareDataView(_result.Table);
            cmbShow.SelectedIndex = 0; // hier wird auch MarkSelected durchgeführt
            progress1.Visible     = false;
        }
예제 #2
0
        async static public Task <FormQueryBuilder> CreateAsync(ITableClass tc)
        {
            var dlg = new FormQueryBuilder();

            dlg._tc = tc;


            if (dlg._tc == null)
            {
                return(dlg);
            }

            gView.Framework.Data.QueryFilter filter = new gView.Framework.Data.QueryFilter();
            filter.SubFields = "*";

            using (ICursor cursor = await dlg._tc.Search(filter))
            {
                if (cursor is IFeatureCursor)
                {
                    dlg._table = new FeatureTable((IFeatureCursor)cursor, dlg._tc.Fields, dlg._tc);
                }
                else if (cursor is IRowCursor)
                {
                    dlg._table = new RowTable((IRowCursor)cursor, dlg._tc.Fields);
                }
                else
                {
                    return(dlg);
                }
                await dlg._table.Fill(2000);
            }

            dlg.cmbMethod.SelectedIndex = 0;
            foreach (IField field in dlg._tc.Fields.ToEnumerable())
            {
                if (field.type == FieldType.binary ||
                    field.type == FieldType.Shape)
                {
                    continue;
                }

                dlg.lstFields.Items.Add(Field.WhereClauseFieldName(field.name));
            }

            return(dlg);
        }
예제 #3
0
        public FormQueryBuilder(ITableClass tc)
        {
            _tc = tc;

            InitializeComponent();
            if (_tc == null)
            {
                return;
            }

            gView.Framework.Data.QueryFilter filter = new gView.Framework.Data.QueryFilter();
            filter.SubFields = "*";

            using (ICursor cursor = _tc.Search(filter))
            {
                if (cursor is IFeatureCursor)
                {
                    _table = new FeatureTable((IFeatureCursor)cursor, _tc.Fields, _tc);
                }
                else if (cursor is IRowCursor)
                {
                    _table = new RowTable((IRowCursor)cursor, _tc.Fields);
                }
                else
                {
                    return;
                }
                _table.Fill(2000);
            }

            cmbMethod.SelectedIndex = 0;
            foreach (IField field in _tc.Fields.ToEnumerable())
            {
                if (field.type == FieldType.binary ||
                    field.type == FieldType.Shape)
                {
                    continue;
                }

                lstFields.Items.Add(Field.WhereClauseFieldName(field.name));
            }
        }