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); }
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(); })); }
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); }
public bool CheckStatus(EnumDefine.CartStatusEnum status) { return(Status == status); }
public void SetStatus(EnumDefine.CartStatusEnum status) { Status = status; }