Ejemplo n.º 1
0
        private static ConceptLine PopulateConceptLine(double DocumentNumber, string StoreNumber, decimal LineNumber, string PartNumber, double Quantity, decimal RequestedJulian, Concept concept)
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConceptCSV)).Location) + @"\" + "log4net.config"));
            log.Debug($"Populating concept line with {DocumentNumber.ToString()},{StoreNumber},{LineNumber.ToString()},{PartNumber},{Quantity.ToString()},{RequestedJulian.ToString()},{StoreNumber}-{concept.ConceptID}");

            ConceptLine line;

            try
            {
                line = new ConceptLine();
                line.DocumentNumber = DocumentNumber;
                line.BranchPlant    = BranchPlant;
                string alky = StoreNumber + "-" + concept.ConceptID;
                line.ShipToAddress       = (double)JDE.GetAddressFromALKY(alky);
                line.LineNumber          = LineNumber;
                line.JDEPartNumber       = PartNumber;
                line.Quantity            = Quantity;
                line.JulianRequestedDate = RequestedJulian;
            }
            catch (Exception eBLL)
            {
                log.Error($"Error writing concept line " + eBLL.Message);
                throw;
            }
            return(line);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Populate a single ship-to line from the CSV
        /// </summary>
        /// <param name="r"></param>
        /// <param name="LookupJDEAddress"></param>
        /// <returns></returns>
        private static ShipToLine PopulateShipToLine(DataRow r, bool LookupJDEaddress)
        {
            ShipToLine line = new ShipToLine();

            line.StoreName          = (null == r["SHIP TO NAME"].ToString()) ? "" : r.Field <String>("SHIP TO NAME").ToUpper();
            line.Address1           = (null == r.Field <String>("ADDRESS 1")) ? "" : r.Field <String>("ADDRESS 1").ToUpper();
            line.Address2           = (null == r.Field <String>("ADDRESS 2")) ? "" : r.Field <String>("ADDRESS 2").ToUpper();
            line.City               = (null == r.Field <String>("CITY")) ? "" : r.Field <String>("CITY").ToUpper();
            line.State              = (null == r.Field <String>("STATE")) ? "" : r.Field <String>("STATE").ToUpper();
            line.Zip                = (null == r.Field <String>("ZIP")) ? "" : r.Field <String>("ZIP").ToUpper();
            line.TaxAreaCode        = (null == r.Field <String>("TAX AREA CODE")) ? "" : r.Field <String>("TAX AREA CODE").ToUpper();
            line.TaxExplanationCode = (null == r.Field <String>("TAX EXPLANATION CODE")) ? "" : r.Field <String>("TAX EXPLANATION CODE").ToUpper();
            line.Concept            = (null == r.Field <String>("CONCEPT CODE")) ? "" : r.Field <String>("CONCEPT CODE").ToUpper();
            line.StoreNumber        = (null == r.Field <String>("STORE NUMBER")) ? "" : r.Field <String>("STORE NUMBER").ToUpper();
            if (true == LookupJDEaddress)
            {
                try
                {
                    string alky       = line.StoreNumber + "-" + line.Concept;
                    double?jdeaddress = JDE.GetAddressFromALKY(alky);
                    line.JDEAddress = (null == jdeaddress) ? 0 : (double)jdeaddress;
                }
                catch
                {
                    throw;
                }
            }
            else
            {
                line.JDEAddress = 0;
            }
            try
            {
                line.County = JDE.GetCounty(r.Field <String>("ZIP").ToUpper());
            }
            catch
            {
                throw;
            }
            return(line);
        }