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

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

            if (dtStudent != null)
            {
                DataRow[] r = dtStudent.Copy().Select("Select='True'", "Name");
                if (r != null && 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");
                    rptStudentSmartCardWithoutBarcode fr = new rptStudentSmartCardWithoutBarcode();
                    fr.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                    fr.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperLetter;
                    fr.SetDataSource(dtStudent);
                    ShowAllReports s = new ShowAllReports();
                    s.Text = "Smart/Identity Card";

                    fr.SetParameterValue("Title", "IDENTITY CARD");
                    fr.SetParameterValue("ICStatus", true);
                    fr.DataDefinition.FormulaFields["RollNo"].Text = "'0'";
                    s.crystalReportViewer1.ReportSource            = fr;
                    s.Show();
                }
                else
                {
                    MessageBox.Show("Please Select Student...");
                }
            }
            else
            {
                MessageBox.Show("Please Select Student...");
            }
        }
Exemple #3
0
        private void btnAdminCard_Click(object sender, EventArgs e)
        {
            DataTable dtStudent = Connection.GetDataTableFromDataGridViewDefaultDataType(dataGridView1);

            DataRow[] r = dtStudent.Copy().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"] = null;
                }

                dtStudent.Columns.Add("RollNo", typeof(string));
                foreach (DataRow Row in dtStudent.Rows)
                {
                    object obj = Connection.GetExecuteScalar("Select RollNo From tbl_StudentAttendance Where " +
                                                             " SessionCode='" + school.CurrentSessionCode + "' And ClassNo='" + cmbClass.SelectedValue + "' " +
                                                             " And StudentNo='" + Row["StudentNo"] + "'");
                    Row["RollNo"] = (obj != null) ? obj : "0";
                }

                dtStudent.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\SmartCard.xsd");
                rptStudentSmartCardWithoutBarcode fr = new rptStudentSmartCardWithoutBarcode();
                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;

                string ex = string.Empty;
                ex = "ADMIT CARD [ " + cmbExam.Text.ToString() + " ]";
                fr.SetParameterValue("Title", ex);
                fr.SetParameterValue("ICStatus", false);
                //dtStudent.Dispose();
                s.Show();
            }
            else
            {
                MessageBox.Show("Please Select Student...");
            }
        }