예제 #1
0
        public Book(KeyValuePair <string, List <string> > book)
        {
            if (book.Value.Count == 8)
            {
                this.Id = book.Key;

                this.Isbn = book.Value[0];

                this.Author = book.Value[1];

                this.Title = book.Value[2];

                this.Genre = GetGenre(book.Value[3]);

                this.Publisher = book.Value[4];

                string publishDate = book.Value[5];
                Publish_date        = Convert.ToDateTime(publishDate);
                Publish_date_String = Publish_date.ToString("yyyy-MM-dd");

                this.Description = book.Value[6];

                string registrationDate = book.Value[7];
                Registration_date        = Convert.ToDateTime(registrationDate);
                Registration_date_String = Registration_date.ToString("yyyy-MM-dd");
            }
            else
            {
                this.Id = book.Key;

                this.Author = book.Value[0];

                this.Title = book.Value[1];

                this.Genre = GetGenre(book.Value[2]);

                this.Publisher = book.Value[3];

                string publishDate = book.Value[4];
                Publish_date        = Convert.ToDateTime(publishDate);
                Publish_date_String = Publish_date.ToString("yyyy-MM-dd");

                this.Description = book.Value[5];

                string registrationDate = book.Value[6];
                Registration_date        = Convert.ToDateTime(registrationDate);
                Registration_date_String = Registration_date.ToString("yyyy-MM-dd");
            }
        }
예제 #2
0
 public override string ToString()
 {
     return(string.Format($"Id = {Id}\n\tIsBn = {IsBn}\n\tAuthor = {Author}\n\tTitle = {Title}\n\t" +
                          $"Gender = {Genre}\n\tPublisher = {Publisher}\n\tPublish_date = {Publish_date.ToString("MMMM-dd-yyyy")}\n\t" +
                          $"\n\tRegistration_date = {Registration_date.ToString("MMMM-dd-yyyy")}\n\tDescription: {Description.Replace("\n","\n\t\t")}"));
 }