コード例 #1
0
ファイル: Program.cs プロジェクト: aytajnurullazada/MyProject
        static void GetSaleByDateRange()
        {
            Console.WriteLine("Bashlangic tarixi qeyd edin (il.ay.gun)");
            string   date1 = Console.ReadLine();
            DateTime StartDate;

            while (!DateTime.TryParse(date1, out StartDate))
            {
                Console.WriteLine("tarixi duzgun daxil edin");
                date1 = Console.ReadLine();
            }
            Console.WriteLine("Bitish tarixi qeyd edin (il.ay.gun)");
            string   date2 = Console.ReadLine();
            DateTime EndDate;

            while (!DateTime.TryParse(date2, out EndDate))
            {
                Console.WriteLine("tarixi duzgun daxil edin");
                date2 = Console.ReadLine();
            }
            var table = new ConsoleTable("Satish", "Satish Meblegi", "Satish Tarixi", "Satish sayi", "Satish Nomresi");
            int i     = 1;
            var list  = marketableService.GetSaleByDateRange(StartDate, EndDate);

            if (list.Count == 0)
            {
                Console.WriteLine("Bu tarix araliginda satish yoxdur");
            }
            else
            {
                foreach (var item in list)
                {
                    table.AddRow(i, item.SaleAmount, item.SaleDate.ToString("dd.MM.yyyy"), item.SaleItems.Count, item.SaleNumber);
                    i++;
                }

                table.Write();
            }
        }