protected void ExportPDFManual(DataTable TenantTable) { DataTable GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); if (Directory.Exists(Path.Combine(filePath, "Report")) == false) { Directory.CreateDirectory(Path.Combine(filePath, "Report")); } string pathname = ""; switch (radioGroupTenantType.EditValue.To<int>()) { case 1: // Room Reserved ReportDocuments.tenant_reserved PrintTenantReserved = new DXWindowsApplication2.ReportDocuments.tenant_reserved(); PrintTenantReserved.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantBooking_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf"); PrintTenantReserved.ExportToPdf(pathname); PrintTenantReserved.ShowPreview(); break; case 2: // Room Cancel Booking ReportDocuments.tenant_cancelbooking PrintTenantCancel = new DXWindowsApplication2.ReportDocuments.tenant_cancelbooking(); PrintTenantCancel.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantCancel_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf"); PrintTenantCancel.ExportToPdf(pathname); PrintTenantCancel.ShowPreview(); break; case 3: // Room Rent ReportDocuments.tenant PrintTenant = new DXWindowsApplication2.ReportDocuments.tenant(); PrintTenant.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantRental_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf"); PrintTenant.ExportToPdf(pathname); PrintTenant.ShowPreview(); break; case 5: // Room Inform Leave ReportDocuments.tenant_informleave PrintTenantInformLeave = new DXWindowsApplication2.ReportDocuments.tenant_informleave(); PrintTenantInformLeave.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantInformLeave_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf"); PrintTenantInformLeave.ExportToPdf(pathname); PrintTenantInformLeave.ShowPreview(); break; default: ReportDocuments.tenant PrintTenant2 = new DXWindowsApplication2.ReportDocuments.tenant(); PrintTenant2.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantRental_" + DateTime.Now.ToString("yyyyMMdd") + ".pdf"); PrintTenant2.ExportToPdf(pathname); PrintTenant2.ShowPreview(); break; } }
protected void ExportExcelManual(DataTable TenantTable) { DataTable GeneralInfo = BusinessLogicBridge.DataStore.getGeneralConfig(); string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); filePath = filePath + @"\" + GeneralInfo.Rows[0]["path_all_document"].ToString(); if (Directory.Exists(Path.Combine(filePath, "Report")) == false) { Directory.CreateDirectory(Path.Combine(filePath, "Report")); } string pathname = ""; switch (radioGroupTenantType.EditValue.To <int>()) { case 1: // Room Reserved ReportDocuments.tenant_reserved PrintTenantReserved = new DXWindowsApplication2.ReportDocuments.tenant_reserved(); PrintTenantReserved.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantBooking_" + DateTime.Now.ToString("yyyyMMdd") + ".xls"); PrintTenantReserved.ExportToXls(pathname); PrintTenantReserved.ShowPreview(); break; case 2: // Room Cancel Booking ReportDocuments.tenant_cancelbooking PrintTenantCancel = new DXWindowsApplication2.ReportDocuments.tenant_cancelbooking(); PrintTenantCancel.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantCancel_" + DateTime.Now.ToString("yyyyMMdd") + ".xls"); PrintTenantCancel.ExportToXls(pathname); PrintTenantCancel.ShowPreview(); break; case 3: // Room Rent ReportDocuments.tenant PrintTenant = new DXWindowsApplication2.ReportDocuments.tenant(); PrintTenant.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantRental_" + DateTime.Now.ToString("yyyyMMdd") + ".xls"); PrintTenant.ExportToXls(pathname); PrintTenant.ShowPreview(); break; case 5: // Room Inform Leave ReportDocuments.tenant_informleave PrintTenantInformLeave = new DXWindowsApplication2.ReportDocuments.tenant_informleave(); PrintTenantInformLeave.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantInformLeave_" + DateTime.Now.ToString("yyyyMMdd") + ".xls"); PrintTenantInformLeave.ExportToXls(pathname); PrintTenantInformLeave.ShowPreview(); break; default: ReportDocuments.tenant PrintTenant2 = new DXWindowsApplication2.ReportDocuments.tenant(); PrintTenant2.loopGenDataRow(TenantTable, lookUpEditBuilding.Text, lookUpEditRoomFrom.Text, lookUpEditRoomTo.Text); pathname = DXWindowsApplication2.MainForm.CombinePaths(Environment.GetFolderPath(Environment.SpecialFolder.Personal), GeneralInfo.Rows[0]["path_all_document"].ToString(), "Report", "TenantRental_" + DateTime.Now.ToString("yyyyMMdd") + ".xls"); PrintTenant2.ExportToXls(pathname); PrintTenant2.ShowPreview(); break; } }