public static List <GenericSvcResult> ActivateInvoice(int invoiceId, bool sendEmail) { List <GenericSvcResult> results = new List <GenericSvcResult>(); try { Invoice invoice = InvoiceController.GetCustomerInvoiceInternally(invoiceId); // ES.TaskManager.StartTask("SPF", "ACTIVATE_INVOICE"); ES.TaskManager.WriteParameter("InvoiceID", invoiceId); // ActivatePaidInvoicesTask task = new ActivatePaidInvoicesTask(); // load invoice lines List <InvoiceItem> lines = InvoiceController.GetCustomerInvoiceItems(invoiceId); // iterate and activate foreach (InvoiceItem line in lines) { if (!line.Processed && line.ServiceId > 0) { results.Add(task.ActivateInvoiceItem(line)); } } } catch (Exception ex) { ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } // return(results); }
public static GenericSvcResult ActivateService(int serviceId, bool sendEmail) { GenericSvcResult result = new GenericSvcResult(); try { Service svc = GetRawCustomerService(serviceId); // ES.TaskManager.StartTask(SystemTasks.SOURCE_SPF, SystemTasks.SVC_ACTIVATE); ES.TaskManager.WriteParameter("Service", svc.ServiceName); // ActivatePaidInvoicesTask task = new ActivatePaidInvoicesTask(); // obtain result result = task.ActivateService(serviceId, sendEmail, false); } catch (Exception ex) { ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } // return(result); }
public override void ExecuteTrigger(TriggerEventArgs eventArgs) { // try { ActivatePaidInvoicesTask activator = new ActivatePaidInvoicesTask(); // Load invoice items to activate List <InvoiceItem> items = InvoiceController.GetCustomerInvoiceItems(Convert.ToInt32(ReferenceId)); // foreach (InvoiceItem item in items) { try { ES.TaskManager.Write("Activating service"); // activating GenericSvcResult result = activator.ActivateInvoiceItem(item); // LOG ERROR if (!result.Succeed) { ES.TaskManager.WriteError(result.Error); if (!String.IsNullOrEmpty(result.ErrorCode)) { ES.TaskManager.WriteParameter("Error code", result.ErrorCode); } ES.TaskManager.WriteParameter("Result code", result.ResultCode); // go to next item continue; } // ES.TaskManager.Write("Activated"); } catch (Exception ex) { ES.TaskManager.WriteError(ex); } } } catch (Exception ex) { TriggerStatus = "ERROR"; ES.TaskManager.WriteError(ex); } }
public override void ExecuteTrigger(TriggerEventArgs eventArgs) { // try { ActivatePaidInvoicesTask activator = new ActivatePaidInvoicesTask(); // Load invoice items to activate List<InvoiceItem> items = InvoiceController.GetCustomerInvoiceItems(Convert.ToInt32(ReferenceId)); // foreach (InvoiceItem item in items) { try { ES.TaskManager.Write("Activating service"); // activating GenericSvcResult result = activator.ActivateInvoiceItem(item); // LOG ERROR if (!result.Succeed) { ES.TaskManager.WriteError(result.Error); if (!String.IsNullOrEmpty(result.ErrorCode)) ES.TaskManager.WriteParameter("Error code", result.ErrorCode); ES.TaskManager.WriteParameter("Result code", result.ResultCode); // go to next item continue; } // ES.TaskManager.Write("Activated"); } catch (Exception ex) { ES.TaskManager.WriteError(ex); } } } catch (Exception ex) { TriggerStatus = "ERROR"; ES.TaskManager.WriteError(ex); } }
public static List<GenericSvcResult> ActivateInvoice(int invoiceId, bool sendEmail) { List<GenericSvcResult> results = new List<GenericSvcResult>(); try { Invoice invoice = InvoiceController.GetCustomerInvoiceInternally(invoiceId); // ES.TaskManager.StartTask("SPF", "ACTIVATE_INVOICE"); ES.TaskManager.WriteParameter("InvoiceID", invoiceId); // ActivatePaidInvoicesTask task = new ActivatePaidInvoicesTask(); // load invoice lines List<InvoiceItem> lines = InvoiceController.GetCustomerInvoiceItems(invoiceId); // iterate and activate foreach (InvoiceItem line in lines) { if (!line.Processed && line.ServiceId > 0) results.Add(task.ActivateInvoiceItem(line)); } } catch (Exception ex) { ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } // return results; }
public static GenericSvcResult ActivateService(int serviceId, bool sendEmail) { GenericSvcResult result = new GenericSvcResult(); try { Service svc = GetRawCustomerService(serviceId); // ES.TaskManager.StartTask(SystemTasks.SOURCE_SPF, SystemTasks.SVC_ACTIVATE); ES.TaskManager.WriteParameter("Service", svc.ServiceName); // ActivatePaidInvoicesTask task = new ActivatePaidInvoicesTask(); // obtain result result = task.ActivateService(serviceId, sendEmail, false); } catch (Exception ex) { ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } // return result; }