static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; string text = Config.Instance.PromtText; ConsoleColor color = Config.Instance.PromtColor; ConfigRouter(); while (true) { ViewHelp.Write(text, color); string request = Console.ReadLine(); try { Router.Instance.Forward(request); } catch (Exception e) { ViewHelp.WriteLine(e.Message, ConsoleColor.Red); } finally { Console.WriteLine(); } if (request.ToLower() == "quit") { break; } } }
///<summary> /// Thuc hien in thong tin cuon sach ra man hinh console /// </summary> public void Render() { if (Model == null) { ViewHelp.WriteLine("NO BOOK FOUND, SORRY!!", ConsoleColor.Red); return; } Console.ForegroundColor = ConsoleColor.Cyan; ViewHelp.WriteLine("BOOK DETAIL INFORMATION: ", ConsoleColor.Cyan); Console.ResetColor(); Console.WriteLine($"Author: \t {Model.Authors}"); Console.WriteLine($"Title: \t {Model.Title}"); Console.WriteLine($"Publisher: \t {Model.Publisher}"); Console.WriteLine($"Year: \t {Model.Year}"); Console.WriteLine($"Edition: \t {Model.Edition}"); Console.WriteLine($"Isbn: \t {Model.Isbn}"); Console.WriteLine($"Tags: \t {Model.Tags}"); Console.WriteLine($"Description: \t {Model.Description}"); Console.WriteLine($"Rating: \t {Model.Rating}"); Console.WriteLine($"Reading: \t {Model.Reading}"); Console.WriteLine($"File: \t {Model.File}"); Console.WriteLine($"FileName: \t {Model.FileName}"); }
public override void Render() { ViewHelp.WriteLine("UPDATE BOOK INFORMATION", ConsoleColor.Green); string title = ViewHelp.InputString("Title", Model.Authors); string authors = ViewHelp.InputString("Authors", Model.Authors); string publisher = ViewHelp.InputString("Publisher", Model.Publisher); int year = ViewHelp.InputInt("Year", Model.Year); int edition = ViewHelp.InputInt("Edition", Model.Edition); string tags = ViewHelp.InputString("Tags", Model.Tags); string description = ViewHelp.InputString("Description", Model.Description); int rate = ViewHelp.InputInt("Rate", Model.Rating); bool reading = ViewHelp.InputBool("Reading", Model.Reading); string file = ViewHelp.InputString("File", Model.File); var request = "do update ? " + $"id = {Model.Id} & " + $"title = {title} & " + $"authors = {authors} & " + $"publisher = {publisher} & " + $"year = {year} & " + $"edition = {edition} & " + $"tags = {tags} & " + $"description = {description} & " + $"rate = {rate} & " + $"reading = {reading} & " + $"file = {file}"; Router.Instance.Forward(request); }
public override void Render() { ViewHelp.WriteLine("CREATE A NEW BOOK", ConsoleColor.Green); string title = ViewHelp.InputString("Title"); string authors = ViewHelp.InputString("Authors"); string publisher = ViewHelp.InputString("Publisher"); int year = ViewHelp.InputInt("Year"); int edition = ViewHelp.InputInt("Edition"); string tags = ViewHelp.InputString("Tags"); string description = ViewHelp.InputString("Description"); int rate = ViewHelp.InputInt("Rate"); bool reading = ViewHelp.InputBool("Reading"); string file = ViewHelp.InputString("File"); var request = "do create ? " + $"title = {title} & " + $"authors = {authors} & " + $"publisher = {publisher} & " + $"year = {year} & " + $"edition = {edition} & " + $"tags = {tags} & " + $"description = {description} & " + $"rate = {rate} & " + $"reading = {reading} & " + $"file = {file}"; Router.Instance.Forward(request); }
public override void Render() { foreach (var g in Model) { ViewHelp.WriteLine($"# {g.Key}", ConsoleColor.Magenta); foreach (Book b in g) { ViewHelp.Write($"[{b.Id}] ", ConsoleColor.Yellow); ViewHelp.WriteLine(b.Title, b.Reading ? ConsoleColor.Cyan : ConsoleColor.White); } } }
private static void Help(Parameter parameter) { if (parameter == null) { ViewHelp.WriteLine("SUPPORTED COMMANDS : ", ConsoleColor.Green); ViewHelp.WriteLine(Router.Instance.GetRoutes(), ConsoleColor.Yellow); ViewHelp.WriteLine("type: help ? cmd = <command> to get command details"); return; } Console.BackgroundColor = ConsoleColor.DarkBlue; string command = parameter["cmd"].ToLower(); ViewHelp.WriteLine(Router.Instance.GetHelp(command)); }
public void Render() { ViewHelp.WriteLine("UPDATE BOOK INFORMATION", ConsoleColor.Green); var title = ViewHelp.InputString("Title", Model.Title); var authors = ViewHelp.InputString("Authors", Model.Authors); var publisher = ViewHelp.InputString("Publisher", Model.Publisher); var year = ViewHelp.InputInt("Year", Model.Year); var editon = ViewHelp.InputInt("Edition", Model.Edition); var tags = ViewHelp.InputString("Tags", Model.Tags); var description = ViewHelp.InputString("Description", Model.Description); var rate = ViewHelp.InputInt("Rate", Model.Rating); var reading = ViewHelp.InputBool("Reading", Model.Reading); var file = ViewHelp.InputString("File", Model.File); }
/// <summary> /// In danh sách /// </summary> public override void Render() { if (Model.Length == 0) { ViewHelp.WriteLine("No book found!", ConsoleColor.Yellow); return; } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("THE BOOK LIST"); Console.ForegroundColor = ConsoleColor.Yellow; foreach (Book b in Model) { ViewHelp.Write($"[{b.Id}] ", ConsoleColor.Yellow); ViewHelp.WriteLine(b.Title, b.Reading ? ConsoleColor.Cyan : ConsoleColor.White); } ViewHelp.WriteLine($"{Model.Length} item(s)", ConsoleColor.Green); }
/// <summary> /// thực hiện in thông tin ra màn hình /// </summary> public override void Render() { if (Model == null) { ViewHelp.WriteLine("NO BOOK FOUND. SORRY!", ConsoleColor.Red); } ViewHelp.WriteLine("BOOK DETAIL INFORMATION", ConsoleColor.Green); // hiển thị các thông tin của cuốn sách Console.WriteLine($"-Authors : {Model.Authors}"); Console.WriteLine($"-Title : {Model.Title}"); Console.WriteLine($"-Publisher : {Model.Publisher}"); Console.WriteLine($"-Year : {Model.Year}"); Console.WriteLine($"-Edition : {Model.Edition}"); Console.WriteLine($"-ISBN : {Model.Isbn}"); Console.WriteLine($"-Tags : {Model.Tags}"); Console.WriteLine($"-Desciption : {Model.Description}"); Console.WriteLine($"-Rating : {Model.Rating}"); Console.WriteLine($"-Reading : {Model.Reading}"); Console.WriteLine($"-File : {Model.File}"); Console.WriteLine($"-File name : {Model.FileName}"); }
private static void About(Parameter parameter) { ViewHelp.WriteLine("BOOK MANAGER VERSION 1.0", ConsoleColor.Green); }