示例#1
0
文件: BuyDAL.cs 项目: jaydeny/XMSHOP
        public int AddBuy(BuyEntity buy)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbbuy (buy_time,buy_count,buy_AN,goods_id,buy_total,order_id)");
            strSql.Append("values");
            strSql.Append("(@BuyTime,@BuyCount,@BuyAccountName,@GoodsID,@BuyPrice,@OrderID,@TypeId)");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] paras =
            {
                new SqlParameter("@BuyTime",        buy.BuyTime),
                new SqlParameter("@BuyCount",       buy.BuyCount),
                new SqlParameter("@BuyAccountName", buy.BuyAccountName),
                new SqlParameter("@GoodsID",        buy.GoodsID),
                new SqlParameter("@BuyPrice",       buy.BuyPrice),
                new SqlParameter("@OrderID",        buy.OrderID)
            };
            return(Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.connStr, CommandType.Text, strSql.ToString(), paras)));
        }
 public BuyViewModel()
 {
     buyBookCommand = new BuyBookCommand(this);
     // CurrentBuyBook = new BuyEntity();
     SelectBuyBook = new BuyEntity();
 }