//-------------------------------------------------------------------------- private void Initialise() { if (this.ScannedFormId > 0) { Facade.Form facForm = new Facade.Form(); this.BookingForm = facForm.GetForScannedFormId(this.ScannedFormId); } int scanFormId = -1; // With job POD scanning if (this.OrderId > 0) { Facade.Form facForm = new Facade.Form(); if (this.BookingForm == null) { this.BookingForm = new Entities.Scan(); } this.BookingForm.ScannedDateTime = DateTime.Today; this.BookingForm.FormTypeId = eFormTypeId.BookingForm; this.BookingForm.ScannedFormPDF = this.FileName; if (this.AppendOrReplace.Contains("A")) { this.BookingForm.IsAppend = true; } else { this.BookingForm.IsAppend = false; } // if this is not set then we don't know where to save the file locally so it must have been uploaded immediately. if (this.AppendOrReplace.Contains("U") || String.IsNullOrEmpty(Globals.Configuration.ScannedDocumentPath)) { this.BookingForm.IsUploaded = true; } else { this.BookingForm.IsUploaded = false; } scanFormId = facForm.Create(this.BookingForm, ((Entities.CustomPrincipal)Page.User).UserName); if (scanFormId > 0) { Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); facOrder.UpdateBookingFormScannedFormId(this.OrderId, scanFormId, ((Entities.CustomPrincipal)Page.User).UserName); } } this.Close(this.ScannedFormId.ToString()); }
private int SaveReportPdf(eReportType reportType, byte[] bytes, string userName) { var uploaderPath = Globals.Configuration.OrchestratorServerUploaderPdfsPath; if (string.IsNullOrEmpty(uploaderPath)) { throw new ApplicationException("Cannot email report: the OrchestratorServerUploaderPdfsPath setting has not been configured."); } if (!Directory.Exists(uploaderPath)) { Directory.CreateDirectory(uploaderPath); } var sendNowPath = Path.Combine(uploaderPath, "sendnow"); if (!Directory.Exists(sendNowPath)) { Directory.CreateDirectory(sendNowPath); } var fileName = string.Format("EmailedReport_{0}_{1}_{2:yyyyMMddHHmmss}.pdf", Enum.GetName(typeof(eReportType), reportType), userName, DateTime.Now); var fileNameAndPath = Globals.Configuration.ScanFormSendNow ? Path.Combine(sendNowPath, fileName) : Path.Combine(uploaderPath, fileName); File.WriteAllBytes(fileNameAndPath, bytes); var facForm = new Facade.Form(); var bookingForm = new Entities.Scan { ScannedDateTime = DateTime.Today, FormTypeId = eFormTypeId.EmailedReport, ScannedFormPDF = fileName, IsAppend = false, IsUploaded = false, }; var scannedFormID = facForm.Create(bookingForm, userName); return(scannedFormID); }
//-------------------------------------------------------------------------- private void Initialise() { if (this.ScannedFormId > 0) { Facade.Form facForm = new Facade.Form(); this.Manifest = facForm.GetForScannedFormId(this.ScannedFormId); } int scanFormId = -1; // With job POD scanning if (this.ManifestId > 0) { Facade.Form facForm = new Facade.Form(); if (this.Manifest == null) { this.Manifest = new Entities.Scan(); } this.Manifest.ScannedDateTime = DateTime.Today; this.Manifest.FormTypeId = eFormTypeId.Manifest; if (String.IsNullOrEmpty(this.FileName)) { this.Manifest.ScannedFormPDF = Orchestrator.Globals.Constants.NO_DOCUMENT_AVAILABLE; } else { this.Manifest.ScannedFormPDF = this.FileName; } if (this.AppendOrReplace.Contains("A")) { this.Manifest.IsAppend = true; } else { this.Manifest.IsAppend = false; } // if this is not set then we don't know where to save the file locally so it must have been uploaded immediately. if (this.AppendOrReplace.Contains("U") || String.IsNullOrEmpty(Globals.Configuration.ScannedDocumentPath)) { this.Manifest.IsUploaded = true; } else { this.Manifest.IsUploaded = false; } scanFormId = facForm.Create(this.Manifest, ((Entities.CustomPrincipal)Page.User).UserName); if (scanFormId > 0) { this.Manifest.ScannedFormId = scanFormId; // Update manifest record here Orchestrator.Facade.ResourceManifest facResourceManifest = new Orchestrator.Facade.ResourceManifest(); facResourceManifest.UpdateResourceManifestScan(this.ManifestId, scanFormId, ((Entities.CustomPrincipal)Page.User).UserName); } } this.Close(this.ScannedFormId.ToString()); }
void btnNext_Click(object sender, EventArgs e) { if (this.ScannedFormId > 0) { Facade.Form facForm = new Facade.Form(); this.DehireReceipt = facForm.GetForScannedFormId(this.ScannedFormId); } int scanFormId = -1; // With job POD scanning if (this.OrderId > 0) { Facade.Form facForm = new Facade.Form(); Facade.IDeHireReceipt facDehireReceipt = new Facade.CollectDrop(); string userID = ((Entities.CustomPrincipal)Page.User).UserName; if (this.DehireReceipt == null) { this.DehireReceipt = new Entities.Scan(); } this.DehireReceipt.ScannedDateTime = DateTime.Today; this.DehireReceipt.FormTypeId = eFormTypeId.DehireReceipt; this.DehireReceipt.ScannedFormPDF = this.FileName; // N = No document available if (this.AppendOrReplace.Contains("N")) { if (this.DehireReceipt.ScannedFormId == 0) { this.DehireReceipt.ScannedFormPDF = Orchestrator.Globals.Constants.NO_DOCUMENT_AVAILABLE; } } else { this.DehireReceipt.ScannedFormPDF = this.FileName; } if (this.AppendOrReplace.Contains("A")) { this.DehireReceipt.IsAppend = true; } else { this.DehireReceipt.IsAppend = false; } // if this is not set then we don't know where to save the file locally so it must have been uploaded immediately. if (this.AppendOrReplace.Contains("U") || String.IsNullOrEmpty(Globals.Configuration.ScannedDocumentPath)) { this.DehireReceipt.IsUploaded = true; } else { this.DehireReceipt.IsUploaded = false; } // Update the receipt number, facDehireReceipt.UpdateReceiptNumber(DehireReceiptId, txtDehireReceiptNumber.Text, userID); // Create the scanned form. scanFormId = facForm.Create(this.DehireReceipt, userID); if (scanFormId > 0) { facDehireReceipt.UpdateScannedForm(DehireReceiptId, scanFormId, userID); } } this.Close(this.ScannedFormId.ToString()); }
//-------------------------------------------------------------------------- private void Initialise() { Facade.Form facForm = new Facade.Form(); if (this.ScannedFormId > 0) { this.ScannedForm = facForm.GetForScannedFormId(this.ScannedFormId); } else { this.ScannedForm = new Entities.Scan(); } this.ScannedForm.ScannedDateTime = DateTime.Today; this.ScannedForm.FormTypeId = (eFormTypeId)this.ScannedFormTypeId; this.ScannedForm.ScannedFormPDF = this.FileName; if (this.AppendOrReplace.Contains("A")) { this.ScannedForm.IsAppend = true; } else { this.ScannedForm.IsAppend = false; } // if this is not set then we don't know where to save the file locally so it must have been uploaded immediately. if (this.AppendOrReplace.Contains("U") || String.IsNullOrEmpty(Globals.Configuration.ScannedDocumentPath)) { this.ScannedForm.IsUploaded = true; } else { this.ScannedForm.IsUploaded = false; } //Creates a new scanned form and references the previous scanned form if necessary int scanFormId = facForm.Create(this.ScannedForm, ((Entities.CustomPrincipal)Page.User).UserName); if (scanFormId > 0) { EF.OrganisationDocument orgDoc = null; if (this.OrganisationDocumentId > 0) { orgDoc = DataContext.OrganisationDocuments.First(od => od.OrganisationDocumentId == this.OrganisationDocumentId); } else { orgDoc = new EF.OrganisationDocument(); orgDoc.Description = DataContext.FormTypes.First(ft => ft.FormTypeId == this.ScannedFormTypeId).Description; orgDoc.OrganisationReference.EntityKey = EF.DataContext.CreateKey("OrganisationSet", "IdentityId", this.OrganisationIdentityId); this.DataContext.AddToOrganisationDocuments(orgDoc); } orgDoc.ScannedFormReference.EntityKey = EF.DataContext.CreateKey("ScannedForms", "ScannedFormID", scanFormId); this.DataContext.SaveChanges(); } this.Close(this.ScannedFormId.ToString()); }