コード例 #1
0
ファイル: XfrmShipTo.cs プロジェクト: rlillback/Rollout
        /// <summary>
        /// Populate the ship-to data structure
        /// </summary>
        /// <param name="csv"></param>
        /// <param name="PopulateJDEAddress"></param>
        /// <returns></returns>
        public static ShipTo CSVToShipTo(ShipToCSV csv, bool LookupJDEaddress)
        {
            ShipTo shipTo = new ShipTo();

            shipTo.NewShipTos = new List <ShipToLine>();
            if (!PopulateShipToHeader(ref shipTo, csv))
            {
                //TODO: Error handler
            }
            foreach (DataRow r in csv.DT.Rows)
            {
                ShipToLine line = PopulateShipToLine(r, LookupJDEaddress);
                shipTo.NewShipTos.Add(line);
            }
            return(shipTo);
        }
コード例 #2
0
ファイル: XfrmShipTo.cs プロジェクト: rlillback/Rollout
        /// <summary>
        /// Populate the top common ship to information
        /// </summary>
        /// <param name="shipTo"></param>
        /// <param name="csv"></param>
        /// <returns></returns>
        private static bool PopulateShipToHeader(ref ShipTo shipTo, ShipToCSV csv)
        {
            bool   success = true;
            Random random  = new Random();

            shipTo.batch = random.Next().ToString(); // 32-bit integer
            DataRow r = csv.DT.Rows[0];

            shipTo.ConceptID = r["CONCEPT CODE"].ToString();
            double?parent = JDE.GetParentFromConcept(shipTo.ConceptID);

            if (null != parent)
            {
                shipTo.ParentAddress = (double)parent;
            }
            else
            {
                log.Debug($"Couldn't find parent for {r["CONCEPT CODE"].ToString()}");
                success = false;
            }
            return(success);
        }