Exemplo n.º 1
0
        public DataTable dsBaoBieu(string _id)
        {
            DataTable         table  = new DataTable();
            List <BaoBieuDTO> _data  = new List <BaoBieuDTO>();
            BaoBieuBUS        _dvBus = new BaoBieuBUS();

            _data = _dvBus.LayThongTinBaoBieuTheoIDKhachHang(_id);

            table.Columns.Add("ID Báo Biểu", typeof(string)).ReadOnly = true;
            table.Columns.Add("ID Phòng", typeof(string));
            table.Columns.Add("ID Nhân Viên", typeof(string));
            table.Columns.Add("ID Khách Hàng", typeof(string));
            table.Columns.Add("TG Bắt Đầu", typeof(string));
            table.Columns.Add("TG Kết Thúc", typeof(string));
            table.Columns.Add("DS Dịch Vụ", typeof(string));
            table.Columns.Add("Tồng tiền", typeof(string));

            foreach (var item in _data)
            {
                string s = Global.Instance().ConvertCurrency(item.TongTien.ToString());
                table.Rows.Add(item.IdBaoBieu.ToString(), item.IdPhong.ToString(), item.IdNhanVien.ToString(), item.IdKhachHang.ToString(), item.ThoiGianBatDau.ToString(), item.ThoiGianKetThuc.ToString(), item.DsDichVu.ToString(), s.ToString());
            }

            return(table);
        }
Exemplo n.º 2
0
        public BaoBieu(string id)
        {
            InitializeComponent();

            this._Id = id;
            _bus     = new BaoBieuBUS();

            TruyenDataVao();
        }
Exemplo n.º 3
0
        public DanhSachBaoBieu()
        {
            InitializeComponent();

            dataGrdV.AutoSizeRowsMode      = DataGridViewAutoSizeRowsMode.None;
            dataGrdV.AllowUserToResizeRows = false;
            dataGrdV.RowTemplate.Height    = 40;

            _bus = new BaoBieuBUS();
            DocDuLieu(_bus.LayDuDieu());
        }
Exemplo n.º 4
0
        public string idBaoBieu()
        {
            BaoBieuBUS        dv    = new BaoBieuBUS();
            List <BaoBieuDTO> _list = dv.LayDanhSachBaoBieu();
            int idDichVu            = 0;

            if (_list.Count != 0)
            {
                idDichVu = Int32.Parse(_list[_list.Count - 1].IdBaoBieu.ToString()) + 1;
            }
            return(idDichVu.ToString());
        }
Exemplo n.º 5
0
        //Tra Phong
        private void button11_Click(object sender, EventArgs e)
        {
            if (trangThaiPhong == 1)
            {
                PhongDTO phong = _phongBUS.LayThongTinPhong(idPhongClick);

                DateTime dtNow = DateTime.Now;

                PhongDangSuDungDTO _pdsdDTO = new PhongDangSuDungDTO();
                _pdsdDTO = _phongBUS.LayThongTinPhongDangSuDung(idPhongClick);

                string[]         _array = _pdsdDTO.DsDichVu.Split(',');
                DichVuBUS        _dvBus = new DichVuBUS();
                List <DichVuDTO> _dvDTO = new List <DichVuDTO>();

                foreach (var item in _array)
                {
                    DichVuDTO _dv = _dvBus.LayThongTinDichVu(item);
                    if (_dv != null)
                    {
                        _dvDTO.Add(_dv);
                    }
                }

                string idPhong        = "\n ID Phòng: " + idPhongClick;
                string tenPhong       = "\n Tên Phòng: " + phong.TenPhong;
                string ngayDatPhong   = "\n Thời gian Đặt Phòng: " + txtThoiGianDatPhong.Text;
                string ngayTraPhong   = "\n Thời gian Trả Phòng: " + dtNow.ToString();
                string dsDV_ThanhToan = "\n Danh sách dịch vụ sử dụng:";
                int    sDichVu        = 0;
                foreach (var item in _dvDTO)
                {
                    dsDV_ThanhToan += "\n       + " + item.TenDichVu;


                    sDichVu += (int)item.Gia;
                }
                DateTime dtBatDau = DateTime.Parse(txtThoiGianDatPhong.Text);

                TimeSpan span       = dtNow - dtBatDau;
                double   TongHoaDon = (span.TotalMinutes / 60) * (phong.Dongia) + sDichVu;
                string   s          = Global.Instance().ConvertCurrency(TongHoaDon.ToString());


                string chiphi = "\n Tổng hóa đơn: " + s + " VND";

                DialogResult dialogResult = MessageBox.Show("Bạn muốn thanh toán hóa đơn với:" + idPhong + tenPhong + ngayDatPhong + ngayTraPhong + dsDV_ThanhToan + chiphi, "Thanh Toán", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    BaoBieuDTO baoBieu = new BaoBieuDTO();
                    baoBieu.IdBaoBieu       = Global.Instance().idBaoBieu();
                    baoBieu.IdPhong         = idPhongClick;
                    baoBieu.IdNhanVien      = "1";
                    baoBieu.IdKhachHang     = _pdsdDTO.IdKhachHang;
                    baoBieu.DsDichVu        = _pdsdDTO.DsDichVu;
                    baoBieu.ThoiGianBatDau  = txtThoiGianDatPhong.Text;
                    baoBieu.ThoiGianKetThuc = dtNow.ToString();
                    baoBieu.TongTien        = (float)TongHoaDon;

                    BaoBieuBUS _baobieuBUs = new BaoBieuBUS();
                    _baobieuBUs.ThemThongTinBaoBieu(baoBieu);

                    _phongBUS.XoaThongTinPhongDangSuDung(idPhongClick);

                    //Cap nhat thong tin Phong
                    PhongDTO _phongCapNhat = _phongBUS.LayThongTinPhong(idPhongClick);
                    _phongCapNhat.TrangThai = "Còn Trống";
                    _phongBUS.CapNhatThongTinPhong(_phongCapNhat);

                    LoadData(state);
                }
                else if (dialogResult == DialogResult.No)
                {
                    //do something else
                }
            }
            else
            {
                MessageBox.Show("Phòng đang sử dụng mới được trả phòng", "Thông báo");
            }
        }