Example #1
0
        /// <summary>
        /// Spawns a Retriever to search filesystem and find Amazon order files in the specified PID directories. Automatically conducts file retrieval operation upon completion of object initialization.
        /// </summary>
        /// <param name="pidsIn">List of PIDs to search</param>
        /// <param name="isFBA">Indicates search should include folder AmazonFBAOrders in addition to AmazonOrders</param>
        /// <param name="lowDate">Low end of date range. Struct of ints for MM, DD, YYYY.</param>
        /// <param name="highDate">High end of date range. Struct of ints for MM, DD, YYYY.</param>
        /// <param name="isVerbose">Controls verbose console output feedback.</param>
        /// <param name="destIn">Parent folder for this session. Retrieved files copied here.</param>
        public Retriever(string[] pidsIn, bool isFBA, string lowDate, string highDate, bool isVerbose, string destIn)
        {
            Console.Write("\nSpawning default Retriever... \n");

            this.AmazonOrderDateRegex = new Regex("^(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[01])[0-9]{4}$");
            this.PidRegex = new Regex("^[0-9]{8}$");
            this.Root = @"\\rdu-isilon-01.auctionrover.com\cads\profiles";

            this.PidCopyChecklist = new PidChecklistPair[pidsIn.Length];
            for (int i = 0; i < pidsIn.Length; i++)
            {
                PidCopyChecklist[i] = new PidChecklistPair(pidsIn[i], false);
            }
            this.SearchIsFBA = isFBA;
            this.LowDate = lowDate;
            this.HighDate = highDate;
            this.VerboseOutput = isVerbose;
            this.DestinationRoot = destIn;

            if (PidInputIsValid() & DateInputsAreValid())
            {
                if (VerboseOutput)
                {
                    Console.WriteLine();
                    Console.WriteLine("RETRIEVER PARAMETERS");
                    Console.WriteLine(string.Concat("Root: ", Root));
                    Console.WriteLine(string.Concat("Num of PIDs to search: ", PidCopyChecklist.Length));
                    Console.WriteLine(string.Concat("Date range: ", DateTimeConverter.MMDDYYYYToDateTime(LowDate), " - ", DateTimeConverter.MMDDYYYYToDateTime(HighDate)));
                    Console.WriteLine(string.Concat("Search FBA orders folder: ", SearchIsFBA));
                    Console.WriteLine();
                }
                DoRetrieve();
            }
        }
Example #2
0
        /// <summary>
        /// Spawns a Searcher to search retrieved files for Amazon order numbers. Automatically conducts search operation upon completion of object initialization.
        /// </summary>
        /// <param name="pidsIn">List of pids to search</param>
        /// <param name="ordersIn">List of order numbers to find</param>
        /// <param name="dir">Folder for this session created by the Retriever</param>
        /// <param name="isVerbose">Verbose console output feedback</param>
        /// <param name="matchMultiple">Continue searching for order after first match</param>
        public Searcher(string[] pidsIn, string[] ordersIn, string dir, bool isVerbose, MatchModes matchModeIn)
        {
            Console.Write("\nSpawning Searcher... \n");

            // Initialize properties
            this.PidSearchChecklist = new PidChecklistPair[pidsIn.Length];
            for (int i = 0; i < pidsIn.Length; i++)
                PidSearchChecklist[i] = new PidChecklistPair(pidsIn[i], false);
            this.TargetDirectory = dir;
            this.NumOrdersFound = 0;
            this.CurrentOrderToFind = new StringBuilder("");
            this.CurrentPidSearch = new StringBuilder("");
            this.VerboseOutput = isVerbose;

            this.SearchMatchMode = matchModeIn;
            switch (SearchMatchMode)
            {
                case MatchModes.Single:
                    this.OrderFindChecklist = new OrderChecklistSet[ordersIn.Length];
                    for (int i = 0; i < ordersIn.Length; i++)
                        OrderFindChecklist[i] = new OrderChecklistSet(ordersIn[i], false, "");
                    break;
                case MatchModes.Multiple:
                case MatchModes.AmzEU:
                    this.OrderFindChecklist = new OrderChecklistSet[ordersIn.Length];
                    for (int i = 0; i < ordersIn.Length; i++)
                        OrderFindChecklist[i] = new OrderChecklistSet(ordersIn[i], false, "");
                    this.MultipleOrderFindChecklist = new List<MultipleOrderResultListSet>();
                    break;
                default:
                    break;
            }

            if (VerboseOutput)
            {
                Console.WriteLine();
                Console.WriteLine("SEARCHER PARAMETERS");
                Console.WriteLine(string.Concat("Num of orders to find: ", OrderFindChecklist.Length));
                Console.WriteLine();
            }

            if (OrderInputIsValid())
                DoLocate();
        }