/// <summary> /// 表:BLCategory (添加一条数据 /// </summary> /// <param name="bLCategory">添加的数据</param> /// <returns>执行成功的行数</returns> public static int Insert(BLCategory bLCategory) { return(DBHelp.ExecuteNonQuery( "insert into BLCategory values(@BLName)", new SqlParameter[] { new SqlParameter("@BLName", bLCategory.BLName) })); }
/// <summary> /// 表:BLCategory (根据BLID删除数据 /// </summary> /// <param name="BLID">所需BLID</param> /// <returns>执行成功行数</returns> public static int Delete_BLID(int BLID) { return(DBHelp.ExecuteNonQuery( "delete from BLCategory where BLID=@BLID", new SqlParameter[] { new SqlParameter("@BLID", BLID) })); }
/// <summary> /// 表:Trade (根据MID删除数据 /// </summary> /// <param name="MID">所需MID</param> /// <returns>执行成功的行数</returns> public static int Delelte_MID(int MID) { return(DBHelp.ExecuteNonQuery( "delete from trade where MID=@MID", new SqlParameter[] { new SqlParameter("@MID", MID) })); }
/// <summary> /// 表:Book (根据BID删除 /// </summary> /// <param name="BID">所需BID</param> /// <returns>执行成功行数</returns> public static int Delete_BID(int BID) { return(DBHelp.ExecuteNonQuery( "delete from Book where BID=@BID", new SqlParameter[] { new SqlParameter("@BID", BID) })); }
/// <summary> /// 表:Trade (根据TID删除数据 /// </summary> /// <param name="TID">所需TID</param> /// <returns>执行成功行数</returns> public static int Delete_TID(int TID) { return(DBHelp.ExecuteNonQuery( "Delete from Trade where TID=@TID", new SqlParameter[] { new SqlParameter("@TID", TID) })); }
/// <summary> /// 表:BLCategory (修改数据 /// </summary> /// <param name="bLCategory">修改的数据</param> /// <returns>执行成功的行数</returns> public static int Update(BLCategory bLCategory) { return(DBHelp.ExecuteNonQuery( "update BLCategory set BLName=@BLName where BLID=@BLID", new SqlParameter[] { new SqlParameter("@BLName", bLCategory.BLName), new SqlParameter("@BLID", bLCategory.BLID), })); }
/// <summary> /// 表:Trade (根据TID修改BCount /// </summary> /// <param name="trade">修改的数据</param> /// <returns>执行成功的行数</returns> public static int Update_BCount(int BCount, int TID) { return(DBHelp.ExecuteNonQuery( "update Trade set BCount=@BCount where TID=@TID", new SqlParameter[] { new SqlParameter("@BCount", BCount), new SqlParameter("@TID", TID), })); }
/// <summary> /// 表:Order (根据OID修改OState /// </summary> /// <param name="OID">所需OID</param> /// <param name="OState">所需OState</param> /// <returns></returns> public static int UpdateOState_OID(string OID, int OState) { return(DBHelp.ExecuteNonQuery( "update [Order] set OState=@OState where OID=@OID", new SqlParameter[] { new SqlParameter("@OState", OState), new SqlParameter("@OID", OID), })); }
/// <summary> /// 表:Trade (根据MID与BID修改 /// </summary> /// <param name="trade">修改的数据</param> /// <returns>执行成功的行数</returns> public static int Update_BCount(Trade trade) { return(DBHelp.ExecuteNonQuery( "update Trade set BCount=BCount+@BCount where MID=@MID and BID=@BID", new SqlParameter[] { new SqlParameter("@BCount", trade.BCount), new SqlParameter("@MID", trade.MID), new SqlParameter("@BID", trade.BID), })); }
/// <summary> /// 表:Trade (添加数据 /// </summary> /// <param name="trade">添加的数据</param> /// <returns>执行成功的行数</returns> public static int Insert(Trade trade) { return(DBHelp.ExecuteNonQuery( "insert into Trade values(@BID,@MID,@BCount)", new SqlParameter[] { new SqlParameter("@BID", trade.BID), new SqlParameter("@MID", trade.MID), new SqlParameter("@BCount", trade.BCount), })); }
/// <summary> /// 表:Member (添加注册用户信息 /// </summary> /// <param name="member">注册用户</param> /// <returns>执行成功行数</returns> public static int Register(Member member) { return(DBHelp.ExecuteNonQuery( "insert into Member values(@MName,@MEmail,@MPassword)", new SqlParameter[] { new SqlParameter("@MName", member.MName), new SqlParameter("@Memail", member.MEmail), new SqlParameter("@MPassword", member.MPassword), })); }
/// <summary> /// 表:OrderDetails (添加一条数据 /// </summary> /// <param name="orderDetail">添加的数据</param> /// <returns>执行成功的行数</returns> public static int Insert(OrderDetails orderDetail) { return(DBHelp.ExecuteNonQuery( "insert into OrderDetails values(@OID,@BID,@BPrice,@BCount)", new SqlParameter[] { new SqlParameter("@OID", orderDetail.OID), new SqlParameter("@BID", orderDetail.BID), new SqlParameter("@BPrice", orderDetail.BPrice), new SqlParameter("@BCount", orderDetail.BCount), })); }
/// <summary> /// 表:Book (根据BID修改BCount与BSaleCount /// </summary> /// <param name="book">修改的数据</param> /// <returns>执行成功的行数</returns> public static int Update_BCountAndBSaleCount(Book book) { if (Select_BCount(book.BID) > book.BCount) { return(DBHelp.ExecuteNonQuery( "update Book set BCount=BCount-@BCount,BSaleCount=BSaleCount+@BCount where BID=@BID", new SqlParameter[] { new SqlParameter("@BCount", book.BCount), new SqlParameter("@BID", book.BID) })); } return(0); }
/// <summary> /// 表:Order (添加一条数据 /// </summary> /// <param name="order">添加的数据</param> /// <returns>执行成功的行数</returns> public static int Insert(Order order) { return(DBHelp.ExecuteNonQuery( "insert into [Order] values(@OID,@MID,@ODate,@OConsignee,@OAddress,@OTelephone,@OSumPrice,@OState)", new SqlParameter[] { new SqlParameter("@OID", order.OID), new SqlParameter("@MID", order.MID), new SqlParameter("@ODate", order.ODate), new SqlParameter("@OConsignee", order.OConsignee), new SqlParameter("@OAddress", order.OAddress), new SqlParameter("@OTelephone", order.OTelephone), new SqlParameter("@OSumPrice", order.OSumPrice), new SqlParameter("@OState", order.OState), })); }
/// <summary> /// 表:Book (根据BID修改数据 /// </summary> /// <param name="book">修改的数据</param> /// <returns>执行成功的行数</returns> public static int Update_BID(Book book) { return(DBHelp.ExecuteNonQuery( "update Book set BSID=@BSID,BName=@BName,BAuthor=@BAuthor,BISBN=@BISBN,BTOC=@BTOC,BComment=@BComment,BPic=@BPic,BPrice=@BPrice,BCount=@BCount,BSaleCount=@BSaleCount where BID=@BID", new SqlParameter[] { new SqlParameter("@BSID", book.BSID), new SqlParameter("@BName", book.BName), new SqlParameter("@BAuthor", book.BAuthor), new SqlParameter("@BISBN", book.BISBN), new SqlParameter("@BTOC", book.BTOC), new SqlParameter("@BComment", book.BComment), new SqlParameter("@BPic", book.BPic), new SqlParameter("@BPrice", book.BPrice), new SqlParameter("@BCount", book.BCount), new SqlParameter("@BSaleCount", book.BSaleCount), new SqlParameter("@BID", book.BID) })); }
/// <summary> /// 表:Book (添加一条数据 /// </summary> /// <param name="book">添加的数据</param> /// <returns>执行成功的行数</returns> public static int Insert(Book book) { return(DBHelp.ExecuteNonQuery( "insert into Book values(@BID,@BSID,@BName,@BAuthor,@BISBN,@BTOC,@BComment,@BPic,@BPrice,@BCount,@BDate,@BSaleCount)", new SqlParameter[] { new SqlParameter("@BID", book.BID), new SqlParameter("@BSID", book.BSID), new SqlParameter("@BName", book.BName), new SqlParameter("@BAuthor", book.BAuthor), new SqlParameter("@BISBN", book.BISBN), new SqlParameter("@BTOC", DBNull.Value), new SqlParameter("@BComment", DBNull.Value), new SqlParameter("@BPic", book.BPic), new SqlParameter("@BPrice", book.BPrice), new SqlParameter("@BCount", book.BCount), new SqlParameter("@BDate", book.BDate), new SqlParameter("@BSaleCount", book.BSaleCount), })); }