static public void DisplayDataBook(DataBookInfo Node, bool isSearchResult) { if (Node == null) { Console.WriteLine("No book with this data"); } else { if (!isSearchResult) { Console.WriteLine("\nINFORMATION ABOUT BOOK WITH ISBN = {0}", Node.ISBN); } else { Console.WriteLine("\nINFORMATION ABOUT DETECTED BOOK"); } Console.WriteLine("_________________________________________"); Console.WriteLine("Name of book:\t\t{0}", Node.name); Console.WriteLine("Author:\t\t\t{0}", Node.author); if (!isSearchResult) { Console.WriteLine("Annotation:\t\t{0}", Node.annotation); } Console.WriteLine("ISBN:\t\t\t{0}", Node.ISBN); Console.WriteLine("Publication date:\t{0}", Node.publicationDate.ToShortDateString()); } }
public DataBookInfo BookDataByISBN() { Console.WriteLine("\n2: Databook by ISBN\n_________________________________________"); DataBookInfo result = _client.FindNoteByISBN(UserInteraction.EnterISBN().ToString()); if (result == null) { Console.WriteLine("No book with this ISBN"); } else { UserInteraction.DisplayDataBook(result, false); } return(result); }
private void AddBookCommandImpl(object obj) { InputBox inputBox = new InputBox(); inputBox.ShowDialog(); DataBookInfo newItem = inputBox.newItemFromInputbox; if (inputBox.isValid == true) { _wcfClient.AddNewNote(newItem); this.Books.Add(newItem); } else { Error errWindow = new Error(); errWindow.ShowDialog(); AddBookCommandImpl(null); } }
public void AddNewNote(DataBookInfo newItem) { JavaScriptSerializer jss = new JavaScriptSerializer(); var request = (HttpWebRequest)WebRequest.Create(this.url.TrimEnd('/') + "/add"); request.Method = "POST"; request.ContentType = "application/json; charset=UTF-8"; request.Accept = "application/json"; using (var sw = new StreamWriter(request.GetRequestStream())) { var dataToSerialize = jss.Serialize(newItem); sw.Write(dataToSerialize); } using (var response = request.GetResponse()) { response.Close(); } }
private void okButton_Click(object sender, RoutedEventArgs e) { int tempISBN = 0; DateTime tempDate = DateTime.Now; if ((Int32.TryParse(this.ISBN_text.Text, out tempISBN) == true) && (DateTime.TryParse(this.date_text.Text, out tempDate) == true) && (this.nameText.Text != "") && (this.author_text.Text != "") && (this.annotationText.Text != "") && (this.ISBN_text.Text != "") && (this.date_text.Text != "")) { this.newItemFromInputbox = new DataBookInfo(this.nameText.Text, this.author_text.Text, this.annotationText.Text, tempISBN, tempDate); this.isValid = true; } else { this.newItemFromInputbox = null; this.isValid = false; } this.Close(); }
public void AddNewNote(DataBookInfo newNote) { _proxy.AddNewNote(newNote); }