示例#1
0
 public CBill(CKhachHang kh, CDatPhong dp, CDatDichVu ddv, DateTime ngaythanhtoan)
 {
     m_kh            = kh;
     m_dp            = dp;
     m_ddv           = ddv;
     m_ngaythanhtoan = ngaythanhtoan;
 }
示例#2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            CKhachHang kh = new CKhachHang();

            kh.Hoten    = txtTenKH.Text;
            kh.CMND     = Convert.ToInt32(txtCM.Text);
            kh.Gioitinh = chkGioitinh.Checked;
            kh.Tuoi     = Convert.ToInt32(txtTuoi.Text);
            kh.Quoctich = txtQuoctich.Text;
            kh.Sdt      = Convert.ToInt32(txtSDT.Text);
            foreach (CKhachHang item  in frmmng.Data.ArrKH)
            {
                if (item.CMND == kh.CMND)
                {
                    MessageBox.Show("Số CMND trùng nhau.");
                    return;
                }
            }
            frmmng.Data.ArrKH.Add(kh);
            i++;
            hienthi();

            CBill ctmbill = new CBill(kh, null, null, DateTime.Now);

            frmmng.Data.ArrBill.Add(ctmbill);
        }
示例#3
0
 public void hienthiKH(int j)
 {
     CKhachHang kh = (CKhachHang)frmmng.Data.ArrKH[j];
     txtTenKH.Text = kh.Hoten;
     txtCM.Text = kh.CMND.ToString();
     chkGioitinh.Checked = kh.Gioitinh;
     txtTuoi.Text = kh.Tuoi.ToString();
     txtQuoctich.Text = kh.Quoctich;
     txtSDT.Text = kh.Sdt.ToString();
 }
示例#4
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            CKhachHang kh = (CKhachHang)arrKH[i];

            kh.Hoten    = txtTenKH.Text;
            kh.CMND     = Convert.ToInt32(txtCM.Text);
            kh.Gioitinh = chkGioitinh.Checked;
            kh.Tuoi     = Convert.ToInt32(txtTuoi.Text);
            kh.Quoctich = txtQuoctich.Text;
            kh.Sdt      = Convert.ToInt32(txtSDT.Text);
            hienthi();
        }
示例#5
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            CKhachHang kh = (CKhachHang)frmmng.Data.ArrKH[i];
            kh.Hoten = txtTenKH.Text;
            kh.CMND = Convert.ToInt32(txtCM.Text);
            kh.Gioitinh = chkGioitinh.Checked;
            kh.Tuoi = Convert.ToInt32(txtTuoi.Text);
            kh.Quoctich = txtQuoctich.Text;
            kh.Sdt = Convert.ToInt32(txtSDT.Text);
            hienthi();

            CBill ctmbill = (CBill)frmmng.Data.ArrBill[i];
            ctmbill.Kh = kh;
        }
示例#6
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            CKhachHang kh = new CKhachHang();

            kh.Hoten    = txtTenKH.Text;
            kh.CMND     = Convert.ToInt32(txtCM.Text);
            kh.Gioitinh = chkGioitinh.Checked;
            kh.Tuoi     = Convert.ToInt32(txtTuoi.Text);
            kh.Quoctich = txtQuoctich.Text;
            kh.Sdt      = Convert.ToInt32(txtSDT.Text);
            arrKH.Add(kh);
            i++;
            hienthi();
        }
示例#7
0
        private CKhachHang timInfoKH(string hoten, int cmnd)
        {
            CKhachHang timkh = null;

            foreach (CKhachHang kh  in frmmng.Data.ArrKH)
            {
                if (string.Compare(kh.Hoten, hoten) == 0 && cmnd == kh.CMND)
                {
                    timkh = kh;
                    break;
                }
            }
            return(timkh);
        }
示例#8
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            CKhachHang kh = new CKhachHang();
            kh.Hoten = txtTenKH.Text;
            kh.CMND = Convert.ToInt32(txtCM.Text);
            kh.Gioitinh = chkGioitinh.Checked;
            kh.Tuoi = Convert.ToInt32(txtTuoi.Text);
            kh.Quoctich = txtQuoctich.Text;
            kh.Sdt = Convert.ToInt32(txtSDT.Text);
            frmmng.Data.ArrKH.Add(kh);
            i++;
            hienthi();

            CBill ctmbill = new CBill(kh, null, null, DateTime.Now);
            frmmng.Data.ArrBill.Add(ctmbill);
        }
示例#9
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (arrDP.Count <= 0)
            {
                MessageBox.Show("Không có dữ liệu!", "Error");
                return;
            }
            CHistory ls = new CHistory();

            ls.Dp.Kh.Hoten        = arrDP[i].Kh.Hoten;
            ls.Dp.Kh.CMND         = arrDP[i].Kh.CMND;
            ls.Dp.Ngayden         = arrDP[i].Ngayden;
            ls.Dp.Ngaydi          = arrDP[i].Ngaydi;
            ls.Dp.Phong.Sophong   = arrDP[i].Phong.Sophong;
            ls.Dp.Phong.Loaiphong = arrDP[i].Phong.Loaiphong;
            ls.Dp.Phong.Gia       = arrDP[i].Phong.Gia;
            CKhachHang timkh = timInfoKH(ls.Dp.Kh.Hoten, ls.Dp.Kh.CMND);

            if (timkh == null)
            {
                MessageBox.Show("Không tìm thấy khách hàng trong danh sách khách hàng");
                return;
            }
            ls.Kh.Hoten    = ls.Dp.Kh.Hoten;
            ls.Kh.CMND     = ls.Dp.Kh.CMND;
            ls.Kh.Gioitinh = timkh.Gioitinh;
            ls.Kh.Tuoi     = timkh.Tuoi;
            ls.Kh.Quoctich = timkh.Quoctich;
            ls.Kh.Sdt      = timkh.Sdt;
            arrLS.Add(ls);

            CDatPhong dp = arrDP[i];

            foreach (CPhong p in arrPKS)
            {
                if (p.Sophong == dp.Phong.Sophong && string.Compare(p.Loaiphong, dp.Phong.Loaiphong) == 0)
                {
                    p.Trangthai = "Empty";
                    SaveP("dsp.txt");
                    break;
                }
            }
            foreach (CKhachHang kh in arrKH)
            {
                if (kh.CMND == dp.Kh.CMND)
                {
                    arrKH.Remove(kh);
                    SaveKH("dskh.txt");
                    break;
                }
            }
            ShowDataTenKH();
            arrDP.RemoveAt(i);
            i--;
            if (i < 0 && arrDP.Count > 0)
            {
                i = 0;
            }
            if (i >= 0)
            {
                hienthiDP(i);
            }
            hienthi();
        }