public ActionResult CreditMemoReport(Guid creditMemoId) { var operationResult = new OperationResult(); MemoryStream ms = new MemoryStream(); try { ms = ReportingManager.CreateCreditMemoReport(creditMemoId); } catch (Exception ex) { operationResult.Message = "Error occured printing Credit Memo"; logger.ErrorFormat("Error occured printing Credit Memo: {0} ", ex.ToString()); this.AddNotification(operationResult.Message, NotificationType.ERROR); } return(new FileStreamResult(ms, "application/pdf")); }
public JsonResult SendCreditMemoEmail(Guid creditMemoId, EmailModel model) { var operationResult = new OperationResult(); var _emailManager = new MailManager(); var ms = ReportingManager.CreateCreditMemoReport(creditMemoId); var creditMemo = _creditMemoRepository.GetCreditMemo(creditMemoId); var fromUser = UserManager.FindById(User.Identity.GetUserId()); model.MS = ms; model.FromEmail = fromUser.Email; model.Number = creditMemo.Number; operationResult = _emailManager.SendEmail(model); return(Json(operationResult, JsonRequestBehavior.AllowGet)); }