public void DailyReport() //+ { string msg = ""; List <TransactionShort> tsList = new List <TransactionShort>(); while (true) { Console.Clear(); Console.WriteLine("Отчет на указанную дату"); Console.WriteLine("---------------------------------------------\n"); Console.Write("День: "); string day = Console.ReadLine(); Console.Write("Месяц: "); string month = Console.ReadLine(); Console.Write("Год: "); string year = Console.ReadLine(); string date = day + "." + month + "." + year; DateTime ddate; if (DateTime.TryParse(date, out ddate)) { Console.Clear(); Console.WriteLine("Отчет на {0: dd.MM.yyyy}", ddate); Console.WriteLine("ID\tДата\tID читателя\tЧитатель\tID книги\tКнига\tТип операции"); Console.WriteLine("---------------------------------------------\n"); var tmp = serviceTransaction.GetTransactions(out msg).Where(w => w.Date.Equals(ddate)); foreach (Transaction i in tmp) { TransactionShort ts = new TransactionShort(); ts.Id = i.Id; ts.Date = i.Date; ts.ReaderId = i.Reader.Id; ts.ReaderFullName = i.Reader.Name + " " + i.Reader.Surname; ts.BookId = i.Book.Id; ts.BookName = i.Book.Name; ts.TransactionType = i.TransactionType; tsList.Add(ts); Console.WriteLine("{0}\t{1: dd.MM.yyyy}\t{2}\t{3}\t{4}\t{5}\t{6}", i.Id, i.Date, i.Reader.Id, i.Reader.Name + " " + i.Reader.Surname, i.Book.Id, i.Book.Name, i.TransactionType); } Console.Write("Сохранить в XML формате? (0-нет, 1-да): "); string choice = Console.ReadLine(); if (Char.IsNumber(choice[0]) && choice.Length == 1) { if (choice[0] == '1') { CreateTransactionsXML("DailyReport", tsList, ddate); } } Thread.Sleep(2000); break; } else { Console.WriteLine("Некорректная дата. Введите еще раз"); } } }
public void DebtorsListReport() //+ { string msg = ""; List <TransactionShort> tsList = new List <TransactionShort>(); Console.Clear(); var tList = serviceTransaction.GetIssueTransactions(out msg); var bList = serviceBook.GetBooks(out msg).Where(w => w.BookStatus.Equals(BookStatus.busy)); if (!serviceBook.GetBooks(out msg).Exists(w => w.BookStatus.Equals(BookStatus.busy))) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Все книги свободны, должников нет"); Console.ForegroundColor = ConsoleColor.White; } if (tList != null && serviceBook.GetBooks(out msg).Exists(w => w.BookStatus.Equals(BookStatus.busy))) { foreach (Transaction i in tList) { if (bList.Contains(i.Book)) { TransactionShort ts = new TransactionShort(); ts.Id = i.Id; ts.Date = i.Date; ts.ReaderId = i.Reader.Id; ts.ReaderFullName = i.Reader.Name + " " + i.Reader.Surname; ts.BookId = i.Book.Id; ts.BookName = i.Book.Name; ts.TransactionType = i.TransactionType; tsList.Add(ts); } } Console.WriteLine("Список должников на текущую дату"); Console.WriteLine("Дата\tID читателя\tЧитатель\tID книги\tКнига"); Console.WriteLine("---------------------------------------------\n"); foreach (TransactionShort i in tsList) { Console.WriteLine("{0: dd.MM.yyyy}\t{1}\t{0}\t{0}\t{0}", i.Date, i.ReaderId, i.ReaderFullName, i.BookId, i.BookName); } Console.Write("Сохранить в XML формате? (0-нет, 1-да): "); string choice = Console.ReadLine(); if (Char.IsNumber(choice[0]) && choice.Length == 1) { if (choice[0] == '1') { CreateTransactionsXML("DebtorsReport", tsList, DateTime.Now); } } } Thread.Sleep(2000); }