Book.cs
上传用户:gooyliu
上传日期:2018-09-29
资源大小:5816k
文件大小:7k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data ;
  5. using System.Data.SqlClient ;
  6. using Model;
  7. using DataAccessLayer;
  8. namespace BusinessLogicLayer
  9. {
  10.     public   class BLLBook
  11.     {
  12.        // #region 私有成员
  13.        // private string _bookID;
  14.        // private string _bookName;
  15.        // private string _bookIndex;
  16.        // private int _bookTypeID;
  17.        // private string _author;
  18.        // private string _publish;
  19.        // private double  _price;
  20.        // private  DateTime  _publishDate;
  21.        // private string _abstract;
  22.        // private string _keyword;
  23.        // private int _bookStatus;
  24.        // private DateTime _registeDate;
  25.        //#endregion
  26.        
  27.         
  28.         
  29.        // public BLLBook()
  30.        // {
  31.        // }
  32.         
  33.        // public BLLBook(string bookID,string bookName,string bookIndex,int bookType,string author,string publish,double price,DateTime publishDate,string abstrac,string keyword,int bookStatus,DateTime registeDate)
  34.        // {
  35.        //     this._bookID = bookID;
  36.        //     this._bookName = bookName;
  37.        //     this._bookIndex = bookIndex;
  38.        //     this._bookTypeID = bookType;
  39.        //     this._author = author;
  40.        //     this._publish = publish;
  41.        //     this._price=price ;
  42.        //     this._publishDate=publishDate ;
  43.        //     this._abstract = abstrac;
  44.        //     this._keyword = keyword;
  45.        //     this._bookStatus = bookStatus;
  46.        //     this._registeDate = registeDate;
  47.        // }
  48.        //  #region 属性
  49.        // public string BookID
  50.        // {
  51.        //     set
  52.        //     {
  53.        //         this._bookID = value;
  54.        //     }
  55.        //     get
  56.        //     {
  57.        //         return this._bookID;
  58.        //     }
  59.        // }
  60.        // public string BookName
  61.        // {
  62.        //     set
  63.        //     {
  64.        //         this._bookName = value; 
  65.        //     }
  66.        //     get
  67.        //     {
  68.        //         return this._bookName;             
  69.        //     }
  70.        // }
  71.        // public string BookIndex
  72.        // {
  73.        //     set
  74.        //     {
  75.        //         this._bookIndex = value;
  76.        //     }
  77.        //     get
  78.        //     {
  79.        //         return this._bookIndex;
  80.        //     }
  81.        // }
  82.        // public string BookTypeID
  83.        // {
  84.        //     set
  85.        //     {
  86.        //         this._bookTypeID = value;
  87.        //     }
  88.        //     get
  89.        //     {
  90.        //         return this._bookTypeID;
  91.        //     }
  92.        // }
  93.        // public string Author
  94.        // {
  95.        //     set
  96.        //     {
  97.        //         this._author = value;
  98.        //     }
  99.        //     get
  100.        //     {
  101.        //         return this._author;
  102.        //     }
  103.        // }
  104.        // public string Publish
  105.        // {
  106.        //     set
  107.        //     {
  108.        //         this._publish = value;
  109.        //     }
  110.        //     get
  111.        //     {
  112.        //         return this._publish;
  113.        //     }
  114.        // }
  115.        // public double Price
  116.        // {
  117.        //     set
  118.        //     {
  119.        //         this._price =value ;
  120.        //     }
  121.        //    get 
  122.        //    {
  123.        //        return this._price ;
  124.        //    }
  125.        // }
  126.        // public DateTime PublishDate
  127.        // {
  128.        //     set 
  129.        //     {
  130.        //         this._publishDate =value;
  131.        //     }
  132.        //     get
  133.        //     {
  134.        //         return this._publishDate ;
  135.        //     }
  136.        // }
  137.        // public string Abstrac
  138.        // {
  139.        //     set
  140.        //     {
  141.        //         this._abstract = value;
  142.        //     }
  143.        //     get
  144.        //     {
  145.        //         return this._abstract;
  146.        //     }
  147.        // }
  148.        // public string Keyword
  149.        // {
  150.        //     set
  151.        //     {
  152.        //         this._keyword = value;
  153.        //     }
  154.        //     get
  155.        //     {
  156.        //         return this._keyword;
  157.        //     }
  158.        // }
  159.        // public int  BookStatus
  160.        // {
  161.        //     set
  162.        //     {
  163.        //         this._bookStatus = value;
  164.        //     }
  165.        //     get
  166.        //     {
  167.        //         return this._bookStatus;
  168.        //     }
  169.        // }
  170.        // public DateTime  RegisteDate
  171.        // {
  172.        //     set
  173.        //     {
  174.        //         this._registeDate = value;
  175.        //     }
  176.        //     get
  177.        //     {
  178.        //         return this._registeDate;
  179.        //     }
  180.        // }       
  181.        
  182.        // #endregion
  183.         public BLLBook()
  184.         {
  185.         }
  186.        
  187.         
  188.         DALBook dalBook = new DALBook();
  189.         public bool AddBook(BookInfo bkInfo)
  190.         {
  191.             return dalBook.AddBook(bkInfo); 
  192.             
  193.         }
  194.         public DataSet SearchBook(int type, string queryByCol, string content)
  195.         {
  196.             return dalBook.SearchBook(type, queryByCol, content);
  197.         }
  198.         public DataSet QueryBooks()
  199.         {
  200.             DataBase db = new DataBase();
  201.             return db.GetDataSet("Proc_GetBooks");
  202.         }
  203.         public bool DeleteByProc(string XBookID)
  204.         {
  205.             DataBase db = new DataBase();
  206.             SqlParameter[] para = new SqlParameter[1];
  207.             para[0]= db.MakeInParam("@bookID", SqlDbType.NVarChar, 50, XBookID);
  208.             int count = -1;
  209.             count = db.RunProc("Proc_DeleteBook", para);
  210.             if (count > 0)
  211.                 return true;
  212.             else
  213.                 return false;
  214.         }
  215.         public BookInfo GetBookInfo(string XBookID)
  216.         {
  217.             DataSet ds= dalBook.GetBookInfoByID(XBookID);
  218.             BookInfo bookInfo = new BookInfo();
  219.             if (ds.Tables[0].Rows.Count > 0)
  220.             {
  221.                 DataRow dr = ds.Tables[0].Rows[0];
  222.                 bookInfo.BookID = GetSafeData.ValidateDataRow_S(dr, "bookID");
  223.                 bookInfo.BookName = GetSafeData.ValidateDataRow_S(dr, "bookName");
  224.                 bookInfo.BookIndex = GetSafeData.ValidateDataRow_S(dr, "bookIndex");
  225.                 bookInfo.BookTypeID = GetSafeData.ValidateDataRow_N(dr, "bookTypeID");
  226.                 bookInfo.Author = GetSafeData.ValidateDataRow_S(dr, "author");
  227.                 bookInfo.Publish = GetSafeData.ValidateDataRow_S(dr, "publish");
  228.                 bookInfo.Price = GetSafeData.ValidateDataRow_F(dr, "price");
  229.                 bookInfo.PublishDate = GetSafeData.ValidateDataRow_T(dr, "publishDate");
  230.                 bookInfo.Abstrac=GetSafeData.ValidateDataRow_S(dr,"abstract");
  231.                 bookInfo.Keyword=GetSafeData.ValidateDataRow_S(dr,"keyword");
  232.                 bookInfo.BookStatus=GetSafeData.ValidateDataRow_N(dr,"status"); 
  233.                 bookInfo.RegisteDate = GetSafeData.ValidateDataRow_T(dr, "registeDate");
  234.             }
  235.             return bookInfo;
  236.         }
  237.         public bool UpdateBookInfo(BookInfo bk)
  238.         {
  239.             return dalBook.updateBook(bk);
  240.         }
  241.     }
  242. }