protected void OnTrack(object sender, EventArgs e) { //Track by PO or PRO number if (Page.IsValid) { //Flag search by method Session["TrackBy"] = this.cboSearchType.Items[0].Selected ? TrackingServices.SEARCHBY_PRO : TrackingServices.SEARCHBY_PO; //Track TrackingServices trackSvc = new TrackingServices(); TrackingDS cartons = new TrackingDS(); if (this.cboSearchType.Items[0].Selected) { cartons.Merge(trackSvc.GetCartonsForPRO(this.cboClient.SelectedValue, this.txtNumber.Text)); } else { cartons.Merge(trackSvc.GetCartonsForPO(this.cboClient.SelectedValue, this.txtNumber.Text)); } if (cartons.CartonDetailTable.Rows.Count > 0) { //Build a summary of the cartons found TrackingDS summary = buildSummary(cartons, (this.cboSearchType.Items[0].Selected ? TrackingServices.SEARCHBY_PRO : TrackingServices.SEARCHBY_PO)); Session["TrackingSearch"] = null; Session["TrackingSummary"] = summary; Session["TrackingDetail"] = cartons; Response.Redirect("CartonSummary.aspx"); } else { Master.ShowMsgBox("No records found. Please try again."); } } }
private TrackingDS buildSummary(TrackingDS trackingData, string searchBy) { //Build a summary for the specified carton detail TrackingDS summary = new TrackingDS(); foreach (TrackingDS.CartonDetailTableRow carton in trackingData.CartonDetailTable.Rows) { //Duplicates: The result set contains duplicates string displayNumber = ""; switch (searchBy) { case TrackingServices.SEARCHBY_CARTONNUMBER: case TrackingServices.SEARCHBY_PLATENUMBER: case TrackingServices.SEARCHBY_PRO: case TrackingServices.SEARCHBY_PO: displayNumber = carton.CTN.Trim(); break; case TrackingServices.SEARCHBY_LABELNUMBER: displayNumber = carton.LBL.ToString(); break; } string id = carton.CTN.Trim(); if (summary.CartonSummaryTable.FindByID(id) != null) { id = carton.CTN.Trim() + DateTime.Now.Second; } addSummaryRow(id, displayNumber, carton, summary); } return(summary); }
private void track(string storeNumber, bool isSubStoreSearch) { // //Flag search by method Session["TrackBy"] = "Store"; Session["SubStore"] = isSubStoreSearch ? this.txtStore.Text : null; //Track bool byPickup = this.cboDateType.SelectedValue == "Pickup"; MembershipServices membership = new MembershipServices(); ProfileCommon profile = membership.MemberProfile; string vendorID = (profile.Type.ToLower() == "vendor") ? profile.ClientVendorID : null; string clientID = this.cboClient.SelectedValue; TrackingServices svcs = new TrackingServices(); TrackingDS cartons = new TrackingDS(); cartons.Merge(svcs.GetCartonsForStore(clientID, storeNumber, this.dtpFromDate.SelectedDate, this.dtpToDate.SelectedDate, vendorID, byPickup)); if (cartons.CartonDetailForStoreTable.Rows.Count > 0) { //Capture substore (if applicable); set search results into Session state; redirect //to the summary page TrackingDS summary = buildSummary(cartons); Session["StoreSummary"] = summary; Session["StoreDetail"] = cartons; Page.Response.Redirect("StoreSummary.aspx", false); } else { //Notify user that there are no cartons for the specified store Master.ShowMsgBox("No records found. Please try again."); } }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for form load event if (!Page.IsPostBack) { TrackingDS summary = (TrackingDS)Session["TrackingSummary"]; if (summary != null && summary.CartonSummaryTable.Rows.Count > 0) { //Title this.lblSubTitle.Text = " " + summary.CartonSummaryTable.Rows.Count.ToString() + " cartons"; try { TrackingDS cartons = (TrackingDS)Session["TrackingDetail"]; if (Session["TrackBy"].ToString() == TrackingServices.SEARCHBY_PRO) { this.lblTitle.Text += " for PRO# "; this.lblTitle.Text += cartons.CartonDetailTable[0].IsNull("ShipmentNumber") ? "?" : cartons.CartonDetailTable[0]["ShipmentNumber"].ToString(); } if (Session["TrackBy"].ToString() == TrackingServices.SEARCHBY_PO) { this.lblTitle.Text += " for PO# "; this.lblTitle.Text += cartons.CartonDetailTable[0].IsPONull() ? "?" : cartons.CartonDetailTable[0].PO; } } catch { } //Summary this.SummaryGridView.DataSourceID = ""; this.SummaryGridView.DataMember = "CartonSummaryTable"; this.SummaryGridView.DataSource = summary; this.SummaryGridView.DataBind(); //List cartons 'not found' or 'not searched' StringBuilder lst = new StringBuilder(); TrackingDS cartonsSearch = (TrackingDS)Session["TrackingSearch"]; if (cartonsSearch != null) { DataRow[] notValid = cartonsSearch.CartonSearchTable.Select("Valid = false"); for (int i = 0; i < notValid.Length; i++) { lst.Append(notValid[i]["SearchID"]).Append(Convert.ToChar(13)); } DataRow[] notFound = cartonsSearch.CartonSearchTable.Select("Found = false"); for (int i = 0; i < notFound.Length; i++) { lst.Append(notFound[i]["SearchID"]).Append(Convert.ToChar(13)); } } this.cartonNotFoundTextBox.Text = lst.ToString(); this.cartonNotFoundPanel.Visible = (lst.Length > 0); } else { Master.ShowMsgBox("Could not find summary information. Please return to tracking page and try again."); } } }
public TrackingDS GetCartonsForStore(string clientID, string store, DateTime fromDate, DateTime toDate, string vendorID, bool searchByPickup) { //Get a list of cartons (details) for the specified store by pickup or delivery TrackingDS cartons = new TrackingDS(); string usp = searchByPickup ? USP_BYPICKUP : USP_BYDELIVERY; string tbl = searchByPickup ? TBL_BYPICKUP : TBL_BYDELIVERY; DataSet ds = fillDataset(usp, tbl, new object[] { clientID, store, fromDate.ToString("yyyy-MM-dd"), toDate.ToString("yyyy-MM-dd"), vendorID }); cartons.Merge(ds.Tables[tbl]); return(cartons); }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for form load event if (!Page.IsPostBack) { //Prepopulate from carton detail string cartonNumber = Request.QueryString["ID"] == null ? "" : Request.QueryString["ID"].ToString(); if (cartonNumber.Length > 0) { TrackingDS summary = (TrackingDS)Session["TrackingSummary"]; if (summary != null && summary.CartonSummaryTable.Rows.Count > 0) { //Find the summary info for cartonNumber TrackingDS.CartonSummaryTableRow summaryRow = summary.CartonSummaryTable.FindByID(cartonNumber); if (summaryRow != null) { //Get all detail rows for this carton string filter = "[LBL]=" + summaryRow.LBLNumber; TrackingDS cartons = (TrackingDS)Session["TrackingDetail"]; DataRow[] detailRows = cartons.CartonDetailTable.Select(filter); if (detailRows != null && detailRows.Length > 0) { //Show tracking detail for the carton TrackingDS.CartonDetailTableRow carton = (TrackingDS.CartonDetailTableRow)detailRows[0]; this.lblName.Text = "ATTN: Claims Department"; this.lblCarrier.Text = "Argix Direct, Inc."; this.lblDate.Text = DateTime.Today.ToShortDateString(); this.lblAddress.Text = "100 Middlesex Center Blvd, Jamesburg, NJ 08831"; this.lblClaimant.Text = carton.CLNM.Trim(); //Client name if (carton.CTN.Trim().Length > 0) { this.lblDescription.Text = "Carton# " + carton.CTN.Trim(); //Carton# } else { this.lblDescription.Text = "Label# " + carton.LBL.ToString().Trim(); //LabelSeq# } this.lblConsignor.Text = carton.CLNM.Trim(); //Client name, city, state this.lblShipFrom.Text = carton.VNM.Trim() + " " + carton.VCT.Trim() + ", " + carton.VST.Trim(); //Vendor name, city, state this.lblFinalDest.Text = carton.SNM.Trim() + " " + carton.SCT.Trim() + ", " + carton.SST.Trim(); //Store name, city, state this.lblRoutedVia.Text = "Argix Direct, Inc."; this.lblBOLBy.Text = carton.VNM.Trim(); //Vendor name this.lblBOLDate.Text = carton.PUD.Trim(); //Pickup date this.lblPRONum.Text = carton.VK.Trim(); //PRO# this.lblTrailerNum.Text = ""; //Vendor trailer# this.lblConsignee.Text = carton.SNM.Trim() + " " + carton.SCT.Trim() + ", " + carton.SST.Trim(); //Store name, city, state } } } } } }
private TrackingDS buildSummary(TrackingDS trackingSearch, TrackingDS cartons, string searchBy) { //Build a summary for the specified carton detail TrackingDS summary = new TrackingDS(); foreach (TrackingDS.CartonDetailTableRow carton in cartons.CartonDetailTable.Rows) { //Find the row by displayNumber in cartonsSearch string displayNumber = ""; switch (searchBy) { case TrackingServices.SEARCHBY_CARTONNUMBER: case TrackingServices.SEARCHBY_PLATENUMBER: case TrackingServices.SEARCHBY_PRO: case TrackingServices.SEARCHBY_PO: displayNumber = carton.CTN.Trim(); break; case TrackingServices.SEARCHBY_LABELNUMBER: displayNumber = carton.LBL.ToString(); break; default: displayNumber = carton.CTN.Trim(); break; } string id = ""; TrackingDS.CartonSearchTableRow searchRow = trackingSearch.CartonSearchTable.FindBySearchID(displayNumber); if (searchRow != null) { //Already marked found? if (searchRow.Found) { //Duplicate carton number, which is possible but lbl seq will be unique within same carton numbers searchRow.Count += 1; id = displayNumber + "-" + searchRow.Count.ToString(); } else { //Mark this carton as found searchRow.Found = true; searchRow.Count = 1; id = displayNumber; } if (summary.CartonSummaryTable.FindByID(id) == null) { addSummaryRow(id, displayNumber, carton, summary); } } } return(summary); }
public TrackingDS GetCartonsForPRO(string client, string shipment) { //Get a list of cartons (details) for the specified client and PO number TrackingDS cartons = new TrackingDS(); TrackingDS _cartons = new TrackingDS(); DataSet ds = fillDataset(USP_BYPRO, TBL_BYPRO, new object[] { client, shipment }); _cartons.Merge(ds.Tables[TBL_BYPRO]); if (_cartons != null && _cartons.Tables[TBL_BYPRO].Rows.Count > 0) { DataView view = _cartons.Tables[TBL_BYPRO].DefaultView; view.Sort = "CTN,BL DESC,SCNTP DESC,SCD DESC,SCT DESC"; DataTable table = getUniqueRows(view); cartons.Merge(table.Select()); } return(cartons); }
private TrackingDS buildSummary(TrackingDS cartonData) { //TL:0420603 has different dates - 26 and 28 //TL:0510603 does not have any dates TrackingDS uniqueTLs = new TrackingDS(); uniqueTLs.Merge(cartonData.CartonDetailForStoreTable.DefaultView.ToTable(true, new string[] { "TL" })); foreach (TrackingDS.CartonDetailForStoreTableRow row in uniqueTLs.CartonDetailForStoreTable.Rows) { row.CartonCount = cartonData.CartonDetailForStoreTable.Select("TL='" + row.TL + "'").Length; row.Weight = int.Parse(cartonData.CartonDetailForStoreTable.Compute("Sum(weight)", "TL='" + row.TL + "'").ToString()); object minDate = cartonData.CartonDetailForStoreTable.Compute("Min(PodDate)", "TL='" + row.TL + "' AND (IsNull(PodDate,#01/01/1900#) <> #01/01/1900#)"); TrackingDS.CartonDetailForStoreTableRow firstRow = (TrackingDS.CartonDetailForStoreTableRow)(cartonData.CartonDetailForStoreTable.Select("TL='" + row.TL + "'"))[0]; //set pod/eta with pod date if available otherwise use ofdi date if (minDate != System.DBNull.Value) { row.PodDate = DateTime.Parse(minDate.ToString()); } else { if (!firstRow.IsOFD1Null()) { row.PodDate = firstRow.OFD1; } } row.Store = firstRow.Store; row.CBOL = firstRow.IsCBOLNull() ? "" : firstRow.CBOL; if (firstRow.Trf == "N") { row.AgName = firstRow.AgName; } else { row.AgName = firstRow.AgName + " (Transfer)"; } row.AcceptChanges(); } return(uniqueTLs); }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event if (!Page.IsPostBack) { //Display search by store summary information TrackingDS ds = (TrackingDS)Session["StoreSummary"]; if (ds != null && ds.CartonDetailForStoreTable.Rows.Count > 0) { //Summary found- show store\substore and set summary data in grid this.lblTitle.Text = "Store Summary: Store #" + (Session["SubStore"] != null ? Session["SubStore"] : ds.CartonDetailForStoreTable[0].Store.PadLeft(5, '0')); this.grdSummary.DataSourceID = ""; this.grdSummary.DataMember = "CartonDetailForStoreTable"; this.grdSummary.DataSource = ds; this.grdSummary.DataBind(); } else { Response.Redirect("TrackByStore.aspx"); } } }
private void displayTrackingDetail(string cartonNumber) { //Display tracking info for the specified carton TrackingDS summary = (TrackingDS)Session["TrackingSummary"]; if (summary != null) { //Find the summary info for cartonNumber TrackingDS.CartonSummaryTableRow summaryRow = summary.CartonSummaryTable.FindByID(cartonNumber); if (summaryRow != null) { //Get all detail rows for this carton string filter = "[LBL]=" + summaryRow.LBLNumber; TrackingDS cartons = (TrackingDS)Session["TrackingDetail"]; DataRow[] detailRows = cartons.CartonDetailTable.Select(filter); if (detailRows != null && detailRows.Length > 0) { //Show tracking detail for the carton showCarton((TrackingDS.CartonDetailTableRow)detailRows[0]); //Update navigation this.cboCartons.Visible = this.CartonLabel.Visible = false; this.btnNavFirst.Visible = this.btnNavPrev.Visible = this.btnNavNext.Visible = this.btnNavLast.Visible = false; if (summary.CartonSummaryTable.Rows.Count > 1) { this.cboCartons.DataSource = summary; this.cboCartons.DataMember = "CartonSummaryTable"; this.cboCartons.DataTextField = "DisplayNumber"; this.cboCartons.DataValueField = "ID"; this.cboCartons.DataBind(); this.cboCartons.SelectedValue = cartonNumber; this.cboCartons.Visible = this.CartonLabel.Visible = summary.CartonSummaryTable.Rows.Count > 1; this.btnNavFirst.Visible = this.btnNavPrev.Visible = this.btnNavNext.Visible = this.btnNavLast.Visible = summary.CartonSummaryTable.Rows.Count > 1; } } } } }
public TrackingDS GetCartons(string trackingNumbers, string searchBy, string companyType, string companyID) { //Get a list of cartons (details) for the specified tracking number (carton or label sequence) //One or two records are returned for each carton: ScanType=0: 1; ScanType=1: 1, ScanType=3: 2 (ScanTypes 1, 3) TrackingDS cartons = new TrackingDS(); string usp = "", tbl = ""; switch (searchBy) { case SEARCHBY_LABELNUMBER: usp = USP_BYLABEL; tbl = TBL_BYLABEL; break; case SEARCHBY_CARTONNUMBER: usp = USP_BYCARTON; tbl = TBL_BYCARTON; break; case SEARCHBY_PLATENUMBER: usp = USP_BYPLATE; tbl = TBL_BYPLATE; break; } DataSet ds = null; if (companyID != ID_ARGIX && companyType.ToLower() == "client") { ds = fillDataset(usp, tbl, new object[] { trackingNumbers, companyID, null }); } else if (companyID != ID_ARGIX && companyType.ToLower() == "vendor") { ds = fillDataset(usp, tbl, new object[] { trackingNumbers, null, companyID }); } else { ds = fillDataset(usp, tbl, new object[] { trackingNumbers, null, null }); } if (ds != null && ds.Tables[tbl].Rows.Count > 0) { DataView filterView = ds.Tables[tbl].DefaultView; filterView.Sort = "CTN,BL DESC,SCNTP DESC,SCD DESC,SCT DESC"; DataTable dataTable = getUniqueRows(filterView); cartons.Merge(dataTable.Select()); } return(cartons); }
protected void OnTrack(object sender, EventArgs e) { //Track one or more cartons string searchBy = TrackingServices.SEARCHBY_CARTONNUMBER; switch (this.cboSearchBy.SelectedValue) { case "CartonNumber": searchBy = TrackingServices.SEARCHBY_CARTONNUMBER; break; case "LabelNumber": searchBy = TrackingServices.SEARCHBY_LABELNUMBER; break; case "PlateNumber": searchBy = TrackingServices.SEARCHBY_PLATENUMBER; break; } Session["TrackBy"] = searchBy; Session["SubStore"] = null; //Validate string input = encodeInput(this.txtNumbers.Text); if (input.Length == 0) { this.rfvTracking.IsValid = false; this.rfvTracking.ErrorMessage = "No valid tracking numbers were entered."; return; } string[] numbers = input.Split(Convert.ToChar(13)); if (numbers.Length > (int)Application["TrackingNumbersMax"]) { this.rfvTracking.IsValid = false; this.rfvTracking.ErrorMessage = "You can not search more than 10 items at a time."; return; } //Build search table and validate TrackingDS trackingSearch = new TrackingDS(); for (int i = 0; i < numbers.Length; i++) { string number = numbers[i].Trim(); if (trackingSearch.CartonSearchTable.FindBySearchID(number) == null) { //Not a duplicate- validate format if (searchBy == TrackingServices.SEARCHBY_CARTONNUMBER && number.Length >= (int)Application["CartonLenMin"] && number.Length <= (int)Application["CartonLenMax"]) { trackingSearch.CartonSearchTable.AddCartonSearchTableRow(number, false, i, 0, true); } else if (searchBy == TrackingServices.SEARCHBY_LABELNUMBER && number.Length > 0 && number.Length == (int)Application["ArgixLabelLen"] && isNumeric(number)) { trackingSearch.CartonSearchTable.AddCartonSearchTableRow(number, false, i, 0, true); } else if (searchBy == TrackingServices.SEARCHBY_PLATENUMBER && number.Length > 0 && number.Length <= (int)Application["CartonLenMax"]) { trackingSearch.CartonSearchTable.AddCartonSearchTableRow(number, false, i, 0, true); } else { trackingSearch.CartonSearchTable.AddCartonSearchTableRow(number, false, i, 0, false); } } } DataRow[] valid = trackingSearch.CartonSearchTable.Select("Valid = true"); if (valid.Length == 0) { //No valid numbers to track this.rfvTracking.IsValid = false; this.rfvTracking.ErrorMessage = "No valid tracking numbers were entered."; return; } //Get carton detail data StringBuilder trackingNumbers = new StringBuilder(); foreach (TrackingDS.CartonSearchTableRow row in trackingSearch.CartonSearchTable.Rows) { if (row.Valid) { trackingNumbers.Append(trackingNumbers.Length == 0 ? row.SearchID : "," + row.SearchID); } } ProfileCommon profile = new MembershipServices().MemberProfile; TrackingServices svcs = new TrackingServices(); TrackingDS cartons = new TrackingDS(); cartons.Merge(svcs.GetCartons(trackingNumbers.ToString(), searchBy, profile.Type, profile.ClientVendorID)); if (cartons.CartonDetailTable.Rows.Count > 0) { //Build a summary for the summary page TrackingDS summary = buildSummary(trackingSearch, cartons, searchBy); Session["TrackingSearch"] = trackingSearch; Session["TrackingSummary"] = summary; Session["TrackingDetail"] = cartons; Response.Redirect("CartonSummary.aspx"); } else { Master.ShowMsgBox("No records found. Please try again."); } }
private void addSummaryRow(string id, string displayNumber, TrackingDS.CartonDetailTableRow carton, TrackingDS summary) { //Create a summary row for the specified carton TrackingDS.CartonSummaryTableRow record = summary.CartonSummaryTable.NewCartonSummaryTableRow(); record.ID = id; record.DisplayNumber = displayNumber; record.CTNNumber = carton.CTN.Trim(); record.LBLNumber = carton.LBL.ToString().Trim(); record.CBOL = carton.IsCBOLNull() ? "" : carton.CBOL.Trim(); if (carton.SCNTP == 3 && !carton.IsSCDNull() && carton.SCD.Trim().Length > 0) { record.DateTime = carton.SCD.Trim() + " " + carton.SCTM.Trim(); if (carton.T.Trim().Length == 18 && carton.T.Trim().Substring(0, 2).ToLower() == "1z") { record.Status = "Rerouted: Tracking # " + carton.T.Trim(); } else { switch (carton.OM) { case "M": record.Status = carton.ISMN == 1 ? "Delivered (Scan N/A - Manual Entry)" : "Delivered"; break; case "S": record.Status = "Short At Delivery"; break; case "O": record.Status = "Over At Delivery"; break; case "A": record.Status = "MisRoute At Delivery"; break; } } record.Location = carton.SCT.Trim() + "/" + carton.SST.Trim(); } else { if (carton.SCNTP == 3 && !carton.IsACTSDDNull() && carton.ACTSDD.Trim().Length > 0) { record.DateTime = carton.ACTSDD.Trim(); record.Status = "Out For Delivery"; record.Location = carton.SCT.Trim() + "/" + carton.SST.Trim(); } else { if (!carton.IsAARDNull() && carton.AARD.Trim().Length > 0) { record.DateTime = carton.AARD.Trim() + " " + carton.AART.Trim(); if (carton.SCNTP == 1) { switch (carton.OM) { case "M": record.Status = "Scanned At Delivery Terminal"; break; case "S": record.Status = "Short At Delivery Terminal"; break; case "O": record.Status = "Over At Delivery Terminal"; break; case "A": record.Status = "MisRoute At Delivery Terminal"; break; } } else { record.Status = "Arrived At Delivery Terminal"; } if (!carton.IsSAGCTNull()) { record.Location = carton.SAGCT.Trim() + "/" + (carton.IsSAGSTNull() ? "" : carton.SAGST.Trim()); } else { record.Location = (carton.IsAGCTNull() ? "" : carton.AGCT.Trim()) + "/" + (carton.IsAGSTNull() ? "" : carton.AGST.Trim()); } } else { if (!carton.IsADPDNull() && carton.ADPD.Trim().Length > 0) { record.DateTime = carton.ADPD.Trim() + " " + carton.ADPT.Trim(); record.Status = "Departed Sort Facility"; record.Location = carton.SRTLOC.Trim(); } else { if (!carton.IsASFDNull() && carton.ASFD.Trim().Length > 0) { record.DateTime = carton.ASFD.Trim() + " " + carton.ASFT.Trim(); record.Status = "Arrived At Sort Facility"; record.Location = carton.SRTLOC.Trim(); } } } } } summary.CartonSummaryTable.AddCartonSummaryTableRow(record); }
//Members //Interface protected void Page_Load(object sender, EventArgs e) { //Event handler for page load event string tl = Request.QueryString["TL"]; string lbl = Request.QueryString["LBL"]; string ctn = Request.QueryString["CTN"]; if (!Page.IsPostBack) { //Page request if (tl != null && tl.Length > 0 && lbl == null && ctn == null) { //Page request from StoreSummary.aspx (i.e. StoreDetail.aspx?TL=) //Show TL detail TrackingDS storeDetail = new TrackingDS(); DataSet ds = (DataSet)Session["StoreDetail"]; if (ds != null) { storeDetail.Merge(ds.Tables["CartonDetailForStoreTable"].Select("TL='" + tl + "'")); } if (storeDetail.CartonDetailForStoreTable.Rows.Count > 0) { //Display store\substore, and cartons for the requested TL this.lblTitle.Text = "Tracking Summary: Store#" + (Session["SubStore"] != null ? Session["SubStore"] : storeDetail.CartonDetailForStoreTable[0].Store.PadLeft(5, '0')) + "; TL#" + tl; this.grdTLDetail.DataSourceID = ""; this.grdTLDetail.DataMember = "CartonDetailForStoreTable"; this.grdTLDetail.DataSource = storeDetail; this.grdTLDetail.DataBind(); } else { this.lblTitle.Text = "Tracking Summary: Store#?????" + "; TL#" + tl; } } else if (lbl != null && lbl.Length > 0 && ctn != null && ctn.Length > 0 && tl != null && tl.Length > 0) { //Page request (NOT a postback) from this page (i.e. StoreDetail.aspx?CTN=&LBL=&TL=) //Build summary record for the specified carton (needed by CartonDetail.aspx) TrackingDS summary = new TrackingDS(); summary.CartonSummaryTable.AddCartonSummaryTableRow(lbl, ctn, lbl, lbl, "", "", "", ""); //Build detail for the specified carton (needed by CartonDetail.aspx) TrackingDS cartons = new TrackingDS(); MembershipServices membership = new MembershipServices(); ProfileCommon profile = membership.MemberProfile; TrackingServices svcs = new TrackingServices(); DataSet ds = svcs.GetCartons(lbl, TrackingServices.SEARCHBY_LABELNUMBER, profile.Type, profile.ClientVendorID); cartons.Merge(ds); Session["TrackingSummary"] = Session["TrackingDetail"] = null; if (cartons.CartonDetailTable.Rows.Count > 0) { Session["TrackingSummary"] = summary; Session["TrackingDetail"] = cartons; Response.Redirect("CartonDetail.aspx?ID=" + lbl + "&TL=" + tl); } else { this.errorLabel.Text = "An error occured. System is unable to show details."; } } else { //Something went wrong Response.Redirect("StoreSummary.aspx"); } } }
public TrackingItems TrackCartons(string[] itemNumbers, string companyID) { //Get tracking information for the specified items and company TrackingItems items = null; //Get tracking response for the specified requests items = new TrackingItems(); string numbers = ""; for (int i = 0; i < itemNumbers.Length; i++) { if (i > 0) { numbers += ","; } numbers += itemNumbers[i]; } //Get tracking data response DataSet ds = new DataService().FillDataset(SQL_CONN, USP_BYCARTON, TBL_BYCARTON, new object[] { numbers, companyID, null }); if (ds != null && ds.Tables[TBL_BYCARTON].Rows.Count > 0) { TrackingDS cartons = new TrackingDS(); DataView view = ds.Tables[TBL_BYCARTON].DefaultView; view.Sort = "CTN,BL DESC,SCNTP DESC,SCD DESC,SCT DESC"; DataTable dt = view.Table.Clone(); Hashtable ht = new Hashtable(); for (int i = 0; i < view.Count; i++) { string key = view[i]["CTN"].ToString().Trim() + view[i]["BL"].ToString().Trim(); if (!ht.ContainsKey(key)) { ht.Add(key, null); dt.ImportRow(view[i].Row); } } cartons.TrackingTable.Merge(dt); //Return records for all found items foreach (TrackingDS.TrackingTableRow carton in cartons.TrackingTable.Rows) { //Keep the response item if it matches a requested item for (int i = 0; i < itemNumbers.Length; i++) { if (carton.CTN.Trim() == itemNumbers[i]) { //Keep it TrackingItem item = new TrackingItem(itemNumbers[i], carton); items.Add(item); itemNumbers[i] = ""; //Mark as found by nulling it break; } } } //Return a record for all unfound requests for (int i = 0; i < itemNumbers.Length; i++) { if (itemNumbers[i].Length > 0) { items.Add(new TrackingItem(itemNumbers[i])); } } } return(items); }
protected void OnPODRequest(object sender, EventArgs e) { //Send request to Customer Service and confirmation to user TrackingDS.CartonDetailTableRow carton = null; string cbol = ""; bool imageFound = false; MembershipServices membership = new MembershipServices(); TrackingDS summary = (TrackingDS)Session["TrackingSummary"]; TrackingDS.CartonSummaryTableRow summaryRow = summary.CartonSummaryTable.FindByID(this.CartonNumberValue.Text); if (summaryRow == null) { summaryRow = summary.CartonSummaryTable.FindByID(this.LabelSeqValue.Text); } if (summaryRow != null) { //Get all detail rows for this carton string filter = "[LBL]=" + summaryRow.LBLNumber; TrackingDS cartons = (TrackingDS)Session["TrackingDetail"]; DataRow[] detailRows = cartons.CartonDetailTable.Select(filter); if (detailRows != null && detailRows.Length > 0) { //Get carton data carton = (TrackingDS.CartonDetailTableRow)detailRows[0]; if (membership.IsAdmin || membership.IsArgix || membership.IsPODMember) { //Check for a POD image for this CBOL cbol = carton.IsCBOLNull() ? "" : carton.CBOL.Trim(); if (cbol.Length > 0) { string cl = carton.CL.Trim().PadLeft(3, '0'); string div = "%"; string st = carton.S.ToString().PadLeft(5, '0'); Imaging.ImageService isvc = new Imaging.ImageService(); isvc.Url = Application["ImageService"].ToString(); isvc.UseDefaultCredentials = true; DataSet ds = isvc.SearchSharePointImageStore("TBill", "TBBarCode", cbol + cl + div + st + "%"); imageFound = (ds != null && ds.Tables[0].Rows.Count > 0); } } } } if (imageFound) { //Image available- open image into another browser instance System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language=javascript>"); sb.Append("window.open('PODImage.aspx?doc=TBill&prop=TBBarCode&search=" + cbol + "%', '_blank', 'width=480,height=576,menubar=yes,location=no,toolbar=no,status=yes,resizable=yes');"); sb.Append("</script>"); Page.ClientScript.RegisterStartupScript(typeof(Page), "POD Image", sb.ToString()); } else { //No image; request a POD from Argix EmailServices svcs = new EmailServices(); MembershipUser user = Membership.GetUser(); string substore = Session["SubStore"] != null ? Session["SubStore"].ToString() : ""; svcs.SendPODRequest(user, carton, substore); svcs.SendPODRequestConfirm(user, carton, substore); //Disply confirmation to user Response.Redirect("PODConfirmation.aspx"); } }