示例#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++;
        }
示例#2
0
 public void SetStyle(BookStyle value)
 {
     if (Enum.IsDefined(typeof(BookStyle), value))
     {
         this.style = value;
     }
     else
     {
         this.style = BookStyle.OTHER;
     }
 }
示例#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++;
 }
示例#4
0
 protected Book(string authorName, string bookName, FontStyle titleStyle)
 {
     this._authorName = authorName;
     this._bookName   = bookName;
     this._bookStyle  = GetBookStyle(titleStyle);
 }