public static string Create(InvoiceEntity invoiceEntity, WeeklyInvoiceDetails weeklyInvoiceDetails, CompanyInformationEntity companyInformationEntity, DateTime now, string invoiceFolder) { var generator = new Generator(); var filename = generator.CreateWeeklyInvoice(invoiceEntity, weeklyInvoiceDetails, weeklyInvoiceDetails.Client, companyInformationEntity, now,invoiceFolder); return filename; }
public static void CreateCustomInvoiceFromInput(Repository repository) { var simpleInvoiceDetails = SimpleInvoiceDataReceiver.Get(repository.ClientsWrapper.Data); var now = GetDate(); var pdfFilename = new Generator().CreateCustomInvoice(repository.InvoiceWrapper.Data, simpleInvoiceDetails, repository.CompanyInformationWrapper.Data, now, repository.StorageWrapper.Data.InvoiceDirectory); FileSavedNotifier.Notify(pdfFilename); FileVisualisationRequestor.VisualiseIfRequested(pdfFilename); DirectoryVisualisationRequester.VisualiseIfRequested(pdfFilename); InvoiceEmailer.EmailIfRequested(repository, pdfFilename, simpleInvoiceDetails, now); }
public static void CreatedInvoiceFromXml(Repository repository) { var client = ClientSelector.Get(repository.ClientsWrapper.Data); var now = GetDate(); var pdfFilename = new Generator().CreateWeeklyInvoice(repository.InvoiceWrapper.Data, repository.InvoiceWrapper.Data.WeeklyInvoiceDetails, client, repository.CompanyInformationWrapper.Data, now, repository.StorageWrapper.Data.InvoiceDirectory); FileSavedNotifier.Notify(pdfFilename); FileVisualisationRequestor.VisualiseIfRequested(pdfFilename); DirectoryVisualisationRequester.VisualiseIfRequested(pdfFilename); InvoiceEmailer.EmailIfRequested(repository, pdfFilename, repository.InvoiceWrapper.Data.WeeklyInvoiceDetails, now); repository.InvoiceWrapper.Data.WeeklyInvoiceDetails.Number++; repository.InvoiceWrapper.Save(); }
public static void RunAutomatedWeeklyInvoice(Repository repository) { var client = repository.ClientsWrapper.Data.FirstOrDefault(x => x.Id == repository.InvoiceWrapper.Data.ClientId); var sender = new Sender(new DefaultSmtpWrapper().Data); if (client == null) { sender.Send("*****@*****.**", "Automated invoice failure", "No client detected with id: " + repository.InvoiceWrapper.Data.ClientId, new List<string>()); } var now = GetDate(); var pdfFilename = new Generator().CreateWeeklyInvoice(repository.InvoiceWrapper.Data, repository.InvoiceWrapper.Data.WeeklyInvoiceDetails, client, repository.CompanyInformationWrapper.Data, now, repository.StorageWrapper.Data.InvoiceDirectory); InvoiceEmailer.SendEmailWithAttachement(client, repository.EmailWrapper.Data, repository.InvoiceWrapper.Data.WeeklyInvoiceDetails, pdfFilename, now); sender.Send("*****@*****.**", "Automated invoice success", "Sent invoice with id: " + repository.InvoiceWrapper.Data.WeeklyInvoiceDetails.Number, new List<string>()); repository.InvoiceWrapper.Data.WeeklyInvoiceDetails.Number++; repository.InvoiceWrapper.Save(); }