Example #1
0
        private void roles_dataGridView_CellClick_1(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    add_button.Enabled = false;

                    if (edit == true) //updating
                    {
                        save_button.Enabled = true;
                    }
                    else if (edit == false) //adding
                    {
                        save_button.Enabled = false;
                    }

                    DataGridViewRow row = roles_dataGridView.Rows[e.RowIndex];

                    roleID = Convert.ToInt32(row.Cells[0].Value.ToString());

                    roles_textBox.Text = row.Cells[1].Value.ToString();

                    CodingSourceClass.disable(left_panel);

                    delete_button.Enabled = true;

                    edit_button.Enabled = true;

                    save_button.Enabled = false;

                    cancel_button.Enabled = true;

                    view_button.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                CodingSourceClass.ShowMsg(ex.Message, "Error");

                enable_crud_buttons();

                CodingSourceClass.disable_reset(left_panel);
            }
        }
Example #2
0
        private void payments_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    add_button.Enabled = false;

                    if (edit == true) //updating member
                    {
                        save_button.Enabled = true;
                    }
                    else if (edit == false) //adding member
                    {
                        save_button.Enabled = false;
                    }

                    DataGridViewRow row = payments_dataGridView.Rows[e.RowIndex];

                    paymentID = Convert.ToInt32(row.Cells[0].Value.ToString());

                    customer_comboBox_payments.Text = row.Cells["customernameGV"].Value.ToString();

                    sales_invoice_comboBox_payments.Text = row.Cells["billnoGV"].Value.ToString();

                    shop_comboBox_payments.Text = row.Cells["shopGV"].Value.ToString();

                    customerID = Convert.ToInt32(row.Cells["customerIDGV"].Value);

                    salesinvoiceID = Convert.ToInt32(row.Cells["salesinvoiceIDGV"].Value);

                    if (/*sales_invoice_comboBox_payments.SelectedIndex != -1*/ true)
                    {
                        Hashtable ht = new Hashtable();

                        ht.Add("@custID", customerID);

                        ht.Add("@salesinvoiceID", salesinvoiceID);

                        double[] arr = SQL_TASKS.SaleInvoiceAmounts("st_getSALESINVOICEAMOUNT", ht);

                        total_amount_textBox_payments.Text = arr[0].ToString();

                        amount_paid_textBox_payments.Text = arr[1].ToString();

                        remaining_amount_textBox_payments.Text = arr[2].ToString();
                    }

                    dateTimePicker_payments.Value = Convert.ToDateTime(row.Cells[1].Value);

                    userID = Convert.ToInt32(row.Cells[3].Value.ToString());

                    postedby = row.Cells[4].Value.ToString();

                    amount_to_pay_textBox_payments.Text = row.Cells[10].Value.ToString();

                    cheque_no_textBox.Text = row.Cells[11].Value.ToString();

                    bank_and_branch_textBox.Text = row.Cells[12].Value.ToString();

                    clearing_date_dateTimePicker.Text = row.Cells["clearingdateGV"].Value.ToString();

                    if (cheque_no_textBox.Text == "" && bank_and_branch_textBox.Text == "")
                    {
                        cash_radioButton_sales_invoice.Checked = true;
                    }
                    else
                    {
                        cheque_radioButton.Checked = true;
                    }

                    CodingSourceClass.disable(left_panel);

                    delete_button.Enabled = true;

                    edit_button.Enabled = true;

                    save_button.Enabled = false;

                    cancel_button.Enabled = true;

                    view_button.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                CodingSourceClass.ShowMsg(ex.Message, "Error");

                enable_crud_buttons();

                CodingSourceClass.disable_reset(left_panel);
            }
        }
Example #3
0
        private void salesinvoice_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    add_button.Enabled = false;

                    if (edit == true) //updating member
                    {
                        save_button.Enabled = true;
                    }
                    else if (edit == false) //adding member
                    {
                        save_button.Enabled = false;
                    }

                    DataGridViewRow row = salesinvoice_dataGridView.Rows[e.RowIndex];

                    salesinvoiceID = Convert.ToInt32(row.Cells["salesIDGV"].Value.ToString());

                    shops_comboBox_sales_invoice.Text = row.Cells["shopGV"].Value.ToString();

                    shopID = Convert.ToInt32(row.Cells["shopIDGV"].Value);

                    customers_comboBox_sales_invoice.Text = row.Cells["customernameGV"].Value.ToString();

                    customerID = Convert.ToInt32(row.Cells["customerIDGV"].Value);

                    order_details_textBox.Text = row.Cells["detailsGV"].Value.ToString();

                    amount_textBox_sales_invoice.Text = row.Cells["amountGV"].Value.ToString();

                    string typ = row.Cells["typeGV"].Value.ToString();

                    if (typ == "Cash")
                    {
                        cash_radioButton_sales_invoice.Checked = true;
                    }
                    else
                    {
                        credit_card_radioButton_sales_invoice.Checked = true;
                    }

                    userID = Convert.ToInt32(row.Cells["userIDGV"].Value);

                    bill_no_textBox_salesinvoice.Text = row.Cells["billnoGV"].Value.ToString();

                    CodingSourceClass.disable(left_panel);

                    delete_button.Enabled = true;

                    edit_button.Enabled = true;

                    save_button.Enabled = false;

                    cancel_button.Enabled = true;

                    view_button.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                CodingSourceClass.ShowMsg(ex.Message, "Error");

                enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel);
            }
        }