private void ShowBudgetCellInPanel(BudgetDetailRow row, int columnIndex, DataGridViewCell gridCell) { if (columnIndex >= NonPeriodColumns) { BudgetDetailCell cell = row.Cells[columnIndex - NonPeriodColumns]; mSelectedBudgetCell = cell; mSelectedBudgetRow = row; mSelectedBudgetColumn = columnIndex; mSelectedBudgetGridCell = (BudgetGridCell)gridCell; StartShowCell(row, columnIndex, "Budget"); lblDashboardAmount.Text = "Total of Above Detail: " + cell.CellAmount.ToString("F2"); lblGeneratedAmount.Text = "Original Combined Limit of Above Budgets: " + cell.GeneratedAmount.ToString("F2"); lblBudgetLimit.Text = "Current Combined Limit of Above Budgets: " + cell.BudgetLimit.ToString("F2"); lblBudgetApplied.Text = "Amount Used From Above Budgets: " + cell.BudgetUsed.ToString("F2"); SetBudgetDetailVisibility(true); List <IDetailItemBuilder> builders = new List <IDetailItemBuilder>(); foreach (BudgetTrx budget in cell.Budgets) { builders.Add(new BudgetDetailItemBuilder(budget)); } foreach (TrxSplit split in cell.Splits) { builders.Add(new SplitDetailItemBuilder(split)); } builders.Sort(DetailItemComparer); foreach (var builder in builders) { lvwDetails.Items.Add(builder.Build()); } } else { CheckCellDetailVisibility(false); } }
private void grdMain_CellClick(object sender, DataGridViewCellEventArgs e) { mSelectedBudgetCell = null; mSelectedBudgetRow = null; mSelectedBudgetColumn = 0; mSelectedBudgetGridCell = null; DataGridViewRow row = grdMain.Rows[e.RowIndex]; if (row.Tag is SplitDetailRow) { ShowSplitCell(row.Tag as SplitDetailRow, e.ColumnIndex); } else if (row.Tag is BudgetDetailRow) { ShowBudgetCellInPanel(row.Tag as BudgetDetailRow, e.ColumnIndex, row.Cells[e.ColumnIndex]); } else { CheckCellDetailVisibility(false); } }