コード例 #1
0
 private void btnThem_Click(object sender, EventArgs e)
 {
     if (kiemtra())
     {
         dtpNgayGio.Format       = DateTimePickerFormat.Custom;
         dtpNgayGio.CustomFormat = "dd/MM/yyyy h:mm:ss";
         cttpBUS             = new ChiTietThuePhongBUS();
         cttpDT0             = new ChiTietThuePhongDTO();
         cttpDT0.Maphieuthue = cmbMaPT.SelectedItem.ToString();
         cttpDT0.Maphong     = cmbMaphong.SelectedItem.ToString();
         cttpDT0.Ngay        = DateTime.Parse(dtpNgayGio.Value.ToString());
         cttpDT0.Madichvu    = cmbMaDV.SelectedValue.ToString();
         cttpDT0.Soluong     = (int)numSL.Value;
         if (cttpBUS.insertChiTietThuePhong(cttpDT0) == 1)
         {
             show_CTTP();
         }
         else
         {
             MessageBox.Show("Lỗi thêm dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             dtpNgayGio.Value = DateTime.Now;
         }
     }
 }