Exemplo n.º 1
0
        public CapNhatDichVu(int maPhong)
        {
            InitializeComponent();

            MaPhong                = maPhong;
            txtPhong.Text          = maPhong.ToString();
            dgDanhSach.ItemsSource = DichVuDAO.LoadConSuDung().DefaultView;


            dtGioHang.Columns.Add("MaDV", typeof(int));
            dtGioHang.Columns.Add("TenDV", typeof(string));
            dtGioHang.Columns.Add("DonGia", typeof(float));
            dtGioHang.Columns.Add("SoLuong", typeof(int));
            dtGioHang.Columns.Add("ThanhTien", typeof(float));

            DataTable table = ChiTietDichVuDAO.LoadByMaPhong(maPhong);
            DataRow   rowOfGioHang;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                int    maDv = table.Rows[i].Field <int>(0);
                DichVu dv   = DichVuDAO.LoadOne(maDv);
                rowOfGioHang              = dtGioHang.NewRow();
                rowOfGioHang["MaDV"]      = maDv;
                rowOfGioHang["TenDV"]     = dv.TenDV;
                rowOfGioHang["DonGia"]    = dv.DonGia;
                rowOfGioHang["SoLuong"]   = table.Rows[i].Field <int>(1);
                rowOfGioHang["ThanhTien"] = dv.DonGia * table.Rows[i].Field <int>(1);
                dtGioHang.Rows.Add(rowOfGioHang);
            }
            dgGioHang.ItemsSource = dtGioHang.DefaultView;
            txtTongTien.Text      = TinhTongTien();
        }
Exemplo n.º 2
0
        DataTable LoadDsDichVu()
        {
            DataTable dtGioHang = new DataTable();

            dtGioHang.Columns.Add("MaDV", typeof(int));
            dtGioHang.Columns.Add("TenDV", typeof(string));
            dtGioHang.Columns.Add("DonGia", typeof(float));
            dtGioHang.Columns.Add("SoLuong", typeof(int));
            dtGioHang.Columns.Add("ThanhTien", typeof(float));

            DataTable table = ChiTietDichVuDAO.LoadByMaPhong(MaPhong);
            DataRow   rowOfGioHang;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                int    maDv = table.Rows[i].Field <int>(0);
                DichVu dv   = DichVuDAO.LoadOne(maDv);
                rowOfGioHang              = dtGioHang.NewRow();
                rowOfGioHang["MaDV"]      = maDv;
                rowOfGioHang["TenDV"]     = dv.TenDV;
                rowOfGioHang["DonGia"]    = dv.DonGia;
                rowOfGioHang["SoLuong"]   = table.Rows[i].Field <int>(1);
                rowOfGioHang["ThanhTien"] = dv.DonGia * table.Rows[i].Field <int>(1);
                dtGioHang.Rows.Add(rowOfGioHang);
            }
            return(dtGioHang);
        }