示例#1
0
        private void btn_cash_back_Click(object sender, EventArgs e)
        {
            Control ctrl = this.Parent;

            DataTable        dt  = customer.getnamebyno(txt_searchbox.Text);
            CustomerCashBack ccb = new CustomerCashBack(Convert.ToInt32(dt.Rows[0]["id"].ToString()));


            this.Hide();
            ccb.ShowDialog();
        }
示例#2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView1.Columns["col_add"].Index && e.RowIndex >= 0)
            {
                AdminAccess acc = new AdminAccess();
                acc.ShowDialog();
                if (acc.DialogResult == DialogResult.OK)
                {
                    Customer_Management.CustomerCard_Info cci = new Customer_Management.CustomerCard_Info(Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_id"].Value.ToString()));

                    cci.ShowDialog();
                }
            }
            else if (e.ColumnIndex == dataGridView1.Columns["col_replace"].Index && e.RowIndex >= 0)
            {
                AdminAccess acc = new AdminAccess();
                acc.ShowDialog();
                panel_replace.Hide();
                if (acc.DialogResult == DialogResult.OK)
                {
                    panel_replace.Show();
                    customer_id     = Convert.ToInt32((dataGridView1.CurrentRow.Cells["col_id"].Value.ToString()));
                    lbl_cardno.Text = Convert.ToString(dataGridView1.CurrentRow.Cells["col_card_no"].Value.ToString());
                    DataTable dt = customer.GetPreviousBalance(Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_id"].Value.ToString()));
                    if (dt.Rows.Count > 0)
                    {
                        decimal card_balance = Convert.ToDecimal(dt.Rows[0]["customer_balance"].ToString());
                        lbl_blc.Text = Convert.ToString(card_balance);
                    }
                    else
                    {
                        lbl_blc.Text = "0.00";
                    }
                }
            }
            else if (e.ColumnIndex == dataGridView1.Columns["col_cash_back"].Index && e.RowIndex >= 0)
            {
                CustomerCashBack ccb = new CustomerCashBack(Convert.ToInt32((dataGridView1.CurrentRow.Cells["col_id"].Value.ToString())));
                int customer_id      = Convert.ToInt32((dataGridView1.CurrentRow.Cells["col_id"].Value.ToString()));
                ccb.lbl_customer.Text    = dataGridView1.CurrentRow.Cells["col_name"].Value.ToString() + dataGridView1.CurrentRow.Cells["col_last_name"].Value.ToString();
                ccb.card_type            = dataGridView1.CurrentRow.Cells["col_card_type"].Value.ToString();
                ccb.lbl_customer_no.Text = dataGridView1.CurrentRow.Cells["col_card_no"].Value.ToString();
                DataTable dt = customer.GetPreviousBalance(Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_id"].Value.ToString()));

                if (dt.Rows.Count > 0)
                {
                    decimal card_balance = Convert.ToDecimal(dt.Rows[0]["customer_balance"].ToString());
                    ccb.lbl_id.Text       = dataGridView1.CurrentRow.Cells["col_id"].Value.ToString();
                    ccb.txt_card_blc.Text = Convert.ToString(card_balance);
                    ccb.ShowDialog();
                    if (ccb.btn_save.DialogResult == DialogResult.OK)
                    {
                        Loadcustomer();
                    }
                }
                else
                {
                    MessageBox.Show("Sorry Customer Have 0.00 Balance.", "Transaction Fail", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }