示例#1
0
 public static int Delete(Book book)
 {
     int rows = 0;
     string sql = "delete from Book where bkID=@bkID";
     SqlParameter[] parameters = { new SqlParameter("@bkID", book.bkID) };
     try
     {
         rows = SqlHelper.ExecuteNonQuery(sql, parameters);
     }
     catch (SqlException ex)
     {
         throw new Exception(ex.Message);
     }
     return rows;
 }
示例#2
0
文件: Book.cs 项目: raojun/BookManage
 //添加复制函数
 public Book(Book rt)
 {
     this.bkID = rt.bkID;
     this.bkCode = rt.bkCode;
     this.bkName = rt.bkName;
     this.bkAuthor = rt.bkAuthor;
     this.bkPress = rt.bkPress;
     this.bkdatePress = rt.bkdatePress;
     this.bkISBN = rt.bkISBN;
     this.bkCatalog = rt.bkCatalog;
     this.bkLanguage = rt.bkLanguage;
     this.bkPages = rt.bkPages;
     this.bkPrice = rt.bkPrice;
     this.bkDateIn = rt.bkDateIn;
     this.bkNum = rt.bkNum;
     this.bkBrief = rt.bkBrief;
     this.bkCover = rt.bkCover;
     this.bkStatus = rt.bkStatus;
 }
示例#3
0
 public static int Update(Book book)
 {
     int rows = 0;
     string sql = "update Book set "
         + "bkID=@bkID,"
         + "bkCode=@bkCode,"
         + "bkName=@bkName,"
         + "bkAuthor=@bkAuthor,"
         + "bkPress=@bkPress,"
         + "bkdatePress=@bkdatePress,"
         + "bkISBN=@bkISBN,"
         + "bkCatalog=@bkCatalog,"
         + "bkLanguage=@bkLanguage,"
         + "bkPages=@bkPages,"
         + "bkPrice=@bkPrice,"
         + "bkDateIn=@bkDateIn,"
         + "bkNum=@bkNum,"
         + "bkBrief=@bkBrief,"
         + "bkCover=@bkCover,"
         + "bkStatus=@bkStatus "
         + "where bkID=@bkID";
     SqlParameter[] parameters ={
                                    new SqlParameter("@bkID",book.bkID),
                                    new SqlParameter("@bkCode",book.bkCode),
                                    new SqlParameter("@bkName",book.bkName),
                                    new SqlParameter("@bkAuthor",book.bkAuthor),
                                    new SqlParameter("@bkPress",book.bkPress),
                                    new SqlParameter("@bkdatePress",book.bkdatePress),
                                    new SqlParameter("@bkISBN",book.bkISBN),
                                    new SqlParameter("@bkCatalog",book.bkCatalog),
                                    new SqlParameter("@bkLanguage",book.bkLanguage),
                                    new SqlParameter("@bkPages",book.bkPages),
                                    new SqlParameter("@bkPrice",book.bkPrice),
                                    new SqlParameter("@bkDateIn",book.bkDateIn),
                                    new SqlParameter("@bkNum",book.bkNum),
                                    new SqlParameter("@bkBrief",book.bkBrief),
                                    new SqlParameter("@bkCover",book.bkCover),
                                    new SqlParameter("@bkStatus",book.bkStatus)
                               };
     try
     {
         rows = SqlHelper.ExecuteNonQuery(sql, parameters);
     }
     catch (SqlException ex)
     {
         throw new Exception(ex.Message);
     }
     return rows;
 }
示例#4
0
 public static int Insert(Book book)
 {
     int rows = 0;
     string sql = "insert into Book(bkID,bkCode,bkName,bkAuthor,bkPress,bkdatePress,bkISBN,bkCatalog,bkLanguage,bkPages,bkPrice,bkDateIn,bkNum,bkBrief,bkCover,bkStatus)"
                      + "values (@bkID,@bkCode,@bkName,@bkAuthor,@bkPress,@bkdatePress,@bkISBN,@bkCatalog,@bkLanguage,@bkPages,@bkPrice,@bkDateIn,@bkNum,@bkBrief,@bkCover,@bkStatus)";
     SqlParameter[] parameters ={
                                    new SqlParameter("@bkID",book.bkID),
                                    new SqlParameter("@bkCode",book.bkCode),
                                    new SqlParameter("@bkName",book.bkName),
                                    new SqlParameter("@bkAuthor",book.bkAuthor),
                                    new SqlParameter("@bkPress",book.bkPress),
                                    new SqlParameter("@bkdatePress",book.bkdatePress),
                                    new SqlParameter("@bkISBN",book.bkISBN),
                                    new SqlParameter("@bkCatalog",book.bkCatalog),
                                    new SqlParameter("@bkLanguage",book.bkLanguage),
                                    new SqlParameter("@bkPages",book.bkPages),
                                    new SqlParameter("@bkPrice",book.bkPrice),
                                    new SqlParameter("@bkDateIn",book.bkDateIn),
                                    new SqlParameter("@bkNum",book.bkNum),
                                    new SqlParameter("@bkBrief",book.bkBrief),
                                    new SqlParameter("@bkCover",book.bkCover),
                                    new SqlParameter("@bkStatus",book.bkStatus)
                               };
     try
     {
         rows = SqlHelper.ExecuteNonQuery(sql, parameters);
     }
     catch (SqlException ex)
     {
         throw new Exception(ex.Message);
     }
     return rows;
 }
示例#5
0
 public int Update(Book book)
 {
     return (BookDAL.Update(book));
 }
示例#6
0
 public int Insert(Book book)
 {
     return (BookDAL.Insert(book));
 }
示例#7
0
 public int Delete(Book book)
 {
     return (BookDAL.Delete(book));
 }
示例#8
0
 private void dgvBook_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvBook.CurrentCell == null)
         return;
     book = BookAdmin.GetBook((int)dgvBook["bkID", dgvBook.CurrentCell.RowIndex].Value);
     SetBookToText();
 }