public void PrintActionProcessing() { var orderHistoryService = new OrderHistoryService(_log, _time, _dbFactory); var batchManager = new BatchManager(_log, _time, orderHistoryService, _weightService); var actionService = new SystemActionService(_log, _time); var serviceFactory = new ServiceFactory(); var labelBatchService = new LabelBatchService(_dbFactory, actionService, _log, _time, _weightService, serviceFactory, _emailService, batchManager, _pdfMaker, AddressService.Default, orderHistoryService, AppSettings.DefaultCustomType, AppSettings.LabelDirectory, AppSettings.ReserveDirectory, AppSettings.TemplateDirectory, new LabelBatchService.Config(), AppSettings.IsSampleLabels); labelBatchService.ProcessPrintBatchActions(null); }
protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var log = GetLogger(); var actionService = new SystemActionService(GetLogger(), time); var orderHistoryService = new OrderHistoryService(log, time, dbFactory); var serviceFactory = new ServiceFactory(); var weightService = new WeightService(); var pdfMaker = new PdfMakerByIText(GetLogger()); var batchManager = new BatchManager(log, time, orderHistoryService, weightService); CompanyDTO company = null; using (var db = dbFactory.GetRDb()) { company = db.Companies.GetByIdWithSettingsAsDto(CompanyId); } var addressService = AddressService.Default; var emailSmtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(company, AppSettings.IsDebug, AppSettings.IsSampleLabels); var emailService = new EmailService(GetLogger(), emailSmtpSettings, addressService); var labelBatchService = new LabelBatchService(dbFactory, actionService, GetLogger(), time, weightService, serviceFactory, emailService, batchManager, pdfMaker, addressService, orderHistoryService, AppSettings.DefaultCustomType, AppSettings.LabelDirectory, AppSettings.ReserveDirectory, AppSettings.TemplateDirectory, new LabelBatchService.Config() { PrintErrorsToEmails = new[] { company.SellerEmail, company.SellerWarehouseEmailAddress }, PrintErrorsCCEmails = new[] { EmailHelper.RaananEmail, EmailHelper.SupportDgtexEmail }, }, AppSettings.IsSampleLabels); labelBatchService.ProcessPrintBatchActions(null); }
public virtual ActionResult PrintLabelsForBatch(long batchId) { LogI("PrintLabelsForBatch, batchId=" + batchId); try { var companyId = AccessManager.CompanyId; if (!companyId.HasValue) { throw new ArgumentNullException("CompanyId"); } var when = Time.GetAppNowTime(); var by = AccessManager.UserId; var actionId = ActionService.AddAction(Db, SystemActionType.PrintBatch, batchId.ToString(), new PrintBatchInput() { BatchId = batchId, CompanyId = companyId.Value, UserId = by }, null, by); LogI("PrintLabelsForBatch, actionId=" + actionId); if (AppSettings.IsDebug) { var labelBatchService = new LabelBatchService(DbFactory, ActionService, LogService, Time, WeightService, ServiceFactory, EmailService, BatchManager, new PdfMakerByIText(LogService), new AddressService(null, null, null), OrderHistoryService, AppSettings.DefaultCustomType, AppSettings.LabelDirectory, AppSettings.ReserveDirectory, AppSettings.TemplateDirectory, new LabelBatchService.Config(), AppSettings.IsSampleLabels); _debugPrintLabelThread = new Thread(() => { labelBatchService.ProcessPrintBatchActions(null); }); _debugPrintLabelThread.Start(); } return(JsonGet(MessageResult.Success("", actionId.ToString()))); } catch (Exception ex) { LogE("PrintLabelsForBatch error", ex); return(JsonGet(MessageResult.Error("Print Error: " + ex.Message))); } }