示例#1
0
 private void Btn_qr_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     pictureBox1.Image = qrcode.Draw(dni, 50);
 }
示例#2
0
 private void btn_qr_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw barcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     pictureBox1.Image = barcode.Draw(txt_qr.Text, 50);
 }
示例#3
0
 private void InitializeQR()
 {
     Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     picBoxQR.Image = qrcode.Draw(localIP + ":" + port, 50);
 }
示例#4
0
        /// <summary>
        /// Method create QRc ode
        /// </summary>
        /// <param name="text"> Your text to code </param>
        /// <returns> Return image </returns>
        public System.Drawing.Image Generate_QR_Code(string text)
        {
            Zen.Barcode.CodeQrBarcodeDraw QRcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;

            return(QRcode.Draw(text, 50));
        }
示例#5
0
 private void button1_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw brcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     QrImage.Image = brcode.Draw(QrTextBox.Text, 50);
 }
示例#6
0
 private void button1_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw codeQr = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     pictureBox2.Image = codeQr.Draw(txtIdentified.Text, 25);
 }
示例#7
0
        private void PošaljiKartu(Rezervacija selektiranaRezervacija)
        {
            MemoryStream strmQR  = new MemoryStream();
            MemoryStream strmTem = new MemoryStream();

            Zen.Barcode.CodeQrBarcodeDraw barcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
            System.Drawing.Image          QRCode  = barcode.Draw(selektiranaRezervacija.RezervacijaId.ToString(), 50);
            QRCode.Save(strmQR, System.Drawing.Imaging.ImageFormat.Png);

            XImage QRImage = XImage.FromStream(strmQR);

            string putanja = AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "");

            Image template = Image.FromFile(putanja + "\\BoardingPass\\BoardingPassTemplate.png");

            template.Save(strmTem, System.Drawing.Imaging.ImageFormat.Png);

            XImage Template = XImage.FromStream(strmTem);

            PdfDocument pdf     = new PdfDocument();
            PdfPage     pdfPage = pdf.AddPage();
            XGraphics   graph   = XGraphics.FromPdfPage(pdfPage);

            graph.DrawImage(Template, 5, 5, 585, 225);
            graph.DrawImage(QRImage, 345, 50, 75, 75);

            XFont font = new XFont("Verdana", 8, XFontStyle.Bold);

            graph.DrawString($"{selektiranaRezervacija.KorisnikRezervacije.ImeKorisnika} {selektiranaRezervacija.KorisnikRezervacije.PrezimeKorisnika}", font, XBrushes.Black, new XRect(25, 72, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.PolazisniAerodrom.NazivAerodroma}", font, XBrushes.Black, new XRect(25, 110, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.OdredisniAerodrom.NazivAerodroma}", font, XBrushes.Black, new XRect(25, 150, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.AvionNaLetu.Aviokompanija.NazivAviokompanije}", font, XBrushes.Black, new XRect(182, 110, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.Date.ToString("dd. MMMM")}", font, XBrushes.Black, new XRect(182, 150, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.ToString("HH:mm")}", font, XBrushes.Black, new XRect(282, 150, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);

            graph.DrawString($"{selektiranaRezervacija.KorisnikRezervacije.ImeKorisnika} {selektiranaRezervacija.KorisnikRezervacije.PrezimeKorisnika}", font, XBrushes.Black, new XRect(448, 72, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.PolazisniAerodrom.NazivAerodroma}", font, XBrushes.Black, new XRect(448, 97, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.OdredisniAerodrom.NazivAerodroma}", font, XBrushes.Black, new XRect(448, 125, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.Date.ToString("dd.MM")}", font, XBrushes.Black, new XRect(448, 152, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.ToString("HH:mm")}", font, XBrushes.Black, new XRect(495, 152, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);

            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.BrojLeta}", font, XBrushes.Black, new XRect(25, 190, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.RezerviranoSjedalo.OznakaSjedala}", font, XBrushes.Black, new XRect(104, 190, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.Add(new TimeSpan(0, -45, 0)).ToString("HH:mm")}", font, XBrushes.Black, new XRect(282, 190, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.RezerviranoSjedalo.OznakaSjedala}", font, XBrushes.Black, new XRect(448, 182, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
            graph.DrawString($"{selektiranaRezervacija.LetRezervacije.DatumPolaska.Add(new TimeSpan(0, -45, 0)).ToString("HH:mm")}", font, XBrushes.Black, new XRect(495, 182, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);

            pdf.Save(putanja + "\\BoardingPass\\karta.pdf");
            pdf.Dispose();

            SmtpClient client = new SmtpClient("smtp.gmail.com", 25);

            client.UseDefaultCredentials = false;
            NetworkCredential cred = new NetworkCredential("*****@*****.**", "sj6IWP3o");

            MailMessage Msg = new MailMessage();

            Msg.From = new MailAddress("*****@*****.**");

            Msg.To.Add($"{RepozitorijSkyFlyReservation.prijavljeniKorisnik.EmailKorisnika}");

            Msg.Subject = "Potvrda kupnje karte";

            Msg.Body = $"Poštovani {selektiranaRezervacija.KorisnikRezervacije.ImeKorisnika} {selektiranaRezervacija.KorisnikRezervacije.PrezimeKorisnika},\n\n" +
                       $"Na osnovu provedene kupnje karte za sjedalo {selektiranaRezervacija.RezerviranoSjedalo.OznakaSjedala} na letu {selektiranaRezervacija.LetRezervacije.BrojLeta} | {selektiranaRezervacija.LetRezervacije.PolazisniAerodrom.NazivAerodroma}->{selektiranaRezervacija.LetRezervacije.OdredisniAerodrom.NazivAerodroma} šaljemo Vam kartu za let.\n" +
                       "Karta se nalazi u pdf-u koji ste primili u ovoj poruci.\n" +
                       "Kartu koju ste primili koristite prilikom prijave na aerodromu.\n" +
                       "Molimo Vas da provjeru karte izvršite najkasnije 45 min prije polaska.\n\n" +
                       "S poštovanjem,\n" +
                       "SkyFlyReservation";

            Msg.Attachments.Add(new Attachment(putanja + "\\BoardingPass\\karta.pdf"));

            client.Credentials = cred;

            client.EnableSsl = true;

            client.Send(Msg);
            client.Dispose();
        }
示例#8
0
        /// <summary>
        /// Usando la Libreria Zen.Barcode, desde Nugets manager, logramos generar un codigo de barras /br
        /// y QR. Todavia Falta ver casos de Uso de el Mismo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region CODIGOS GENERADOR

        public void GenerarQR(string dni)
        {
            Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
            pictureBox1.Image = qrcode.Draw(dni, 50);
        }
示例#9
0
 private void QrCodeBtn_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     pictureBox1.Image = qrcode.Draw(QrCodetextBox.Text, 50);
 }
示例#10
0
 private void B_qrcode_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw qr = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     Picbox.Image = qr.Draw(T_qrcode.Text, 100);
 }
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                label5.Text = "First generate unique pin";
            }
            else
            {
                if (textBox2.Text == "")
                {
                    label6.Text = "This is required field";
                    label5.Text = "";
                }
                else
                {
                    string n = "";
                    string p = "";
                    string d = "";
                    string a = "";

                    using (var wb = new WebClient())
                    {
                        var data = new NameValueCollection();
                        data["username"] = "******";
                        data["password"] = "******";

                        var    response         = wb.UploadValues("https://jsonplaceholder.typicode.com/posts", "POST", data);
                        string responseInString = Encoding.UTF8.GetString(response);
                        //Console.WriteLine(responseInString);
                    }

                    using (var wb = new WebClient())
                    {
                        var response = wb.DownloadString("https://jsonplaceholder.typicode.com/todos/1");
                        Dictionary <string, object> list = JsonConvert.DeserializeObject <Dictionary <string, object> >(response.ToString());

                        string[] keys = list.Keys.ToArray();

                        // Get data from json
                        n = list[keys[0]].ToString();
                        p = list[keys[1]].ToString();
                        d = list[keys[2]].ToString();
                        a = list[keys[3]].ToString();

                        //Console.WriteLine(response);
                    }



                    string pin     = textBox1.Text;
                    string course  = textBox2.Text;
                    string comment = textBox3.Text;
                    string date    = DateTime.Now.ToString("MM/dd/yyyy");
                    string Time    = DateTime.Now.ToString("HH:mm:ss");
                    string save    = "pin:" + pin + "\nCourse:" + course + "\nDate:" + date + "\nTime:" + Time + "\nComment:" + comment;
                    save += "\nJSON\nVar1 :" + n + "\nVar2 :" + p + "\nVar3 :" + d + "\nVar4 :" + a;


                    Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                    pictureBox1.Image = qrcode.Draw(save, 50);
                    label5.Text       = "";
                    label6.Text       = "";
                }
            }
        }
示例#12
0
 private void btnQr_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     pictureBox1.Image = qrcode.Draw(lblArza.Text, 50);
 }
示例#13
0
        public static bool SendCustomerDetailsToCustomer(Customer c, Branch b)
        {
            Cursor.Current = Cursors.WaitCursor;

            //QR Code Generation and Content Stream Setup
            PictureBox customerQRCode = new PictureBox();

            customerQRCode.Height = 200;
            customerQRCode.Width  = 200;

            Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
            customerQRCode.Image    = qrcode.Draw(c.ID().ToString(), customerQRCode.Height);
            customerQRCode.AutoSize = true;
            customerQRCode.SizeMode = PictureBoxSizeMode.Zoom;

            var bitmap = new Bitmap(customerQRCode.Height, customerQRCode.Width);

            customerQRCode.DrawToBitmap(bitmap, customerQRCode.ClientRectangle);
            ImageConverter ic = new ImageConverter();

            Byte []      byteStream = (Byte[])ic.ConvertTo(bitmap, typeof(Byte[]));
            MemoryStream customerQR = new MemoryStream(byteStream);

            //SMTP Client Definition
            SmtpClient client = new SmtpClient();

            client.Port                  = 587;
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.Timeout               = 10000;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "P5:qM:7(w[/fZdfr");

            //Message Content Definition
            MailMessage mm = new MailMessage(
                "*****@*****.**",
                c.Email);

            mm.Subject = "Sarre Sports | Registration";
            mm.Body    = String.Format(
                "<h1>{0}</h1></br>" +
                "<h3>Welcome, {1}. Thank you for registering, when you come into store please show your QR Code!</h3></br>" +
                "<p><b>Full Name:</b> {2}</p>" +
                "<p><b>Mobile No:</b> {3}</p>" +
                "<p><b>Customer ID:</b> {4}</p>" +
                "<p>If you are reading this text your email client does not support Image HTML Views.<br>Please try another email client to see your QR Code.</p>",
                b.BranchName(), c.FirstName, c.FullName(), c.MobileNo, c.ID());

            LinkedResource LinkedImage = new LinkedResource(customerQR);

            LinkedImage.ContentId   = "QR";
            LinkedImage.ContentType = new ContentType(MediaTypeNames.Image.Jpeg);

            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
                String.Format(
                    "<h1>{0}</h1></br>" +
                    "<h3>Welcome, {1}. Thank you for registering, when you come into store please show your QR Code!</h3></br>" +
                    "<p><b>Full Name:</b> {2}</p>" +
                    "<p><b>Mobile No:</b> {3}</p>" +
                    "<p><b>Customer ID:</b> {4}</p>" +
                    "Your QR Code:</br><img src=cid:QR>",
                    b.BranchName(), c.FirstName, c.FullName(), c.MobileNo, c.ID()),
                null, "text/html");

            htmlView.LinkedResources.Add(LinkedImage);
            mm.AlternateViews.Add(htmlView);

            mm.BodyEncoding = UTF8Encoding.UTF8;
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

            try
            {
                client.Send(mm);
                return(true);
            }
            catch (SmtpException e)
            {
                Console.WriteLine("SMTP Error: {0}", e.StatusCode);
                return(false);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
                return(false);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                mm.Dispose();
            }
        }
示例#14
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            var HDX = dt.selectHoaDon(lbMaHD.Text).FirstOrDefault();

            if (txtSL.Text.Trim() == "" || txtSL.Text.Trim() == null)
            {
                MessageBox.Show("Bạn chưa nhập số lượng", "Thông báo");
            }
            else if (Convert.ToInt32(txtSL.Text) == 0)
            {
                MessageBox.Show("Số lượng phải lớn hơn 0");
            }
            else
            {
                if (HDX == null)
                {
                    Image QR;
                    Zen.Barcode.CodeQrBarcodeDraw qr = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                    QR = qr.Draw(lbMaHD.Text, 50);
                    MemoryStream stream = new MemoryStream();
                    QR.Save(stream, ImageFormat.Jpeg);
                    dt.Insert_HoaDon(lbMaHD.Text, Convert.ToString(cbbMaKH.SelectedValue), DangNhap.TTNV.MaNV,
                                     Convert.ToDateTime(DateTime.Now), Convert.ToInt32(numericChietKhau.Value), 0, Convert.ToBoolean("true"), stream.ToArray());
                    dt.INSERT_CTHD(lbMaHD.Text, cbbTenSP.SelectedValue.ToString(), Convert.ToInt32(txtSL.Text),
                                   (Convert.ToDouble(txtSL.Text) * Convert.ToDouble(lbDongia.Text)));
                    double thanhtien = 0;
                    foreach (var a in dt.selectCTHD(lbMaHD.Text))
                    {
                        thanhtien = thanhtien + Convert.ToDouble(a.GIABAN) * Convert.ToDouble(a.SL);
                    }
                    dt.UPDATE_ThanhTien(lbMaHD.Text, thanhtien);
                    MessageBox.Show("Thêm thành công", "Thêm");
                    numericChietKhau.Enabled = false;
                    var sp = dt.selectSP(cbbTenSP.SelectedValue.ToString()).FirstOrDefault();
                    label2.Text = sp.SOLUONG.ToString();
                }
                else if (HDX != null)
                {
                    var CTX = dt.selectAll_CTHD(lbMaHD.Text, cbbTenSP.SelectedValue.ToString()).FirstOrDefault();
                    if (CTX == null)
                    {
                        dt.INSERT_CTHD(lbMaHD.Text, cbbTenSP.SelectedValue.ToString(), Convert.ToInt32(txtSL.Text),
                                       (Convert.ToDouble(txtSL.Text) * Convert.ToDouble(lbDongia.Text)));
                        double thanhtien = 0;
                        foreach (var a in dt.selectCTHD(lbMaHD.Text))
                        {
                            thanhtien = thanhtien + Convert.ToDouble(a.GIABAN) * Convert.ToDouble(a.SL);
                        }
                        dt.UPDATE_ThanhTien(lbMaHD.Text, thanhtien);
                        MessageBox.Show("Thêm thành công", "Thêm");
                        var sp = dt.selectSP(cbbTenSP.SelectedValue.ToString()).FirstOrDefault();
                        label2.Text = sp.SOLUONG.ToString();
                    }
                    else if (CTX != null)
                    {
                        dt.updateSL_CTHD(lbMaHD.Text, cbbTenSP.SelectedValue.ToString(), Convert.ToInt32(txtSL.Text) + CTX.SL,
                                         CTX.THANHTIEN + (Convert.ToDouble(txtSL.Text) * Convert.ToDouble(lbDongia.Text)));
                        double thanhtien = 0;
                        foreach (var a in dt.selectCTHD(lbMaHD.Text))
                        {
                            thanhtien = thanhtien + Convert.ToDouble(a.GIABAN) * Convert.ToDouble(a.SL);
                        }
                        dt.UPDATE_ThanhTien(lbMaHD.Text, thanhtien);
                        MessageBox.Show("Thêm thành công", "Thêm");
                        var sp = dt.selectSP(cbbTenSP.SelectedValue.ToString()).FirstOrDefault();
                        label2.Text = sp.SOLUONG.ToString();
                    }
                }
            }
            dgvHD.DataSource = dt.selectCTHD(lbMaHD.Text);
            txtSL.ResetText();
            double TongTienHD       = 0;
            double TongTienDiscount = 0;

            foreach (var a in dt.selectCTHD(lbMaHD.Text))
            {
                TongTienHD = TongTienHD + Convert.ToDouble(a.GIABAN) * Convert.ToDouble(a.SL);
            }
            TongTienDiscount = TongTienHD - ((Convert.ToDouble(numericChietKhau.Value) * TongTienHD) * 0.01);
            dt.UPDATE_TONGTIEN(lbMaHD.Text, TongTienDiscount);
            lbTongTien.Text = TongTienDiscount.ToString("N0");
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (txtHorizontal.Text.Length <= 0 && txtVertical.Text.Length <= 0)
            {
                if (cbxQRType.SelectedItem.ToString() == "1D")
                {
                    if (txtProductID.Text.ToString().Length <= 0)
                    {
                        MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                        return;
                    }
                    Zen.Barcode.Code128BarcodeDraw qrcode1d = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
                    string lblProductIDCut = lblProductID.ToString().Replace(" ", "");
                    picResult.Image = qrcode1d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 100);



                    if (cbxRowAndColumn.Text.Length <= 0)
                    {
                        cbxRowAndColumn.SelectedIndex = 0;
                    }
                    if (cbxRowAndColumn.SelectedItem.ToString() == "1")
                    {
                        this.btnDetailedView.Enabled = false;
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "2")
                    {
                        #region cotvadong=2
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 380;                         //adjustable
                        int    height   = 380;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "3")
                    {
                        #region cotvadong=3
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 570;                         //adjustable
                        int    height   = 570;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "4")
                    {
                        #region cotvadong=4
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 760;                         //adjustable
                        int    height   = 760;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }

                    FormQRsInGrid frmQRsInGrid = new FormQRsInGrid(this.picResult1.Image, this.cbxRowAndColumn, this.txtHorizontal, this.txtVertical);
                    this.panelResult.Enabled = true;
                    this.picResult.Visible   = true;
                    this.btnSave.Enabled     = true;
                    if (this.cbxRowAndColumn.SelectedIndex != 0)
                    {
                        this.btnDetailedView.Enabled = true;
                    }
                }
                else if (cbxQRType.SelectedItem.ToString() == "2D")
                {
                    if (txtProductID.Text.ToString().Length <= 0)
                    {
                        MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                        return;
                    }
                    Zen.Barcode.CodeQrBarcodeDraw qrcode2d = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                    string lblProductIDCut = lblProductID.Text.Replace(" ", "");
                    picResult.Image = qrcode2d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 50);

                    if (cbxRowAndColumn.Text.Length <= 0)
                    {
                        cbxRowAndColumn.SelectedIndex = 0;
                    }
                    if (cbxRowAndColumn.SelectedItem.ToString() == "1")
                    {
                        this.btnDetailedView.Enabled = false;
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "2")
                    {
                        #region cotvadong=2
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 380;                         //adjustable
                        int    height   = 380;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "3")
                    {
                        #region cotvadong=3
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 570;                         //adjustable
                        int    height   = 570;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    else if (cbxRowAndColumn.SelectedItem.ToString() == "4")
                    {
                        #region cotvadong=4
                        Image  imgsmall = this.picResult.Image;
                        int    width    = 760;                         //adjustable
                        int    height   = 760;                         //adjustable
                        Bitmap imgFinal = new Bitmap(width, height);
                        xuLyIn(width, height, imgsmall, imgFinal);
                        #endregion
                    }
                    FormQRsInGrid frmQRsInGrid = new FormQRsInGrid(this.picResult1.Image, this.cbxRowAndColumn, this.txtHorizontal, this.txtVertical);
                    this.panelResult.Enabled = true;
                    this.picResult.Visible   = true;
                    this.btnSave.Enabled     = true;
                    if (this.cbxRowAndColumn.SelectedIndex != 0)
                    {
                        this.btnDetailedView.Enabled = true;
                    }
                }
            }
            else
            {
                //this.cbxRowAndColumn.SelectedIndex = 0;
                if (txtProductID.Text.ToString().Length <= 0)
                {
                    MessageBox.Show("Hãy nhập mã hàng", "Thông báo", MessageBoxButtons.OK);
                    return;
                }
                Zen.Barcode.CodeQrBarcodeDraw qrcode2d = Zen.Barcode.BarcodeDrawFactory.CodeQr;
                string lblProductIDCut = lblProductID.Text.Replace(" ", "");
                picResult.Image = qrcode2d.Draw(lblProductIDCut.Trim() + txtProductID.Text.Trim() + " | " + txtProductName.Text.ToString(), 50);
                Image  imgsmall = this.picResult.Image;
                int    width    = Convert.ToInt32(this.txtHorizontal.Text);
                int    height   = Convert.ToInt32(this.txtVertical.Text);
                Bitmap imgFinal = new Bitmap(width, height);
                xuLyIn(width, height, imgsmall, imgFinal);

                this.panelResult.Enabled     = true;
                this.picResult.Visible       = true;
                this.btnSave.Enabled         = true;
                this.btnDetailedView.Enabled = true;
            }
        }
示例#16
0
        private void button11_Click(object sender, EventArgs e)
        {
            int count = 0;

            string ss = "https://github.com/SahadevDahit/Library-Management-System";

            Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
            p.pictureBox1.Image = qrcode.Draw(ss, 100);

            if (comboBox1.SelectedIndex == -1 || comboBox1.SelectedIndex == 0)
            {
                if (textBox1.Text != "" && textBox11.Text != "")
                {
                    foreach (string item in listBox1.Items)
                    {
                        if (textBox11.Text == item)
                        {
                            count++;
                        }
                    }

                    if (count == 0)
                    {
                        this.Hide();

                        if (printPreviewDialog1.ShowDialog() == DialogResult.OK)
                        {
                            printDocument1.Print();
                        }
                        this.Show();
                    }
                    else
                    {
                        MessageBox.Show("Deposit Book at first.");
                    }
                }
                else
                {
                    MessageBox.Show("Select the proper book from issued list to be diposited");
                }
            }

            else if (textBox1.Text != "" && textBox6.Text != "")
            {
                foreach (string item in listBox1.Items)
                {
                    if (textBox6.Text == item)
                    {
                        count++;
                    }
                }
                if (count == 1)
                {
                    this.Hide();

                    /* PrintDialog pd = new PrintDialog();
                     * PrintDocument doc = new PrintDocument();
                     * doc.PrintPage += printcode;
                     * pd.Document = doc;
                     * if (pd.ShowDialog() == DialogResult.OK)
                     * {
                     *
                     *   doc.Print();
                     * }*/
                    if (printPreviewDialog1.ShowDialog() == DialogResult.OK)
                    {
                        printDocument1.Print();
                    }
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Issue the book first");
                }
                this.Show();
            }
            else
            {
                MessageBox.Show("Please fill the Record of Enrollment no and Book id");
            }
        }
示例#17
0
 private void btnGenerar_Click(object sender, EventArgs e)
 {
     Zen.Barcode.CodeQrBarcodeDraw codigoQr = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     imgQr.Image = codigoQr.Draw(txtGenerar.Text, 40);
 }