private void listViewEx1_MouseClick(object sender, MouseEventArgs e) { dataPhong dtp = new dataPhong(); string maphong = listViewEx1.SelectedItems[0].Text; if (dtp.Kiemtraphong(maphong) == 1) { ChiTietPhong.Maphong = maphong; ChiTietPhong phong = new ChiTietPhong(); phong.ShowDialog(); } if (dtp.Kiemtraphong(maphong) == 0) { DatPhong.MaPhong = maphong; DatPhong datPhong = new DatPhong(); datPhong.ShowDialog(); } TrangThaiPhong ttp = new TrangThaiPhong(); if (dtp.Kiemtraphong(maphong) == 2) { TrangThaiPhong.trangthai = "đang dọn dẹp"; TrangThaiPhong.maphong = maphong; ttp.ShowDialog(); } if (dtp.Kiemtraphong(maphong) == 3) { TrangThaiPhong.trangthai = "đang sửa chữa"; TrangThaiPhong.maphong = maphong; ttp.ShowDialog(); } }
private void btUpd_Click(object sender, EventArgs e) { try { ChiTietPhong ct = new ChiTietPhong(); ct.MaNV = int.Parse(txtMaNV.Text); ct.MaKH = int.Parse(cbbMaKH.Text); ct.MaPhong = int.Parse(cbbMaPhong.Text); ct.NgayDatPhong = dtNgayDatPhong.Value; ct.NgayNhanPhong = dtNgayNhanPhong.Value; ct.NgayTraPhong = dtNgayTraPhong.Value; ct.LoaiHinhThue = txtLoaiHinhThue.Text; ct.ThanhTien = int.Parse(txtThanhTien.Text); ct.GhiChu = txtGhiChu.Text; ct.TrangThaiPhong = cbTrangThai.Checked; ChiTietPhong chitiet = db.ChiTietPhongs.Where(c => c == ct).FirstOrDefault(); chitiet.MaNV = ct.MaNV; chitiet.LoaiHinhThue = ct.LoaiHinhThue; chitiet.GhiChu = ct.GhiChu; db.SubmitChanges(); LoadData(); } catch (Exception ex) { MessageBox.Show("Giá trị nhập không hợp lệ"); } }
private void listViewEx1_MouseClick(object sender, MouseEventArgs e) { ChiTietPhong.Maphong = listViewEx1.SelectedItems[0].Text; ChiTietPhong phong = new ChiTietPhong(); phong.ShowDialog(); //string maphong= listViewEx1.SelectedItems[0].Text; //MessageBox.Show(maphong); }
private void btAdd_Click(object sender, EventArgs e) { List <ChiTietPhong> list = db.ChiTietPhongs.Where(c => c.MaPhong == int.Parse(cbbMaPhong.Text)).ToList(); bool available = false; foreach (ChiTietPhong item in list) { if (item.TrangThaiPhong == true) { available = true; } } if (available == true) { MessageBox.Show("Phòng đang bận"); } else { try { if (dtNgayDatPhong.Value > dtNgayNhanPhong.Value) { MessageBox.Show("Ngày đặt không lớn hơn ngày nhận phòng"); } else { ChiTietPhong ct = new ChiTietPhong(); ct.MaNV = int.Parse(txtMaNV.Text); ct.MaKH = int.Parse(cbbMaKH.Text); ct.MaPhong = int.Parse(cbbMaPhong.Text); ct.NgayDatPhong = dtNgayDatPhong.Value; ct.NgayNhanPhong = dtNgayNhanPhong.Value; ct.NgayTraPhong = new DateTime(8888, 12, 30); ct.LoaiHinhThue = txtLoaiHinhThue.Text; ct.ThanhTien = 0; ct.GhiChu = txtGhiChu.Text; ct.TrangThaiPhong = true; db.ChiTietPhongs.InsertOnSubmit(ct); db.SubmitChanges(); LoadData(); MessageBox.Show("Thêm thành công"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void listViewEx1_MouseClick(object sender, MouseEventArgs e) { dataPhong dtp = new dataPhong(); string maphong = listViewEx1.SelectedItems[0].Name.ToString(); //MessageBox.Show(maphong); int check = client.ktraPhong(Convert.ToInt32(maphong)); switch (check) { case 2: ChiTietPhong.idP = Convert.ToInt32(maphong); ChiTietPhong phong = new ChiTietPhong(); phong.ShowDialog(); listPhong(-1); break; case 1: DatPhong.MaPhong = listViewEx1.SelectedItems[0].Text.ToString();; DatPhong.idp = Convert.ToInt32(maphong); DatPhong datPhong = new DatPhong(); datPhong.ShowDialog(); listPhong(-1); break; case 3: MessageBox.Show("Phòng đang dọn dẹp"); break; case 4: MessageBox.Show("Phòng đang sửa chữa"); break; default: MessageBox.Show("Xảy ra lỗi xin mời thử lại"); break; } //if(dtp.Kiemtraphong(maphong)==1) //{ // ChiTietPhong.Maphong = maphong; // ChiTietPhong phong = new ChiTietPhong(); // phong.ShowDialog(); //} //if (dtp.Kiemtraphong(maphong) == 0) //{ // DatPhong.MaPhong = maphong; // DatPhong datPhong = new DatPhong(); // datPhong.ShowDialog(); //} //TrangThaiPhong ttp = new TrangThaiPhong(); //if (dtp.Kiemtraphong(maphong) == 2) //{ // TrangThaiPhong.trangthai = "đang dọn dẹp"; // TrangThaiPhong.maphong = maphong; // ttp.ShowDialog(); //} //if (dtp.Kiemtraphong(maphong) == 3) //{ // TrangThaiPhong.trangthai = "đang sửa chữa"; // TrangThaiPhong.maphong = maphong; // ttp.ShowDialog(); //} }