Exemplo n.º 1
0
        public static List <StgOrdersCSV> FilterDataFromSTG(List <StgOrdersCSV> listSTG, DataTable daSTG)
        {
            try
            {
                StgOrdersCSV obj = new StgOrdersCSV();
                foreach (var row in daSTG.AsEnumerable())
                {
                    var item = listSTG.FirstOrDefault(x => x.StrCustOrdNumber == (String)row["Customer Order Number"].ToString() && x.StrItemId == (String)row["Item"].ToString());
                    //TextHelper.WriteLine("SQL  : [Order Number: " + (String)row["Customer Order Number"].ToString());
                    //TextHelper.WriteLine("List : [PO: " + item.StrCustPO + ", Item: " + item.StrItemId);
                    //TextHelper.WriteLine("SQL  : [PO: " + (String)row["PO Number"].ToString() + ", Item: " + (String)row["Item"].ToString());
                    if (item.StrCustPO == (String)row["PO Number"].ToString() && item.StrItemId == (String)row["Item"].ToString())
                    {
                        listSTG.Remove(item);
                        //TextHelper.WriteLine("Remove");
                    }
                }
                TextHelper.WriteLine("Object Remove Finished, FilterDataFromSTG");
            }
            catch (Exception e)
            {
                TextHelper.WriteLine("Error in FilterDataFromSTG");
                TextHelper.WriteLine(e.Message);
                return(null);
            }

            return(listSTG);
        }
Exemplo n.º 2
0
        public static List <StgOrdersCSV> AddSTGVendorNumberDatatoObjects(List <StgOrdersCSV> listSTG, DataTable daGP, String Identifier)
        {
            try
            {
                StgOrdersCSV obj = new StgOrdersCSV();

                if (Identifier == "BBBVendorNumber")
                {
                    foreach (var row in daGP.AsEnumerable())
                    {
                        listSTG.Where(o => o.StrItemId == (String)row["Item"].ToString()).ToList().ForEach(o => o.StrBBBVendorNumber = (String)row["Vendor Number"].ToString());
                        listSTG.Where(o => o.StrItemId == (String)row["Item"].ToString()).ToList()
                        .ForEach(o => {
                            if (o.StrRetailerID.Trim() == "BBBCAN")
                            {
                                o.StrRetailerID = o.StrBBBVendorNumber + "CAN";
                            }
                            else
                            {
                                o.StrRetailerID = o.StrBBBVendorNumber;
                            }
                        });
                    }
                }

                if (Identifier != "BBBVendorNumber")
                {
                    //Nothing to Change
                }
            }
            catch (Exception e)
            {
                TextHelper.WriteLine("Error in AddGPDatatoObjects: " + e.Message);
                return(null);
            }

            return(listSTG);
        }