Пример #1
0
        public void TestSteps()
        {
            bool SkipF0101  = true;
            bool SkipF03012 = true;
            // 1.) Read the concept
            ConceptCSV TestConceptCSV = new ConceptCSV(@"E:\gitHub\Rollout\TestFiles\SageRolloutExample1.csv", ",");

            TestConceptCSV.ReadConcept();
            // 2.) Test for missing entries
            List <string> TestMissing = TestConceptCSV.CheckForMissingShipToAddresses();

            // 3.) If entries are missing, do the following:
            if (0 < TestMissing.Count && !SkipF0101)
            {
                // 4.) Populate the missing CSV using the list of missing items
                ShipToCSV MissingShipToCSV = new ShipToCSV(@"E:\gitHub\Rollout\TestFiles\SageRolloutMissing.csv", ",");
                MissingShipToCSV.PopulateSpreadsheet(TestMissing, TestConceptCSV);
                // 5.) Populate the transformed data structure
                ShipTo MissingShipTo = XfrmShipTo.CSVToShipTo(MissingShipToCSV, false); // Don't look up JDE Addresses
                // 6.) Upload the transformed data structure to the F0101 Z-File
                JDE.PopulateF0101Z2(MissingShipTo);
                // 7.) Now write the CSV to disk
                MissingShipToCSV.WriteCSV();
                // 8.) Now, someone must run R01010Z to load the data into JDE.
                // Popup window
            }
            else if (!SkipF03012)
            {
                // TODO: 9.) Check for F03012 records
                // 10.) If F03012 records are missing:
                ShipToCSV MissingShipToCSV = new ShipToCSV(@"E:\gitHub\Rollout\TestFiles\SageRolloutMissing.csv", ",");
                MissingShipToCSV.ReadShipTo();
                if (MissingShipToCSV.ValidateHeader() &&  // Required row is all there
                    MissingShipToCSV.ValidateRows(false)) // We can't have an empty tax area code
                {
                    // 11.) Convert the CSV into a data structure we can upload
                    ShipTo PopulatedShipTo = XfrmShipTo.CSVToShipTo(MissingShipToCSV, true); // Lookup JDE Address
                    // 12.) Upload the data structure into JDE
                    JDE.PopulateF03012Z1(PopulatedShipTo);
                    // 13.) Now someone must run R03010Z to load the data into JDE.
                }
                else
                {
                    //TODO: Say we don't have a valid spreadsheet
                    int x = 0;
                    x++;
                }
            }
            else
            {
                Concept TestConcept = XfrmConcept.CSVtoConcept(TestConceptCSV);
                JDE.PopulateF47011(TestConcept);
                JDE.PopulateF47012(TestConcept);
            }
        }
Пример #2
0
        public void ReadShipToCSVandPopulateF0101Z2()
        {
            ShipToCSV PopulatedCSV = new ShipToCSV(@"E:\gitHub\Rollout\TestFiles\SageRolloutMissing.csv", ",");

            PopulatedCSV.ReadShipTo();
            PopulatedCSV.ValidateHeader();
            PopulatedCSV.ValidateRows(true);
            ShipTo PopulatedShipTo = XfrmShipTo.CSVToShipTo(PopulatedCSV, false); // Dont lookup JDE address

            JDE.PopulateF0101Z2(PopulatedShipTo);
        }
Пример #3
0
        public void PopulateF03012Z1()
        {
            ShipToCSV PopulatedCSV = new ShipToCSV(@"E:\gitHub\Rollout\TestFiles\SageRolloutMissing.csv", ",");

            PopulatedCSV.ReadShipTo();
            PopulatedCSV.ValidateHeader();
            PopulatedCSV.ValidateRows(false);                                    // Force non-empty tax area code
            ShipTo PopulatedShipTo = XfrmShipTo.CSVToShipTo(PopulatedCSV, true); // Lookup JDE address

            JDE.PopulateF03012Z1(PopulatedShipTo);
        }
Пример #4
0
        } // ValidateShipToHeader

        /// <summary>
        /// Validate the data in the shipto CSV
        /// </summary>
        /// <param name="csv"></param>
        /// <param name="AllowBlankTaxAreaCode"></param>
        /// <returns></returns>
        private bool ValidateShipToRows(ref ShipToCSV csv, bool AllowBlankTaxAreaCode)
        {
            bool result = csv.ValidateRows(AllowBlankTaxAreaCode);

            if (!result)
            {
                // TODO:  Fix this to display the bad data
                log.Error("Failed to validate row data for one or more rows");
                using (new CenterDialog(this))
                {
                    MessageBox.Show($"Error in csv. Failed to validate data in one or more rows.  See log file and documentation for more information.", "Error in Rollout CSV Data", MessageBoxButtons.OK);
                }
            }
            else
            {
                log.Debug("All row data is valid for all required columns");
            }
            return(result);
        } // ValidateShipToRows