Exemple #1
0
        private void createLabel(int start, int end, DataTable roster)
        {
            RFIDLabel  = string.Empty;
            RFIDLabel += "${";
            for (int LabelNumber = start; LabelNumber <= end; LabelNumber++)
            {
                string[] firstName;
                string[] lastName;
                var      lastq = from l in roster.AsEnumerable()
                                 where l.Field <string>("Bib_#") == (LabelNumber - 1).ToString()
                                 select l.Field <string>("Last_Name");

                lastName = lastq.ToArray();
                var firstq = from f in roster.AsEnumerable()
                             where f.Field <string>("Bib_#") == (LabelNumber - 1).ToString()
                             select f.Field <string>("First_Name");

                firstName  = firstq.ToArray();
                RFIDLabel += "\n^XA\n^RS8\n";
                RFIDLabel += "^FO25,145^A0N,65^FD";
                if (LabelNumber != start)
                {
                    RFIDLabel += LabelNumber - 1 + "^FS\n";
                    RFIDLabel += "^FO600,25^A0N,50^FD" + lastName[0] + ",^FS\n";
                    RFIDLabel += "^FO600,75^A0N,50^FD" + firstName[0] + "^FS\n";
                    RFIDLabel += "^FO25,25^A0N,65^FDohioraceday.com^FS\n";
                    RFIDLabel += "^FO145,155^A0N,50^FDDO NOT BEND/REMOVE^FS\n";
                    RFIDLabel += "^RFW,H^FD";
                }
                else
                {
                    RFIDLabel += "^FS\n^RFW,H^FD";
                }
                string RFIDNumber = LabelNumber.ToString();
                RFIDLabel += RFIDNumber.PadLeft(24, '0') + "^FS\n^XZ\n";
            }
            RFIDLabel += "\n^XA\n^RS8\n^FO25,25^A0N,65^FD";
            RFIDLabel += end + "^FS\n^RFW,H^FD000000000000000000000000^FS\n^XY\n";
            RFIDLabel += "}$";

            string output = "";

            File.WriteAllText("output.txt", RFIDLabel);
            PrintDialog pd = new PrintDialog();

            pd.PrinterSettings = new PrinterSettings();
            if (DialogResult.OK == pd.ShowDialog(this))
            {
                PrinterHelper.SendFileToPrinter(pd.PrinterSettings.PrinterName, "output.txt");
            }

            //^XA
            //^RS8
            //^FO600,25^A0N,65^FDKline,^FS
            //^FO600,75^A0N,65^FDBradley^FS
            //^FO25,25^A0N,65^FDohioraceday.com^FS
            //^FO25,145^A0N,65^FD1^FS
            //^FO600,145^A0N,65^FDM-39^FS
            //^FO145,155^A0N,50^FDDO NOT BEND/REMOVE^FS
            //^RFW,H^FD000000000000000000000001^FS
            //^XZ

            //PrinterSettings ps = new PrinterSettings();
            //PrinterHelper.SendFileToPrinter(ps.PrinterName, "output.txt");
        }
Exemple #2
0
        private void printLabels()
        {
            int       start;
            int       end;
            bool      blnStart   = int.TryParse(txtStart.Text, out start);
            bool      blnEnd     = int.TryParse(txtEnd.Text, out end);
            int       fileNumber = 1;
            ArrayList Files      = new ArrayList();

            if (blnStart && blnEnd)
            {
                txtStart.BackColor = Color.White;
                txtEnd.BackColor   = Color.White;
                RFIDLabel          = string.Empty;
                RFIDLabel         += "${";
                for (int LabelNumber = start; LabelNumber <= end + 1; LabelNumber++)
                {
                    RFIDLabel += "\n^XA\n^RS8\n^FO25,135^A0N,65^FD";
                    if (LabelNumber != start)
                    {
                        //RFIDLabel += LabelNumber - 1 + "^FS\n^RFW,H^FD";
                        RFIDLabel += LabelNumber - 1 + "^FS\n";
                        // RFIDLabel += "^FO600,25^A0N,50^FD" + lastName[0] + ",^FS\n";
                        // RFIDLabel += "^FO600,75^A0N,50^FD" + firstName[0] + "^FS\n";
                        RFIDLabel += "^FO90,25^A0N,65^FD" + txtLine1.Text + "^FS\n";
                        RFIDLabel += "^FO120,100^A0N,50^FD" + txtLine2.Text + "^FS\n";
                        RFIDLabel += "^RFW,H^FD";
                    }
                    else
                    {
                        RFIDLabel += "^FS\n^RFW,H^FD";
                    }
                    string RFIDNumber = LabelNumber.ToString();
                    RFIDLabel += RFIDNumber.PadLeft(24, '0') + "^FS\n^XZ\n}$\n${";
                    //if (LabelNumber % 100 == 0)
                    //{
                    //    RFIDLabel += "}$";
                    //    string fileName = "output" + fileNumber + ".txt";
                    //    File.WriteAllText(fileName, RFIDLabel);
                    //    Files.Add(fileName);
                    //    RFIDLabel = "${";
                    //    fileNumber++;
                    //}
                }
                RFIDLabel += "\n^XA\n^RS8\n^FO25,25^A0N,65^FD";
                RFIDLabel += end + "^FS\n^RFW,H^FD000000000000000000000000^FS\n^XY\n";
                RFIDLabel += "}$";
            }
            else
            {
                if (!blnStart)
                {
                    txtStart.BackColor = Color.Yellow;
                }
                if (!blnEnd)
                {
                    txtEnd.BackColor = Color.Yellow;
                }
            }
            string FileName = "output" + fileNumber + ".txt";

            File.SetAttributes(FileName, FileAttributes.Normal);
            File.WriteAllText(FileName, RFIDLabel);
            Files.Add(FileName);
            PrintDialog pd = new PrintDialog();

            pd.PrinterSettings = new PrinterSettings();
            if (DialogResult.OK == pd.ShowDialog(this))
            {
                foreach (string file in Files)
                {
                    PrinterHelper.SendFileToPrinter(pd.PrinterSettings.PrinterName, file);
                    System.Threading.Thread.Sleep(500);
                }
            }
        }
Exemple #3
0
        private void printSpecificRace()
        {
            int  start;
            int  end;
            int  raceno;
            bool blnStart  = int.TryParse(txtStart.Text, out start);
            bool blnEnd    = int.TryParse(txtEnd.Text, out end);
            bool blnRaceNo = int.TryParse(txtRaceNumber.Text, out raceno);

            if (blnStart && blnEnd && blnRaceNo)
            {
                txtStart.BackColor      = Color.White;
                txtEnd.BackColor        = Color.White;
                txtRaceNumber.BackColor = Color.White;
                RFIDLabel  = string.Empty;
                RFIDLabel += "${";
                for (int LabelNumber = start; LabelNumber <= end; LabelNumber++)
                {
                    RFIDLabel += "\n^XA\n^RS8\n^FO25,135^A0N,65^FD";
                    if (LabelNumber != start)
                    {
                        RFIDLabel += LabelNumber - 1 + "^FS\n";
                        RFIDLabel += "^FO190,25^A0N,65^FDohioraceday.com^FS\n";
                        RFIDLabel += "^FO215,140^A0N,50^FDDO NOT BEND/REMOVE^FS\n";
                        RFIDLabel += "^RFW,H^FD";
                    }
                    else
                    {
                        RFIDLabel += "^FS\n^RFW,H^FD";
                    }
                    string RFIDNumber = LabelNumber.ToString();
                    RFIDNumber = RFIDNumber.PadLeft(24 - raceno.ToString().Length, '0');
                    RFIDNumber = raceno + RFIDNumber;
                    RFIDLabel += RFIDNumber + "^FS\n^XZ\n";
                }
                RFIDLabel += "\n^XA\n^RS8\n^FO25,25^A0N,65^FD";
                RFIDLabel += end + "^FS\n^RFW,H^FD000000000000000000000000^FS\n^XY\n";
                RFIDLabel += "}$";
            }
            else
            {
                if (!blnStart)
                {
                    txtStart.BackColor = Color.Yellow;
                }
                if (!blnEnd)
                {
                    txtEnd.BackColor = Color.Yellow;
                }
                if (!blnRaceNo)
                {
                    txtRaceNumber.BackColor = Color.Yellow;
                }
                return;
            }
            string output = "";

            File.WriteAllText("output.txt", RFIDLabel);
            PrintDialog pd = new PrintDialog();

            pd.PrinterSettings = new PrinterSettings();
            if (DialogResult.OK == pd.ShowDialog(this))
            {
                PrinterHelper.SendFileToPrinter(pd.PrinterSettings.PrinterName, "output.txt");
            }
            //PrinterSettings ps = new PrinterSettings();
            //PrinterHelper.SendFileToPrinter(ps.PrinterName, "output.txt");
        }