private void CreateBookingForm(string fileName) { //if (fileName.StartsWith("\\")) // fileName = fileName.Substring(1); Orchestrator.Facade.Form facBF = new Orchestrator.Facade.Form(); Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); Entities.Scan bookingForm = new Scan(); bookingForm.FormTypeId = eFormTypeId.BookingForm; bookingForm.ScannedDateTime = DateTime.UtcNow; bookingForm.ScannedFormPDF = fileName; try { bookingForm.ScannedFormId = facBF.Create(bookingForm, ((Entities.CustomPrincipal)Page.User).UserName); facOrder.UpdateBookingFormScannedFormId(OrderID, bookingForm.ScannedFormId, ((Entities.CustomPrincipal)Page.User).UserName); this.ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", "<script type=\"text/javascript\">opener.location.href=opener.location.href; window.close();</script>"); } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; } }
//-------------------------------------------------------------------------- private void Initialise() { ((WizardMasterPage)this.Master).WizardTitle = "Document Wizard"; if (this.ScannedFormId > 0) { Orchestrator.Facade.Form facForm = new Orchestrator.Facade.Form(); Entities.Scan scannedform = facForm.GetForScannedFormId(this.ScannedFormId); tblPODReturn.Visible = false; this.AppendOrReplaceFieldSet.Style["display"] = ""; this.appendReplaceText.Style["display"] = ""; if (scannedform.ScannedFormPDF == Globals.Constants.NO_DOCUMENT_AVAILABLE) { this.AppendOrReplaceFieldSet.Style["display"] = "none"; this.appendReplaceText.Style["display"] = "none"; this.rblAppandOReplace.Style["display"] = "none"; } else { this.rblAppandOReplace.Style["display"] = ""; } this.appendReplaceText.InnerHtml = "A " + scannedform.FormTypeId.ToString() + " document already exists."; if (scannedform.IsUploaded) { this.appendReplaceText.InnerHtml += " [ <a target='_blank' href='" + scannedform.ScannedFormPDF + "' > View </a> ]"; } else { this.appendReplaceText.InnerHtml += " [ Not yet uploaded ]"; } } else { this.AppendOrReplaceFieldSet.Visible = false; this.appendReplaceText.Visible = false; this.rblAppandOReplace.Visible = false; } Facade.IUser facUser = new Facade.User(); Entities.User loggedOnUser = facUser.GetUserByUserName(this.Page.User.Identity.Name); if (!loggedOnUser.HasScannerLicense) { // Disable the scanning option this.rblOperation.Items[0].Selected = false; this.rblOperation.Items[0].Text = "You do not currently have a license to scan."; this.rblOperation.Items[0].Enabled = false; // select the upload option. this.rblOperation.Items[1].Selected = true; } }
protected void dgUnattachedDeHire_ItemDataBound(object sender, DataGridItemEventArgs e) { m_assignedPodCount = (int)ViewState["AssignedPODCount"]; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Orchestrator.Facade.POD facPOD = new Orchestrator.Facade.POD(); Orchestrator.Facade.Form facForm = new Orchestrator.Facade.Form(); int orderID = int.Parse(e.Item.Cells[0].Text); int scannedFormId = -1; int dehireReceiptId = int.Parse(e.Item.Cells[1].Text); string receiptNumber = e.Item.Cells[2].Text; Entities.Scan dehireReceiptScan = null; if (int.TryParse(e.Item.Cells[3].Text, out scannedFormId) && scannedFormId > 0) { dehireReceiptScan = facForm.GetForScannedFormId(scannedFormId); } if (dehireReceiptScan == null) { string date = e.Item.Cells[5].Text; string truncatedDate = date.Substring(0, date.LastIndexOf(' ')); string urlEncodedDate = Server.UrlEncode(truncatedDate); ((CheckBox)e.Item.FindControl("chkUnassignPOD")).Visible = false; ((HyperLink)e.Item.FindControl("lnkPODScanning")).Text = "Scan Dehire Receipt"; ((HyperLink)e.Item.FindControl("lnkPODScanning")).NavigateUrl = @"javascript:OpenDehireWindow(" + JobId + "," + orderID + "," + dehireReceiptId + ",'" + receiptNumber + "');"; } else { if (dehireReceiptScan.ScannedFormId > 0) { ((HyperLink)e.Item.FindControl("lnkPODView")).Visible = true; ((HyperLink)e.Item.FindControl("lnkPODView")).Target = "_blank"; ((HyperLink)e.Item.FindControl("lnkPODView")).NavigateUrl = dehireReceiptScan.ScannedFormPDF.Trim(); } ((RdoBtnGrouper)e.Item.FindControl("rbgCollectionDrop")).Visible = false; ((HyperLink)e.Item.FindControl("lnkPODScanning")).Text = "Dehire Receipt Number " + receiptNumber; ((HyperLink)e.Item.FindControl("lnkPODScanning")).NavigateUrl = @"javascript:OpenDehireWindowForEdit(" + dehireReceiptScan.ScannedFormId.ToString() + "," + JobId + "," + orderID + "," + dehireReceiptId + ",'" + receiptNumber + "');"; m_assignedPodCount++; } } ViewState["AssignedPODCount"] = m_assignedPodCount; }
public bool DoesScannedFormRowExist(string fileName) { bool doesScanFormRowExist = false; Facade.Form facScanForm = new Orchestrator.Facade.Form(); Entities.Scan scan = facScanForm.GetForScannedFormForScannedFormPDF(fileName); if (scan.ScannedFormId > 0) { doesScanFormRowExist = true; } return(doesScanFormRowExist); }
public string ScanHasBeenUploadedTo(string URL) { string methodStatus = String.Empty; Uri URI = new Uri(URL); string newFileName = URI.Segments[URI.Segments.Length - 1]; Facade.Form facScanForm = new Orchestrator.Facade.Form(); Entities.Scan scan = facScanForm.GetForScannedFormForScannedFormPDF(newFileName); if (scan == null) { throw new ApplicationException("ScanHasBeenUploadedTo - Scan not found for filename " + newFileName); } scan.IsUploaded = true; scan.ScannedFormPDF = URL; try { // update the IsUploaded flag on the scannedForm facScanForm.Update(scan, scan.CreateUserID); } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploadedTo - Update ScanForm failed", ex); } //If the scan is a POD email it if (scan.FormTypeId == eFormTypeId.POD) { //Email the POD to the client Facade.IPOD facPod = new Facade.POD(); //Make the call to send the email async as it will //have to download the attachment MethodCall <string, int> asyncSendClientPod = facPod.SendClientPod; asyncSendClientPod.BeginInvoke(scan.ScannedFormId, r => { try { asyncSendClientPod.EndInvoke(r); } catch (Exception ex) { WebUI.Global.UnhandledException(ex); } }, null); } return(methodStatus); }
public Entities.Scan GetScannedForm(string FileName, out string PreviousScanURL) { Facade.Form facScanForm = new Orchestrator.Facade.Form(); Entities.Scan scan = facScanForm.GetForScannedFormForScannedFormPDF(FileName); PreviousScanURL = string.Empty; if (scan != null && scan.PreviousScannedFormId.HasValue) { Entities.Scan previousScan = facScanForm.GetForScannedFormId(scan.PreviousScannedFormId.Value); if (previousScan != null) { PreviousScanURL = previousScan.ScannedFormPDF; } } if (scan == null || scan.ScannedFormId < 1) { return(null); } else { return(scan); } }
private void DisplayOrder(Orchestrator.Entities.Order order) { Orchestrator.Facade.IOrganisation facOrg = new Orchestrator.Facade.Organisation(); Orchestrator.Facade.IPoint facPoint = new Orchestrator.Facade.Point(); Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); Orchestrator.Facade.IPOD facPOD = new Orchestrator.Facade.POD(); Orchestrator.Facade.IOrder facOrd = new Orchestrator.Facade.Order(); order.ClientInvoiceID = facOrd.ClientInvoiceID(OrderID); Orchestrator.Facade.Organisation facOrgD = new Orchestrator.Facade.Organisation(); Orchestrator.Entities.Point collectionPoint = facPoint.GetPointForPointId(order.CollectionPointID); Orchestrator.Entities.Point deliveryPoint = facPoint.GetPointForPointId(order.DeliveryPointID); Orchestrator.Entities.POD scannedPOD = facPOD.GetForOrderID(order.OrderID); Orchestrator.Entities.Scan scannedBookingForm = null; CurrentCulture = new CultureInfo(order.LCID); ExchangeRateID = order.ExchangeRateID; lblOrderHeading.Text = string.Format("Order {0}", order.OrderID); this.lblOrderStatus.Text = order.OrderStatus.ToString(); if (((Entities.CustomPrincipal) this.Page.User).IsInRole(((int)eUserRole.SubConPortal).ToString())) { this.btnPIL.Visible = false; this.btnCreateDeliveryNote.Visible = false; this.btnCreateDeliveryNote2.Visible = false; this.btnPIL2.Visible = false; plcBooking.Visible = false; plcPOD.Visible = false; // get cost for subby and display as rate. (The rate the subby is being paid) Facade.IJobSubContractor jobSubContractor = new Facade.Job(); if (order != null && order.JobSubContractID > 0) { Entities.JobSubContractor js = jobSubContractor.GetSubContractorForJobSubContractId(order.JobSubContractID); CultureInfo subbyCulture = new CultureInfo(js.LCID); if (Orchestrator.Globals.Configuration.MultiCurrency) { this.lblRate.Text = string.Format(rateTemplate, js.ForeignRate.ToString("C", subbyCulture), js.Rate.ToString("C")); } else { this.lblRate.Text = js.Rate.ToString("C", subbyCulture); } } this.tblSubbyRate.Visible = true; this.trRate.Visible = false; this.trInvoiceId.Visible = false; } else { this.tblSubbyRate.Visible = false; //If the order has a scanned Booking Form get it so that //a link to it can be displayed if (order.BookingFormScannedFormId != null) { Orchestrator.Facade.Form facBF = new Orchestrator.Facade.Form(); scannedBookingForm = facBF.GetForScannedFormId(order.BookingFormScannedFormId.Value); } //this.lblOrderID.Text = order.OrderID.ToString(); this.lblOrderStatus.Text = order.OrderStatus.ToString().Replace("_", " "); if (scannedBookingForm != null) { hlBookingFormLink.Visible = true; hlBookingFormLink.NavigateUrl = scannedBookingForm.ScannedFormPDF.Trim(); aScanBookingForm.InnerHtml = "| Re-Scan"; aScanBookingForm.HRef = @"javascript:ReDoBookingForm(" + scannedBookingForm.ScannedFormId + "," + order.OrderID.ToString() + ");"; } else { hlBookingFormLink.Visible = false; aScanBookingForm.InnerHtml = "Scan"; aScanBookingForm.HRef = @"javascript:NewBookingForm(" + order.OrderID.ToString() + ");"; } plcPOD.Visible = false; if (Orchestrator.Globals.Configuration.MultiCurrency) { this.lblRate.Text = string.Format(rateTemplate, order.ForeignRate.ToString("C", CurrentCulture), order.Rate.ToString("C")); } else { this.lblRate.Text = order.ForeignRate.ToString("C", CurrentCulture); } trRate.Visible = !order.IsInGroup; if (order.ClientInvoiceID <= 0) { lblInvoiceNumber.Text = "None Assigned"; } else { lblInvoiceNumber.Text = order.ClientInvoiceID.ToString(); string PDFLink = order.PDFLocation.ToString(); lblInvoiceNumber.NavigateUrl = Orchestrator.Globals.Configuration.WebServer + PDFLink; } } this.lblLoadNumber.Text = order.CustomerOrderNumber; this.lblDeliveryOrderNo.Text = order.DeliveryOrderNumber; this.lblCollectionPoint.Text = collectionPoint.Address.ToString(); this.lblDeliverTo.Text = deliveryPoint.Address.ToString(); this.lblCollectDateTime.Text = (order.CollectionIsAnytime == true ? (order.CollectionDateTime.ToString("dd/MM/yy") + " AnyTime") : (order.CollectionDateTime.ToString("dd/MM/yy HH:mm"))); this.lblDeliveryDateTime.Text = (order.DeliveryIsAnytime == true ? (order.DeliveryDateTime.ToString("dd/MM/yy") + " AnyTime") : (order.DeliveryDateTime.ToString("dd/MM/yy HH:mm"))) + order.DeliveryAnnotation; this.lblPallets.Text = order.NoPallets.ToString() + " " + Orchestrator.Facade.PalletType.GetForPalletTypeId(order.PalletTypeID).Description; this.lblPalletSpaces.Text = order.PalletSpaces.ToString("0.##"); this.lblGoodsType.Text = Orchestrator.Facade.GoodsType.GetForGoodsTypeId(order.GoodsTypeID).Description; this.lblWeight.Text = Convert.ToInt32(order.Weight).ToString() + " " + Orchestrator.Facade.WeightType.GetForWeightTypeId(order.WeightTypeID).ShortCode; this.repReferences.DataSource = order.OrderReferences; this.repReferences.DataBind(); this.lblCartons.Text = order.Cases.ToString(); if (order.Notes == null || order.Notes.Length == 0) { this.lblNotes.Text = " "; } else { this.lblNotes.Text = order.Notes; } if (order.CreateDateTime != DateTime.MinValue) { lblCreated.Text = order.CreatedBy + " on " + order.CreateDateTime.ToString("dd/MM/yy HH:mm"); } lblOrderServiceLevel.Text = order.OrderServiceLevel; if (order.BusinessTypeID > 0) { Orchestrator.Facade.IBusinessType facBusinessType = new Orchestrator.Facade.BusinessType(); Orchestrator.Entities.BusinessType businessType = facBusinessType.GetForBusinessTypeID(order.BusinessTypeID); lblBusinessType.Text = businessType.Description; } else { lblBusinessType.Text = "Not Set"; } plcCancellation.Visible = order.OrderStatus == eOrderStatus.Cancelled; if (order.OrderStatus == eOrderStatus.Cancelled) { lblCancellationReason.Text = order.CancellationReason; lblCancelledBy.Text = order.CancelledBy; lblCancelledAt.Text = order.CancelledAt.ToString("dd/MM/yy HH:mm"); } }
//-------------------------------------------------------------------------- public string ScanHasBeenUploaded(string fileNameAndFTPDirectory) { //If the http post file upload is being used then the PODs must be on this server //so we can append etc. //Not sure why something sikmilar to this is done in scanreceive.aspx //TODO However this needs to be tested //This is no longer called - is it redundant? if (fileNameAndFTPDirectory.StartsWith("\\")) { fileNameAndFTPDirectory = fileNameAndFTPDirectory.Substring(1, fileNameAndFTPDirectory.Length - 1); } string methodStatus = String.Empty; string newFileName = Path.GetFileName(fileNameAndFTPDirectory); string newFileLocation = Path.Combine(Server.MapPath("~/PDFS"), fileNameAndFTPDirectory.Replace(newFileName, "")); string newFileLocationAndName = Path.Combine(newFileLocation, newFileName); Facade.Form facScanForm = new Orchestrator.Facade.Form(); if (this.AppendOrReplace.Contains("A")) { Entities.Scan scan = facScanForm.GetForScannedFormId(this.ScannedFormId); if (scan != null) { PdfDocument previousDocument; string existingFileNameAndPath = scan.ScannedFormPDF; if (File.Exists(existingFileNameAndPath)) { previousDocument = PdfReader.Open(existingFileNameAndPath, PdfDocumentOpenMode.Import); try { // should always exist if (!Directory.Exists(newFileLocation)) { Directory.CreateDirectory(newFileLocation); } } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploaded - Error Creating directory - " + newFileLocation, ex); } try { // read the exisiting but newly created pdf PdfDocument newPdfDoc = PdfReader.Open(newFileLocationAndName, PdfDocumentOpenMode.Import); PdfDocument finalDoc = new PdfDocument(); // Append the previous document to our new document foreach (PdfPage page in previousDocument.Pages) { finalDoc.AddPage(page); } // Append the new document to the previous document foreach (PdfPage page in newPdfDoc.Pages) { finalDoc.AddPage(page); } // attempt to save the new doc finalDoc.Save(newFileLocationAndName); methodStatus = "Appended " + newFileLocationAndName + " to " + existingFileNameAndPath; } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploaded - Error appending document - " + fileNameAndFTPDirectory, ex); } } else { throw new ApplicationException("ExistingScanForm file could not be found - Path - " + existingFileNameAndPath); } } else { throw new ApplicationException("ExistingScanForm entity could not be found."); } } else { methodStatus = "Append = false or no previousScanneDformId to append too."; } return(methodStatus); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // This property defaults to eFormTypeId.POD if it has not been supplied if (this.FormType == eFormTypeId.POD) { Facade.POD facPod = new Orchestrator.Facade.POD(); Entities.POD pod = null; if (this.OrderID > 0) { pod = facPod.GetForOrderID(OrderID); } if (this.CollectDropID > 0) { pod = facPod.GetPODForCollectDropID(CollectDropID); } if (pod != null) { lblDescription.Text = "There has already been a PDF uploaded for this order, if you upload another one this will overrwite the existing file."; txtTicketNo.Text = pod.TicketNo; dteSignatureDate.SelectedDate = pod.SignatureDate; } else { if (!String.IsNullOrEmpty(Request.QueryString["ticket"])) { txtTicketNo.Text = Request.QueryString["ticket"]; } if (!String.IsNullOrEmpty(Request.QueryString["sigDate"])) { dteSignatureDate.SelectedDate = DateTime.Parse(Request.QueryString["sigDate"]); } } } // This property defaults to eFormTypeId.POD if it has not been supplied else if (this.FormType == eFormTypeId.BookingForm) { Orchestrator.Facade.Form facBF = new Orchestrator.Facade.Form(); Facade.IOrder facOrder = new Orchestrator.Facade.Order(); Entities.Order order = null; Entities.Scan bookingForm = null; txtTicketNo.Visible = false; lblTicketRef.Visible = false; this.btnUpload.CausesValidation = false; dteSignatureDate.Visible = false; lblSignatureDate.Visible = false; if (this.OrderID > 0) { order = facOrder.GetForOrderID(OrderID); } if (order != null && order.BookingFormScannedFormId != null) { bookingForm = facBF.GetForScannedFormId((int)order.BookingFormScannedFormId); } if (bookingForm != null) { lblDescription.Text = "There has already been a booking form uploaded for this order, if you upload another one this will overwrite the existing file."; } else { lblDescription.Text = String.Empty; } } } }
public string ScanHasBeenUploaded(string fileNameAndFTPDirectory) { if (fileNameAndFTPDirectory.StartsWith("\\")) { fileNameAndFTPDirectory = fileNameAndFTPDirectory.Substring(1, fileNameAndFTPDirectory.Length - 1); } string pdfLocation = Server.MapPath("~/PDFS"); string methodStatus = String.Empty; string newFileName = Path.GetFileName(fileNameAndFTPDirectory); string newFileLocation = Path.Combine(pdfLocation, fileNameAndFTPDirectory.Replace(newFileName, "")); string newFileLocationAndName = Path.Combine(newFileLocation, newFileName); Facade.Form facScanForm = new Orchestrator.Facade.Form(); Entities.Scan scan = facScanForm.GetForScannedFormForScannedFormPDF(newFileName); if (scan.IsAppend && scan.PreviousScannedFormId != null) { Entities.Scan existingScan = null; // get the previous scannedForm Record existingScan = facScanForm.GetForScannedFormId((int)scan.PreviousScannedFormId); if (existingScan != null) { PdfDocument previousDocument; //string existingFileNameAndPath = Path.Combine(pdfLocation, existingScan.ScannedFormPDF); string existingFileNameAndPath = Server.MapPath(existingScan.ScannedFormPDF); if (File.Exists(existingFileNameAndPath)) { previousDocument = PdfReader.Open(existingFileNameAndPath, PdfDocumentOpenMode.Import); try { // should always exist if (!Directory.Exists(newFileLocation)) { Directory.CreateDirectory(newFileLocation); } } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploaded - Error Creating directory - " + newFileLocation, ex); } try { // read the exisiting but newly created pdf PdfDocument newPdfDoc = PdfReader.Open(newFileLocationAndName, PdfDocumentOpenMode.Import); PdfDocument finalDoc = new PdfDocument(); // Append the previous document to our new document foreach (PdfPage page in previousDocument.Pages) { finalDoc.AddPage(page); } // Append the new document to the previous document foreach (PdfPage page in newPdfDoc.Pages) { finalDoc.AddPage(page); } // attempt to save the new doc finalDoc.Save(newFileLocationAndName); methodStatus = "Appended " + newFileLocationAndName + " to " + existingFileNameAndPath; } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploaded - Error appending document - " + fileNameAndFTPDirectory, ex); } } else { throw new ApplicationException("ExistingScanForm file could not be found - Path - " + existingFileNameAndPath + " - New FileLocationAndName: " + newFileLocationAndName); } } else { throw new ApplicationException("ExistingScanForm entity could not be found."); } } else { methodStatus = "Append = false or no previousScanneDformId to append too." + Environment.NewLine; } scan.IsUploaded = true; //Use full URL instead //scan.ScannedFormPDF = fileNameAndFTPDirectory; string URL = this.Context.Request.Url.GetLeftPart(UriPartial.Authority) + "/PDFS/" + fileNameAndFTPDirectory.Replace('\\', '/'); scan.ScannedFormPDF = URL; try { // update the IsUploaded flag on the scannedForm facScanForm.Update(scan, scan.CreateUserID); Facade.IPOD facPod = new Facade.POD(); methodStatus += facPod.SendClientPod(scan.ScannedFormId); } catch (Exception ex) { throw new ApplicationException("ScanHasBeenUploaded - Update ScanForm failed (ScanForm ID:" + scan.ScannedFormId + ")", ex); } return(methodStatus); }
public List <Orchestrator.BulkScan.Types.ScanResult> GetScanUploadDefaultInformationAndExistingScans(string barcodes) { if (string.IsNullOrEmpty(barcodes)) { return(new List <ScanResult>()); } List <ScanResult> result = new List <ScanResult>(); Facade.Form facForm = new Orchestrator.Facade.Form(); Facade.ResourceManifest facRM = new Orchestrator.Facade.ResourceManifest(); Facade.IOrder facOrder = new Orchestrator.Facade.Order(); Entities.Scan scan = null; ScanResult sr = null; foreach (string barcode in barcodes.Split(":".ToCharArray())) { try { // The 3rd and 4th chars of the barcode indicate the form type switch (barcode.Substring(2, 2)) { case "02": // Resource Manifests string extractedResourceManifestId = barcode.Substring(4, 8); for (int i = 0; i < 8; i++) { if (extractedResourceManifestId.Length > 0 && extractedResourceManifestId.Substring(0, 1) == "0") { extractedResourceManifestId = extractedResourceManifestId.Substring(1); } else { break; } } int resourceManifestId = Convert.ToInt32(extractedResourceManifestId); Entities.ResourceManifest rm = facRM.GetResourceManifest(resourceManifestId); if (rm != null) { sr = new ScanResult(); sr.Barcode = barcode; sr.FormType = "02"; if (rm.ScannedFormId > 0) { scan = facForm.GetForScannedFormId(rm.ScannedFormId); if (scan != null) { sr.PDFPath = scan.ScannedFormPDF; sr.Replace = false; } } result.Add(sr); } break; //case "01": // Delivery Note // int orderId = Convert.ToInt32(barcode.Substring(3)); // Entities.Order order = facOrder.GetForOrderID(orderId); // if (order != null) // { // sr = new ScanResult(); // sr.Barcode = barcode; // sr.FormType = "01"; // if (order.DeliveryNoteScannedFormId.HasValue) // { // scan = facForm.GetForScannedFormId(order.DeliveryNoteScannedFormId.Value); // if (scan != null) // { // sr.PDFPath = scan.ScannedFormPDF; // sr.Replace = false; // } // } // result.Add(sr); // } // break; case "01": // PODS string extratedOrderId = barcode.Substring(4, 8); for (int i = 0; i < 8; i++) { if (extratedOrderId.Length > 0 && extratedOrderId.Substring(0, 1) == "0") { extratedOrderId = extratedOrderId.Substring(1); } else { break; } } int orderId2 = Convert.ToInt32(extratedOrderId); Entities.Order order2 = facOrder.GetForOrderID(orderId2); if (order2 != null) { Facade.POD facPod = new Orchestrator.Facade.POD(); Entities.POD pod = facPod.GetForOrderID(orderId2); BatchItemPodInfo podInfo = new BatchItemPodInfo(); sr = new ScanResult(); sr.Barcode = barcode; sr.FormType = "01"; if (pod != null) { scan = facForm.GetForScannedFormId(pod.ScannedFormId); if (scan != null) { sr.PDFPath = scan.ScannedFormPDF; sr.Replace = false; } } int collectDropId = facOrder.GetDeliveryCollectDropIDForPODScanner(orderId2); int JobId = facOrder.GetDeliveryJobIDForOrderID(orderId2); DataSet dsJobDetails = facPod.GetJobDetails(JobId); bool foundCollectDrop = false; foreach (DataRow row in dsJobDetails.Tables["CollectionDrop"].Rows) { if ((int)row["CollectDropId"] == collectDropId) { podInfo.TicketNumber = row["ClientsCustomerReference"].ToString(); podInfo.SignatureDate = (DateTime)row["CollectDropDateTime"]; foundCollectDrop = true; break; } } // If we don't find pod info, default it to something sensible. if (!foundCollectDrop) { podInfo.TicketNumber = ""; podInfo.SignatureDate = DateTime.Now; } sr.BatchItemInfo = SerializeBatchItemInfoToString(sr.FormType, podInfo); result.Add(sr); } break; default: break; } } catch (Exception ex) { ScanResult srError = new ScanResult(); srError.Barcode = barcode; srError.ErrorOccurred = true; srError.ErrorText = ex.Message; result.Add(srError); } } return(result); }