Example #1
0
        public static void CreateInvoicePDF(string filename, Guid invoiceId)
        {
            try
            {
                var     task    = InvoiceManager.LoadById(invoiceId);
                Invoice invoice = task.Result;
                task.Wait();


                PDF.Export(filename, invoice);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        private static async void GenerateInvoice(Appointment appointment)
        {
            try
            {
                Invoice invoice = new Invoice
                {
                    CustomerId       = appointment.CustomerId,
                    EmployeeFullName = appointment.EmployeeFullName,
                    ServiceDate      = DateTime.Now,
                    ServiceType      = appointment.ServiceType,
                    ServiceRate      = appointment.ServiceRate,
                    Status           = InvoiceStatus.Issued.ToString()
                };

                await InvoiceManager.Insert(invoice);

                InvoiceManager.EmailInvoice(appointment.Email, await InvoiceManager.LoadById(invoice.Id));
            }
            catch (Exception)
            {
                throw;
            }
        }