예제 #1
0
    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.");
            }
        }
    }
예제 #2
0
    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.");
        }
    }
예제 #3
0
    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);
    }
예제 #4
0
    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);
    }
예제 #5
0
    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);
    }
예제 #6
0
    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);
    }
예제 #7
0
    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.");
        }
    }
예제 #8
0
    //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");
            }
        }
    }