Beispiel #1
0
        public void RefreshDataBinding()
        {
            dataSet           = new DataSet();
            dtLoaiPhong       = LoaiPhongBUS.LayTatCaLoaiPhong_DataTable();
            dtDonGiaPhong     = DonGia_LoaiPhongBUS.LayTatCaDonGia_DataTable();
            dtPhong           = PhongBUS.LayTatCaPhong_TinhTrangPhong_LoaiPhong();
            dtPhong.TableName = "phong";

            dataSet.Tables.Add(dtLoaiPhong);
            dataSet.Tables.Add(dtDonGiaPhong);
            dataSet.Tables.Add(dtPhong);

            dataSet.Relations.Add("Đơn giá phòng", dataSet.Tables["loaiphong"].Columns["MaLP"], dataSet.Tables["dongia_loaiphong"].Columns["MaLoaiPhong"]);
            dataSet.Relations.Add("Thông tin phòng", dataSet.Tables["loaiphong"].Columns["MaLP"], dataSet.Tables["phong"].Columns["MaLoaiPhong"]);

            gridControl1.DataSource = dataSet.Tables["loaiphong"];
            gridControl1.LevelTree.Nodes.Add("Đơn giá phòng", gridViewDonGiaPhong);
            gridControl1.LevelTree.Nodes.Add("Thông tin phòng", gridViewPhong);

            if (gridViewLoaiPhong.RowCount == 0)
            {
                wbntLoaiphong.Buttons[1].Properties.Visible = false;
                wbntLoaiphong.Buttons[2].Properties.Visible = false;
            }
        }
Beispiel #2
0
        public void RefreshDataBinding()
        {
            dsDatPhong                  = new DataSet();
            dtDatPhong                  = DatPhongBUS.LayTatCaDatPhong_TinhTrangPhong_KhachHang_NhanVien_DataTable();
            dtDatPhong.TableName        = "datphong";
            dtChiTietDatPhong           = ChiTietDatPhongBUS.LayTatCaChiTietDatPhong_DataTable();
            dtChiTietDatPhong.TableName = "chitietdatphong";
            dsDatPhong.Tables.Add(dtDatPhong);
            dsDatPhong.Tables.Add(dtChiTietDatPhong);
            dsDatPhong.Relations.Add(new DataRelation("thongtinchitietdatphong", dtDatPhong.Columns["MaDatPhong"], dtChiTietDatPhong.Columns["MaDatPhong"]));

            gridControl1.LevelTree.Nodes.Add("thongtinchitietdatphong", gridViewThongTinChiTietDatPhong);

            dtDatPhong_ChiTietDatPhong = DatPhongBUS.LayTatCaDatPhong_ChiTietDatPhong_DataTable();
            dtDatPhong_ChiTietDatPhong.Columns.Add("END_DATE");
            dtDatPhong_ChiTietDatPhong.Columns.Add("MaTinhTrangDatPhong_1", typeof(int));
            int thoiGianToiThieu = ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue();

            foreach (DataRow row in dtDatPhong_ChiTietDatPhong.Rows)
            {
                row["END_DATE"] = DateTime.Parse(row["ThoiGianDatPhong"].ToString()).AddMinutes(thoiGianToiThieu);
                if ((int)row["MaTinhTrangDatPhong"] == 1)
                {
                    row["MaTinhTrangDatPhong_1"] = 3;
                }
                else if ((int)row["MaTinhTrangDatPhong"] == 2)
                {
                    row["MaTinhTrangDatPhong_1"] = 2;
                }
                else
                {
                    row["MaTinhTrangDatPhong_1"] = 1;
                }
            }


            schedulerStorage1.Appointments.DataSource = dtDatPhong_ChiTietDatPhong;
            schedulerStorage1.Resources.DataSource    = dtPhong = PhongBUS.LayTatCaPhong_TinhTrangPhong_LoaiPhong();
            dtPhong.TableName = "phong";
            dsDatPhong.Tables.Add(dtPhong);
            dsDatPhong.Relations.Add(new DataRelation("thongtinphong", dtPhong.Columns["MaPhong"], dtChiTietDatPhong.Columns["MaPhong"]));


            schedulerStorage1.Appointments.Mappings.Subject    = "MaDatPhong";
            schedulerStorage1.Appointments.Mappings.Label      = "MaTinhTrangDatPhong_1";
            schedulerStorage1.Appointments.Mappings.Start      = "ThoiGianDatPhong";
            schedulerStorage1.Appointments.Mappings.End        = "END_DATE";
            schedulerStorage1.Appointments.Mappings.ResourceId = "MaPhong";

            schedulerStorage1.Resources.Mappings.Id      = "MaPhong";
            schedulerStorage1.Resources.Mappings.Caption = "TenPhong";


            //Grid
            gridControl1.DataSource = dsDatPhong.Tables[0];
        }