コード例 #1
0
        public async Task <RCart> Get(string connectionString, string clientId, EnumDefine.CartStatusEnum status)
        {
            var data = await WithConnection(connectionString, async (connection) =>
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@ClientId", clientId, DbType.String);
                parameters.Add("@Status", status.AsEnumToInt(), DbType.Int64);
                return(await connection.QueryFirstOrDefaultAsync <RCart>(ProcName.ShoppingCart_GetByCustomer, parameters, commandType: CommandType.StoredProcedure));
            });

            return(data);
        }
コード例 #2
0
 public async Task <RCartItem[]> Get(string connectionString, string cartId, EnumDefine.CartStatusEnum status)
 {
     return(await WithConnection(connectionString, async (connection) =>
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@CartId", cartId, DbType.String);
         parameters.Add("@Status", status.AsEnumToInt(), DbType.Int64);
         parameters.Add("@AllStatus", EnumDefine.CartStatusEnum.AllStatus.AsEnumToInt(), DbType.Int64);
         var datas = await connection.QueryAsync <RCartItem>(ProcName.ShoppingCartItem_GetByCartId, parameters, null, null, CommandType.StoredProcedure);
         return datas.ToArray();
     }));
 }
コード例 #3
0
        public async Task <RCart> GetFromCache(string clientId, EnumDefine.CartStatusEnum status)
        {
            var cart = await GetFromCache(clientId);

            if (cart != null)
            {
                if (cart.Status == status)
                {
                    cart.CartItems = cart.CartItems.Where(p => p.Status == status).ToArray();
                }
                else
                {
                    return(null);
                }
            }
            return(cart);
        }
コード例 #4
0
 public bool CheckStatus(EnumDefine.CartStatusEnum status)
 {
     return(Status == status);
 }
コード例 #5
0
 public void SetStatus(EnumDefine.CartStatusEnum status)
 {
     Status = status;
 }