Example #1
0
    private void BindDeliveryOrder()
    {
        TransactionBC   objBC    = new TransactionBC();
        PurchaseOrderBC objPucBC = new PurchaseOrderBC();

        try
        {
            DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text);
            DateTime?DateTo   = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text);
            GenericCollection <DeliveryShipmentBE> listOfBE = objBC.GetDeliveryShipmentDetails("Get", TxtIDOC.Text.Trim(), txtDO.Text.Trim(), txtPO.Text.Trim(), drdStatus.SelectedValue, drdServiceComponentPartnerSearch.SelectedValue, txtPlant.Text.Trim(), txtOrderType.Text.Trim(), DateFrom, DateTo);

            foreach (DeliveryShipmentBE obj in listOfBE)
            {
                string PartnerName = objPucBC.GetPartnerName(obj.Plant);
                obj.CM = PartnerName == "" ? obj.CM : PartnerName;
            }

            Session[vDOList] = listOfBE;



            if (ViewState[grdPageSize] != null)
            {
                gvDO.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString());
            }
            else
            {
                gvDO.PageSize = 10;
            }


            lblRec.Text  = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count);
            gvDO.Visible = true;
            if (listOfBE != null && listOfBE.Count > 0)
            {
                rowPage.Visible = true;
                rowGrid.Visible = true;

                gvDO.DataSource = listOfBE;
                gvDO.DataBind();
                lblRec.Text    = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count);
                gvDO.Visible   = true;
                lblRec.Visible = true;
            }
            else
            {
                lblRec.Visible  = false;
                rowGrid.Visible = false;
                rowPage.Visible = false;


                gvDO.Visible    = false;
                gvDO.DataSource = null;
                gvDO.DataBind();
                lblSearchError.Text    = "No records found.";
                lblSearchError.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblSearchError.Text    = ex.Message;
            lblSearchError.Visible = true;
            logFile.ErrorLogging(ex);
        }
    }
Example #2
0
    private GenericCollection <ASNHeaderBE> PrepareASNList(GenericCollection <ASNHeaderBE> listOfBE)
    {
        TransactionBC   objTranBC = new TransactionBC();
        PurchaseOrderBC objBC     = new PurchaseOrderBC();
        GenericCollection <ASNHeaderBE> ASNList = new GenericCollection <ASNHeaderBE>();

        for (int i = 0; i < listOfBE.Count; i++)
        {
            ASNHeaderBE objBE = new ASNHeaderBE();
            objBE.SNo     = i;
            objBE.TxnType = "3B2";
            objBE.TxnDate = listOfBE[i].TxnDate;
            //string File = listOfBE[0].ArchiveFile;
            XmlDocument ASNFile = new XmlDocument();
            //ASNFile.Load(@"D:\BPM\SampleFiles\ASNEGLFiles.xml");
            ASNFile.Load(listOfBE[i].ArchiveFile);
            objBE.ArchiveFile = listOfBE[i].ArchiveFile;
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(ASNFile.NameTable);
            namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.HED.ShowShipment_V02_00_00");

            XmlNode xPartnerNode = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/Sender/ns0:LogicalId", namespaceManager);
            objBE.CM = xPartnerNode == null ? "" : objBC.GetPartnerName(xPartnerNode.InnerText);
            objBE.CM = objBE.CM == "" ? xPartnerNode.InnerText : objBE.CM;

            XmlNode xASTransactionID = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/ApplicationArea/ns0:ReferenceId", namespaceManager);
            objBE.ASFeedTxnID = xASTransactionID == null ? "" : xASTransactionID.InnerText;

            XmlNode xReceiverKey = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/routing/ReceiverKey", namespaceManager);
            objBE.ReceiverKey = xReceiverKey == null ? "" : xReceiverKey.InnerText;

            XmlNode xShipDate = ASNFile.SelectSingleNode("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TransportationEvent/ns0:DateTime", namespaceManager);
            if (xShipDate != null)
            {
                try
                {
                    objBE.ShipDate = Convert.ToDateTime(xShipDate.InnerText.Substring(0, 4) + "-" + xShipDate.InnerText.Substring(4, 2) + "-" + xShipDate.InnerText.Substring(6, 2));
                }
                catch (Exception ex)
                {
                }
            }

            XmlNodeList PartiesNodeList        = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/Parties", namespaceManager);
            XmlNodeList TrackingReferenceNodes = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/Header/TrackingReference", namespaceManager);
            XmlNodeList LineItemNodes          = ASNFile.SelectNodes("ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem", namespaceManager);

            if (LineItemNodes != null)
            {
                objBE.LineCount = LineItemNodes.Count;
            }


            foreach (XmlNode xnd in PartiesNodeList)
            {
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Originating Party")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    objBE.OriginationParty = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText);
                    objBE.OriginationParty = objBE.OriginationParty == "" ? xCMNode.InnerText : objBE.OriginationParty;
                }
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Selling Partner")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    objBE.SellingPartner = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText);
                    objBE.SellingPartner = objBE.SellingPartner == "" ? xCMNode.InnerText : objBE.SellingPartner;
                }
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Ship To")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    objBE.SAPShipTo = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText);
                    objBE.SAPShipTo = objBE.SAPShipTo == "" ? xCMNode.InnerText : objBE.SAPShipTo;
                }

                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Freight Forwarder")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    objBE.FMV = xCMNode == null ? "" : objBC.GetPartnerName(xCMNode.InnerText);
                    objBE.FMV = objBE.FMV == "" ? xCMNode.InnerText : objBE.FMV;
                }
            }
            foreach (XmlNode xnd in TrackingReferenceNodes)
            {
                if (xnd.SelectSingleNode("ns0:TrackingCode", namespaceManager).InnerText == "Load Identifier")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:TrackingId", namespaceManager);
                    objBE.LoadID = xCMNode == null ? "" : xCMNode.InnerText.Substring(0, xCMNode.InnerText.Length - 2);
                }
            }
            GenericCollection <ASNLinesBE> objLinesList = new GenericCollection <ASNLinesBE>();
            int j = 0;
            foreach (XmlNode xnd in LineItemNodes)
            {
                ASNLinesBE  objLineBE       = new ASNLinesBE();
                XmlNodeList LineDocRefNodes = ASNFile.SelectNodes("/ns0:ShowShipment_V02_00_00/DataArea/Shipment/LineItem/DocumentReference", namespaceManager);
                foreach (XmlNode xndDoc in LineDocRefNodes)
                {
                    if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Packing Slip Number")
                    {
                        XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager);
                        objLineBE.PackSlipNumber = xPartnerNode == null ? "" : xCMNode.InnerText;
                    }
                    if (xndDoc.SelectSingleNode("ns0:DocumentTypeCode", namespaceManager).InnerText == "Purchase Order")
                    {
                        XmlNode xCMNode = xndDoc.SelectSingleNode("ns0:Id", namespaceManager);
                        objLineBE.PONumber = xPartnerNode == null ? "" : xCMNode.InnerText;
                        XmlNode xLineNumber = xndDoc.SelectSingleNode("ns0:LineNumber", namespaceManager);
                        objLineBE.LineNumber = xLineNumber == null ? "" : xLineNumber.InnerText;
                    }
                }
                XmlNode xSKUNode = xnd.SelectSingleNode("OrderItem/ns0:ProductIdentifier", namespaceManager);
                objLineBE.SKU = xSKUNode == null ? "" : xSKUNode.InnerText;
                XmlNode xUnitsShippedNode = xnd.SelectSingleNode("ns0:UnitsShipped", namespaceManager);
                objLineBE.ItemQuantity = xUnitsShippedNode == null ? "" : xUnitsShippedNode.InnerText;
                objLinesList.Add(j, objLineBE);
                j++;
            }
            objBE.ASNLines = objLinesList;
            if (objBE.LineCount == 1 && objLinesList != null)
            {
                objBE.PONumber = objLinesList[0].PONumber;
            }
            else
            {
                objBE.PONumber = "See Details";
            }
            ASNList.Add(i, objBE);
        }
        return(ASNList);
    }
Example #3
0
    private void LoadPODetails(string PoNumber, string POFile, string MessageType)
    {
        try
        {
            PurchaseOrderBC objBC = new PurchaseOrderBC();
            //string ArchiveFile = objBC.GetPOArchiveFile(PONumber);

            XmlDocument poFile = new XmlDocument();
            poFile.Load(POFile);
            string RootNode = "";
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(poFile.NameTable);
            if (MessageType.ToLower() == "http://ms.it.ops.cm.processpurchaseorder_v02_10_00#processpurchaseorder_v02_10_00")
            {
                namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.CM.ProcessPurchaseOrder_V02_10_00");
                RootNode = "ProcessPurchaseOrder_V02_10_00";
            }
            else
            {
                namespaceManager.AddNamespace("ns0", "http://MS.IT.Ops.CM.ChangePurchaseOrder_V01_00_00");
                RootNode = "ChangePurchaseOrder_V01_00_00";
            }

            XmlNode xPriceNode = poFile.SelectSingleNode("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/ns0:Price/ns0:Amount", namespaceManager);
            lblPOTotalPrice.Text = xPriceNode == null ? "" : xPriceNode.InnerText;
            XmlNodeList PartiesNodeList = poFile.SelectNodes("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/ns0:Parties", namespaceManager);


            foreach (XmlNode xnd in PartiesNodeList)
            {
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "SAPVendor")
                {
                    XmlNode xSAPVendorNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    lblSAPVendorNumber.Text = xSAPVendorNode == null ? "" : xSAPVendorNode.InnerText;
                    lblSAPVendorNumber.Text = objBC.GetPartnerName(lblSAPVendorNumber.Text);
                }
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "Contract Manufacturer")
                {
                    XmlNode xCMNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    lblCM.Text = xCMNode == null ? "" : xCMNode.InnerText;
                    lblCM.Text = objBC.GetPartnerName(lblCM.Text);
                }
                if (xnd.SelectSingleNode("ns0:PartyTypeCode", namespaceManager).InnerText == "ShipTo")
                {
                    XmlNode xNameNode = xnd.SelectSingleNode("ns0:ContactInformation/ns0:Name", namespaceManager);
                    lblShipToName.Text = xNameNode == null ? "" : xNameNode.InnerText;
                    XmlNode xPhoneNode = xnd.SelectSingleNode("ns0:ContactInformation/ns0:Phone", namespaceManager);
                    lblShipToPhone.Text = xPhoneNode == null ? "" : xPhoneNode.InnerText;
                    XmlNode xPartnerNameNode = xnd.SelectSingleNode("ns0:PartyIdentifier", namespaceManager);
                    lblShipToPartnername.Text = xPartnerNameNode == null ? "" : xPartnerNameNode.InnerText;
                    lblShipToPartnername.Text = objBC.GetPartnerName(lblShipToPartnername.Text);
                    XmlNode xAddressLine1Node = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:AddressLine1", namespaceManager);
                    lblShipToAddressLine1.Text = xAddressLine1Node == null ? "" : xAddressLine1Node.InnerText;
                    XmlNode xCityNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:City", namespaceManager);
                    lblShipToCity.Text = xCityNode == null ? "" : xCityNode.InnerText;
                    XmlNode xCountryNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:Country", namespaceManager);
                    lblShipToCountry.Text = xCountryNode == null ? "" : xCountryNode.InnerText;
                    XmlNode xZipNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:Zip", namespaceManager);
                    lblShipToZIP.Text = xZipNode == null ? "" : xZipNode.InnerText;
                    XmlNode xStateNode = xnd.SelectSingleNode("ns0:PhysicalAddress/ns0:State", namespaceManager);
                    lblShipToState.Text = xStateNode == null ? "" : xStateNode.InnerText;
                }
            }

            XmlNode xPOTypeNode = poFile.SelectSingleNode("/ns0:" + RootNode + "/DataArea/PurchaseOrder/Header/Application/SAP/ns0:PurchaseOrderType", namespaceManager);
            lblSAPPOType.Text = xPOTypeNode == null ? "" : xPOTypeNode.InnerText;

            BindPOLines(poFile, namespaceManager, RootNode);
            GenericCollection <PurchaseOrderHistoryBE> POHistryList = new GenericCollection <PurchaseOrderHistoryBE>();
            POHistryList = objBC.BindPOHistory(PoNumber);
            Session["POHistoryCollection"] = POHistryList;
            databind();
            this.ViewState["vs"] = 0;
            databindPOHistory();
            this.ViewState["vsHistory"] = 0;

            trPODetails.Visible = true;
        }
        catch (Exception Ex)
        {
            lblSearchError.Text    = Ex.Message;
            lblSearchError.Visible = true;
            logFile.ErrorLogging(Ex);
            trPODetails.Visible = false;
        }
    }
    private void BindShowShipment()
    {
        TransactionBC   objBC    = new TransactionBC();
        PurchaseOrderBC objPucBC = new PurchaseOrderBC();

        try
        {
            DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text);
            DateTime?DateTo   = txtDateTo.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text);

            TimeSpan?duration = null;

            // Assign values to a and b...

            if (DateFrom.HasValue && DateTo.HasValue)
            {
                duration = DateTo.Value - DateFrom.Value;
            }

            double days = duration.GetValueOrDefault().TotalDays;

            if (days > 2 && txtDO.Text.Trim() == "")
            {
                lblSearchError.Text    = "Please select 2 Days difference between dates due to high volume of data or Provide DO Number to Search";
                lblSearchError.Visible = true;
                return;
            }

            GenericCollection <ShowShipmentBE> listOfBE = objBC.GetShowShipment945Details("Get", TxtIDOC.Text.Trim(), txtDO.Text.Trim(), txtLoadID.Text.Trim(), drdStatus.SelectedValue, drdTxnType.SelectedValue, drdServiceComponentPartnerSearch.SelectedValue, txtPlant.Text.Trim(), txtOrderType.Text.Trim(), DateFrom, DateTo);

            foreach (ShowShipmentBE objExt1 in listOfBE)
            {
                if (objExt1.StageName == "SentPositive997ToPartner")
                {
                    objExt1.Ack997Status = "pos997";
                }
                if (objExt1.StageName == "SentNegative997ToPartner")
                {
                    objExt1.Ack997Status = "neg997";
                }
                if (objExt1.StageName == "SentPositiveEDI824ToPartner")
                {
                    objExt1.Ack824Status = "pos824";
                }
                if (objExt1.StageName == "SentNegativeEDI824ToPartner")
                {
                    objExt1.Ack824Status = "Neg824";
                }
                if (objExt1.StageName == "SendPositiveEDI824for945ToBatchPrimaryTransport")
                {
                    objExt1.Ack824Status = "Pos824Batch";
                }
                if (objExt1.StageName == "SendNegativeEDI824for945ToBatchPrimaryTransport")
                {
                    objExt1.Ack824Status = "Neg824Batch";
                }
                if (objExt1.StageName == "SendNegativeEDI824for945ToBatchSecondaryTransport")
                {
                    objExt1.Ack824Status = "Neg824Batch";
                }
                if (objExt1.StageName == "SendPositiveEDI824for945ToBatchSecondaryTransport")
                {
                    objExt1.Ack824Status = "Pos824Batch";
                }
                if (objExt1.StageName == "AperakAckSentToPartner")
                {
                    objExt1.AckAperakStatus = "posAperak";
                }
                if (objExt1.StageName == "AperakNAckSentToPartner")
                {
                    objExt1.AckAperakStatus = "negAperak";
                }
                if (objExt1.MDNStatus == "RcvdPositiveMDNFromPartner")
                {
                    objExt1.MDNStatus = "PosMDN";
                }
                if (objExt1.MDNStatus == "Error_RcvdNegativeMDNFromPartnerEx")
                {
                    objExt1.MDNStatus = "NegMDN";
                }
                if (objExt1.MDNStatus == "Error_MDNNotReceivedFromPartner")
                {
                    objExt1.MDNStatus = "NoMDN";
                }
            }

            foreach (ShowShipmentBE obj in listOfBE)
            {
                string PartnerName = objPucBC.GetPartnerName(obj.Plant);
                obj.CM = PartnerName == "" ? obj.CM : PartnerName;
            }

            Session[vSSList] = listOfBE;



            if (ViewState[grdPageSize] != null)
            {
                gvDO.PageSize = Convert.ToInt32(ViewState[grdPageSize].ToString());
            }
            else
            {
                gvDO.PageSize = 10;
            }


            lblRec.Text  = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count);
            gvDO.Visible = true;
            if (listOfBE != null && listOfBE.Count > 0)
            {
                rowPage.Visible = true;
                rowGrid.Visible = true;

                gvDO.DataSource = listOfBE;
                gvDO.DataBind();
                lblRec.Text    = Utils.GridRecDispMsg(gvDO.PageIndex, gvDO.PageSize, listOfBE.Count);
                gvDO.Visible   = true;
                lblRec.Visible = true;
            }
            else
            {
                lblRec.Visible  = false;
                rowGrid.Visible = false;
                rowPage.Visible = false;


                gvDO.Visible    = false;
                gvDO.DataSource = null;
                gvDO.DataBind();
                lblSearchError.Text    = "No records found.";
                lblSearchError.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblSearchError.Text    = ex.Message;
            lblSearchError.Visible = true;
            logFile.ErrorLogging(ex);
        }
    }