public GenericCollection <PurchaseOrderBE> GetPurchaseOrdersList(string TaskID, string Partner, DateTime?DateFrom, DateTime?DateTO, string PONumner)
        {
            string BAMEnvironment     = HttpContext.Current.Session["Environment"] != null ? HttpContext.Current.Session["Environment"].ToString() : "UAT";
            string corpnetconnection1 = BAMEnvironment == "UAT" ? ConfigurationSettings.AppSettings["UATCorpnetBAMConn"].ToString() : ConfigurationSettings.AppSettings["ProdCorpnetBAMConn"].ToString();

            SqlConnection corpnetconnection = new SqlConnection(corpnetconnection1);
            GenericCollection <PurchaseOrderBE> PurchaseOrderList = new GenericCollection <PurchaseOrderBE>();

            try
            {
                SqlParameter[] sqlparams = new SqlParameter[5];
                sqlparams[0] = new SqlParameter("@TaskID", TaskID);
                sqlparams[1] = new SqlParameter("@StartDate", DateFrom != null ? DateFrom : Convert.ToDateTime("1/1/1990"));
                sqlparams[2] = new SqlParameter("@EndDate", DateTO != null ? DateTO : Convert.ToDateTime("12/31/2050"));
                sqlparams[3] = new SqlParameter("@Partner", Partner);
                sqlparams[4] = new SqlParameter("@PONumber", PONumner);
                DataSet ds = null;
                ds = SqlHelper.ExecuteDataset(corpnetconnection, CommandType.StoredProcedure, "Get_PODetails", sqlparams);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            PurchaseOrderBE objBE = new PurchaseOrderBE();
                            objBE.PONumber       = ds.Tables[0].Rows[i]["TransactionID"].ToString();
                            objBE.TxnType        = ds.Tables[0].Rows[i]["TaskID"].ToString();
                            objBE.CM             = ds.Tables[0].Rows[i]["CM"].ToString();
                            objBE.CorpnetStatus  = ds.Tables[0].Rows[i]["POStatus"].ToString();
                            objBE.ExtranetStatus = "NA";
                            objBE.PODate         = ds.Tables[0].Rows[i]["PODate"].ToString();
                            objBE.ASNDate        = ds.Tables[0].Rows[i]["ASNDate"].ToString();
                            objBE.ASNDate        = objBE.ASNDate != "" ? objBE.ASNDate.Substring(0, 16) : "";
                            objBE.ASNStatus      = ds.Tables[0].Rows[i]["ASNStatus"].ToString();
                            objBE.GRDate         = ds.Tables[0].Rows[i]["GRDate"].ToString();
                            objBE.GRDate         = objBE.GRDate != "" ? objBE.GRDate.Substring(0, 16) : "";
                            objBE.GRStatus       = ds.Tables[0].Rows[i]["GRStatus"].ToString();
                            PurchaseOrderList.Add(i, objBE);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PurchaseOrderList);
        }
    private static void CommandExecutor(ref GenericCollection <string> genericCollection, string input, ref string result)
    {
        string[] commandOfArgs = input
                                 .Split(' ');

        switch (commandOfArgs[0])
        {
        case "Add":
            genericCollection.Add(commandOfArgs[1]);
            break;

        case "Remove":
            int index = int.Parse(commandOfArgs[1]);
            genericCollection.Remove(index);
            break;

        case "Contains":
            result = genericCollection.Contains(commandOfArgs[1]).ToString();
            break;

        case "Swap":
            int index1 = int.Parse(commandOfArgs[1]);
            int index2 = int.Parse(commandOfArgs[2]);
            genericCollection.Swap(index1, index2);
            break;

        case "Greater":
            result = genericCollection.CountGreaterThan(commandOfArgs[1]).ToString();
            break;

        case "Max":
            result = genericCollection.Max();
            break;

        case "Min":
            result = genericCollection.Min();
            break;

        case "Sort":
            Sorter sorter = new Sorter();
            genericCollection = sorter.Sort(genericCollection);
            break;

        case "Print":
            result = genericCollection.Print();
            break;
        }
    }
        public static GenericCollection <TItem> GetUniqueCollection <TItem>(this GenericCollection <TItem> collection)
        {
            var result  = new GenericCollection <TItem>();
            var history = new List <TItem>();

            foreach (var item in collection)
            {
                if (!history.Contains(item))
                {
                    result.Add(item);
                    history.Add(item);
                }
            }

            return(result);
        }
        public static GenericCollection <TItem> ScrambleWordList <TItem>(this GenericCollection <TItem> collection)
        {
            var selectedWords = collection.Where(w => random.Next(0, 2) == 0).ToArray();
            var initialSize   = collection.Count;

            collection.Clear();

            for (int i = 0; i < initialSize; i++)
            {
                var selectedIndex = random.Next(0, selectedWords.Length);

                collection.Add(selectedWords[selectedIndex]);
            }

            return(collection);
        }
示例#5
0
        public static GenericCollection <Character> FilterForHumans(this Knot <Character> knot)
        {
            var result      = new GenericCollection <Character>();
            var currentKnot = knot.Start;

            while (currentKnot.Next != null)
            {
                if (currentKnot.Data.Species.SpeciesId == 1)
                {
                    result.Add(currentKnot.Data);
                }

                currentKnot = currentKnot.Next;
            }

            return(result);
        }
示例#6
0
        static void GenericCollectionExample()
        {
            GenericCollection <int> genericCollectionInts = new GenericCollection <int>();

            genericCollectionInts.Add(4);
            genericCollectionInts.Add(24);
            genericCollectionInts.Add(45);
            genericCollectionInts.Add(422);
            genericCollectionInts.Add(44);
            genericCollectionInts.Add(41);
            genericCollectionInts.Add(41);

            for (int i = 0; i < genericCollectionInts.Length; i++)
            {
                Console.WriteLine(genericCollectionInts[i]);
            }

            GenericCollection <int> genericCollectionInts2 = new GenericCollection <int>();

            genericCollectionInts2.Add(4);
            genericCollectionInts2.Add(24);
            genericCollectionInts2.Add(45);

            GenericCollection <string> genericCollectionString = new GenericCollection <string>();

            genericCollectionString.Add("a");
            genericCollectionString.Add("b");
            genericCollectionString.Add("c");
            genericCollectionString.Add("d");
            genericCollectionString.Add("e");
            genericCollectionString.Add("f");
            genericCollectionString.Add("g");
            genericCollectionString.Add("k");
            genericCollectionString.Add("j");

            for (int i = 0; i < genericCollectionString.Length; i++)
            {
                Console.WriteLine(genericCollectionString[i]);
            }

            Console.ReadLine();
        }
        public GenericCollection <PurchaseOrderBE> ModifyExtranetPODetails(string POList, string Type)
        {
            string BAMEnvironment = HttpContext.Current.Session["Environment"] != null ? HttpContext.Current.Session["Environment"].ToString() : "UAT";

            string extranetconnection1 = BAMEnvironment == "UAT" ? ConfigurationSettings.AppSettings["UATExtranetBAMConn"].ToString() : ConfigurationSettings.AppSettings["ProdExtranetBAMConn1"].ToString();


            SqlConnection extranetconnection = new SqlConnection(extranetconnection1);
            GenericCollection <PurchaseOrderBE> PurchaseOrderList = new GenericCollection <PurchaseOrderBE>();

            try
            {
                SqlParameter[] sqlparams = new SqlParameter[2];
                sqlparams[0] = new SqlParameter("@TxnID", POList);
                sqlparams[1] = new SqlParameter("@type", Type);
                DataSet ds = null;
                ds = SqlHelper.ExecuteDataset(extranetconnection, CommandType.StoredProcedure, "usp_get_IndividualPODetails", sqlparams);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            PurchaseOrderBE objBE = new PurchaseOrderBE();
                            objBE.ReferenceID    = ds.Tables[0].Rows[i]["TransactionID"].ToString();
                            objBE.ExtranetStatus = ds.Tables[0].Rows[i]["Status"].ToString();
                            objBE.POCBODRcvd     = ds.Tables[0].Rows[i]["Field5"].ToString();
                            PurchaseOrderList.Add(i, objBE);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PurchaseOrderList);
        }
示例#8
0
        public GenericCollection <ServiceComponent> GetServiceComponentList(string ServiceLineID, string ServiceID, string ServiceOptionID, string ServCompType)
        {
            GenericCollection <ServiceComponent> ServiceComponentList = new GenericCollection <ServiceComponent>();

            try
            {
                SqlParameter[] sqlparams = new SqlParameter[4];
                sqlparams[0] = new SqlParameter("@ServiceLineID", ServiceLineID);
                sqlparams[1] = new SqlParameter("@ServiceID", ServiceID);
                sqlparams[2] = new SqlParameter("@ServiceOptionID", ServiceOptionID);
                sqlparams[3] = new SqlParameter("@ServiceComponentType", ServCompType);
                DataSet ds = null;
                ds = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, "Get_ServiceComponentList", sqlparams);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            ServiceComponent objBE = new ServiceComponent();
                            if (ServCompType == "SCH")
                            {
                                objBE.ServiceComponentID = Convert.ToInt32(ds.Tables[0].Rows[i]["ServiceComponentID"].ToString());
                            }
                            objBE.ServiceComponentDesc = ds.Tables[0].Rows[i]["ServiceComponentDesc"].ToString();
                            ServiceComponentList.Add(i, objBE);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ServiceComponentList);
        }
示例#9
0
    private void BindPurchaseOrder()
    {
        PurchaseOrderBC objBC = new PurchaseOrderBC();

        try
        {
            trPODetails.Visible = false;
            DateTime?DateFrom = txtDateFrom.Text == "" ? Convert.ToDateTime("1/1/1990") : Convert.ToDateTime(txtDateFrom.Text);
            DateTime?DateTo   = txtDateFrom.Text == "" ? Convert.ToDateTime("12/31/2050") : Convert.ToDateTime(txtDateTo.Text);
            trPODetails.Visible = false;
            GenericCollection <PurchaseOrderBE> listOfBE = objBC.GetIndividualPODetails(txtPONumber.Text, drdTxnType.SelectedValue, DateFrom, DateTo, drdServiceComponentPartnerSearch.SelectedValue);

            GenericCollection <PurchaseOrderBE> FinalList = new GenericCollection <PurchaseOrderBE>();


            string ExtranetPartners = ConfigurationSettings.AppSettings["ExtranetCMS"];

            foreach (PurchaseOrderBE objBE in listOfBE)
            {
                if (ExtranetPartners.Contains(objBE.CM))
                {
                    objBE.isICOEPartner = "NO";
                }
                else
                {
                    objBE.isICOEPartner = "YES";
                }
            }

            if (drdISOEorExtranet.SelectedIndex == 1)
            {
                int i = 0;
                foreach (PurchaseOrderBE obj1 in listOfBE)
                {
                    if (obj1.isICOEPartner == "YES")
                    {
                        FinalList.Add(i, obj1);
                    }
                }
                listOfBE = FinalList;
            }

            if (drdISOEorExtranet.SelectedIndex == 2)
            {
                int i = 0;
                foreach (PurchaseOrderBE obj1 in listOfBE)
                {
                    if (obj1.isICOEPartner == "NO")
                    {
                        FinalList.Add(i, obj1);
                    }
                }
                listOfBE = FinalList;
            }


            if (drdISOEorExtranet.SelectedIndex != 1)
            {
                listOfBE = ModifyExtranetPODetails(listOfBE);
            }


            if (drdPOStatus.SelectedIndex == 1)
            {
                int j = 0;
                for (int i = 0; i < listOfBE.Count; i++)
                {
                    if (listOfBE[i].isICOEPartner == "NO" && listOfBE[i].ExtranetStatus.ToLower() == "success")
                    {
                        FinalList.Add(j, listOfBE[i]);
                        j++;
                    }
                    if (listOfBE[i].isICOEPartner == "YES" && listOfBE[i].CorpnetStatus.ToLower() == "success")
                    {
                        FinalList.Add(j, listOfBE[i]);
                        j++;
                    }
                }
                listOfBE = FinalList;
            }

            if (drdPOStatus.SelectedIndex == 2)
            {
                int j = 0;
                for (int i = 0; i < listOfBE.Count; i++)
                {
                    if (listOfBE[i].isICOEPartner == "NO" && listOfBE[i].ExtranetStatus.ToLower() == "failed")
                    {
                        FinalList.Add(j, listOfBE[i]);
                        j++;
                    }
                    if (listOfBE[i].isICOEPartner == "YES" && listOfBE[i].CorpnetStatus.ToLower() == "failed")
                    {
                        FinalList.Add(j, listOfBE[i]);
                        j++;
                    }
                }
                listOfBE = FinalList;
            }

            if (drdPOStatus.SelectedIndex == 3)
            {
                for (int i = 0; i < listOfBE.Count; i++)
                {
                    if (listOfBE[i].isICOEPartner == "NO" && (listOfBE[i].ExtranetStatus.ToLower() == "failed" || listOfBE[i].ExtranetStatus.ToLower() == "na"))
                    {
                        FinalList.Add(i, listOfBE[i]);
                    }
                }
                listOfBE = FinalList;
            }


            //listOfBE = GetASNStatus(listOfBE);


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


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

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


                gvPurchaseOrder.Visible    = false;
                gvPurchaseOrder.DataSource = null;
                gvPurchaseOrder.DataBind();
                lblSearchError.Text    = "No records found.";
                lblSearchError.Visible = true;
            }
            Session[vPOList] = listOfBE;
        }
        catch (Exception ex)
        {
            lblSearchError.Text    = ex.Message;
            lblSearchError.Visible = true;
            logFile.ErrorLogging(ex);
        }
    }
示例#10
0
    private void BindPurchaseOrder()
    {
        TransactionBC objBC = new TransactionBC();

        try
        {
            trPODetails.Visible = false;
            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 <ASNHeaderBE> listOfBE    = objBC.GetASNArchiveFiles(DateFrom, DateTo);
            GenericCollection <ASNHeaderBE> DisplayList = new GenericCollection <ASNHeaderBE>();



            //for (int i = 0; i < listOfBE.Count; i++)
            //{
            //    for (int j = 0; j < listOfBE.Count; j++)
            //    {
            //        TimeSpan? duration = listOfBE[i].TxnDate.Value - listOfBE[j].TxnDate.Value;

            //        if (duration.Value.Duration().TotalSeconds < 20)
            //            listOfBE[j].TxnDate = listOfBE[i].TxnDate;
            //    }
            //}

            //for (int j = 0; j < listOfBE.Count; j++)
            //{
            //    if (DisplayList.Count == 0)
            //    {
            //        DisplayList.Add(j, listOfBE[j]);
            //    }
            //    else
            //    {
            //        bool duplicate = false;
            //        for (int k = 0; k < DisplayList.Count; k++)
            //        {
            //            if (listOfBE[j].TxnDate == DisplayList[k].TxnDate)
            //                duplicate = true;
            //        }
            //        if (!duplicate)
            //            DisplayList.Add(DisplayList.Count, listOfBE[j]);
            //    }
            //}

            //if (DisplayList.Count > 0)
            //{
            //    listOfBE = DisplayList;
            //    DisplayList = null;
            //}

            listOfBE = PrepareASNList(listOfBE);

            for (int i = 0; i < listOfBE.Count; i++)
            {
                for (int j = 0; j < listOfBE.Count; j++)
                {
                    if (listOfBE[i].LoadID == listOfBE[j].LoadID && listOfBE[i].PONumber == listOfBE[j].PONumber && listOfBE[j].ReceiverKey != "HEDBTS")
                    {
                        listOfBE[i].FMVCopy = listOfBE[j].ArchiveFile;
                    }
                }
            }


            for (int j = 0; j < listOfBE.Count; j++)
            {
                if (DisplayList == null)
                {
                    if (listOfBE[j].ReceiverKey == "HEDBTS")
                    {
                        DisplayList.Add(j, listOfBE[j]);
                    }
                }
                else
                {
                    bool duplicate = false;
                    for (int k = 0; k < DisplayList.Count; k++)
                    {
                        if ((listOfBE[j].ReceiverKey == "HEDBTS" && listOfBE[j].LoadID == DisplayList[k].LoadID && listOfBE[j].PONumber == DisplayList[k].PONumber) || listOfBE[j].ReceiverKey != "HEDBTS")
                        {
                            duplicate = true;
                        }
                    }
                    if (!duplicate)
                    {
                        DisplayList.Add(DisplayList.Count, listOfBE[j]);
                    }
                }
            }
            if (DisplayList.Count > 0)
            {
                listOfBE    = DisplayList;
                DisplayList = null;
            }

            if (drdServiceComponentPartnerSearch.SelectedIndex != 0)
            {
                for (int j = 0; j < listOfBE.Count; j++)
                {
                    if (listOfBE[j].CM != drdServiceComponentPartnerSearch.SelectedValue)
                    {
                        DisplayList.Add(j, listOfBE[j]);
                    }
                }
                if (DisplayList.Count > 0)
                {
                    listOfBE    = DisplayList;
                    DisplayList = null;
                }
            }


            if (txtLoadID.Text != "")
            {
                for (int j = 0; j < listOfBE.Count; j++)
                {
                    if (listOfBE[j].LoadID.ToLower() != txtLoadID.Text.Trim().ToLower())
                    {
                        DisplayList.Add(j, listOfBE[j]);
                    }
                }
                if (DisplayList.Count > 0)
                {
                    listOfBE    = DisplayList;
                    DisplayList = null;
                }
            }


            if (txtPONumber.Text != "")
            {
                for (int j = 0; j < listOfBE.Count; j++)
                {
                    if (listOfBE[j].PONumber.ToLower() != txtPONumber.Text.Trim().ToLower())
                    {
                        DisplayList.Add(j, listOfBE[j]);
                    }
                }
                if (DisplayList.Count > 0)
                {
                    listOfBE    = DisplayList;
                    DisplayList = null;
                }
            }
            Session[vASNList] = listOfBE;



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


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

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


                gvASN.Visible    = false;
                gvASN.DataSource = null;
                gvASN.DataBind();
                lblSearchError.Text    = "No records found.";
                lblSearchError.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblSearchError.Text    = ex.Message;
            lblSearchError.Visible = true;
            logFile.ErrorLogging(ex);
        }
    }
示例#11
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);
    }
    private void BindPurchaseOrder()
    {
        TransactionBC objBC = new TransactionBC();

        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 <TransformationBE> listOfBE    = objBC.GetTransformationDetails(DateFrom, DateTo, txtControlNumber.Text.Trim(), drdServiceComponentPartnerSearch.SelectedValue, txtPONumber.Text.Trim(), txtPlant.Text.Trim());
            GenericCollection <TransformationBE> DisplayList = new GenericCollection <TransformationBE>();

            foreach (TransformationBE objExt1 in listOfBE)
            {
                if ((objExt1.StageName.ToLower().Contains("error") || objExt1.StageName.ToLower().Contains("failed")) && (objExt1.StageName != "LogError_NegativeMDNReceived" || objExt1.StageName != "LogError_MDN_NotReceived"))
                {
                    objExt1.Status = "Failed";
                }
                else
                {
                    objExt1.Status = "Success";
                }
                if (objExt1.StageName == "SentPositive997ToPartner")
                {
                    objExt1.FuncAck = "pos997";
                }
                if (objExt1.StageName == "SentNegative997ToPartner")
                {
                    objExt1.FuncAck = "neg997";
                }
                if (objExt1.StageName == "SentPositiveEDI824ToPartner")
                {
                    objExt1.FuncAck = "pos824";
                }
                if (objExt1.StageName == "SentNegativeEDI824ToPartner")
                {
                    objExt1.FuncAck = "Neg824";
                }
                if (objExt1.StageName == "LogError_MDN_NotReceived")
                {
                    objExt1.MDN = "NoMDN";
                }
                if (objExt1.StageName == "PositiveMDNReceived")
                {
                    objExt1.MDN = "posMDN";
                }
                if (objExt1.StageName == "LogError_NegativeMDNReceived")
                {
                    objExt1.MDN = "NegMDN";
                }
                if (objExt1.StageName == "SendPositiveEDI824for841ToBatchPrimaryTransport")
                {
                    objExt1.FuncAck = "Pos824Batch";
                }
                if (objExt1.StageName == "SendNegativeEDI824for841ToBatchPrimaryTransport")
                {
                    objExt1.FuncAck = "Neg824Batch";
                }
            }

            for (int j = 0; j < listOfBE.Count; j++)
            {
                if (DisplayList.Count == 0)
                {
                    DisplayList.Add(j, listOfBE[j]);
                }
                else
                {
                    bool duplicate = false;
                    for (int k = 0; k < DisplayList.Count; k++)
                    {
                        if (listOfBE[j].ControlNumber == DisplayList[k].ControlNumber && listOfBE[j].CM == DisplayList[k].CM && listOfBE[j].TxnDate == DisplayList[k].TxnDate)
                        {
                            DisplayList[k].Status  = String.IsNullOrEmpty(DisplayList[k].Status) ? listOfBE[j].Status : DisplayList[k].Status;
                            DisplayList[k].FuncAck = String.IsNullOrEmpty(DisplayList[k].FuncAck) ? listOfBE[j].FuncAck : DisplayList[k].FuncAck;
                            DisplayList[k].MDN     = String.IsNullOrEmpty(DisplayList[k].MDN) ? listOfBE[j].MDN : DisplayList[k].MDN;
                            duplicate = true;
                        }
                    }
                    if (!duplicate)
                    {
                        DisplayList.Add(DisplayList.Count, listOfBE[j]);
                    }
                }
            }

            if (DisplayList.Count > 0)
            {
                listOfBE = DisplayList;
            }

            Session[v841List] = listOfBE;

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


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

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


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