private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(objPhong, null))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(objPhong.id, Guid.Empty))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            String strViTri = "[Không Rõ]";
            if (!Object.Equals(objPhong.vitri, null))
                strViTri = objPhong.vitri.coso != null ? objPhong.vitri.coso.ten + (objPhong.vitri.day != null ? " - " + objPhong.vitri.day.ten + (objPhong.vitri.tang != null ? " - " + objPhong.vitri.tang.ten : "") : "") : "";
            if (Object.Equals(listCTThietBis, null))
            {
                XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (listCTThietBis.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewCTThietBi), gridViewCTThietBi, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText(String.Format("Danh Sách Thiết Bị Tại Phòng: {0} ({1})", objPhong.ten, strViTri));
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 2
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(_ViTriHienTai, null))
            {
                XtraMessageBox.Show("Chưa chọn vị trí!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(listPhong, null))
            {
                XtraMessageBox.Show("Không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                String strViTri = _ViTriHienTai.coso != null ? _ViTriHienTai.coso.ten + (_ViTriHienTai.day != null ? " - " + _ViTriHienTai.day.ten + (_ViTriHienTai.tang != null ? " - " + _ViTriHienTai.tang.ten : "") : "") : "";
                if (listPhong.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewPhong), gridViewPhong, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText("Danh Sách Phòng Tại: " + strViTri);
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    strViTri = "[" + strViTri + "]";
                    XtraMessageBox.Show(strViTri + " không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 3
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(NhanVienPTs, null))
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (NhanVienPTs.Count > 0)
            {
                try
                {
                    DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                    splashScreenManager_Report.ShowWaitForm();
                    splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                    splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                    XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewNhanVien), gridViewNhanVien, barCheckItemLandscape.Checked, false);
                    _XtraReport_Template.SetTitleText("Danh Sách Nhân Viên Phụ Trách");
                    if (barCheckItemThietKe.Checked)
                    {
                        ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        designTool.ShowDesignerDialog();

                        ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                        printTool.ShowPreviewDialog();
                    }
                    else
                    {
                        ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        printTool.ShowPreviewDialog();
                    }
                }
                catch
                {
                    XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }