Example #1
0
        private void ExpenseGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int TransactionID = 0;

            if (e.ColumnIndex == 8)
            {
                drpClientList.SelectedValue   = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["ClientID"].Value.ToString());
                drpLocationList.SelectedValue = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["LocationID"].Value.ToString());
                drpCategoryList.SelectedValue = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["CategoryID"].Value.ToString());
                lblTransactionID.Text         = ExpenseGrid.Rows[e.RowIndex].Cells["TransactionID"].Value.ToString();
                txtPayTo.Text                = ExpenseGrid.Rows[e.RowIndex].Cells["PayTo"].Value.ToString();
                txtAmount.Text               = ExpenseGrid.Rows[e.RowIndex].Cells["Amount"].Value.ToString();
                txtNote.Text                 = ExpenseGrid.Rows[e.RowIndex].Cells["Note"].Value.ToString();
                dateTime.Text                = ExpenseGrid.Rows[e.RowIndex].Cells["Date"].Value.ToString();
                pnlExpenseForm.Visible       = true;
                pnlExpenseGrid.Visible       = false;
                btnSaveExpenseDetail.Visible = false;
                btnUpdate.Visible            = true;
            }
            if (e.ColumnIndex == 9)
            {
                TransactionID = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["TransactionID"].Value);

                ExpenseDetailManager cm = new ExpenseDetailManager();
                cm.DeleteExpense(TransactionID);
                bindExpenseGrid();

                pnlExpenseForm.Visible = false;
                pnlExpenseGrid.Visible = true;
            }
        }
Example #2
0
        private void ExpenseGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int TransactionID = 0;

            if (e.ColumnIndex == 8)
            {

                drpClientList.SelectedValue = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["ClientID"].Value.ToString());
                drpLocationList.SelectedValue = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["LocationID"].Value.ToString());
                drpCategoryList.SelectedValue = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["CategoryID"].Value.ToString());
                lblTransactionID.Text = ExpenseGrid.Rows[e.RowIndex].Cells["TransactionID"].Value.ToString();
                txtPayTo.Text = ExpenseGrid.Rows[e.RowIndex].Cells["PayTo"].Value.ToString();
                txtAmount.Text = ExpenseGrid.Rows[e.RowIndex].Cells["Amount"].Value.ToString();
                txtNote.Text = ExpenseGrid.Rows[e.RowIndex].Cells["Note"].Value.ToString();
                dateTime.Text = ExpenseGrid.Rows[e.RowIndex].Cells["Date"].Value.ToString();
                pnlExpenseForm.Visible = true;
                pnlExpenseGrid.Visible = false;
                btnSaveExpenseDetail.Visible = false;
                btnUpdate.Visible = true;

            }
            if (e.ColumnIndex == 9)
            {
                TransactionID = Convert.ToInt32(ExpenseGrid.Rows[e.RowIndex].Cells["TransactionID"].Value);

                ExpenseDetailManager cm = new ExpenseDetailManager();
                cm.DeleteExpense(TransactionID);
                bindExpenseGrid();

                pnlExpenseForm.Visible = false;
                pnlExpenseGrid.Visible = true;
            }
        }