예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            index = e.RowIndex;
            if (e.ColumnIndex == dataGridView1.Columns["detail"].Index)
            {
                mapn     = dataGridView1.Rows[index].Cells[0].Value.ToString();
                mancc    = dataGridView1.Rows[index].Cells[1].Value.ToString();
                ngaylap  = (DateTime)dataGridView1.Rows[index].Cells[2].Value;
                tongtien = dataGridView1.Rows[index].Cells[3].Value.ToString();

                FormDetailInputCoupon form = new FormDetailInputCoupon();
                form.ShowDialog();

                dataGridView1.DataSource = ctr1.Load();
            }
            else if (e.ColumnIndex == dataGridView1.Columns["edit"].Index)
            {
                mapn     = dataGridView1.Rows[index].Cells[0].Value.ToString();
                mancc    = dataGridView1.Rows[index].Cells[1].Value.ToString();
                ngaylap  = (DateTime)dataGridView1.Rows[index].Cells[2].Value;
                tongtien = dataGridView1.Rows[index].Cells[3].Value.ToString();

                FormEditInputCoupon form = new FormEditInputCoupon();
                form.ShowDialog();

                dataGridView1.DataSource = ctr1.Load();
            }
            else if (e.ColumnIndex == dataGridView1.Columns["delete"].Index)
            {
                DialogResult dlr = MessageBox.Show("Bạn Chắc chắn xóa ?", "Thông Báo!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlr == DialogResult.Yes)
                {
                    ctr1.Delete(dataGridView1.Rows[index].Cells[0].Value.ToString());
                    dataGridView1.DataSource = ctr1.Load();
                }
            }
        }
        private void btn_Edit_Click(object sender, EventArgs e)
        {
            FormEditInputCoupon form = new FormEditInputCoupon();

            form.ShowDialog();
        }