public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptStudentSmartCardWithBarcode rpt = new rptStudentSmartCardWithBarcode();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        private void btnBarcode_Click(object sender, EventArgs e)
        {
            DataTable dtStudent = Connection.GetDataTableFromDataGridViewDefaultDataType(dataGridView1);

            DataRow[] r = dtStudent.Select("Select='True'", "Name");
            if (r.Length > 0)
            {
                if (string.IsNullOrEmpty(dtStudent.Rows[0]["logoimage"].ToString()))
                {
                    DataSet dsi = new DataSet();
                    dsi = Connection.JGetDefaultImage();

                    if (dsi.Tables[0].Rows.Count > 0)
                    {
                        TData = (byte[])(dsi.Tables[0].Rows[0]["Image"]);
                        //byte[] ByteImage = (byte[])dtStudent.Rows[0]["logoimage"];
                        Bitmap bmp = Connection.GetImageFromByteArray(TData);
                        bmp = Connection.AdjustContrastOfImage(bmp, 80f);
                        byte[] ByteImage1 = Connection.GetByteArrayFromImage(bmp);
                        dtStudent                      = r.CopyToDataTable();
                        dtStudent.TableName            = "Student Details";
                        dtStudent.Rows[0]["Watermark"] = Connection.GetByteArrayFromImage(bmp);
                    }
                }
                else
                {
                    byte[] ByteImage = (byte[])dtStudent.Rows[0]["logoimage"];
                    Bitmap bmp       = Connection.GetImageFromByteArray(ByteImage);
                    bmp = Connection.AdjustContrastOfImage(bmp, 80f);
                    byte[] ByteImage1 = Connection.GetByteArrayFromImage(bmp);
                    dtStudent                      = r.CopyToDataTable();
                    dtStudent.TableName            = "Student Details";
                    dtStudent.Rows[0]["Watermark"] = Connection.GetByteArrayFromImage(bmp);
                }

                dtStudent.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\SmartCard.xsd");
                rptStudentSmartCardWithBarcode fr = new rptStudentSmartCardWithBarcode();
                fr.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                fr.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperLetter;
                fr.SetDataSource(dtStudent);
                ShowAllReports s = new ShowAllReports();
                s.Text = "Smart/Identity Card";
                s.crystalReportViewer1.ReportSource = fr;
                s.Show();
            }
            else
            {
                MessageBox.Show("Please Select Student...");
            }
        }