Ejemplo n.º 1
0
        private void CheckServer()
        {
            int iLabelSize = PrinterHelper.getPageHeight(Program.settings.printer);

            timer.Stop();
            Countdown.Text = "Checking...";
            Refresh();

            var pj = Util.FetchPrintJob();

            if (pj.jobs.Count > 0)
            {
                dtLastPrint = DateTime.Now;

                foreach (var j in pj.jobs)
                {
                    Program.SecurityCode = j.securitycode;

                    foreach (var e in j.list)
                    {
                        e.securitycode = Program.SecurityCode;
                    }

                    if (!Program.settings.useOldDatamaxFormat)
                    {
                        PrinterHelper.doPrinting(j.list);
                    }
                    else
                    {
                        var doprint = new DoPrinting();
                        var ms      = new MemoryStream();

                        if (iLabelSize >= 170 && iLabelSize <= 230)
                        {
                            doprint.PrintLabels2(ms, j.list);
                        }
                        else
                        {
                            doprint.PrintLabels(ms, j.list);
                        }
                        doprint.FinishUp(ms);
                    }
                }

                triesLeft = MAX_TRIES;
            }
            else
            {
                triesLeft--;
            }

            count = TIME_BETWEEN_TRIES;
            timer.Start();
        }
Ejemplo n.º 2
0
        private void CheckServer()
        {
            int iLabelSize = PrinterHelper.getPageHeight(Program.Printer);

            timer1.Stop();
            Countdown.Text = "Checking...";
            Refresh();
            var pj = Util.FetchPrintJob();

            if (pj.jobs.Count > 0)
            {
                dtLastPrint = DateTime.Now;

                foreach (var j in pj.jobs)
                {
                    Program.SecurityCode = j.securitycode;

                    if (Program.UseNewLabels)
                    {
                        foreach (var e in j.list)
                        {
                            e.securitycode = Program.SecurityCode;
                        }
                        PrinterHelper.doPrinting(j.list);
                    }
                    else
                    {
                        var doprint = new DoPrinting();
                        var ms      = new MemoryStream();
                        if (iLabelSize >= 170 && iLabelSize <= 230)
                        {
                            doprint.PrintLabels2(ms, j.list);
                        }
                        else
                        {
                            doprint.PrintLabels(ms, j.list);
                        }
                        doprint.FinishUp(ms);
                    }
                }
            }
            count = INT_count;
            timer1.Start();
        }
Ejemplo n.º 3
0
        private void CheckServer()
        {
            int iLabelSize = PrinterHelper.getPageHeight(Program.Printer);

            timer1.Stop();
            Countdown.Text = "Checking...";
            Refresh();
            var pj = Util.FetchPrintJob();
            if (pj.jobs.Count > 0)
            {
                dtLastPrint = DateTime.Now;

                foreach (var j in pj.jobs)
                {
                    Program.SecurityCode = j.securitycode;

                    if (Program.UseNewLabels)
                    {
                        foreach (var e in j.list) { e.securitycode = Program.SecurityCode; }
                        PrinterHelper.doPrinting(j.list);
                    }
                    else
                    {
                        var doprint = new DoPrinting();
                        var ms = new MemoryStream();
                        if (iLabelSize >= 170 && iLabelSize <= 230)
                            doprint.PrintLabels2(ms, j.list);
                        else
                            doprint.PrintLabels(ms, j.list);
                        doprint.FinishUp(ms);
                    }
                }
            }
            count = INT_count;
            timer1.Start();
        }
Ejemplo n.º 4
0
        private void DoPrinting(object sender, DoWorkEventArgs e)
        {
            if (list == null)
            {
                return;
            }

            var qlist = list.Where(c => c.CheckedIn && c.NumLabels > 0);

            if (!PrintAll.Text.HasValue())
            {
                qlist = qlist.Where(c => c.WasChecked);
            }

            var q = from c in qlist
                    select new LabelInfo
            {
                allergies             = c.allergies,
                pid                   = c.cinfo.pid,
                mv                    = c.cinfo.mv,
                n                     = c.NumLabels,
                first                 = c.preferredname,
                last                  = c.last,
                location              = c.location,
                hour                  = c.cinfo.hour,
                org                   = c.orgname,
                custody               = c.custody,
                transport             = c.transport,
                requiressecuritylabel = c.RequiresSecurityLabel,
                securitycode          = Program.SecurityCode,
                dob                   = (c.dob != null && c.dob.Length > 0 ? DateTime.Parse(c.dob) : DateTime.Now),
                parents               = c.parents
            };

            Util.UnLockFamily();

            if (Program.settings.printMode == "Cloud Printing")
            {
                //TODO: print using cloud printing method
                return;
            }

            if (Program.settings.printMode == "Print To Server")
            {
                PrintServerLabels(q);
                return;
            }
            else if (Program.settings.printMode == "Cloud Printing")
            {
                return;
            }

            if (q.Count() > 0)
            {
                if (!Program.settings.useOldDatamaxFormat)
                {
                    if (!PrinterHelper.doPrinting(q))
                    {
                        MessageBox.Show("There were no labels to print, please adjust your printer page size.  If the page size is correct, please contact support for assistance.", "Printer Page Size Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    DoPrinting doprint    = new DoPrinting();
                    int        iLabelSize = PrinterHelper.getPageHeight(Program.settings.printer);

                    using (var ms = new MemoryStream())
                    {
                        if (iLabelSize >= 151 && iLabelSize <= 250)
                        {
                            doprint.PrintLabels2(ms, q);
                        }
                        else
                        {
                            doprint.PrintLabels(ms, q);
                        }

                        doprint.FinishUp(ms);
                    }
                }
            }
        }