Example #1
0
        public Book(string author, string title, int price, int pages, string style) : base("book", price, 5)
        {
            style       = style.ToUpper();
            this.author = author;
            this.title  = title;

            if (Enum.IsDefined(typeof(BookStyle), style))
            {
                this.style = (BookStyle)Enum.Parse(typeof(BookStyle), style, true);
            }
            else
            {
                this.style = BookStyle.OTHER;
            }

            if (price < 1)
            {
                price = 0;
            }
            else
            {
                this.price = price;
            }

            if (pages < 1)
            {
                pages = 0;
            }
            else
            {
                this.pages = pages;
            }
            number++;
        }
Example #2
0
 public void SetStyle(BookStyle value)
 {
     if (Enum.IsDefined(typeof(BookStyle), value))
     {
         this.style = value;
     }
     else
     {
         this.style = BookStyle.OTHER;
     }
 }
Example #3
0
 public Book(string author, string title, string style) : base("book", 2500, 5)
 {
     style       = style.ToUpper();
     this.author = author;
     this.title  = title;
     this.pages  = 100;
     if (Enum.IsDefined(typeof(BookStyle), style))
     {
         this.style = (BookStyle)Enum.Parse(typeof(BookStyle), style, true);
     }
     else
     {
         this.style = BookStyle.OTHER;
     }
     number++;
 }
Example #4
0
 protected Book(string authorName, string bookName, FontStyle titleStyle)
 {
     this._authorName = authorName;
     this._bookName   = bookName;
     this._bookStyle  = GetBookStyle(titleStyle);
 }