//----------------------------------------------------------------------------------- /// <summary> /// Run the search using current fitler values. /// </summary> private DataSet GetData() { // Get filter values from form: string stringFilterValue = txtSearchFor.Text.Trim(); string orderID = cblSearchFor.Items.FindByValue("ORDERID").Selected ? stringFilterValue : String.Empty; string loadNo = cblSearchFor.Items.FindByValue("LOADNO").Selected ? stringFilterValue : String.Empty; string docketNo = cblSearchFor.Items.FindByValue("DOCKETNO").Selected ? stringFilterValue : String.Empty; string runID = cblSearchFor.Items.FindByValue("JOBID").Selected ? stringFilterValue : String.Empty; int driverId = String.IsNullOrEmpty(cboDriver.SelectedValue) ? -1 : Int32.Parse(cboDriver.SelectedValue); DateTime selectedStartDate = dteStartDate.SelectedDate.Value; DateTime selectedEndDate = dteEndDate.SelectedDate.Value; DateTime startDateFilter = selectedStartDate.Subtract(selectedStartDate.TimeOfDay); // Set h:m:s to 00:00.00 DateTime endDateFilter = selectedEndDate.Subtract(selectedEndDate.TimeOfDay).Add(new TimeSpan(23, 59, 59)); // Set h:m:s to 23:59.59 bool includeCheckedInPODs = chkIncludeCheckedInPODs.Checked; bool includeResourced = chkIncludeResourced.Checked; // Originally, you could pass a param into this method to ignore any date filters; However, I have since fixed the querystring weirdness so this is no // longer necessary though updating the SPROC was too much work so I just left it in place in case it becomes useful in future. bool ignoreDates = false; // Now run the search: Facade.IPOD facPOD = new Facade.POD(); return(facPOD.GetOutstandingForDriverOrSubby(driverId, startDateFilter, endDateFilter, orderID, loadNo, docketNo, runID, includeCheckedInPODs, ignoreDates, includeResourced)); }
private void btnEmailFax_Click(object sender, System.EventArgs e) { ArrayList podsToEmail = (ArrayList)ViewState["PODsToEmail"]; foreach (DataGridItem dgItem in dgPODSearchResults.Items) { if (((CheckBox)dgItem.FindControl("chkEmailPOD")).Checked) { podsToEmail.Add(int.Parse(dgItem.Cells[0].Text)); } } string podIdsCSV = String.Empty; foreach (Object o in podsToEmail) { if (!(podIdsCSV == String.Empty)) { podIdsCSV += ","; } podIdsCSV += (int)o; } if (podsToEmail.Count > 0) { Facade.IPOD facPOD = new Facade.POD(); LoadReport(podIdsCSV); } }
protected void dgPODSearchResults_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { Facade.IPOD facPOD = new Facade.POD(); DataSet dsPODList = (DataSet)ViewState["PODSearchResults"]; //' Retrieve the data source from session state. DataTable dt = dsPODList.Tables[0]; //' Create a DataView from the DataTable. DataView dv = new DataView(dt); //' The DataView provides an easy way to sort. Simply set the //' Sort property with the name of the field to sort by. if (this.SortCriteria == e.SortExpression) { if (this.SortDir == "desc") { this.SortDir = "asc"; } else { this.SortDir = "desc"; } } this.SortCriteria = e.SortExpression; dv.Sort = e.SortExpression + ' ' + this.SortDir; //' Re-bind the data source and specify that it should be sorted //' by the field specified in the SortExpression property. dgPODSearchResults.DataSource = dv; dgPODSearchResults.DataBind(); }
private void btnTestEmail_Click(object sender, EventArgs e) { Facade.EmailTemplate facEmailTemplate = new Facade.EmailTemplate(); Entities.EmailTemplate emailTemplate = facEmailTemplate.GetForEmailTemplateId(Globals.Configuration.PodEmailTemplateId); // Get data to be used to populate placeHolders Facade.IPOD facPod = new Facade.POD(); facPod.SendClientPod(113530); }
private DataSet GetData() { DateTime startDate = dteStartDate.SelectedDate.Value; startDate = startDate.Subtract(startDate.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value; endDate = endDate.Subtract(endDate.TimeOfDay); endDate = endDate.Add(new TimeSpan(23, 59, 59)); Facade.IPOD facPOD = new Facade.POD(); return(facPOD.GetMissingPODs(Int32.Parse(cboClient.SelectedValue), startDate, endDate)); }
//-------------------------------------------------------------------------- protected void btnRecordPODReturn_Click(object sender, EventArgs e) { bool PODReceived = false; if (this.rblPODReceived.SelectedValue == "0") { PODReceived = true; } Facade.IPOD facPOD = new Facade.POD(); int retVal = facPOD.RecordPODReturn(JobId, CollectDropId, 0, PODReceived, txtPODReturnComment.Text, ((Entities.CustomPrincipal)Page.User).UserName); this.Close("-1"); }
private void LoadReport(string podIdsCSV) { Facade.IPOD facPOD = new Facade.POD(); DataSet dsPODs = facPOD.GetScannedPODsForPODId(podIdsCSV); //------------------------------------------------------------------------------------- // Load Report Section //------------------------------------------------------------------------------------- Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.EmailFaxForm; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsPODs; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; // Show the user control reportViewer.Visible = true; }
protected void dgPODSearchResults_ItemCommand(object sender, DataGridCommandEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Facade.IPOD facPOD = new Facade.POD(); Facade.IForm facForm = new Facade.Form(); Entities.POD podToView = facPOD.GetForPODId(int.Parse(e.Item.Cells[0].Text)); Entities.Scan scan = facForm.GetForScannedFormId(podToView.ScannedFormId); byte[] scannedFormImage; scannedFormImage = Convert.FromBase64String(scan.ScannedFormImage); Response.Clear(); Response.ContentType = "image/tiff"; Response.AddHeader("Content-Disposition", "attachment; filename=" + "PODTicketNo" + e.Item.Cells[1].Text + ".tif"); Response.OutputStream.Write(scannedFormImage, 0, scannedFormImage.Length); Response.End(); } }
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 string ScanHasBeenUploadedToWithId(string URL, int scannedFormId) { var methodStatus = String.Empty; var facScanForm = new Facade.Form(); var scan = facScanForm.GetForScannedFormId(scannedFormId); if (scan == null) { // If scan is null try and use the old method based on file name. ScanHasBeenUploadedTo(URL); return(methodStatus); } 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); }
protected void btnAddToJob_Click(object sender, System.EventArgs e) { int collectDropId = 0; int PODId = 0; Entities.POD podToAssign = null; // Find the Collect Drop ID for the selected collect drop portion foreach (DataGridItem cdsItem in dgCollectionDropSummary.Items) { DataGrid dgCollectionDrop = (DataGrid)cdsItem.FindControl("dgCollectionDrop"); foreach (DataGridItem cdItem in dgCollectionDrop.Items) { RdoBtnGrouper rbgCollectionDrop = (RdoBtnGrouper)cdItem.FindControl("rbgCollectionDrop"); if (rbgCollectionDrop.Checked) { collectDropId = int.Parse(cdItem.Cells[0].Text); } } } // Find the POD ID of the selected POD foreach (DataGridItem PODItem in dgUnassignedPODs.Items) { RdoBtnGrouper rbgPODId = (RdoBtnGrouper)PODItem.FindControl("rbgPODId"); if (rbgPODId.Checked) { PODId = int.Parse(PODItem.Cells[0].Text); podToAssign = new Entities.POD(PODId, PODItem.Cells[1].Text, DateTime.Parse(PODItem.Cells[2].Text), m_jobId, collectDropId); } } if (podToAssign != null && collectDropId > 0 && PODId > 0) { Facade.IPOD facPOD = new Facade.POD(); facPOD.AssignToJob(podToAssign, ((Entities.CustomPrincipal)Page.User).UserName); } else { lblAddToJobError.Text = "Select POD and drop to which to assign."; lblAddToJobError.Visible = true; } PopulatePODs(); }
private void PerformSearch() { bool noCriteria = false; if (cboClient.Text == "" && txtTicketNo.Text == "" && dteSignatureDate.Text == "" && txtCustomerRef.Text == "" && txtDestination.Text == "") { noCriteria = true; } Facade.IPOD facPOD = new Facade.POD(); DataSet dsPODSearchResults = null; if (noCriteria) { dsPODSearchResults = facPOD.GetAll(); } else { int clientId = cboClient.SelectedValue == "" ? 0 : int.Parse(cboClient.SelectedValue); int loadNo = txtLoadNo.Text == "" ? 0 : int.Parse(txtLoadNo.Text); string ticketNo = txtTicketNo.Text == "" ? "" : txtTicketNo.Text; string customerReference = txtCustomerRef.Text == "" ? "" : txtCustomerRef.Text; string destination = txtDestination.Text == "" ? "" : txtDestination.Text; DateTime signatureDate; DateTime scannedDate; if (dteSignatureDate.SelectedDate.Value == DateTime.MinValue) { signatureDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue)); } else { signatureDate = dteSignatureDate.SelectedDate.Value; } scannedDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue)); //dsPODSearchResults = facPOD.GetWithParams(clientId, ticketNo, signatureDate, scannedDate, scannedDateFrom, scannedDateTo, loadNo, customerReference, destination); } ViewState["PODSearchResults"] = dsPODSearchResults; dgPODSearchResults.DataSource = dsPODSearchResults; dgPODSearchResults.DataBind(); }
protected void dgUnassignedPODs_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Facade.IPOD facPOD = new Facade.POD(); Entities.POD itemPOD = facPOD.GetForPODId(int.Parse(e.Item.Cells[0].Text)); string podId = e.Item.Cells[0].Text; HyperLink lnkViewPOD = (HyperLink)e.Item.FindControl("lnkViewPOD"); if (itemPOD.ScannedFormId > 0) { lnkViewPOD.Target = "_blank"; lnkViewPOD.NavigateUrl = itemPOD.ScannedFormPDF; } else { lnkViewPOD.Visible = false; } } }
protected void btnUnassignPODs_Click(object sender, System.EventArgs e) { Facade.IPOD facPOD = new Facade.POD(); ArrayList arrayListPODIds = new ArrayList(); foreach (DataGridItem cdsItem in dgCollectionDropSummary.Items) { DataGrid dgCollectionDrop = (DataGrid)cdsItem.FindControl("dgCollectionDrop"); foreach (DataGridItem cdItem in dgCollectionDrop.Items) { if (((CheckBox)cdItem.FindControl("chkUnassignPOD")).Checked) { DataSet dsPOD = facPOD.GetForCollectDropID(int.Parse(cdItem.Cells[0].Text)); arrayListPODIds.Add((int)dsPOD.Tables[0].Rows[0]["PODId"]); } } } int[] toUnassignPODIds = new int[arrayListPODIds.Count]; for (int counter = 0; counter < arrayListPODIds.Count; counter++) { toUnassignPODIds[counter] = (int)arrayListPODIds[counter]; } if (arrayListPODIds.Count > 0 && ((int)arrayListPODIds[0]) > 0) { lblUnassignPODsError.Visible = false; facPOD.UnassignFromJob(toUnassignPODIds, ((Entities.CustomPrincipal)Page.User).UserName); } else { lblUnassignPODsError.Text = "Please mark POD(s) to unassign"; lblUnassignPODsError.Visible = true; } PopulatePODs(); }
//-------------------------------------------------------------------------- private void Initialise() { if (this.ScannedFormId > 0) { Facade.IPOD facPOD = new Facade.POD(); this.Pod = facPOD.GetForScannedFormId(this.ScannedFormId); if (Orchestrator.Globals.Configuration.AutoPopulateScanTicketNumber) { this.txtTicketNo.Text = this.Pod.TicketNo; } this.dteSignatureDate.SelectedDate = this.Pod.SignatureDate; this.dgAdditionalReferences.DataSource = this.Pod.AdditionalReferences; this.dgAdditionalReferences.DataBind(); } else { Facade.IPOD facPod = new Orchestrator.Facade.POD(); DataSet dsJobDetails = facPod.GetJobDetails(this.JobId); foreach (DataRow row in dsJobDetails.Tables["CollectionDrop"].Rows) { if ((int)row["CollectDropId"] == this.CollectDropId) { if (Orchestrator.Globals.Configuration.AutoPopulateScanTicketNumber) { this.txtTicketNo.Text = row["ClientsCustomerReference"].ToString(); } this.dteSignatureDate.SelectedDate = (DateTime)row["CollectDropDateTime"]; break; } } } ((WizardMasterPage)this.Master).WizardTitle = "Document Wizard"; }
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); }
private void PopulatePODs() { ViewState["AssignedPODCount"] = 0; // Only show the centrally scanned pods if the option is set in tblSystem. bool centrallyScannedPODsActive = Facade.SystemSettings.CentrallyScannedPODsActive(); Facade.IPOD facPOD = new Facade.POD(); m_dsJob = facPOD.GetJobDetails(m_jobId); dgCollectionDropSummary.DataSource = facPOD.GetJobDetails(m_jobId); dgCollectionDropSummary.DataMember = "CollectionDropSummary"; dgCollectionDropSummary.DataBind(); DataSet ds = facPOD.GetJobDetailsWithOutLeg(m_jobId); dgUnattachedDeHire.DataSource = ds; dgUnattachedDeHire.DataBind(); if (m_jobId > 0) { DataSet dsUnassignedPODs = facPOD.GetUnassignedToJobByClientId(m_job.IdentityId); if (dsUnassignedPODs.Tables[0].Rows.Count > 0) { pnlUnassignedPODs.Visible = true && centrallyScannedPODsActive; dgUnassignedPODs.DataSource = dsUnassignedPODs; } else { pnlUnassignedPODs.Visible = false && centrallyScannedPODsActive; } } else { dgUnassignedPODs.DataSource = facPOD.GetUnassignedToJob(); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { pnlUnattachedDeHire.Visible = true; } else { pnlUnattachedDeHire.Visible = false; } try { dgUnassignedPODs.DataBind(); } catch (Exception) { dgUnassignedPODs.CurrentPageIndex = 0; dgUnassignedPODs.DataBind(); } if ((int)ViewState["AssignedPODCount"] > 0) { btnUnassignPODs.Visible = true; } else { btnUnassignPODs.Visible = false; } }
private void GetPODs() { bool noCriteria = false; if (dteDateOfDelivery.DateInput.Text == String.Empty && dteDateOfDeliveryFrom.DateInput.Text == String.Empty && dteDateOfDeliveryTo.DateInput.Text == String.Empty && cboClient.Text == String.Empty && cboClientsCustomer.Text == String.Empty && txtTicketNo.Text == String.Empty && this.orderIdTextbox.Text == String.Empty && this.loadNoTextbox.Text == String.Empty && this.docketNoTextbox.Text == String.Empty && this.customerReferenceTextbox.Text == String.Empty && this.jobIdTextbox.Text == String.Empty && this.trailerRefTextbox.Text == String.Empty) { noCriteria = true; } Facade.IPOD facPOD = new Facade.POD(); if (noCriteria) { dsPODList = facPOD.GetAll(); } else { // By POD Filtering int clientId = cboClient.SelectedValue == "" ? 0 : int.Parse(cboClient.SelectedValue); int clientsCustomerId = cboClientsCustomer.SelectedValue == "" ? 0 : int.Parse(cboClientsCustomer.SelectedValue); string ticketNo = txtTicketNo.Text == "" ? "" : txtTicketNo.Text; DateTime deliveryDate, deliveryDateFrom, deliveryDateTo; if (dteDateOfDelivery.SelectedDate == null || dteDateOfDelivery.SelectedDate.Value == DateTime.MinValue) { deliveryDate = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue)); } else { deliveryDate = dteDateOfDelivery.SelectedDate.Value; } if (dteDateOfDeliveryFrom.SelectedDate == null || dteDateOfDeliveryFrom.SelectedDate.Value == DateTime.MinValue) { deliveryDateFrom = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue)); } else { deliveryDateFrom = dteDateOfDeliveryFrom.SelectedDate.Value; } if (dteDateOfDeliveryTo.SelectedDate == null || dteDateOfDeliveryTo.SelectedDate.Value == DateTime.MinValue) { deliveryDateTo = Convert.ToDateTime(Convert.ToString(SqlDateTime.MinValue)); } else { deliveryDateTo = dteDateOfDeliveryTo.SelectedDate.Value; deliveryDateTo = deliveryDateTo.Add(new TimeSpan(23, 59, 00)); } // By Job Filtering string loadNo = this.loadNoTextbox.Text.Trim(); string docketNo = this.docketNoTextbox.Text.Trim(); string customerReference = this.customerReferenceTextbox.Text.Trim();; string trailerRef = this.trailerRefTextbox.Text.Trim(); int jobId = 0; int orderId = 0; if (!String.IsNullOrEmpty(this.jobIdTextbox.Text)) { int.TryParse(this.jobIdTextbox.Text, out jobId); } if (!String.IsNullOrEmpty(this.orderIdTextbox.Text)) { int.TryParse(this.orderIdTextbox.Text, out orderId); } dsPODList = facPOD.GetWithParams(clientId, clientsCustomerId, ticketNo, deliveryDate, deliveryDateFrom, deliveryDateTo, loadNo, docketNo, customerReference, trailerRef, jobId, orderId); } ViewState["C_PODDATA_VS"] = dsPODList; if (dsPODList.Tables[0].Rows.Count > 0) { dgPODList.DataSource = dsPODList; dgPODList.DataBind(); dgPODList.Visible = true; lblError.Visible = false; } else { lblError.Visible = true; dgPODList.Visible = false; } }