AccessDAL/Cart.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;

using System.Data;
using System.Data.OleDb;
using MyShop.IDAL;
using MyShop.Model;
namespace MyShop.AccessDAL
{
    public class Cart: ICart
    {
        private ConfigInfo configInfo = new ConfigInfo();
        private string tableName = "Ljh_Cart";
        public Cart()
        {
            if (!string.IsNullOrEmpty(configInfo.TablePrefix.Trim()))
                tableName = configInfo.TablePrefix + "Cart";
        }

        #region ICart 成员

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns>返回ID, 如果发生错误则返回-1</returns>
        public int Add(CartInfo model)
        {
            if (model == null)
            {
                return 0;
            }
            string commandText = "insert into " + this.tableName + "(productId,cartId,quantity,updateTime,subtotal,presentId) values(@productId,@cartId,@quantity,@updateTime,@subtotal,@presentId) ";
            OleDbParameter[] commandParameters = {
				Database.MakeInParam("@ProductId", OleDbType.Integer,4,model.ProductId),
				Database.MakeInParam("@CartId", OleDbType.VarWChar,50,model.CartId),
				Database.MakeInParam("@Quantity", OleDbType.Integer,4,model.Quantity),
				Database.MakeInParam("@UpdateTime", OleDbType.Date,8,model.UpdateTime),
				Database.MakeInParam("@Subtotal", OleDbType.Currency,8,model.Subtotal),
				Database.MakeInParam("@PresentId", OleDbType.Integer,4,model.PresentId)
                                                           };
            int intIdentity = -1;
            try
            {
                Database.ExecuteNonQuery(CommandType.Text, out intIdentity, commandText, commandParameters);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return intIdentity;
        }


        /// <summary>
        /// 删除购物车项目 
        /// </summary>
        /// <param name="filter">where后面的条件语句,不加where</param>
        /// <returns>返回影响行数</returns>
        public int Delete(string filter)
后面还有 251 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。