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; } }
void btnCreateDeliveryNote_Click(object sender, EventArgs e) { NameValueCollection reportParams = new NameValueCollection(); DataSet dsDelivery = null; string OrderIDs = string.Empty; foreach (GridDataItem item in grdLoadOrder.SelectedItems) { OrderIDs += item.OwnerTableView.DataKeyValues[item.ItemIndex]["OrderID"].ToString(); OrderIDs += ","; } Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); if (!String.IsNullOrEmpty(OrderIDs)) { dsDelivery = facOrder.GetDeliveryNoteDataForOrderIDs(OrderIDs); //------------------------------------------------------------------------------------- // Load Report Section //------------------------------------------------------------------------------------- Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.DeliveryNote; Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = reportParams; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsDelivery; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; // Show the user control Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "<script language=\"javascript\">window.open('" + Page.ResolveClientUrl("../reports/reportviewer.aspx?wiz=true") + "');</script>"); } }
void btnCreateDeliveryNote_Click(object sender, EventArgs e) { NameValueCollection reportParams = new NameValueCollection(); DataSet dsDelivery = null; Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); if (OrderID != -1) { dsDelivery = facOrder.GetDeliveryNoteDataForOrderIDs(OrderID.ToString()); //------------------------------------------------------------------------------------- // Load Report Section //------------------------------------------------------------------------------------- Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.DeliveryNote; Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = reportParams; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsDelivery; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; //string url = this.Request.Url.AbsoluteUri; //if (url.LastIndexOf("&action") > 0) // url = url.Remove(url.LastIndexOf("&action")); //Response.Redirect(url + "&action=dn"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", "window.open('" + Page.ResolveClientUrl("../reports/reportviewer.aspx?wiz=true") + "');", true); } }
void grdServiceLevels_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { Orchestrator.Facade.IOrderServiceLevel facOrderServiceLevel = new Orchestrator.Facade.Order(); DataSet ds = facOrderServiceLevel.GetAll(); this.grdServiceLevels.DataSource = ds; }
void grdDeliveries_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { if (!IsPostBack && (!string.IsNullOrEmpty(Request.QueryString["oID"]) && (!string.IsNullOrEmpty(Request.QueryString["jobId"])))) { int orderID = 0; int jobID = 0; int.TryParse(Request.QueryString["oID"], out orderID); int.TryParse(Request.QueryString["jobId"], out jobID); OrderID = orderID; JobID = jobID; Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); if (OrderID > 0) { grdDeliveries.Columns.FindByUniqueName("OrderID").Visible = true; grdDeliveries.DataSource = facOrder.GetDisplayList(OrderID); } else { grdDeliveries.Columns.FindByUniqueName("OrderID").Visible = false; grdDeliveries.DataSource = facOrder.GetDisplayListForJobID(JobID); } } }
void grdLoadSheet_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { int instructionId = int.Parse(Request.QueryString["instructionID"]); Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); //this.LoadSheetData = facOrder.GetLoadSheet(instructionId); this.grdLoadSheet.DataSource = this.LoadSheetData; //txtDriverNotes.Text = this.LoadSheetData.Tables[0].Rows[0]["DriverInstructions"].ToString(); }
void gvOrders_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (Instruction != null && Instruction.InstructionID > 0) { Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); gvOrders.DataSource = facOrder.GetOrdersForInstructionID(Instruction.InstructionID); gvOrders.Columns[C_CollectFromColumnIndex].Visible = ShowCollectionColumns; gvOrders.Columns[C_CollectAtColumnIndex].Visible = ShowCollectionColumns; } }
private DataSet GetReadyToInvoiceForDates() { int clientID = 0; if (!IsFromDash) { int.TryParse(cboClient.SelectedValue, out clientID); } else { clientID = m_IdentityId; } DataSet ds = null; Orchestrator.Facade.IOrder facOrder = new Orchestrator.Facade.Order(); ds = facOrder.GetOrdersReadyToInvoice(rdiStartDate.SelectedDate, rdiEndDate.SelectedDate, rdoListInvoiceType.Items[0].Selected || rdoListInvoiceType.Items[2].Selected, rdoListInvoiceType.Items[1].Selected || rdoListInvoiceType.Items[2].Selected, clientID); IsFromDash = false; return(ds); }
protected void btnSubmitAlternative_Click(object sender, EventArgs e) { if (ucPoint.PointID > 0) { int orderId = Convert.ToInt32(Request.QueryString["OrderId"].ToString()); int pointId = Convert.ToInt32(Request.QueryString["PointId"].ToString()); string pointType = Request.QueryString["PType"].ToString(); if (pointType.ToUpper() == "D") { pointType = "delivery"; } else if (pointType.ToUpper() == "C") { pointType = "collection"; } Facade.Point facPoint = new Orchestrator.Facade.Point(); this.Point = facPoint.GetPointForPointId(pointId); this.Point.PointStateId = ePointState.Rejected; Facade.IOrder facOrder = new Orchestrator.Facade.Order(); Entities.Order order = facOrder.GetForOrderID(orderId); switch (pointType) { case "delivery": order.DeliveryPointID = ucPoint.PointID; break; case "collection": order.CollectionPointID = ucPoint.PointID; break; default: break; } bool failTheTransaction = false; using (TransactionScope ts = new TransactionScope()) { // Do not set the point to rejected when submitting an alternative, doing so // may causse problems for other unapproved invoices that use the same point. if (!failTheTransaction) { // Update the orders collection or delivery point to the alternative point. bool orderUpdated = false; orderUpdated = facOrder.Update(order, this.User.Identity.Name); if (!orderUpdated) { failTheTransaction = true; } } if (!failTheTransaction) { ts.Complete(); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "SubmitAlternativePoint", "window.opener.__doPostBack('','Refresh');window.close();", true); } } } else { // User must first select an alternative point. } }
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; } } } }
private void CreatePOD(string fileName) { //if (fileName.StartsWith("\\")) // fileName = fileName.Substring(1); Entities.POD pod = null; Facade.POD facPOD = new Orchestrator.Facade.POD(); //Determine the Delivery job and collect drop for this order. if (this.OrderID > 0) { pod = facPOD.GetForOrderID(OrderID); } if (this.CollectDropID > 0) { pod = facPOD.GetPODForCollectDropID(this.CollectDropID); } // Is there already a POD for this collect drop? if (pod == null) { pod = new Orchestrator.Entities.POD(); // get the details we need for the pod record. Facade.Order facOrder = new Orchestrator.Facade.Order(); Facade.ICollectDrop facCollectDrop = new Orchestrator.Facade.CollectDrop(); Dictionary <string, int> orderDetails = null; if (this.OrderID > 0) { orderDetails = facOrder.GetDeliveryDetails(this.OrderID); } else { orderDetails = facCollectDrop.GetDeliveryDetails(this.CollectDropID); } // Do we default to now (upload date) or do we look at the create date of the s pod.CollectDropId = orderDetails["CollectDropID"]; pod.JobId = orderDetails["JobID"]; pod.OrganisationId = orderDetails["CustomerIdentityID"]; pod.FormTypeId = eFormTypeId.POD; } pod.ScannedDateTime = DateTime.Now; pod.SignatureDate = (DateTime)dteSignatureDate.SelectedDate; pod.TicketNo = txtTicketNo.Text; pod.ScannedFormPDF = fileName; try { if (pod.PODId > 0) { facPOD.Update(pod, Page.User.Identity.Name); } else { facPOD.Create(pod, pod.JobId, pod.OrganisationId, pod.CollectDropId, Page.User.Identity.Name); } 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; } }
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); }