static public void AddBook() { string spec = "12345"; string spec1; string name; string autor; string ganre; Console.WriteLine("Please enter spesial password"); spec1 = Console.ReadLine(); if ((spec1.Equals(spec) == true)) { Console.WriteLine("Name:"); name = Console.ReadLine(); Console.WriteLine("Autor:"); autor = Console.ReadLine(); Console.WriteLine("Ganre:"); ganre = Console.ReadLine(); BookAll book = new BookAll(name, autor, ganre, 1); Console.WriteLine(name + " " + autor + " New Book"); WriteInListBooks(book); } else { Console.WriteLine("You enter wrong password!"); } }
static public void ReturnBook(BookAll book, Person pers) { foreach (BookAll book1 in pers.getListBook()) { if (book1.name == book.name && book1.autor == book.autor) { pers.Removelist(book); book.setStateReturnBook(); } else { Console.WriteLine("You didn`t take this book"); } } }
public static void WriteInListBooks(BookAll book) { XmlSerializer formatter = new XmlSerializer(typeof(List <BookAll>)); //List<BookAll> booklist = new List<BookAll>(); List <BookAll> booklist = OpenListBooks(); //Console.WriteLine(book.NameB); booklist.Add(book); // получаем поток, куда будем записывать сериализованный объект using (FileStream fs = new FileStream("books.xml", FileMode.OpenOrCreate)) { formatter.Serialize(fs, booklist); //Console.WriteLine("WriteInListBooks"); } }
static public void Registration() { BookAll book1 = new BookAll(); string name; string surname; string login; string password; string dateBirth; List <BookAll> listBook1 = new List <BookAll>(); listBook1.Add(book1); Console.WriteLine("Name:"); name = Console.ReadLine(); Console.WriteLine("Surname:"); surname = Console.ReadLine(); Console.WriteLine("Login:"******"Date of birth:"); dateBirth = Console.ReadLine(); Console.WriteLine("Password:"******" " + surname + " Welcome to library!"); WriteInListPerson(pers); Account(pers); //Enter(personMap); //test (must delete) } else { Console.WriteLine("You must fill all field"); Registration(); } }
static public void DoOrder() { string name; string autor; Console.WriteLine("Name:"); name = Console.ReadLine(); Console.WriteLine("Autor:"); autor = Console.ReadLine(); BookAll book1 = new BookAll("name1", "autor1", "ganre1"); BookAll book2 = new BookAll("name2", "autor2", "ganre2"); List <BookAll> listBookPostach1 = new List <BookAll>(); listBookPostach1.Add(book1); listBookPostach1.Add(book2); BookAll book3 = new BookAll("name3", "autor3", "ganre3"); BookAll book4 = new BookAll("name4", "autor4", "ganre4"); List <BookAll> listBookPostach2 = new List <BookAll>(); listBookPostach2.Add(book3); listBookPostach2.Add(book4); Postach post1 = new Postach("post1", listBookPostach1); Postach post2 = new Postach("post2", listBookPostach2); AbstractCompany comp = new AbstractCompany(); comp.Addtolist(post1); comp.Addtolist(post2); Console.WriteLine("The book " + comp.ChooseProd(name, autor).name + " " + comp.ChooseProd(name, autor).autor + "was ordered. Please wait"); }
static public void ReturnBook(BookAll book) { book.setStateReturnBook(); }
static public void TakeBook(BookAll book) { book.setStateTakeBook(); }
public void AddtolistPostach(BookAll book) { listBookPostach.Add(book); }
public void Removelist(BookAll book) { listBook.Remove(book); }
public void Addtolist(BookAll book) { listBook.Add(book); }