// // GET: /DocumentMangementService/ public ActionResult CreateDocumentAndSaveToLocation() { var db = new PortugalVillasContext(); var parentContainer = new BookingParentContainer(); //dependenceies var dc = new DocumentGenerationController(); var customer = db.Customers.Find(1); var booking = db.Bookings.Find(4); var type = PRCDocument.PRCDocumentType.UK_WineTasting; //create a document with all parsed variables var document = dc.CreateDocumentToFileSystem(customer, type, booking); /* db.Documents.Add(new Document * { * CustomerID = customer.CustomerID, * DocumentBLOB = document, * EventID = 2 * * }); * * db.SaveChanges();*/ //save it to the DB or the FileSystem return(RedirectToAction("Dashboard", "Admin")); }
// // GET: /DocumentMangementService/ public ActionResult CreateDocumentAndSaveToLocation() { var db = new PortugalVillasContext(); var parentContainer = new BookingParentContainer(); //dependenceies var dc = new DocumentGenerationController(); var customer = db.Customers.Find(1); var booking = db.Bookings.Find(4); var type = PRCDocument.PRCDocumentType.UK_WineTasting; //create a document with all parsed variables var document = dc.CreateDocumentToFileSystem(customer, type, booking); /* db.Documents.Add(new Document { CustomerID = customer.CustomerID, DocumentBLOB = document, EventID = 2 }); db.SaveChanges();*/ //save it to the DB or the FileSystem return RedirectToAction("Dashboard", "Admin"); }
public override EventCommandResult ExecuteCommand() { var result = new EventCommandResult(); var dc = new DocumentGenerationController(); //create a document with all parsed variables var document = dc.CreateDocument(this.customer, this.documentType, this.booking, this.bes); this.Event.Documents.Add(new Document { DocumentBLOB = document }); if (booking != null) { this.Event.Documents.FirstOrDefault().DocumentName = "C"+customer.CustomerID + "B"+booking.BookingID + DateTime.Now.ToLongDateString() + documentType.ToString(); } if (bes != null) { this.Event.Documents.FirstOrDefault().DocumentName = "C"+customer.CustomerID + "BE"+bes.BookingExtraSelectionID + DateTime.Now.ToLongDateString() + documentType.ToString(); } //get that doc just created and add it to the event // this.Event.Documents.Add(document); if (!document.Equals(null) && !document.Equals("")) { result.ResultCode = 200; result.CommandExecutedInfo = "DocumentOutCommand"; result.ResultMessage = "OK"; } else { result.ResultCode = 800; result.CommandExecutedInfo = "DocumentOutCommand"; result.ResultMessage = "Fail"; } return result; }