//////////////////////////////////////////////////////////////////////////////////////////// // Data Grid View events //////////////////////////////////////////////////////////////////////////////////////////// private void cdDGV_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { CDLinesDGV lineDGV = sender as CDLinesDGV; int lineID = -1; // Defaults. Used for new lines. lineDGV.flagLineError = false; lineDGV.flagAccountError = false; // try to get the current row lineID try { lineID = Convert.ToInt32(lineDGV["lineItemIDColumn", e.RowIndex].Value); } catch { return; } TransactionDataSet.LineItemRow thisLine = this.tDataSet.LineItem.FindByid(lineID); // Set Flags if (thisLine != null) { bool thisLineUsesEnvelopes = thisLine.AccountRowByFK_Line_accountID.envelopes; lineDGV.flagLineError = thisLine.lineError; if (thisLine.accountID == SpclAccount.NULL) { lineDGV.flagAccountError = true; } //if (thisLine.envelopeID == SpclEnvelope.SPLIT || !thisLineUsesEnvelopes) // lineDGV.flagReadOnlyEnvelope = true; } }
//////////////////////////////////////////////////////////////////////////////////////////// // Functions Private //////////////////////////////////////////////////////////////////////////////////////////// private void buildDGVs() { //////////////////////////////////// // Credit DGV (Top) this.creditDGV = new CDLinesDGV(LineCD.CREDIT); this.creditDGV.Dock = DockStyle.Fill; this.transactionLayoutPanel.Controls.Add(this.creditDGV, 0, 1); this.transactionLayoutPanel.SetColumnSpan(this.creditDGV, 6); this.creditDGV.BindingSourceLineItemDGV.DataSource = tDataSet; this.creditDGV.BindingSourceLineItemDGV.DataMember = "LineItem"; this.creditDGV.BindingSourceLineItemDGV.Filter = "creditDebit = 0"; // LineCD.CREDIT this.creditDGV.BindingSourceAccountIDCol.DataSource = tDataSet; this.creditDGV.BindingSourceAccountIDCol.DataMember = "Account"; this.creditDGV.BindingSourceAccountIDCol.Sort = "name"; this.creditDGV.BindingSourceAccountIDCol.Filter = "id <> " + SpclAccount.MULTIPLE; this.creditDGV.BindingSourceEnvelopeIDCol.DataSource = tDataSet; this.creditDGV.BindingSourceEnvelopeIDCol.DataMember = "Envelope"; this.creditDGV.BindingSourceEnvelopeIDCol.Sort = "name"; this.creditDGV.BindingSourceTypeIDCol.DataSource = tDataSet; this.creditDGV.BindingSourceTypeIDCol.DataMember = "LineType"; this.creditDGV.BindingSourceTypeIDCol.Sort = "name"; this.creditDGV.CellClick += new DataGridViewCellEventHandler(creditDGV_CellClick); this.creditDGV.RowPrePaint += new DataGridViewRowPrePaintEventHandler(cdDGV_RowPrePaint); this.creditDGV.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(creditDGV_CellContextMenuStripNeeded); //////////////////////////////////// // Debit DGV (Bottom) this.debitDGV = new CDLinesDGV(LineCD.DEBIT); this.debitDGV.Dock = DockStyle.Fill; this.transactionLayoutPanel.Controls.Add(this.debitDGV, 0, 3); this.transactionLayoutPanel.SetColumnSpan(this.debitDGV, 6); this.debitDGV.BindingSourceLineItemDGV.DataSource = tDataSet; this.debitDGV.BindingSourceLineItemDGV.DataMember = "LineItem"; this.debitDGV.BindingSourceLineItemDGV.Filter = "creditDebit = 1"; // LineCD.DEBIT this.debitDGV.BindingSourceAccountIDCol.DataSource = tDataSet; this.debitDGV.BindingSourceAccountIDCol.DataMember = "Account"; this.debitDGV.BindingSourceAccountIDCol.Sort = "name"; this.debitDGV.BindingSourceAccountIDCol.Filter = "id <> " + SpclAccount.MULTIPLE.ToString(); this.debitDGV.BindingSourceEnvelopeIDCol.DataSource = tDataSet; this.debitDGV.BindingSourceEnvelopeIDCol.DataMember = "Envelope"; this.debitDGV.BindingSourceEnvelopeIDCol.Sort = "name"; this.debitDGV.BindingSourceTypeIDCol.DataSource = tDataSet; this.debitDGV.BindingSourceTypeIDCol.DataMember = "LineType"; this.debitDGV.BindingSourceTypeIDCol.Sort = "name"; this.debitDGV.CellClick += new DataGridViewCellEventHandler(debitDGV_CellClick); this.debitDGV.RowPrePaint += new DataGridViewRowPrePaintEventHandler(cdDGV_RowPrePaint); this.debitDGV.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(debitDGV_CellContextMenuStripNeeded); //////////////////////////////////// // SubTransactions DGV this.envLinesDGV = new EnvelopeLineDGV(); this.transactionLayoutPanel.Controls.Add(this.envLinesDGV, 0, 5); this.transactionLayoutPanel.SetRowSpan(this.envLinesDGV, 3); this.envLinesDGV.BindingSourceEnvelopeLineDGV.DataSource = this.tDataSet; this.envLinesDGV.BindingSourceEnvelopeLineDGV.DataMember = "EnvelopeLine"; this.envLinesDGV.BindingSourceEnvelopeCol.DataSource = this.tDataSet; this.envLinesDGV.BindingSourceEnvelopeCol.DataMember = "Envelope"; this.envLinesDGV.BindingSourceEnvelopeCol.Sort = "name"; this.envLinesDGV.BindingSourceEnvelopeCol.Filter = "id <> " + SpclEnvelope.SPLIT.ToString(); this.envLinesDGV.RowPrePaint += new DataGridViewRowPrePaintEventHandler(envLinesDGV_RowPrePaint); this.envLinesDGV.CellClick += new DataGridViewCellEventHandler(subTransDGV_CellClick); }