示例#1
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var Orow = (SaleBarcodCreateDTO)gridView1.GetFocusedRow();

            if (Orow != null)
            {
                string Barcode, Check12Digits;

                Random rnd      = new Random();
                int    sayi1    = (Convert.ToInt32(rnd.Next(10000, 999999999)));
                int    sayi2    = (Convert.ToInt32(rnd.Next(10, 99)));
                string _barcode = Convert.ToString(sayi1 + "" + sayi2);

                if (_barcode.Length > 0)
                {
                    Check12Digits = _barcode.PadRight(12, '0');
                    Barcode       = EAN13Class.EAN13(Check12Digits);
                    if (!String.Equals(EAN13Class.Barcode13Digits, "") || (EAN13Class.Barcode13Digits != ""))
                    {
                        Orow.Barcode = EAN13Class.Barcode13Digits.ToString();
                    }
                }
                gridControl1.RefreshDataSource();
            }
        }
示例#2
0
        private void textEdit4_TextChanged(object sender, EventArgs e)
        {
            string Barcode, Check12Digits;

            if (textEdit4.Text != "")
            {
                Check12Digits = textEdit4.Text.PadRight(12, '0');
                Barcode       = EAN13Class.EAN13(Check12Digits);

                if (!String.Equals(EAN13Class.Barcode13Digits, "") || (EAN13Class.Barcode13Digits != ""))
                {
                    txtBarcode.Text = EAN13Class.Barcode13Digits.ToString();
                    Int32 inStart = Convert.ToInt32(txtBarcode.Text.Length - 1);
                    ChanceTextColor.ChangeColor(txtBarcode, inStart);
                }
            }
        }
示例#3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if ((!String.IsNullOrEmpty(textBox1.Text) || !string.IsNullOrWhiteSpace(textBox1.Text)))
            {
                if (textBox1.Text.Length <= 13)
                {
                    if (comboBox1.SelectedIndex != -1)
                    {
                        String str = "[0-9]";

                        if (Regex.IsMatch(textBox1.Text, str))
                        {
                            string Barrcode, Check2Digits;

                            Check2Digits = textBox1.Text.PadRight(13, '0');
                            Barrcode     = EAN13Class.EAN13(Check2Digits);
                            label4.Text  = Barrcode;
                        }
                        else
                        {
                            MessageBox.Show("لا يسمح بكتابة حروف");
                            if (radioButton1.Checked == true)
                            {
                                if (radioButton1.Checked == true)
                                {
                                    textBox1.Text = "1";
                                }
                            }
                        }


                        string LastBarcode = Path.Combine(Path.GetFullPath(@"BarcodeImge\"));
                        Bitmap b           = new Bitmap(label4.Width, label4.Height);
                        label4.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height));
                        if (Directory.Exists(LastBarcode))
                        {
                            LastBarcode = LastBarcode + "LastBarcode.jpg";
                        }
                        else
                        {
                            Directory.CreateDirectory(LastBarcode);
                        }


                        // LastBarcode = LastBarcode + "LastBarcode.jpg";
                        b.Save(LastBarcode);
                        if (File.Exists(LastBarcode))
                        {
                            //صغير
                            //وسط
                            //كبير
                            //ضخم
                            if (comboBox1.SelectedIndex != -1)
                            {
                                // reportViewer1.Reset();
                                reportViewer1.LocalReport.DisplayName = "الباركود الخاص بالمنتج " + textBox3.Text + " حجم " + comboBox1.SelectedItem.ToString();
                                if (comboBox2.SelectedIndex == 0)
                                {
                                    reportViewer1.LocalReport.ReportEmbeddedResource = "ITI_Project.Reports.Barcode.A4BarcoderSmall.rdlc";
                                    ReportParameter p  = new ReportParameter("BarcodeImage", LastBarcode);
                                    ReportParameter p2 = new ReportParameter("ProductName", textBox3.Text);
                                    ReportParameter p3 = new ReportParameter("PrpductPrice", textBox4.Text);
                                    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p2, p3 });
                                    this.reportViewer1.RefreshReport();
                                    reportViewer1.Refresh();
                                }
                                else if (comboBox2.SelectedIndex == 1)
                                {
                                    reportViewer1.LocalReport.ReportEmbeddedResource = "ITI_Project.Reports.Barcode.A4BarcoderMeduim.rdlc";
                                    ReportParameter p  = new ReportParameter("BarcodeImage", LastBarcode);
                                    ReportParameter p2 = new ReportParameter("ProductName", textBox3.Text);
                                    ReportParameter p3 = new ReportParameter("PrpductPrice", textBox4.Text);
                                    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p2, p3 });
                                    this.reportViewer1.RefreshReport();
                                    reportViewer1.Refresh();
                                }
                                else if (comboBox2.SelectedIndex == 2)
                                {
                                    reportViewer1.LocalReport.ReportEmbeddedResource = "ITI_Project.Reports.Barcode.A4Barcoderdlc.rdlc";
                                    ReportParameter p  = new ReportParameter("BarcodeImage", LastBarcode);
                                    ReportParameter p2 = new ReportParameter("ProductName", textBox3.Text);
                                    ReportParameter p3 = new ReportParameter("PrpductPrice", textBox4.Text);
                                    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p2, p3 });
                                    this.reportViewer1.RefreshReport();
                                    reportViewer1.Refresh();
                                }
                                else if (comboBox2.SelectedIndex == 3)
                                {
                                    reportViewer1.LocalReport.ReportEmbeddedResource = "ITI_Project.Reports.Barcode.A4BarcoderLarg.rdlc";
                                    ReportParameter p  = new ReportParameter("BarcodeImage", LastBarcode);
                                    ReportParameter p2 = new ReportParameter("ProductName", textBox3.Text);
                                    ReportParameter p3 = new ReportParameter("PrpductPrice", textBox4.Text);
                                    this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p2, p3 });
                                    this.reportViewer1.RefreshReport();
                                    reportViewer1.Refresh();
                                }
                            }
                        }
                    }
                }
            }
        }
示例#4
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if ((!String.IsNullOrEmpty(textBox1.Text) || !string.IsNullOrWhiteSpace(textBox1.Text)))
            {
                if (textBox1.Text.Length <= 13)
                {
                    String str = "[0-9]";

                    if (Regex.IsMatch(textBox1.Text, str))
                    {
                        string Barrcode, Check2Digits;

                        Check2Digits = textBox1.Text.PadRight(13, '0');
                        Barrcode     = EAN13Class.EAN13(Check2Digits);
                        label4.Text  = Barrcode;
                    }
                    else
                    {
                        MessageBox.Show("لا يسمح بكتابة حروف");
                        if (radioButton1.Checked == true)
                        {
                            if (radioButton1.Checked == true)
                            {
                                textBox1.Text = "1";
                            }
                        }
                    }



                    /// passing image to report
                    ///

                    string LastBarcode = Path.Combine(Path.GetFullPath(@"BarcodeImge\"));
                    Bitmap b           = new Bitmap(label4.Width, label4.Height);
                    label4.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height));
                    if (Directory.Exists(LastBarcode))
                    {
                        LastBarcode = LastBarcode + "LastBarcode.jpg";
                    }
                    else
                    {
                        Directory.CreateDirectory(LastBarcode);
                    }


                    // LastBarcode = LastBarcode + "LastBarcode.jpg";
                    b.Save(LastBarcode);
                    if (File.Exists(LastBarcode))
                    {
                        reportViewer1.LocalReport.DisplayName            = "الباركود الخاص بالمنتج " + textBox3.Text;
                        reportViewer1.LocalReport.ReportEmbeddedResource = "ITI_Project.Reports.Barcode.BarcodeSmallSize.rdlc";
                        ReportParameter p  = new ReportParameter("BarcodeImage", LastBarcode);
                        ReportParameter p2 = new ReportParameter("ProductName", textBox3.Text);
                        ReportParameter p3 = new ReportParameter("PrpductPrice", textBox4.Text);
                        this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p, p2, p3 });
                        this.reportViewer1.RefreshReport();
                        reportViewer1.Refresh();
                    }
                }
                else
                {
                    XtraMessageBox.Show(" غير مسموح باكثر من 13 رقم ");
                }
            }
            else
            {
                MessageBox.Show("يرجى كتابة نص  اولا");
            }
        }