コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            BUS_HoaDon    ihd = new BUS_HoaDon();
            List <string> hd  = new List <string>();

            ;
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                List <string> cthd = new List <string>();
                cthd.Add(txtCodeBill.Text);
                cthd.Add(dataGridView1.Rows[i].Cells[1].Value.ToString());
                cthd.Add(dataGridView1.Rows[i].Cells[3].Value.ToString());
                cthd.Add(dataGridView1.Rows[i].Cells[2].Value.ToString());
                ihd.ChiTietHoaDon(cthd);
            }
            hd.Add(txtCodeBill.Text);
            hd.Add(txtCodeMember.Text);
            hd.Add(txtCodeStaff.Text);
            hd.Add(Convert.ToDateTime(dtpDateOfPrint.Text).ToString("MM/dd/yyyy"));
            hd.Add(txtSafe.Text);
            hd.Add(txtSum.Text);
            if (ihd.ThemHd(hd))
            {
                MessageBox.Show("Đã thêm mới hoá đơn !", "Thông báo", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Không thêm mới được hoá đơn ! Vui lòng thử lại !", "Lỗi ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
 private void btnPay_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có thực sự muốn trả phòng này không ?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         BUS_Phong  classroom = new BUS_Phong();
         BUS_HoaDon bill      = new BUS_HoaDon();
         if (classroom.NhanTraPhong("No", "0", item[0]) && bill.ThemHd(Inserts()))
         {
             MessageBox.Show("Đã trả phòng  !", "Thông báo", MessageBoxButtons.OK);
         }
         else
         {
             MessageBox.Show("Trả phòng thất bại !", "Thông báo", MessageBoxButtons.OK);
         }
     }
 }