private void InitializeManualCode() { // The auto-generated code requires that the grid be named grdDetails (for filter/find), but that doesn't work for another part of the autogenerated code! // So we make grdDetails reference grdSuppliers here at initialization grdDetails = grdSuppliers; grdSuppliers.DataPageLoaded += new TDataPageLoadedEventHandler(grdSuppliers_DataPageLoaded); }
private void InitializeManualCode() { // The auto-generated code requires that the grid be named grdDetails (for filter/find), but that doesn't work for another part of the autogenerated code! // So we make grdDetails reference grdInvoices here at initialization grdDetails = grdInvoices; grdInvoices.MouseClick += new MouseEventHandler(grdResult_Click); grdInvoices.DataPageLoaded += new TDataPageLoadedEventHandler(grdInvoices_DataPageLoaded); grdInvoices.Selection.SelectionChanged += new SourceGrid.RangeRegionChangedEventHandler(Selection_SelectionChanged); }
/// <summary> /// Return selected row /// </summary> /// <param name="AGrid"></param> /// <returns></returns> public static ATransAnalAttribRow GetSelectedAttributeRow(TSgrdDataGridPaged AGrid) { DataRowView[] SelectedGridRow = AGrid.SelectedDataRowsAsDataRowView; if (SelectedGridRow.Length >= 1) { return((ATransAnalAttribRow)SelectedGridRow[0].Row); } return(null); }
/// <summary> /// Sets up the visual appearance of the Grid. /// </summary> /// <remarks><em>Caution:</em>Do not call this Method with <paramref name="AAutoSizeCells" /> set to true /// if the Grid holds more than a few hundred Rows, as the Grid will take quite a time for the auto-sizing /// calculation!</remarks> public static void SetupDataGridVisualAppearance(TSgrdDataGridPaged ADataGrid, bool AAutoSizeCells = true) { // make the border to the right of the fixed columns bold ((TSgrdTextColumn)ADataGrid.Columns[2]).BoldRightBorder = true; // TLogging.Log("ADataGrid.Rows.Count: " + ADataGrid.Rows.Count.ToString()); if (AAutoSizeCells) { ADataGrid.AutoResizeGrid(); } }
private void RefreshAnalysisAttributesGrid(TCmbAutoPopulated ACombo, GLBatchTDS ADS) { TSgrdDataGridPaged Grid = null; int TransactionNumber = 0; if (ACombo.Name == cmbFromAccountCode.Name) { Grid = grdFromAnalAttributes; TransactionNumber = FJournal.LastTransactionNumber + 1; } else { Grid = grdToAnalAttributes; TransactionNumber = FCurrentTransactionNumber; } //Empty the grid ADS.ATransAnalAttrib.DefaultView.RowFilter = "1=2"; FPSAttributesRow = null; if (!TRemote.MFinance.Setup.WebConnectors.AccountHasAnalysisAttributes(FLedgerNumber, ACombo.GetSelectedString(), true)) { if (Grid.Enabled) { Grid.Enabled = false; } return; } else { if (!Grid.Enabled) { Grid.Enabled = true; } } FAnalysisAttributesLogic.SetTransAnalAttributeDefaultView(ADS, TransactionNumber); Grid.DataSource = new DevAge.ComponentModel.BoundDataView(ADS.ATransAnalAttrib.DefaultView); if (Grid.Rows.Count > 1) { Grid.SelectRowWithoutFocus(1); AnalysisAttributesGrid_RowSelected(Grid, null); } }
/// <summary> /// The main constructor /// </summary> /// <param name="ACallerFormOrControl">The form or control that is instantiating this class</param> /// <param name="APetraUtilsObject">The TFrmPetraUtils instance associated with the caller form or control</param> /// <param name="AGrid">The grid associated with the caller form or control</param> /// <param name="AButtonPanel">The IButtonPanel associated with the caller form or control. (Typically simply pass 'this').</param> /// <param name="APanelFilterFind">The Panel control associated with the caller form or control.</param> /// <param name="AChkToggleFilter">The checkbox control associated with the caller form or control.</param> /// <param name="ALblRecordCounter">The Label control displaying the record count associated with the caller form or control.</param> public TFilterAndFindPanel(IFilterAndFind ACallerFormOrControl, TFrmPetraUtils APetraUtilsObject, TSgrdDataGridPaged AGrid, IButtonPanel AButtonPanel, Panel APanelFilterFind, CheckBox AChkToggleFilter, Label ALblRecordCounter) { FCallerFormOrControl = ACallerFormOrControl; FPetraUtilsObject = APetraUtilsObject; FGrid = AGrid; FButtonPanel = AButtonPanel; FPnlFilterFind = APanelFilterFind; FChkToggleFilter = AChkToggleFilter; FLblRecordCounter = ALblRecordCounter; }
/// <summary> /// Loads the data of the column parameters to the grid /// </summary> /// <param name="AGrid">Grid to show the values</param> /// <param name="AColumnTable">Table that holds the column parameter data</param> public static void LoadDataToGrid(ref TSgrdDataGridPaged AGrid, ref DataTable AColumnTable) { AGrid.Columns.Clear(); for (int counter = 0; counter < AColumnTable.Columns.Count; ++counter) { AGrid.AddTextColumn("Column " + Convert.ToString(counter + 1), AColumnTable.Columns[counter]); // SourceGrid.Cells.ColumnHeader myColumnHeader = (SourceGrid.Cells.ColumnHeader)AGrid.Columns[counter].HeaderCell; } AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(new DataView(AColumnTable)); AGrid.DataSource.AllowEdit = false; AGrid.DataSource.AllowNew = false; AGrid.DataSource.AllowDelete = false; AGrid.AutoSizeCells(); }
/// <summary> /// Sets up the DataBinding of the Grid. /// </summary> public static void SetupDataGridDataBinding(TSgrdDataGridPaged ADataGrid, DataTable APagedDataTable, RowEventHandler AFocusRowEnteredHandler = null) { DataView FindResultPagedDV; FindResultPagedDV = APagedDataTable.DefaultView; FindResultPagedDV.AllowNew = false; FindResultPagedDV.AllowDelete = false; FindResultPagedDV.AllowEdit = false; ADataGrid.DataSource = new DevAge.ComponentModel.BoundDataView(FindResultPagedDV); if (AFocusRowEnteredHandler != null) { // Hook up event that fires when a different Row is selected ADataGrid.Selection.FocusRowEntered += new RowEventHandler(AFocusRowEnteredHandler); } }
private void InitializeManualCode() { grdDetails = grdResult; grdResult.MouseClick += new MouseEventHandler(grdResult_Click); grdResult.DataPageLoaded += new TDataPageLoadedEventHandler(grdResult_DataPageLoaded); grdResult.Selection.SelectionChanged += new SourceGrid.RangeRegionChangedEventHandler(grdResult_SelectionChanged); FPetraUtilsObject.SetStatusBarText(grdDetails, Catalog.GetString("Use the navigation keys to select a transaction. Double-click to view the details")); FPetraUtilsObject.SetStatusBarText(btnAddTaggedToPayment, Catalog.GetString("Click to pay the tagged items")); FPetraUtilsObject.SetStatusBarText(btnApproveTagged, Catalog.GetString("Click to approve the tagged items")); FPetraUtilsObject.SetStatusBarText(btnPostTagged, Catalog.GetString("Click to post the tagged items")); FPetraUtilsObject.SetStatusBarText(btnReloadList, Catalog.GetString("Click to re-load the transactions list")); FPetraUtilsObject.SetStatusBarText(btnTagAll, Catalog.GetString("Click to tag all the displayed items")); FPetraUtilsObject.SetStatusBarText(btnUntagAll, Catalog.GetString("Click to un-tag all the displayed items")); FPetraUtilsObject.SetStatusBarText(chkToggleFilter, Catalog.GetString("Click to show/hide the Filter/Find panel")); }
/// constructor public TSgrdDataGridPagedTester(string name) { Finder <TSgrdDataGridPaged> finder = new Finder <TSgrdDataGridPaged>(name); _TheObject = finder.Find(); }
/// constructor public TSgrdDataGridPagedTester(string name, string formName) { Finder <TSgrdDataGridPaged> finder = new Finder <TSgrdDataGridPaged>(name, new FormFinder().Find(formName)); _TheObject = finder.Find(); }
/// <summary> /// Setups the contact attributes grid (used on the following screens: Contact Log tab, Contacts with Partners and Extract by Contact Log. /// </summary> /// <param name="AGrid">Grid to be set up</param> /// <param name="AAttributes">Attributes to be included in the grid</param> /// <param name="AIncludeDescription">Include columns that display the attribute descriptions</param> /// <param name="AContactLogIDFilter">Filter grid to only show rows for given contact log if</param> public static DataView SetupContactAttributesGrid(ref TSgrdDataGridPaged AGrid, DataTable AAttributes, bool AIncludeDescription, Int64 AContactLogIDFilter = -1) { DataView ContactAttributeTableDV = TDataCache.TMPartner.GetCacheableMailingTable(TCacheableMailingTablesEnum.ContactAttributeList).DefaultView; ContactAttributeTableDV.Sort = PContactAttributeTable.GetContactAttributeCodeDBName() + " ASC"; DataView ContactAttributeDetailTableDV = TDataCache.TMPartner.GetCacheableMailingTable(TCacheableMailingTablesEnum.ContactAttributeDetailList).DefaultView; ContactAttributeDetailTableDV.Sort = PContactAttributeDetailTable.GetContactAttributeCodeDBName() + " ASC, " + PContactAttributeDetailTable.GetContactAttrDetailCodeDBName() + " ASC"; DataTable DT = new PPartnerContactAttributeTable(); if ((AAttributes != null) && (AAttributes.Rows.Count > 0)) { DT = AAttributes.Copy(); } if (AIncludeDescription) { DT.Columns.Add("AttributeDescription", System.Type.GetType("System.String")); DT.Columns.Add("AttributeDetailDescription", System.Type.GetType("System.String")); // add descriptions to new table foreach (DataRow Row in DT.Rows) { if (Row.RowState != DataRowState.Deleted) { Row["AttributeDescription"] = GetContactAttributeDesciption( Row[PPartnerContactAttributeTable.GetContactAttributeCodeDBName()].ToString(), ContactAttributeTableDV); Row["AttributeDetailDescription"] = GetContactAttributeDetailDesciption( Row[PPartnerContactAttributeTable.GetContactAttributeCodeDBName()].ToString(), Row[PPartnerContactAttributeTable.GetContactAttrDetailCodeDBName()].ToString(), ContactAttributeDetailTableDV); } } } AGrid.Columns.Clear(); AGrid.AddTextColumn("Attribute Code", DT.Columns[PPartnerContactAttributeTable.GetContactAttributeCodeDBName()]); if (AIncludeDescription) { AGrid.AddTextColumn("Description", DT.Columns["AttributeDescription"]); } AGrid.AddTextColumn("Detail Code", DT.Columns[PPartnerContactAttributeTable.GetContactAttrDetailCodeDBName()]); if (AIncludeDescription) { AGrid.AddTextColumn("Description", DT.Columns["AttributeDetailDescription"]); } DataView GridTableDV = DT.DefaultView; GridTableDV.AllowNew = false; GridTableDV.AllowEdit = false; GridTableDV.AllowDelete = false; if (AContactLogIDFilter != -1) { GridTableDV.RowFilter = PPartnerContactAttributeTable.GetContactIdDBName() + " = " + AContactLogIDFilter; } // DataBind the DataGrid AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(GridTableDV); AGrid.AutoResizeGrid(); return(GridTableDV); }
private void InitializeManualCode() { // The auto-generated code requires that the grid be named grdDetails (for filter/find), but that doesn't work for another part of the autogenerated code! // So we make grdDetails reference grdSuppliers here at initialization grdDetails = grdCostCentres; }
private void AnalysisAttributesGrid_RowSelected(System.Object sender, RangeRegionChangedEventArgs e) { TSgrdDataGridPaged Grid = sender as TSgrdDataGridPaged; if (Grid == null) { Grid = (TSgrdDataGridPaged)((SourceGrid.Selection.RowSelection)sender).Grid; } if (Grid.Selection.ActivePosition.IsEmpty() || (Grid.Selection.ActivePosition.Column == 0)) { return; } if ((TAnalysisAttributes.GetSelectedAttributeRow(Grid) == null) || (FPSAttributesRow == TAnalysisAttributes.GetSelectedAttributeRow(Grid))) { return; } FPSAttributesRow = TAnalysisAttributes.GetSelectedAttributeRow(Grid); string currentAnalTypeCode = FPSAttributesRow.AnalysisTypeCode; FCacheDS.AFreeformAnalysis.DefaultView.RowFilter = String.Format("{0}='{1}' AND {2}=true", AFreeformAnalysisTable.GetAnalysisTypeCodeDBName(), currentAnalTypeCode, AFreeformAnalysisTable.GetActiveDBName()); int analTypeCodeValuesCount = FCacheDS.AFreeformAnalysis.DefaultView.Count; if (analTypeCodeValuesCount == 0) { MessageBox.Show(Catalog.GetString( "No attribute values are defined!"), currentAnalTypeCode, MessageBoxButtons.OK, MessageBoxIcon.Error); } string[] analTypeValues = new string[analTypeCodeValuesCount]; FCacheDS.AFreeformAnalysis.DefaultView.Sort = AFreeformAnalysisTable.GetAnalysisValueDBName(); int counter = 0; foreach (DataRowView dvr in FCacheDS.AFreeformAnalysis.DefaultView) { AFreeformAnalysisRow faRow = (AFreeformAnalysisRow)dvr.Row; analTypeValues[counter] = faRow.AnalysisValue; counter++; } //Refresh the combo values if (Grid.Name == grdFromAnalAttributes.Name) { FcmbFromAnalAttribValues.StandardValuesExclusive = true; FcmbFromAnalAttribValues.StandardValues = analTypeValues; } else { FcmbToAnalAttribValues.StandardValuesExclusive = true; FcmbToAnalAttribValues.StandardValues = analTypeValues; } }
private void SetupAnalysisAttributeGrid(TSgrdDataGridPaged AGrid, ref SourceGrid.Cells.Editors.ComboBox AGridCombo) { AGrid.DataSource = null; GLBatchTDS DS = null; TCmbAutoPopulated AccountCombo = null; SourceGrid.Cells.Editors.ComboBox ATempCombo = null; if (AGrid.Name == grdFromAnalAttributes.Name) { FTempFromDS = (GLBatchTDS)FMainDS.Clone(); DS = FTempFromDS; AccountCombo = cmbFromAccountCode; } else { DS = FMainDS; AccountCombo = cmbDetailAccountCode; } if (AGrid.Columns.Count == 0) { ATempCombo = new SourceGrid.Cells.Editors.ComboBox(typeof(string)); ATempCombo.EnableEdit = true; ATempCombo.EditableMode = EditableMode.Focus; AGrid.Columns.Clear(); AGrid.AddTextColumn(Catalog.GetString("Type"), FMainDS.ATransAnalAttrib.ColumnAnalysisTypeCode, 99); AGrid.AddTextColumn(Catalog.GetString("Value"), DS.ATransAnalAttrib.Columns[ATransAnalAttribTable.GetAnalysisAttributeValueDBName()], 150, ATempCombo); } FAnalysisAttributesLogic.SetTransAnalAttributeDefaultView(DS); DS.ATransAnalAttrib.DefaultView.AllowNew = false; AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(DS.ATransAnalAttrib.DefaultView); AGrid.SetHeaderTooltip(0, Catalog.GetString("Type")); AGrid.SetHeaderTooltip(1, Catalog.GetString("Value")); AGrid.Selection.SelectionChanged += AnalysisAttributesGrid_RowSelected; //Prepare Analysis attributes grid to highlight inactive analysis codes // Create a cell view for special conditions SourceGrid.Cells.Views.Cell strikeoutCell2 = new SourceGrid.Cells.Views.Cell(); strikeoutCell2.Font = new System.Drawing.Font(AGrid.Font, FontStyle.Strikeout); // Create a condition, apply the view when true, and assign a delegate to handle it SourceGrid.Conditions.ConditionView conditionAnalysisCodeActive = new SourceGrid.Conditions.ConditionView(strikeoutCell2); conditionAnalysisCodeActive.EvaluateFunction = delegate(SourceGrid.DataGridColumn column2, int gridRow2, object itemRow2) { DataRowView row2 = (DataRowView)itemRow2; string analysisCode = row2[ATransAnalAttribTable.ColumnAnalysisTypeCodeId].ToString(); return(!FAnalysisAttributesLogic.AnalysisCodeIsActive(AccountCombo.GetSelectedString(), FCacheDS.AAnalysisAttribute, analysisCode)); }; // Create a condition, apply the view when true, and assign a delegate to handle it SourceGrid.Conditions.ConditionView conditionAnalysisAttributeValueActive = new SourceGrid.Conditions.ConditionView(strikeoutCell2); conditionAnalysisAttributeValueActive.EvaluateFunction = delegate(SourceGrid.DataGridColumn column2, int gridRow2, object itemRow2) { if (itemRow2 != null) { DataRowView row2 = (DataRowView)itemRow2; string analysisCode = row2[ATransAnalAttribTable.ColumnAnalysisTypeCodeId].ToString(); string analysisAttributeValue = row2[ATransAnalAttribTable.ColumnAnalysisAttributeValueId].ToString(); return(!TAnalysisAttributes.AnalysisAttributeValueIsActive(ref ATempCombo, FCacheDS.AFreeformAnalysis, analysisCode, analysisAttributeValue)); } else { return(false); } }; //Add conditions to columns int indexOfAnalysisCodeColumn = 0; int indexOfAnalysisAttributeValueColumn = 1; AGrid.Columns[indexOfAnalysisCodeColumn].Conditions.Add(conditionAnalysisCodeActive); AGrid.Columns[indexOfAnalysisAttributeValueColumn].Conditions.Add(conditionAnalysisAttributeValueActive); AGridCombo = ATempCombo; }