Beispiel #1
0
        static void Main(string[] args)
        {
            //var inData = File.ReadAllLines(@"C:\stepsDataClean\cleanDataString.csv");

            //var c = CultureInfo.GetCultureInfo("ru-Ru");

            StepRepository.StepRepositoryFile stepRepository = new StepRepository.StepRepositoryFile(@"C:\stepsDataClean\cleanDataString.csv");

            var Dataparsed = stepRepository.GetAll();//inData.Select(s => s.Split(';')).Select(i => new Tuple<DateTime, LazyItem>(DateTime.Parse(i[0], c), new LazyItem(i[1])));

            var years = Dataparsed.Select(i => i.TargetDate.Year).Distinct().Where(i => i != 2015 && i != DateTime.Now.Year);

            var targetDays = DayAnalizer.DayAnalizer.GetDaysLike(years, DateTime.Now, true).ToList();

            var month = targetDays.Select(d => d.Month).Distinct().First();

            List <StepAtDay> preSelected = new List <StepAtDay>();

            foreach (var i in Dataparsed)
            {
                if (targetDays.Contains(i.TargetDate.Date))
                {
                    preSelected.Add(i);
                    targetDays = targetDays.Except(new List <DateTime> {
                        i.TargetDate.Date
                    }).ToList();
                }
            }

            foreach (var d in preSelected)
            {
                Console.WriteLine($"Date:{d.TargetDate.Date.ToString("dd.MM.yyyy")} Steps:{d.Value}");
            }

            var step = preSelected.Select(i => i.Value > 1500 ? i.Value : 1500);

            Console.WriteLine($"MIN:{step.Min()}");

            Console.WriteLine($"AVG:{Math.Round(step.Average(), 0)}");

            Console.WriteLine($"MAX:{step.Max()}");

            string outString = $"DAY:{DateTime.Now.ToString("dd.MM.yyyy")} MIN:{step.Min()} AVG:{Math.Round(step.Average(), 0)} MAX:{step.Max()}";

            string filePath = @"C:\outbox\jason3lite\" + Guid.NewGuid().ToString().Split('-')[0] + ".txt";

            File.WriteAllText(filePath, outString);
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            StepRepository.StepRepositoryFile stepRepository = new StepRepository.StepRepositoryFile(@"C:\stepsDataClean\cleanDataString.csv");
            CommonProperty CommonProperty = new CommonProperty(stepRepository, new LobalugSettings());

            MenuMasterAction <CommonProperty> mainMenu = new MenuMasterAction <CommonProperty>();

            mainMenu.AddItem("Print Summary", SummaryPrinter.Print);

            mainMenu.AddItem("Empty Data", SummaryPrinter.EmptyData);

            mainMenu.AddItem("Print for day", SummaryPrinter.PrintForDay);

            mainMenu.AddItem("Input step`s data", StepsInserter.StepInsertMain);

            mainMenu.AddItem("Analize data", SummaryPrinter.AnalizeData);

            mainMenu.PrintAndWait(CommonProperty);
        }