Beispiel #1
0
        private void PrintLabel(string sWorkCode)
        {
            Console.WriteLine("Printing Labels: " + sWorkCode + "...");

            StatusLabel.Text = "Printing Labels for: " + sWorkCode + "...";

            try
            {
                // ja - start a new print job
                LabelGen pd = new LabelGen();

                // ja - from the table name determine the location they are printing from
                LabelGeneratorLib.PrinterArea eLoc = PrinterArea.final;

                // ja - add the job (read labelcodes from Database)
                pd.AddPrintJob(eLoc, sWorkCode, true);

                // ja - read the serials database and fill the list
                List <string> myList = GetSerials();

                // ja - add the serial numbers to the print job
                pd.AddDataRowFromDB(myList);

                // ja - print the labels for all of the jobs
                if (pd.PrintLabels())
                {
                    MessageBox.Show("Labels Printed Successfully");
                    StatusLabel.Text = "Labels Printed Successfully";
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public int AddPrintJob(LabelGeneratorLib.PrinterArea eArea, LabelGeneratorLib.LabelTypes eLabelType, List <string> sColumns)
        {
            //LabelGen objClass = (LabelGen)Session["LabelGen"];

            //return objClass.AddPrintJob(eArea, eLabelType, sColumns);

            return(_labelGen.AddPrintJob(eArea, eLabelType, sColumns));
        }
        //Session["LabelGen"] = _labelGen;

        public bool Print(LabelGeneratorLib.PrinterArea eArea, LabelGeneratorLib.LabelTypes eLabelType, List <string> sColumns, string sTemplate, int nQty, int nStartPos = 0)
        {
            LabelGen _labelGen = new LabelGen();

            int nJob = _labelGen.AddPrintJob(eArea, eLabelType, sColumns);

            _labelGen.AddDataRow(nJob, sTemplate, nQty, nStartPos);

            _labelGen.PrintLabels();

            return(true);
        }
        private void PrintLabel(string sKey, string sWorkCode, string sTable)
        {
            Console.WriteLine("Printing Labels: " + sWorkCode + "...");

#if DEBUG
            SetPrintedFlag(sKey);

            //return;
#endif

            try
            {
                // ja - start a new print job
                LabelGen pd = new LabelGen(sTable);

                // ja - from the table name determine the location they are printing from
                LabelGeneratorLib.PrinterArea eLoc = FindLocation(sTable);

                // ja - add the job (read labelcodes from Database)
                pd.AddPrintJob(eLoc, sWorkCode, true);

                // ja - read the serials database and fill the list
                List <string> myList = GetSerials(sKey);

                // ja - add the serial numbers to the print job
                pd.AddDataRowFromDB(myList);

                // ja - print the labels for all of the jobs
                pd.PrintLabels();

                // ja - mark in the jobs database queue that this has been printed
                SetPrintedFlag(sKey);
            }
            catch (System.Exception ex)
            {
                Config.Log(ex.Message);
            }
        }