Ejemplo n.º 1
0
 private void btnTraPhong_Click(object sender, EventArgs e)
 {
     if (txtMaKhachHang.Text == "")
     {
         MessageBox.Show("Vui lòng chọn phòng để trả");
         return;
     }
     else
     {
         if (lvPhong.SelectedItems.Count > 0)
         {
             PhongBUS     phongBUS = new PhongBUS();
             ListViewItem lv       = lvPhong.SelectedItems[0];
             Phong        p        = new Phong();
             Phong        p2       = new Phong();
             p.Maphong = lv.SubItems[1].Text;
             ThuePhongBUS thuephongbus = new ThuePhongBUS();
             KhachHangBUS khBUS        = new KhachHangBUS();
             ThuePhong    tp           = new ThuePhong();
             tp = thuephongbus.LayThongTinThuePhong(p.Maphong);
             p2 = phongBUS.PhongTheoMa(p.Maphong);
             string      mathuephong = tp.Mathuephong;
             string      maphong     = p.Maphong;
             string      tenphong    = p2.Tenphong;
             decimal     giaphong    = p2.Giaphong;
             string      tenkhach    = txtTenKhachHang.Text;
             DateTime    ngaythue    = DateTime.Parse(txtNgayThue.Text);
             int         tiendichvu  = int.Parse(txtTongTienDV.Text);
             string      manhanvien  = NhanVien.Instance.Manhanvien;
             frmTraPhong frm         = new frmTraPhong(mathuephong, tenphong, giaphong, tenkhach, ngaythue, tiendichvu, manhanvien, maphong);
             frm.ShowDialog();
             LoadDanhSachPhong();
         }
     }
 }
Ejemplo n.º 2
0
        private void butQLPhong_Click(object sender, EventArgs e)
        {
            ThuePhong frm = new ThuePhong();

            frm.ShowDialog();
            frm.Close();
            frm.Dispose();
        }
Ejemplo n.º 3
0
        private void LvPhong_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvPhong.SelectedItems.Count > 0)
            {
                ListViewItem lv = lvPhong.SelectedItems[0];

                if (lv.SubItems[4].Text.Equals("1"))
                {
                    Phong p = new Phong();
                    p.Maphong = lv.SubItems[1].Text;
                    ThuePhongBUS thuephongbus = new ThuePhongBUS();
                    KhachHangBUS khBUS        = new KhachHangBUS();
                    ThuePhong    tp           = new ThuePhong();
                    tp = thuephongbus.LayThongTinThuePhong(p.Maphong);
                    KhachHang kh = new KhachHang();
                    kh = khBUS.LayThongTinKhachHangTheoMa(tp.Makhachhang);
                    txtMaKhachHang.Text  = kh.Makhachhang;
                    txtTenKhachHang.Text = kh.Tenkhachhang;
                    txtNgayThue.Text     = tp.Ngaythue.ToString();
                    txtSoChungMinh.Text  = kh.Sochungminh;

                    // Lay ma su dung dich vu tu thue phong

                    if (tp.Masudungdichvu != null)
                    {
                        masudungdichvu = tp.Masudungdichvu;
                        LoadSuDungDVPhong(masudungdichvu);
                    }
                }
                else
                {
                    txtMaKhachHang.Text  = "";
                    txtTenKhachHang.Text = "";
                    txtNgayThue.Text     = "";
                    txtSoChungMinh.Text  = "";
                }
            }
        }