using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using nmsSetup; using System.Collections.Generic; using QRCoder; using System.IO; using System.Drawing; public partial class diplomaPrint : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); SqlCommand cmd; public Int32 i = 1; clsBLSetup obj; PRPSetup objprp; protected void Page_Load(object sender, EventArgs e) { //if (Session["OfficeAdmin"] == null) //{ // Response.Redirect("../../Default.aspx?logout=session&path=employee/printPage.aspx"); //} //if (Session["investorList"] == null) //{ // Response.Redirect("PendingPrint.aspx", false); //} try { if (Page.IsPostBack == false) { GetData(1); } lkprint.Attributes.Add("onClick", "printSpecial()"); } catch (Exception ex) { Label1.Visible = true; Label1.Text = ex.Message.ToString(); } } public void GetData(Int32 sno1) { clsBLSetup obj = new clsBLSetup(); DataSet ds = new DataSet(); try { //PRPSetup objmemprp = new PRPSetup(); //objmemprp.id = Request.QueryString["memId"].ToString(); //objmemprp.moduleId = "1";//me // ds = obj.viewprintICard(objmemprp); //string st = ""; //int a; //ds = obj.viewprintDiplomaSubjectAll(objmemprp); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); SqlCommand cmd = new SqlCommand("viewPrintdiplomaOther", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@studentId", Request.QueryString["memId"].ToString()); // cmd.Parameters.AddWithValue("@moduleId", 2); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); //lblSrNo.Text = "2019-20/BPPS/0001"; //lblName.Text = "Mrs. Sharanjeet Kaur"; //lblRegNo.Text = "EARLY CHILDHOOD CARE AND EDUCATION"; //lblfrom.Text = "15 DEC. 2019"; //lblto.Text = "10 FEB 2020"; //lblDistrict.Text = "HISAR"; //lblState.Text = "HARYANA"; lblSrNo.Text = ds.Tables[0].Rows[0]["StudentCode"].ToString(); // string session= ds.Tables[0].Rows[0]["years"].ToString(); //lblIssueDate.Text = "14-FEB-2020"; // lblIssueDate.Text = ds.Tables[0].Rows[0]["issueDate"].ToString(); lblName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); lblFather.Text = ds.Tables[0].Rows[0]["FatherName"].ToString(); //lblDOB.Text = ds.Tables[0].Rows[0]["studentDOB"].ToString(); lblPlanName.Text = ds.Tables[0].Rows[0]["courseName"].ToString(); //lblShortName.Text = ds.Tables[0].Rows[0]["courseShortName"].ToString(); // lblBranchName.Text = ds.Tables[0].Rows[0]["cBranchName"].ToString(); // lblDistrict.Text = ds.Tables[0].Rows[0]["cBranchDistrict"].ToString(); //lblDuration.Text = ds.Tables[0].Rows[0]["smMonth"].ToString(); lblRegNo.Text = ds.Tables[0].Rows[0]["StudentCode"].ToString(); // Image1.ImageUrl = ds.Tables[0].Rows[0]["imagePath"].ToString(); //lblGrade.Text = ds.Tables[0].Rows[0]["grade"].ToString(); //lblStartDate.Text = ds.Tables[0].Rows[0]["startDate"].ToString(); //lblEndDate.Text = ds.Tables[0].Rows[0]["EndDate"].ToString(); // lblPlanCode.Text = ds.Tables[0].Rows[0]["cBranchCodeId"].ToString(); // lblCourseContent.Text = ds.Tables[0].Rows[0]["courseContent"].ToString(); // lblCertificate.Text = ds.Tables[0].Rows[0]["dipType"].ToString(); // lblfrom.Text = ds.Tables[0].Rows[0]["startDate"].ToString(); // lblto.Text = ds.Tables[0].Rows[0]["EndDate"].ToString(); // QRCode(lblRegNo.Text, lblName.Text, lblFather.Text); } catch (Exception ex) { Label1.Visible = true; Label1.Text = ex.Message.ToString(); } // return ds; } private void QRCode(string regNo, string name, string fname) { string code = "Registration No-:" + regNo + "" + " Student Name: " + name + " " + "Father Name : " + fname + " " + " HTTP://WWW.ieduptraining.org"; QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q); System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image(); imgBarCode.Height = 70; imgBarCode.Width = 70; using (Bitmap bitMap = qrCode.GetGraphic(20)) { using (MemoryStream ms = new MemoryStream()) { bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] byteImage = ms.ToArray(); imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage); } // plBarCode.Controls.Add(imgBarCode); } } public void rep() { try { // string lst; // List lst = new List(); // lst = (List)(Session["investorList"]); //(List)(Session["investorList"]); // objprp = new clsPRPprofile(); // obj = new clsBLprofile(); // objprp.memberId = lst; // Repeater1.DataSource = lst; //obj.SelectAgentPrintFinal(objprp); // Repeater1.DataBind(); } catch (Exception ex) { Label1.Visible = true; Label1.Text = ex.Message.ToString(); } } protected void lnkButton_Command(object sender, CommandEventArgs e) { // UpdateInfo(); } }