private void btnPrintReport_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要进行套打吗?这样占用较多时间,请不要关闭窗口", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (selection1.SelectedCount == 0) { MessageBox.Show("请先选择需要打印报表的采购结算单"); } else { try { for (int i = 0; i < selection1.SelectedCount; ++i) { int RowIndex = selection1.GetSelectedRowIndex(i); int RowHandle = gridView1.GetRowHandle(RowIndex); string strCGJSDID = gridView1.GetRowCellValue(RowHandle, colCGJSDID).ToString(); MakeStrArry(strCGJSDID); XtraReportCGJSD report = new XtraReportCGJSD(GetTempDataSet(strCGJSDID), StrArrySetRepotr); report.Print(); System.Threading.Thread.Sleep(1000); report.Dispose(); } } catch (Exception ex) { throw ex; } finally { selection1.ClearSelection(); unitOfWork1.DropIdentityMap(); SlelectCountClear(); xpServerCollectionSource1.Reload(); } } } }
private void btnPreview_Click(object sender, EventArgs e) { bool fgCheck = false; if (selection1.SelectedCount == 0) { fgCheck = false; MessageBox.Show("请先选择需要预览的采购结算单"); } else if (selection1.SelectedCount != 1) { fgCheck = false; MessageBox.Show("每次只能预览一张采购结算单"); } else { fgCheck = true; } if (fgCheck == true) { int RowIndex = selection1.GetSelectedRowIndex(0); int RowHandle = gridView1.GetRowHandle(RowIndex); string strCGJSDID = gridView1.GetRowCellValue(RowHandle, colCGJSDID).ToString(); MakeStrArry(strCGJSDID); XtraReportCGJSD report = new XtraReportCGJSD(GetTempDataSet(strCGJSDID), StrArrySetRepotr); report.ShowPreviewDialog(); } }