private void btnTimKiem_Click(object sender, EventArgs e) { if (txtTimKiem.Text.Trim() == "") { return; } else { KhachHang_WCFClient kh_wcf = new KhachHang_WCFClient(); List <KhachHang_Ent> dsKhachHang = kh_wcf.TimKiem_KhachHang_by_CMND(txtTimKiem.Text.Trim()).ToList(); PhieuCheckIn_WCFClient pck_wcf = new PhieuCheckIn_WCFClient(); try { if (pck_wcf.isKhachThue(dsKhachHang[0].Id_khach)) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> lstP = pck_wcf.GetPhieuCheckIns_NoCheckOut_byIDKhach(dsKhachHang[0].Id_khach).ToList(); loaDataToGridView(DataTable_DSPhieu(lstP)); Custom_DataGridView(dgv_DSPhieuCheckIn); } else { MessageBox.Show("Khách Này Đã Trả Phòng", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception) { MessageBox.Show("Không Tồn Tại", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnTraPhong_Click(object sender, EventArgs e) { if (dgv_DSPhieuCheckIn.SelectedRows.Count > 0) { Phong_WCFClient phong_wcf = new Phong_WCFClient(); PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); DateTime date = DateTime.Now; TimeSpan now = new TimeSpan(date.Hour, date.Minute, date.Second); int idPhong = phong_wcf.GetIDPhong_by_SoPhong((dgv_DSPhieuCheckIn.SelectedRows[0].Cells[2].Value.ToString().Trim())); if (p_wcf.TraPhong(Convert.ToInt32(dgv_DSPhieuCheckIn.SelectedRows[0].Cells[0].Value.ToString().Trim()), now, date)) { if (phong_wcf.update_TinhTrangPhong(idPhong, 0)) { MessageBox.Show(this, "Thành Công!"); PhieuCheckIn_WCFClient temp = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> lstP = temp.GetPhieuCheckIns_NoCheckOut().ToList(); loaDataToGridView(DataTable_DSPhieu(lstP)); Custom_DataGridView(dgv_DSPhieuCheckIn); } else { MessageBox.Show(this, "Thất Bại!"); } } else { MessageBox.Show(this, "Thất Bại!"); } } }
private void InitializeThongTinChung() { PhieuCheckIn_WCFClient pci_wcf = new PhieuCheckIn_WCFClient(); NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient(); txtIdPhieu.Text = (pci_wcf.GetPhieuCheckIns()[pci_wcf.GetPhieuCheckIns().Length - 1].Id_phieu_checkin + 1).ToString(); txtHoTenNV.Text = (nv_wcf.GetHoTen_NhanVien(ID_NV)); }
private void btnReload_Click(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> lstP = p_wcf.GetPhieuCheckIns_NoCheckOut().ToList(); loaDataToGridView(DataTable_DSPhieu(lstP)); Custom_DataGridView(dgv_DSPhieuCheckIn); }
private void btnShowKhachThue_Click(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); list = p_wcf.GetPhieuCheckIns_NoCheckOut().ToList(); Loading_DSP(DataTable_DSP(list)); Custom_DataGridView(dgv_DSPhieuCheckIn); }
private void frmTraPhong_Load(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> lstP = p_wcf.GetPhieuCheckIns_NoCheckOut().ToList(); loaDataToGridView(DataTable_DSPhieu(lstP)); Custom_DataGridView(dgv_DSPhieuCheckIn); btnReload.Image = imgs_Button.Images[0]; }
private void rbtnThangHienTai_CheckedChanged(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); list = p_wcf.lsPhieuCheckIn_ToMonth(DateTime.Now).ToList(); Loading_BaoCao(DataTable_DSP(list)); Custom_DataGridView(dgv_BaoCao); }
private void frmThongKe_Load(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); list = p_wcf.GetPhieuCheckIns().ToList(); Loading_BaoCao(DataTable_DSP(list)); Custom_DataGridView(dgv_BaoCao); }
private void btnHienThi_Click(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); try { DateTime date = new DateTime(Convert.ToInt32(txtNam.Text), Convert.ToInt32(cbx_Thang.Text.Trim()), 1); list = p_wcf.lsPhieuCheckIn_ToMonth(date).ToList(); Loading_BaoCao(DataTable_DSP(list)); Custom_DataGridView(dgv_BaoCao); } catch { MessageBox.Show("Chưa Đủ Thông Tin", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void frmDatPhong_Load(object sender, EventArgs e) { PhieuCheckIn_WCFClient p_wcf = new PhieuCheckIn_WCFClient(); List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); list = p_wcf.GetPhieuCheckIns().ToList(); InitializeThongTinChung(); //Khởi Tao Dữ Liệu Ban Đầu string[] LoaiPhong = { "", "Phòng Standard", "Phòng Deluxe", "Phòng Express View", "Phòng VIP" }; cbx_LoaiPhong.DataSource = LoaiPhong; txtThue.Text = "10"; txtPhuThu.Text = "0"; txtGiamGia.Text = "0"; txtTimKiem.Text = "123456789"; Loading_DSP(DataTable_DSP(list)); Custom_DataGridView(dgv_DSPhieuCheckIn); }
private void txtSoPhong_TextChanged(object sender, EventArgs e) { Phong_WCFClient p_wcf = new Phong_WCFClient(); PhieuCheckIn_WCFClient pck_wcf = new PhieuCheckIn_WCFClient(); KhachHang_WCFClient kh_wcf = new KhachHang_WCFClient(); int idKhach = 0; int idPhong = p_wcf.GetIDPhong_by_SoPhong(txtSoPhong.Text.Trim()); foreach (var item in pck_wcf.GetPhieuCheckIns()) { if (item.Id_Phong == idPhong && item.TrangThaiHoaDon == 0) { idKhach = item.Id_khach; break; } } txtHoTenKH.Text = kh_wcf.getHoKhacHang_byID(idKhach) + " " + kh_wcf.getTenKhacHang_byID(idKhach); }
private void btnThanhToan_Click(object sender, EventArgs e) { DichVu_WCFClient dv_wcf = new DichVu_WCFClient(); Phong_WCFClient p_wcf = new Phong_WCFClient(); PhieuCheckIn_WCFClient pck_wcf = new PhieuCheckIn_WCFClient(); KhachHang_WCFClient kh_wcf = new KhachHang_WCFClient(); PhieuCheckIn_Ent p_dv_ent = new PhieuCheckIn_Ent(); int idPhong = p_wcf.GetIDPhong_by_SoPhong(txtSoPhong.Text.Trim()); if (txtSoPhong.Text.Trim().Equals("")) { MessageBox.Show("Nhập Số Phòng", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int idKhach = 0; foreach (var item in pck_wcf.GetPhieuCheckIns()) { if (item.Id_Phong == idPhong && item.TrangThaiHoaDon == 0) { idKhach = item.Id_khach; } } PhieuCheckIn_Ent p_ent = new PhieuCheckIn_Ent(); foreach (var item in pck_wcf.GetPhieuCheckIns().ToList()) { if (item.Id_khach == idKhach) { p_ent.Ngay_check_in = item.Ngay_check_in; p_ent.Gio_check_in = item.Gio_check_in; p_ent.Ngay_check_out = item.Ngay_check_out; p_ent.Gio_check_out = item.Gio_check_out; p_ent.Giam_gia = item.Giam_gia; p_ent.SoLuongKhach = item.SoLuongKhach; } } int checkLoi = 0; for (int i = 0; i < dgvCTDV.Rows.Count - 1; i++) { p_dv_ent.Id_Phong = idPhong; p_dv_ent.Id_khach = Convert.ToInt32(idKhach); p_dv_ent.Id_NhanVien = idNhanVien; p_dv_ent.Id_DichVu = dv_wcf.GetIDDichVu_byTenDV(dgvCTDV.Rows[i].Cells[0].Value.ToString()); p_dv_ent.SoLuongDichVu = Convert.ToInt32(dgvCTDV.Rows[i].Cells[1].Value); p_dv_ent.Ngay_check_in = (DateTime)p_ent.Ngay_check_in; p_dv_ent.Gio_check_in = p_ent.Gio_check_in; p_dv_ent.Ngay_check_out = p_ent.Ngay_check_out; p_dv_ent.Gio_check_out = p_ent.Gio_check_out; p_dv_ent.Giam_gia = p_ent.Giam_gia; p_dv_ent.SoLuongKhach = p_ent.SoLuongKhach; p_dv_ent.TrangThaiHoaDon = 1; p_dv_ent.SoLuongDichVu = Convert.ToInt32(dgvCTDV.Rows[i].Cells[1].Value.ToString().Trim()); if (!pck_wcf.ThemPhieuCheckIn_DichVu(p_dv_ent)) { checkLoi = 1; MessageBox.Show("Có Lỗi Xảy Ra!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (checkLoi == 0) { MessageBox.Show("Lưu Thành Công", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void btnLuuDatPhong_Click(object sender, EventArgs e) { TimeSpan date = dtpNgayTraPhong.Value - DateTime.Now.Date; if (date.Days <= 0) { MessageBox.Show("Nhập Ngày Lớn Hơn Ngày Hiện Tại", "", MessageBoxButtons.OK, MessageBoxIcon.Error); dtpNgayTraPhong.Focus(); return; } Phong_WCFClient ph_wcf = new Phong_WCFClient(); NhanVien_WCFClient nv_wcf = new NhanVien_WCFClient(); PhieuCheckIn_WCFClient phieu_wcf = new PhieuCheckIn_WCFClient(); PhieuCheckIn_Ent p_ent = new PhieuCheckIn_Ent(); if (!CheckNull()) { MessageBox.Show("Chưa Nhập Đủ Thông Tin", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } p_ent.Id_khach = Convert.ToInt32(maKH); p_ent.Id_NhanVien = ID_NV; p_ent.Id_Phong = ph_wcf.getIDPhong(cbx_SoPhong.Text); p_ent.Giam_gia = Convert.ToDouble(txtGiamGia.Text); p_ent.SoLuongKhach = Convert.ToInt32(cbox_SoNguoi.Text); p_ent.Ngay_check_in = Convert.ToDateTime(DateTime.Now.ToShortDateString()); TimeSpan gio_in = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); p_ent.Gio_check_in = gio_in; p_ent.Ngay_check_out = Convert.ToDateTime(dtpNgayTraPhong.Text.ToString()); TimeSpan gio_out = new TimeSpan(14, 00, 00); //p_ent.Id_DichVu = 0; p_ent.Gio_check_out = gio_out; if (phieu_wcf.ThemPhieuCheckIn(p_ent)) { DialogResult ds = MessageBox.Show("Lưu Thành Công, Tiếp Tục ?", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information); if (ds == DialogResult.OK) { List <PhieuCheckIn_Ent> list = new List <PhieuCheckIn_Ent>(); list = phieu_wcf.lsPhieuCheckIn_ToDate(DateTime.Now.Date).ToList(); ph_wcf.update_TinhTrangPhong(p_ent.Id_Phong, 1); Loading_DSP(DataTable_DSP(list)); Custom_DataGridView(dgv_DSPhieuCheckIn); return; } } else { DialogResult ds = MessageBox.Show("Lưu Thất Bại, Thử Lại ?", "Lỗi", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (ds == DialogResult.Yes) { return; } else { this.Close(); } } }