Exemplo n.º 1
0
        public static void Print(TachographDocument document)
        {
            var registrationData = GetRegistrationData();
            var workshopSettings = GetWorkshopSettings();
            var printerSettings  = GetPrinterSettings();

            var parameters = new WorkerParameters();

            parameters.SetParameter("AutoPrintLabels", printerSettings.AutoPrintLabels);
            parameters.SetParameter("LabelNumberOfCopies", printerSettings.LabelNumberOfCopies);

            parameters.SetParameter("Address1", workshopSettings.Address1);
            parameters.SetParameter("Town", workshopSettings.Town);
            parameters.SetParameter("PostCode", workshopSettings.PostCode);
            parameters.SetParameter("WorkshopName", workshopSettings.WorkshopName);
            parameters.SetParameter("PhoneNumber", workshopSettings.PhoneNumber);
            parameters.SetParameter("DateFormat", Constants.LongYearDateFormat);
            parameters.SetParameter("LicenseKey", registrationData.LicenseKey);
            parameters.SetParameter("ExpirationDate", registrationData.ExpirationDate);
            parameters.SetParameter("DefaultLabelPrinter", printerSettings.DefaultLabelPrinter);
            parameters.SetParameter("CompanyName", registrationData.CompanyName);
            parameters.SetParameter("TemporaryDirectory", ImageHelper.GetTemporaryDirectory());
            parameters.SetParameter("DefaultFont", printerSettings.DefaultFont);
            parameters.SetParameter("ShowCompanyNameOnLabels", printerSettings.ShowCompanyNameOnLabels);

            parameters.SetParameter("DocumentType", document.DocumentType);
            parameters.SetParameter("KFactor", document.KFactor);
            parameters.SetParameter("WFactor", document.WFactor);
            parameters.SetParameter("LFactor", document.LFactor);
            parameters.SetParameter("VIN", document.VIN);
            parameters.SetParameter("SerialNumber", document.SerialNumber);
            parameters.SetParameter("TyreSize", document.TyreSize);
            parameters.SetParameter("CalibrationTime", document.CalibrationTime);

            parameters.SetParameter("SealNumber", registrationData.SealNumber);
            parameters.SetParameter("SkillrayTachoIcon", ImageHelper.LoadFromResources("skillray_tacho_icon").ToByteArray());

            var workerTask = new WorkerTask {
                TaskName = WorkerTaskName.LabelPrint
            };

            workerTask.SetWorkerParameters(parameters);

            WorkerHelper.QueueTask(workerTask);
        }
Exemplo n.º 2
0
        private static void CreateEmailTask(MailSettings settings, string attachmentPath, string recipient)
        {
            var parameters = new WorkerParameters();

            parameters.SetParameter("PersonaliseMyEmails", settings.PersonaliseMyEmails);
            parameters.SetParameter("AttachmentPath", attachmentPath);
            parameters.SetParameter("Recipient", recipient);
            parameters.SetParameter("Subject", settings.Subject);
            parameters.SetParameter("Body", settings.Body);

            var workerTask = new WorkerTask {
                TaskName = WorkerTaskName.Email
            };

            workerTask.SetWorkerParameters(parameters);

            WorkerHelper.QueueTask(workerTask);
        }