Ejemplo n.º 1
0
        private void btn_xoa_Click(object sender, EventArgs e)
        {
            try
            {
                Voucher vc = new Voucher();
                vc.Mavoucher = int.Parse(this.txt_ma.Text);
                vc.Ten       = this.txt_tenma.Text;
                vc.Chitiet   = this.txt_chitiet.Text;
                vc.Discount  = float.Parse(this.txt_discount.Text);


                DateTime a = Convert.ToDateTime(dt_ngaybatdau.Value);
                vc.Ngaybatdau = a;
                DateTime b = Convert.ToDateTime(dt_ngaykt.Value);
                vc.Ngayketthuc = b;
                DAOVoucher k = new DAOVoucher();
                k.xoaVoucher(vc);
                dataGridView1.DataSource = k.getvoucher();
                MessageBox.Show("xoa thanh cong");
            }
            catch
            {
                MessageBox.Show("error");
            }
        }
Ejemplo n.º 2
0
        void loadVoucher()
        {
            DAOVoucher a = new DAOVoucher();

            cbVoucher.DataSource    = a.getvoucher();
            cbVoucher.DisplayMember = "mavoucher";
            cbVoucher.ValueMember   = "Discount";
        }
Ejemplo n.º 3
0
 private void btn_them_Click(object sender, EventArgs e)
 {
     try
     {
         Voucher vc = new Voucher();
         vc.Ten         = this.txt_tenma.Text;
         vc.Chitiet     = this.txt_chitiet.Text;
         vc.Discount    = float.Parse(this.txt_discount.Text);
         vc.Ngaybatdau  = this.dt_ngaybatdau.Value;
         vc.Ngayketthuc = this.dt_ngaykt.Value;
         DAOVoucher a = new DAOVoucher();
         a.themVoucher(vc);
         MessageBox.Show("them thanh cong");
         dataGridView1.DataSource = a.getvoucher();
     }
     catch (Exception s)
     {
         MessageBox.Show(s.Message);
     }
 }
Ejemplo n.º 4
0
        private void frmVoucher_Load(object sender, EventArgs e)
        {
            try
            {
                DAOVoucher a = new DAOVoucher();
                dataGridView1.DataSource = a.getvoucher();

                /*
                 * this.txt_ma.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                 * this.txt_tenma.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                 * this.dt_ngaybatdau.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells[2].Value.ToString());
                 * this.dt_ngaykt.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells[3].Value.ToString());
                 * this.txt_chitiet.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                 * this.txt_discount.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
                 */
            }
            catch
            {
                MessageBox.Show("error");
            }
        }