public void btn_TraPhong_Click(object sender, EventArgs e) { //string q, w, p; HoaDonEntities hd = new HoaDonEntities(); hd.Phong = ID; hd.Ten = lb_contentNguoiThue.Text; hd.Sdt = lb_contentSDT.Text; hd.NgayVao = lb_contentNgayVao.Text; hd.NgayTra = Convert.ToString(System.DateTime.Today.ToString()); hd.SoDien = txt_contentDien.Text; hd.SoNuoc = txt_contentNuoc.Text; hd.SoInternet = txt_contentInternet.Text; hd.TongCong = lb_TongCong.Text; HoaDonBUS hdbus = new HoaDonBUS(); DataTable dtt = hdbus.ThemHDBUS(hd); PhongEntities ee = new PhongEntities(); ThongTinKhachThueEntities c = new ThongTinKhachThueEntities(); c.ID = Convert.ToInt32(ID); c.Ten = null; c.NgaySinh = null; //w = ""; c.GioiTinh = Convert.ToBoolean(null); //q = ""; c.CMND = Convert.ToInt32(null); //c.CMND = Convert.ToInt32(lb_contentCMND.Text); c.NgayCap = ""; c.NoiCap = ""; c.NgayVao = ""; //p = ""; c.Sdt = Convert.ToInt32(null); //c.PhongId = Convert.ToInt32(""); ee.HienTrang = mm; ee.Id = Convert.ToInt32(ID); ThongTinKhachThueBUS cbus = new ThongTinKhachThueBUS(); DataTable dt = cbus.GetTKBUS(c); PhongBUS t = new PhongBUS(); DataTable tt = t.GetUpdate(ee); MessageBox.Show("Trả " + label3.Text + " thành công."); homee.doimauu(b1); Close(); }
private void button1_Click(object sender, EventArgs e) { ThongTinKhachThueEntities c = new ThongTinKhachThueEntities(); LichSuEntities d = new LichSuEntities(); PhongEntities ee = new PhongEntities(); if (textBox1.Text == "") { MessageBox.Show("Xin nhặp tên"); textBox1.Focus(); } else { if (checkBox1.Checked || checkBox2.Checked == true) { if (textBox11.Text == "") { MessageBox.Show("Xin nhặp CMND"); textBox11.Focus(); } else { if (comboBox3.Text == "") { MessageBox.Show("Xin chọn nơi cấp"); comboBox3.Focus(); } else { if (textBox10.Text == "") { MessageBox.Show("Xin nhặp SĐT"); textBox10.Focus(); } else { c.Ten = textBox1.Text; c.NgaySinh = dateTimePicker1.Text; if (checkBox1.Checked == true) { c.GioiTinh = true; } else { c.GioiTinh = false; } if (checkBox2.Checked == true) { c.GioiTinh = false; } else { c.GioiTinh = true; } c.CMND = Convert.ToInt32(textBox11.Text); c.NgayCap = Convert.ToString(dateTimePicker4.Text); c.NoiCap = comboBox3.Text; c.NgayVao = Convert.ToString(dateTimePicker5.Text); c.Sdt = Convert.ToInt32(textBox10.Text); c.ID = Convert.ToInt32(ID); d.Ten = textBox1.Text; d.NgaySinh = Convert.ToString(dateTimePicker1.Text); if (checkBox1.Checked == true) { d.GioiTinh = true; } else { d.GioiTinh = false; } if (checkBox2.Checked == true) { d.GioiTinh = false; } else { d.GioiTinh = true; } d.CMND = Convert.ToInt32(textBox11.Text); d.NgayCap = dateTimePicker4.Text; d.NoiCap = comboBox3.Text; d.NgayVao = Convert.ToString(dateTimePicker5.Text); d.Sdt = Convert.ToInt32(textBox10.Text); d.ID = Convert.ToInt32(ID); ee.HienTrang = mm; ee.Id = Convert.ToInt32(ID); ThongTinKhachThueBUS cbus = new ThongTinKhachThueBUS(); DataTable dt = cbus.GetTKBUS(c); LichSuBUS a = new LichSuBUS(); DataTable s = a.ThemLSBUS(d); PhongBUS t = new PhongBUS(); DataTable tt = t.GetUpdate(ee); MessageBox.Show("Thuê " + label3.Text + " thành công."); home.doimau(b); Close(); } } } } else { MessageBox.Show("Hãy chọn giới tính"); } } }