示例#1
0
    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");
        }
    }