Пример #1
0
 private void btnPMs_Click(object sender, EventArgs e)
 {
     try
     {
         RPT.RPT_Single_Category RPT = new RPT.RPT_Single_Category();
         RPT.FRM_RPT_Medicine    FRM = new RPT.FRM_RPT_Medicine();
         RPT.SetParameterValue("@ID", txtID.Text);
         FRM.crystalReportViewer1.ReportSource = RPT;
         FRM.ShowDialog();
     }
     catch
     {
         MessageBox.Show("حدث خطأ ما", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        private void btnExPDFMed_Click(object sender, EventArgs e)
        {
            try
            {
                RPT.RPT_Single_Category RPT = new RPT.RPT_Single_Category();

                //Create export options
                ExportOptions EXO = new ExportOptions();

                //PDF Format Options object
                PdfFormatOptions PDFFormat = new PdfFormatOptions();

                //Create object for destination
                DiskFileDestinationOptions DFDO = new DiskFileDestinationOptions();

                //Set the path of destination
                DFDO.DiskFileName = @"D:\CategoryDetails.pdf";

                //Options
                EXO = RPT.ExportOptions;
                //
                EXO.ExportDestinationType = ExportDestinationType.DiskFile;
                //
                EXO.ExportFormatType = ExportFormatType.PortableDocFormat;
                //
                EXO.ExportFormatOptions = PDFFormat;
                //
                EXO.ExportDestinationOptions = DFDO;

                //Refresh
                RPT.Refresh();

                //Get parameter
                RPT.SetParameterValue("@ID", txtID.Text);

                //Export
                RPT.Export();

                //Show message
                MessageBox.Show("تم تصدير اللائحة بنجاح", "عملية التصدير", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show("حدث خطأ ما", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }