Пример #1
0
        private void FinishThread()
        {
            // Fetch the first page of data
            try
            {
                grdResult.MinimumPageSize = 200;
                FPagedDataTable           = grdResult.LoadFirstDataPage(@GetDataPagedResult);
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString());
            }

            InitialiseGrid();

            // Fix for SQLite: it returns a DataColumn of DataType 'double' for the 'Amount' and 'OutstandingAmount' DataColumns,
            // which the 'AddCurrencyColumn' of TSgrdDataGrid can't deal with!
            if (FPagedDataTable.Columns["Amount"].DataType == typeof(double))
            {
                DataUtilities.ChangeDataColumnDataType(FPagedDataTable, "Amount", typeof(decimal));
            }

            if ((FPagedDataTable.Columns["OutstandingAmount"].DataType == typeof(double)) ||
                (FPagedDataTable.Columns["OutstandingAmount"].DataType == typeof(System.Int64)))     // Int64 only when no outstanding amount, else double
            {
                DataUtilities.ChangeDataColumnDataType(FPagedDataTable, "OutstandingAmount", typeof(decimal));
            }

            DataView myDataView = FPagedDataTable.DefaultView;

            myDataView.AllowNew = false;

            grdResult.DataSource = new DevAge.ComponentModel.BoundDataView(myDataView);
            grdResult.Visible    = true;
            UpdateRowFilter();
            string currentFilter = FFilterAndFindObject.CurrentActiveFilter;

            ApplyFilterManual(ref currentFilter);

            if (grdResult.TotalPages > 0)
            {
                //
                // I don't want to do either of these things, if I'm being called from a child form
                // that's just been saved..
                //              grdResult.BringToFront();
                //              grdResult.Focus();

                if (grdResult.TotalPages > 1)
                {
                    grdResult.LoadAllDataPages();
                }

                // Highlight first Row
                SelectRowInGrid(1);
            }

            grdResult.AutoResizeGrid();

            grdResult.SetHeaderTooltip(0, Catalog.GetString("Check to Tag"));
            grdResult.SetHeaderTooltip(1, Catalog.GetString("Inv#"));
            grdResult.SetHeaderTooltip(2, Catalog.GetString("Type"));
            grdResult.SetHeaderTooltip(3, Catalog.GetString("Amount"));
            grdResult.SetHeaderTooltip(4, Catalog.GetString("Outstanding"));
            grdResult.SetHeaderTooltip(5, Catalog.GetString("Currency"));
            grdResult.SetHeaderTooltip(6, Catalog.GetString("Status"));
            grdResult.SetHeaderTooltip(7, Catalog.GetString("Date"));

            UpdateSupplierBalance();
            UpdateDisplayedBalance();
            UpdateRecordNumberDisplay();
            RefreshSumTagged(null, null);

            ActionEnabledEvent(null, new ActionEventArgs("cndSelectedSupplier", grdResult.TotalPages > 0));
        }