private void GetDetailDataFromControlsManual(AccountsPayableTDSAApDocumentDetailRow ARow) { if (ARow == null) { return; } UpdateAttributeLabel(ARow); }
private void UpdateAttributeLabel(AccountsPayableTDSAApDocumentDetailRow DetailRow) { string strAnalAttr = ""; FMainDS.AApAnalAttrib.DefaultView.RowFilter = String.Format("{0}={1}", AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber); foreach (DataRowView rv in FMainDS.AApAnalAttrib.DefaultView) { AApAnalAttribRow Row = (AApAnalAttribRow)rv.Row; if (strAnalAttr.Length > 0) { strAnalAttr += ", "; } strAnalAttr += (Row.AnalysisTypeCode + "=" + Row.AnalysisAttributeValue); } DetailRow.AnalAttr = strAnalAttr; }
// // Called from cmbDetailAccountCode.SelectedValueChanged, // I need to load the Analysis Types Pane with the required attributes for this account, // and show any assignments already made. void ShowAnalysisAttributesForAccount(object sender, EventArgs e) { // // It's possible that my TDS doesn't even have an AnalAttrib table... if (FMainDS.AApAnalAttrib == null) { FMainDS.Merge(new AApAnalAttribTable()); } if (FPetraUtilsObject.SuppressChangeDetection || (FPreviouslySelectedDetailRow == null)) { return; } //Empty the grid FMainDS.AApAnalAttrib.DefaultView.RowFilter = "1=2"; FPSAttributesRow = null; if (grdAnalAttributes.Columns.Count < 2) // This is initialisation but I moved it here because sometimes this is called before Show(). { grdAnalAttributes.SpecialKeys = GridSpecialKeys.Default | GridSpecialKeys.Tab; cmbAnalAttribValues = new SourceGrid.Cells.Editors.ComboBox(typeof(string)); cmbAnalAttribValues.Control.DropDownStyle = ComboBoxStyle.DropDownList; cmbAnalAttribValues.EnableEdit = true; cmbAnalAttribValues.EditableMode = EditableMode.Focus; cmbAnalAttribValues.Control.SelectedValueChanged += new EventHandler(AnalysisAttributeValueChanged); grdAnalAttributes.AddTextColumn("Value", FMainDS.AApAnalAttrib.Columns[AApAnalAttribTable.GetAnalysisAttributeValueDBName()], 120, cmbAnalAttribValues); grdAnalAttributes.Selection.SelectionChanged += new RangeRegionChangedEventHandler(AnalysisAttributesGrid_RowSelected); } grdAnalAttributes.Columns[0].Width = 90; // for some unknown reason, this doesn't work. grdAnalAttributes.Columns[1].Width = 120; AccountsPayableTDSAApDocumentDetailRow DetailRow = GetSelectedDetailRow(); DetailRow.AccountCode = cmbDetailAccountCode.GetSelectedString(); // // So I want to remove any attributes attached to this row that don't have the new account code... FMainDS.AApAnalAttrib.DefaultView.RowFilter = String.Format("{0}={1} AND {2}={3} AND {4}={5} AND {6}<>'{7}'", AApAnalAttribTable.GetLedgerNumberDBName(), DetailRow.LedgerNumber, AApAnalAttribTable.GetApDocumentIdDBName(), DetailRow.ApDocumentId, AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber, AApAnalAttribTable.GetAccountCodeDBName(), DetailRow.AccountCode); for (Int32 RowIdx = FMainDS.AApAnalAttrib.DefaultView.Count; RowIdx > 0; RowIdx--) { FMainDS.AApAnalAttrib.DefaultView[RowIdx - 1].Row.Delete(); } FMainDS.AAnalysisAttribute.DefaultView.RowFilter = String.Format("{0}='{1}'", AAnalysisAttributeTable.GetAccountCodeDBName(), DetailRow.AccountCode); String AccountCodeRowFilter = String.Format("{0}={1} AND {2}={3} AND {4}={5} AND {6}='{7}'", AApAnalAttribTable.GetLedgerNumberDBName(), DetailRow.LedgerNumber, AApAnalAttribTable.GetApDocumentIdDBName(), DetailRow.ApDocumentId, AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber, AApAnalAttribTable.GetAccountCodeDBName(), DetailRow.AccountCode); foreach (DataRowView rv in FMainDS.AAnalysisAttribute.DefaultView) // List of attributes required for this account { AAnalysisAttributeRow AttrRow = (AAnalysisAttributeRow)rv.Row; FMainDS.AApAnalAttrib.DefaultView.RowFilter = AccountCodeRowFilter + String.Format(" AND {0}='{1}'", AApAnalAttribTable.GetAnalysisTypeCodeDBName(), AttrRow.AnalysisTypeCode); if (FMainDS.AApAnalAttrib.DefaultView.Count == 0) // No Entry yet for this attribute. This is likely, given I just deleted everything... { AApAnalAttribRow AARow = FMainDS.AApAnalAttrib.NewRowTyped(); AARow.LedgerNumber = DetailRow.LedgerNumber; AARow.ApDocumentId = DetailRow.ApDocumentId; AARow.DetailNumber = DetailRow.DetailNumber; AARow.AnalysisTypeCode = AttrRow.AnalysisTypeCode; AARow.AccountCode = DetailRow.AccountCode; FMainDS.AApAnalAttrib.Rows.Add(AARow); } } FMainDS.AApAnalAttrib.DefaultView.RowFilter = AccountCodeRowFilter; FMainDS.AApAnalAttrib.DefaultView.Sort = AApAnalAttribTable.GetAnalysisTypeCodeDBName(); grdAnalAttributes.DataSource = null; grdAnalAttributes.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.AApAnalAttrib.DefaultView); UpdateAttributeLabel(DetailRow); if (grdAnalAttributes.Rows.Count > 2) { grdAnalAttributes.Enabled = true; grdAnalAttributes.SelectRowWithoutFocus(1); AnalysisAttributesGrid_RowSelected(null, null); } else { grdAnalAttributes.Enabled = false; } }
private void GetDetailDataFromControlsManual(AccountsPayableTDSAApDocumentDetailRow ARow) { if (ARow == null) { return; } UpdateAttributeLabel(ARow); }
private void UpdateAttributeLabel(AccountsPayableTDSAApDocumentDetailRow DetailRow) { string strAnalAttr = ""; FMainDS.AApAnalAttrib.DefaultView.RowFilter = String.Format("{0}={1}", AApAnalAttribTable.GetDetailNumberDBName(), DetailRow.DetailNumber); foreach (DataRowView rv in FMainDS.AApAnalAttrib.DefaultView) { AApAnalAttribRow Row = (AApAnalAttribRow)rv.Row; if (strAnalAttr.Length > 0) { strAnalAttr += ", "; } strAnalAttr += (Row.AnalysisTypeCode + "=" + Row.AnalysisAttributeValue); } DetailRow.AnalAttr = strAnalAttr; }