/// <summary>
 /// todoComment
 /// </summary>
 /// <param name="AGrid"></param>
 /// <param name="ASourceTable"></param>
 public void CreateColumns(TSgrdDataGrid AGrid, PFoundationProposalDetailTable ASourceTable)
 {
     SourceGrid.Cells.Editors.ComboBox ProjectEditor;
     SourceGrid.Cells.Editors.TextBoxButton MinistryEditor;
     ProjectEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(String));
     ProjectEditor.EditableMode = EditableMode.Focus;
     MinistryEditor = new SourceGrid.Cells.Editors.TextBoxButton(typeof(Int64));
     MinistryEditor.EditableMode = EditableMode.Focus;
     AGrid.AddTextColumn("Projects", ASourceTable.ColumnProjectMotivationDetail, -1, ProjectEditor);
     AGrid.AddTextColumn("Key Ministries", ASourceTable.ColumnKeyMinistryKey, -1, MinistryEditor);
     AGrid.AddTextColumn("Areas", ASourceTable.ColumnAreaPartnerKey, -1, MinistryEditor);
     AGrid.AddTextColumn("Fields", ASourceTable.ColumnFieldPartnerKey);
 }
        /// <summary>
        /// Main method to initialise the grid and label on a specified tab
        /// </summary>
        /// <param name="ATableName"></param>
        /// <param name="AGrid"></param>
        /// <param name="ADescriptionLabel"></param>
        private void InitialiseTab(KeyboardShortcutTableNames ATableName, TSgrdDataGrid AGrid, Label ADescriptionLabel)
        {
            if (AGrid == null)
            {
                // The grid has already been initialised so we have nothing to do
                return;
            }

            ADescriptionLabel.AutoSize = false;
            ADescriptionLabel.Width = this.Width - 40;
            ADescriptionLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

            switch (ATableName)
            {
                case KeyboardShortcutTableNames.General:
                    ADescriptionLabel.Text = ApplWideResourcestrings.StrKeysHelpCategoryGeneral;
                    break;

                case KeyboardShortcutTableNames.List:
                    ADescriptionLabel.Text = ApplWideResourcestrings.StrKeysHelpCategoryList;
                    break;

                case KeyboardShortcutTableNames.Navigation:
                    ADescriptionLabel.Text = ApplWideResourcestrings.StrKeysHelpCategoryNavigation;
                    break;

                case KeyboardShortcutTableNames.FilterFind:
                    ADescriptionLabel.Text = ApplWideResourcestrings.StrKeysHelpCategoryFilterFind;
                    break;
            }

            DataTable table = FMainDS.Tables[ATableName.ToString()];

            AGrid.AddTextColumn(FColumnNames[0], table.Columns[0], 100);
            AGrid.AddTextColumn(FColumnNames[1], table.Columns[1], 250);
            AGrid.AutoStretchColumnsToFitWidth = true;
            AGrid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;
            AGrid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableStretch | SourceGrid.AutoSizeMode.EnableAutoSize;

            table.DefaultView.AllowNew = false;
            AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(table.DefaultView);
            AGrid.AutoSizeCells(new SourceGrid.Range(1, 1, AGrid.Rows.Count - 1, 1));

            // We need this line, otherwise the Enter key locks up the screen.  For this grid, on a dialog, we have no special keys.
            AGrid.SpecialKeys = SourceGrid.GridSpecialKeys.None;
        }
 /// <summary>
 /// todoComment
 /// </summary>
 /// <param name="AGrid"></param>
 /// <param name="ASourceTable"></param>
 public void CreateColumns(TSgrdDataGrid AGrid, PFoundationProposalTable ASourceTable)
 {
     AGrid.AddTextColumn("Status", ASourceTable.ColumnProposalStatus);
     AGrid.AddTextColumn("Submitted", ASourceTable.ColumnSubmittedDate);
     AGrid.AddTextColumn("Requested", ASourceTable.ColumnAmountRequested);
     AGrid.AddTextColumn("Approved", ASourceTable.ColumnAmountApproved);
     AGrid.AddTextColumn("Received", ASourceTable.ColumnAmountGranted);
 }
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGrid"></param>
        /// <param name="ASourceTable"></param>
        public void CreateColumns(TSgrdDataGrid AGrid, PFoundationDeadlineTable ASourceTable)
        {
            SourceGrid.Cells.Editors.ComboBox FMonthEditor;
            SourceGrid.Cells.Editors.TextBoxNumeric FDayEditor;
            Int32[] MonthDropDownValues;
            String[] MonthDropDownDisplayValues;
            DevAge.ComponentModel.Validator.ValueMapping MonthDropDownMapping;

            // Set up Month ComboBox editor
            MonthDropDownValues = new Int32[] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };
            MonthDropDownDisplayValues = new String[] {
                "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST",
                "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
            };
            FMonthEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(Int32), MonthDropDownValues, true);
            FMonthEditor.Control.FormattingEnabled = true;
            MonthDropDownMapping = new DevAge.ComponentModel.Validator.ValueMapping();
            MonthDropDownMapping.SpecialType = typeof(String);
            MonthDropDownMapping.SpecialList = MonthDropDownDisplayValues;
            MonthDropDownMapping.ValueList = MonthDropDownValues;
            MonthDropDownMapping.BindValidator(FMonthEditor);
            FMonthEditor.EditableMode = EditableMode.Focus;

            FDayEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(Int32));
            FDayEditor.EditableMode = EditableMode.Focus;

            AGrid.AddTextColumn("Month", ASourceTable.ColumnDeadlineMonth, 80, FMonthEditor);
            AGrid.AddTextColumn("Day", ASourceTable.ColumnDeadlineDay, -1, FDayEditor);

            // Hook up editor events
            FDayEditor.Control.Validating += new System.ComponentModel.CancelEventHandler(Day_Validating);
            FMonthEditor.Control.Validating += new System.ComponentModel.CancelEventHandler(Month_Validating);
        }
Exemple #5
0
        /// <summary>
        /// Try to populate the grid with the current result.
        /// </summary>
        /// <returns>s false if no detail report is available
        /// </returns>
        public Boolean PopulateResultGrid(TSgrdDataGrid ASgGridView)
        {
            Boolean ReturnValue;
            DataTable t;
            DataRow row;
            Int32 i;
            Int32 counter;
            Int32 columnCounter;
            string caption;
            ArrayList sortedList;
            bool display;

            ReturnValue = true;
            FGridView = ASgGridView;

            // only do this if there are detail reports available
            // this is to prevent bugs that are still happening (same column caption etc)
            if (!parameters.Exists("param_detail_report_0"))
            {
                return false;
            }

            results.SortChildren();
            sortedList = new ArrayList();
            results.CreateSortedListByMaster(sortedList, 0);

            // create columns
            // todo: header left
            // todo: indented columns
            t = new DataTable();
            columnCounter = 0;
            t.Columns.Add("id");

            for (i = 0; i <= results.GetMaxDisplayColumns() - 1; i += 1)
            {
                if ((!parameters.Get("ColumnCaption", i).IsNil()))
                {
                    caption =
                        (parameters.Get("ColumnCaption",
                             i).ToString() + ' ' +
                         parameters.Get("ColumnCaption2", i).ToString(false) + ' ' + parameters.Get("ColumnCaption3", i).ToString(false)).Trim();

                    // todo: add i for preventing same name columns (finance reports, long captions)
                    if (t.Columns.Contains(caption))
                    {
                        caption = caption + i.ToString();
                    }
                }
                else
                {
                    caption = "Column" + i.ToString();
                }

                /* if useIndented then
                 * begin
                 * columnCounter := ColumnCounter + 1;
                 * t.Columns.Add(caption + 'Indented');
                 * end;
                 */
                t.Columns.Add(caption);
                columnCounter = columnCounter + 1;
            }

            foreach (TResult element in sortedList)
            {
                if (element.display)
                {
                    row = t.NewRow();
                    display = false;
                    row[0] = element.code;

                    for (i = 0; i <= results.GetMaxDisplayColumns() - 1; i += 1)
                    {
                        if ((element.column[i] != null) && (!element.column[i].IsNil()))
                        {
                            display = true;
                            row[i + 1] = element.column[i].ToString();
                        }
                    }

                    if (display)
                    {
                        t.Rows.Add(row);
                    }
                }
            }

            FGridView.Columns.Clear();
            FGridView.AddTextColumn(t.Columns[0].ColumnName, t.Columns[0], 0);

            for (counter = 0; counter <= parameters.Get("MaxDisplayColumns").ToInt() - 1; counter += 1)
            {
                FGridView.AddTextColumn(t.Columns[counter + 1].ColumnName, t.Columns[counter + 1]);
            }

            FGridView.DataSource = new DevAge.ComponentModel.BoundDataView(new DataView(t));
            ((DevAge.ComponentModel.BoundDataView)FGridView.DataSource).AllowEdit = false;
            ((DevAge.ComponentModel.BoundDataView)FGridView.DataSource).AllowNew = false;
            ((DevAge.ComponentModel.BoundDataView)FGridView.DataSource).AllowDelete = false;
            FGridView.AutoSizeCells();

            // FGridView.Width := 576;   it is necessary to reassign the width because the columns don't take up the maximum width
            return ReturnValue;
        }
 /// <summary>
 /// todoComment
 /// </summary>
 /// <param name="AGrid"></param>
 /// <param name="ASourceTable"></param>
 public void CreateColumns(TSgrdDataGrid AGrid, DataTable ASourceTable)
 {
     AGrid.AddPartnerKeyColumn("Site Key", ASourceTable.Columns[PPartnerLedgerTable.GetPartnerKeyDBName()], 75);
     AGrid.AddTextColumn("Site Name", ASourceTable.Columns[PPartnerTable.GetPartnerShortNameDBName()], 353);
 }
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGrid"></param>
        public void CreateColumns(TSgrdDataGrid AGrid)
        {
            // var
            // ForeignTableColumn: DataColumn;
            // Add column Category in FMultiTableDS. Info is taken from the Interest table.
            // Rest of info comes from PartnerInterest table.
            // ForeignTableColumn := new DataColumn();
            // ForeignTableColumn.DataType := System.Type.GetType('System.String');
            // ForeignTableColumn.ColumnName := 'Parent_' + PInterestTable.GetCategoryDBName();
            // ForeignTableColumn.Expression := 'Parent.' + PInterestTable.GetCategoryDBName();
            // FMultiTableDS.EnableRelation('PartnerInterestCategory');
            // FMultiTableDS.PPartnerInterest.Columns.Add(ForeignTableColumn);
            // Agrid.AddTextColumn('Category', FMultiTableDS.PInterest.ColumnCategory);
            // AGrid.AddTextColumn('Category', FMultiTableDS.PPartnerInterest.Columns[
            // 'Parent_' + PInterestTable.GetCategoryDBName()]);
            // ????
            // AGrid.AddTextColumn('Category', FMultiTableDS.Tables. );
            // ????
            AGrid.AddTextColumn("Interest", FMultiTableDS.PPartnerInterest.ColumnInterest);
            AGrid.AddTextColumn("Country", FMultiTableDS.PPartnerInterest.ColumnCountry);
            AGrid.AddTextColumn("Field", FMultiTableDS.PPartnerInterest.ColumnFieldKey);
            AGrid.AddTextColumn("Level", FMultiTableDS.PPartnerInterest.ColumnLevel);
            AGrid.AddTextColumn("Comment", FMultiTableDS.PPartnerInterest.ColumnComment);

            // Agrid.Columns[5].DataCell.Editor := nil;
        }