Beispiel #1
0
        protected void Session_Start(object sender, EventArgs e)
        {
            var shoppingCart = new ShoppingCartDTO();

            Session["MyCart"] = shoppingCart;
            Session["Name"]   = "";
            Session["Roles"]  = new List <string>();
        }
Beispiel #2
0
        public async Task <bool> AddProduct(ShoppingCartDTO cart, ShoppingCartProductDTO product)
        {
            var request = new AddProductRequest(cart.Id, product);

            var response = await restClient.Put <AddProductRequest, AddProductResponse>(
                routing.URL,
                routing.AddProduct, request, HeaderAccept.Json);

            return(response.IsSuccess);
        }
        public async Task <ShoppingCartDTO> GetShoppingCartByUserID(int userID)
        {
            string requestURI = $"{shoppingCartMsEndPoint}/{apiBaseAddress}/{userID}";

            string cartJson = await httpClient.GetStringAsync(requestURI);

            ShoppingCartDTO cartDTO = JsonConvert.DeserializeObject <ShoppingCartDTO>(cartJson);

            return(cartDTO);
        }
Beispiel #4
0
 private static Invoice CreateInvoiceFromCart(ShoppingCartDTO cartDTO)
 {
     return(new Invoice()
     {
         UserID = cartDTO.UserID,
         ShoppingCartID = cartDTO.ShoppingCartID,
         CountOfCommodities = cartDTO.Items.Count,
         Total = cartDTO.Total,
         CreatedAt = DateTime.Now
     });
 }
        public bool Add(ShoppingCartDTO cartItem)
        {
            try
            {
                //Add only if cart item is anot already available.
                var prodExistCount = this.context.ShoppingCartItems.Where(x => x.ProductId == cartItem.ProductId &&
                                                                          x.CustomerId == cartItem.CustomerId &&
                                                                          x.BranchId == cartItem.BranchId).Count();
                if (prodExistCount == 0)
                {
                    ShoppingCartItem shoppingCartItem = new ShoppingCartItem();
                    shoppingCartItem.ProductId       = cartItem.ProductId;
                    shoppingCartItem.BranchId        = cartItem.BranchId;
                    shoppingCartItem.UnitPrice       = cartItem.UnitPrice;
                    shoppingCartItem.Quantity        = cartItem.Quantity;
                    shoppingCartItem.ShippingCharges = cartItem.AdditionalShippingCharge;
                    shoppingCartItem.SelectedSize    = cartItem.SelectedSize;
                    shoppingCartItem.CustomerId      = cartItem.CustomerId;
                    shoppingCartItem.CreatedOnUtc    = DateTime.UtcNow;
                    shoppingCartItem.UpdatedOnUtc    = DateTime.UtcNow;

                    context.ShoppingCartItems.Add(shoppingCartItem);
                    this.context.Entry(shoppingCartItem).State = EntityState.Added;
                    var changes = context.SaveChanges();
                    if (changes > 0)
                    {
                        return(true);
                    }
                }
                else if (prodExistCount > 0)
                {
                    ShoppingCartItem shoppingCartItem = this.context.ShoppingCartItems.Where(x => x.ProductId == cartItem.ProductId &&
                                                                                             x.CustomerId == cartItem.CustomerId &&
                                                                                             x.BranchId == cartItem.BranchId).FirstOrDefault();

                    shoppingCartItem.Quantity        = cartItem.Quantity;
                    shoppingCartItem.ShippingCharges = cartItem.AdditionalShippingCharge;

                    shoppingCartItem.UpdatedOnUtc = DateTime.UtcNow;
                    this.context.Entry(shoppingCartItem).State = EntityState.Modified;
                    var changes = context.SaveChanges();
                    if (changes > 0)
                    {
                        return(true);
                    }
                }
            }
            catch
            {
            }
            return(false);
        }
Beispiel #6
0
 public ActionResult <IEnumerable <ShoppingCartDTO> > Get()
 {
     try
     {
         IEnumerable <ShoppingCart>    carts    = purchasesService.GetAllCompletedPurchases();
         IEnumerable <ShoppingCartDTO> cartDTOs = carts.Select(c => ShoppingCartDTO.FromDbModel(c));
         return(Ok(cartDTOs));
     }
     catch (Exception e)
     {
         return(Problem(e.Message, statusCode: StatusCodes.Status500InternalServerError));
     }
 }
Beispiel #7
0
        public async Task <JsonResult> AddShoppingCart([FromBody] ShoppingCartDTO shoppingCartDTO)
        {
            _logger.LogInformation($"User: {shoppingCartDTO.UserId} , Ürün :{shoppingCartDTO.ProductId} için sepet ekleme çağrıldı.");

            var shoppingCart = _mapper.Map <ShoppingCartDTO, ShoppingCart>(shoppingCartDTO);

            _logger.LogInformation($"User: {shoppingCartDTO.UserId} , Ürün :{shoppingCartDTO.ProductId} için sepet mapping işlemi yapıldı..");

            var serviceResponse = await _shoppingCartService.AddShoppingCart(shoppingCart);

            _logger.LogInformation($"User: {shoppingCartDTO.UserId} , Ürün :{shoppingCartDTO.ProductId} için servis cevap döndü. Başarılı :{serviceResponse.IsSuccess}.");

            return(Json(serviceResponse));
        }
        public async Task <ActionResult <ShoppingCartDTO> > Get()
        {
            try
            {
                ShoppingCart cart = await purchasesService.GenerateNewCartAsync();

                ShoppingCartDTO dtoCart = ShoppingCartDTO.FromDbModel(cart);
                return(Ok(dtoCart));
            }
            catch (Exception e)
            {
                return(Problem(e.Message, statusCode: StatusCodes.Status500InternalServerError));
            }
        }
        public async Task <OrderDTO> CreateOrder(Customer.DTO.CustomerDTO customer, ShoppingCartDTO cart, BillingAddressDTO billing)
        {
            var request = new CreateOrderRequest();

            request.Customer       = mapper.Map <OrderCustomerDTO>(customer);
            request.BillingAddress = billing;
            request.Products       = mapper.Map <IEnumerable <ProductDTO> >(cart.Products);

            var response = await client.Post <CreateOrderRequest, CreateOrderResponse>(
                routingConfig.URL,
                routingConfig.CreateOrder, request, HeaderAccept.Json);

            return(response.Order);
        }
        private ShoppingCartDTO ToDTO(ShoppingCartEntity shoppingCartEntity)
        {
            ShoppingCartDTO shoppingCartDTO = new ShoppingCartDTO()
            {
                CardTypeId   = shoppingCartEntity.CardTypeId,
                Id           = shoppingCartEntity.Id,
                CardTypeName = shoppingCartEntity.CardType.CardTypeName,
                Num          = shoppingCartEntity.Num,
                UserId       = shoppingCartEntity.UserId,
                UserName     = shoppingCartEntity.User.UserName
            };

            return(shoppingCartDTO);
        }
 public long InsertShoppingCart(ShoppingCartDTO t_ShoppingCart)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         ShoppingCartEntity ShoppingCartEntity = new ShoppingCartEntity()
         {
             CardTypeId = t_ShoppingCart.CardTypeId,
             Num        = t_ShoppingCart.Num,
             UserId     = t_ShoppingCart.UserId
         };
         ctx.ShoppingCarts.Add(ShoppingCartEntity);
         ctx.SaveChanges();
         return(ShoppingCartEntity.Id);
     }
 }
Beispiel #12
0
        public List <ShoppingCartResultSet> AddShoppingCartItem(ShoppingCartDTO cartItem)
        {
            CartRepository cartRepository = new CartRepository();
            var            currentUser    = ClaimsPrincipal.Current.Identity.Name;
            UserService    userService    = new UserService();

            if (currentUser != null && currentUser == cartItem.UserName)
            {
                var user = userService.GetUser(currentUser);
                cartItem.CustomerId = user.UserId;
                _shoppingCartRepository.Add(cartItem);
                return(GetShoppingCartItemForUser(user.UserId));
            }
            return(null);
        }
Beispiel #13
0
        public List <ShoppingCartResultSet> RemoveShoppingCartItem(ShoppingCartDTO cartItem)
        {
            CartRepository cartRepository = new CartRepository();
            var            currentUser    = ClaimsPrincipal.Current.Identity.Name;
            UserService    userService    = new UserService();

            if (currentUser != null && currentUser == cartItem.UserName)
            {
                var user = userService.GetUser(currentUser);
                cartItem.CustomerId = user.UserId;
                var updateCartItem = _shoppingCartRepository.Find(x => x.ProductId == cartItem.ProductId && x.CustomerId == user.UserId).FirstOrDefault <ShoppingCartItem>();
                _shoppingCartRepository.Delete(updateCartItem);
                return(GetShoppingCartItemForUser(user.UserId));
            }
            return(null);
        }
Beispiel #14
0
        public IActionResult GetShoppingCart()
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ShoppingCart cart = GetOrCreateShoppingCart();

            if (cart != null)
            {
                // send only necessary values
                var apiCart = new ShoppingCartDTO(cart.Id, cart.CartDataJSON);
                return(new JsonResult(apiCart));
            }
            return(BadRequest());
        }
Beispiel #15
0
        private ShoppingCartDTO DummyCart()
        {
            ShoppingCartDTO cart = new ShoppingCartDTO()
            {
                Id = 1,

                AllBooksInsideCart = DummyCartItems(),

                Total = 135,

                Discount = 135 / 10,   //13.5

                GrandTotal = 1215 / 10 //121.5
            };

            return(cart);
        }
        // Add computer components to the cart.

        public IActionResult OnPostComputerToCart()
        {
            var         computerData = session.GetString("computer");
            ComputerDTO computer     = JsonConvert.DeserializeObject <ComputerDTO>(computerData);

            Product cpu         = context.Product.FirstOrDefault(m => m.ID == computer.CpuId);
            Product vga         = context.Product.FirstOrDefault(m => m.ID == computer.VgaId);
            Product memory      = context.Product.FirstOrDefault(m => m.ID == computer.MemoryId);
            Product monitor     = context.Product.FirstOrDefault(m => m.ID == computer.MonitorId);
            Product motherboard = context.Product.FirstOrDefault(m => m.ID == computer.MotherboardId);

            ProductOrderDTO cpuDto         = new ProductOrderDTO(cpu, 1);
            ProductOrderDTO vgaDto         = new ProductOrderDTO(vga, 1);
            ProductOrderDTO memoryDto      = new ProductOrderDTO(memory, 1);
            ProductOrderDTO monitorDto     = new ProductOrderDTO(monitor, 1);
            ProductOrderDTO motherboardDto = new ProductOrderDTO(motherboard, 1);

            ShoppingCartDTO cartDto  = null;
            var             cartData = session.GetString("cart");

            if (cartData != null)
            {
                cartDto = JsonConvert.DeserializeObject <ShoppingCartDTO>(cartData);
            }
            else
            {
                cartDto = new ShoppingCartDTO();
            }

            cartDto.Add(cpuDto);
            cartDto.Add(vgaDto);
            cartDto.Add(memoryDto);
            cartDto.Add(monitorDto);
            cartDto.Add(motherboardDto);

            // Save cart.
            var newCart = JsonConvert.SerializeObject(cartDto);

            session.SetString("cart", newCart);

            // Delete computer.
            session.Remove("computer");

            return(RedirectToAction("OnGetAsync"));
        }
        public async Task <ActionResult <ShoppingCartDTO> > Get(Guid id)
        {
            try
            {
                ShoppingCart cart = await purchasesService.GetCartByIdAsync(id);

                ShoppingCartDTO dtoCart = ShoppingCartDTO.FromDbModel(cart);
                return(Ok(dtoCart));
            }
            catch (KeyNotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (Exception e)
            {
                return(Problem(e.Message, statusCode: StatusCodes.Status500InternalServerError));
            }
        }
        public static ShoppingCartDTO MapCartDomainCartToDTO(ShoppingCart cart, IMapper mapper)
        {
            var mapped_cart = new ShoppingCartDTO
            {
                CartId     = cart.Id,
                Discounts  = mapper.Map <ICollection <CartDiscountDTO> >(cart.CartDiscounts),
                Items      = mapper.Map <ICollection <CartItemDTO> >(cart.CartItems),
                TotalPrice = cart.TotalPrice
            };

            for (int i = 0; i < mapped_cart.Items.Count(); i++)
            {
                var item = cart.CartItems.First(ci => ci.ItemId == mapped_cart.Items.ElementAt(i).Id);
                mapped_cart.Items.ElementAt(i).Quantity = item.Quantity;
            }

            return(mapped_cart);
        }
Beispiel #19
0
        public static QueryResponseDTO <bool> DeleteShoppingCartInfo(ShoppingCartDTO dto)
        {
            QueryResponseDTO <bool> response = new QueryResponseDTO <bool>();

            response.ResultEntity = false;


            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("RemoveShoppingCartInfo");

            using (DynamicQuerySqlBuilder sqlBuilder = new DynamicQuerySqlBuilder(
                       dataCommand.CommandText, dataCommand, dto.PagingInfo, "ID ASC"))
            {
                if (null != dto)
                {
                    if (!string.IsNullOrEmpty(dto.UserID))
                    {
                        sqlBuilder.ConditionConstructor
                        .AddCondition(QueryConditionRelationType.AND, "UserID", DbType.AnsiString, "@UserID", QueryConditionOperatorType.Equal, dto.UserID);
                    }

                    if (!string.IsNullOrEmpty(dto.SellerID))
                    {
                        sqlBuilder.ConditionConstructor
                        .AddCondition(QueryConditionRelationType.AND, "SellerID", DbType.AnsiString, "@SellerID", QueryConditionOperatorType.Equal, dto.SellerID);
                    }
                }
                //QueryData
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                var updateRows = dataCommand.ExecuteNonQuery();
                if (updateRows > 0)
                {
                    response.ResultEntity = true;
                    response.Code         = ResponseStaticModel.Code.OK;
                    response.Message      = ResponseStaticModel.Message.OK;
                }
                else
                {
                    response.ResultEntity = false;
                    response.Code         = ResponseStaticModel.Code.FAILED;
                    response.Message      = ResponseStaticModel.Message.FAILED;
                }
            }
            return(response);
        }
Beispiel #20
0
        public ActionResult SubmitReq()
        {
            var deptCode = Request.Cookies["Employee"]?["DeptCode"];
            var empNum   = Convert.ToInt32(Request.Cookies["Employee"]?["EmpNum"]);
            var fullName = Request.Cookies["Employee"]?["Name"];

            if (Session["MyCart"] is ShoppingCartDTO shoppingCart && shoppingCart.GetCartItemCount() > 0)
            {
                var requisition = new Requisition()
                {
                    RequestRemarks    = Request["remarks"],
                    RequisitionDate   = DateTime.Today,
                    RequisitionEmpNum = empNum,
                    Status            = RequisitionStatus.Pending,
                    DeptCode          = deptCode
                };

                _requisitionRepo.Add(requisition);

                foreach (var cart in shoppingCart.GetAllCartItem())
                {
                    var requisitionDetail = new RequisitionDetail()
                    {
                        RequisitionId = requisition.RequisitionId,
                        ItemNum       = cart.Stationery.ItemNum,
                        Quantity      = cart.Quantity
                    };
                    requisitionDetail.Stationery = _requisitionRepo.AddRequisitionDetail(requisitionDetail);
                }

                Session["MyCart"] = new ShoppingCartDTO();

                //Send email
                var headEmail = _employeeRepo.GetDepartmentHead(deptCode).EmailAddress;
                var email     = new LUSSISEmail.Builder().From(User.Identity.Name)
                                .To(headEmail).ForNewRequistion(fullName, requisition).Build();
                new Thread(delegate() { EmailHelper.SendEmail(email); }).Start();

                return(RedirectToAction("MyRequisitions"));
            }

            return(RedirectToAction("MyCart"));
        }
Beispiel #21
0
        public List <ShoppingCartResultSet> UpdateCartItemQuantity(ShoppingCartDTO cartItem)
        {
            CartRepository cartRepository = new CartRepository();
            var            currentUser    = ClaimsPrincipal.Current.Identity.Name;
            UserService    userService    = new UserService();

            if (!string.IsNullOrEmpty(currentUser) && cartItem != null && currentUser == cartItem.UserName)
            {
                var user = userService.GetUser(currentUser);
                cartItem.CustomerId = user.UserId;
                var updateCartItem = _shoppingCartRepository.Find(x => x.ProductId == cartItem.ProductId && x.CustomerId == user.UserId).FirstOrDefault <ShoppingCartItem>();
                if (updateCartItem != null)
                {
                    updateCartItem.Quantity = cartItem.Quantity;
                    _shoppingCartRepository.UpdateAndSave(updateCartItem);
                    return(GetShoppingCartItemForUser(user.UserId));
                }
            }
            return(null);
        }
 public long UpdateShoppingCart(ShoppingCartDTO t_ShoppingCart)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         BaseService <ShoppingCartEntity> bs = new BaseService <ShoppingCartEntity>(ctx);
         if (bs.GetAll().Any(e => e.Id == t_ShoppingCart.Id))
         {
             return(0);
         }
         else
         {
             var shoopingCart = bs.GetById(t_ShoppingCart.Id);
             shoopingCart.Num        = t_ShoppingCart.Num;
             shoopingCart.UserId     = t_ShoppingCart.UserId;
             shoopingCart.CardTypeId = t_ShoppingCart.CardTypeId;
             ctx.SaveChanges();
             return(t_ShoppingCart.Id);
         }
     }
 }
Beispiel #23
0
        public ShoppingCartDTO Get(int id)
        {
            ShoppingCart    shoppingCart   = IShoppingCartRepository.Get(id);
            ShoppingCartDTO myShoppingCart = new ShoppingCartDTO()
            {
                TotalPrice = shoppingCart.TotalPrice
            };
            IEnumerable <ComponentCart> compCartList = IComponentCartRepository.GetAll().Where(p => p.ShoppingCartId == shoppingCart.Id);

            if (compCartList != null)
            {
                List <Component> compList = new List <Component>();
                foreach (ComponentCart myCompCart in compCartList)
                {
                    Component myComp = IComponentRepository.GetAll().SingleOrDefault(p => p.Id == myCompCart.ComponentId);
                    compList.Add(myComp);
                }
                myShoppingCart.Components = compList;
            }
            return(myShoppingCart);
        }
Beispiel #24
0
        public async Task <InvoiceDTO> ByUserID(int userID)
        {
            //получаем текущую корзину
            ShoppingCartDTO cartDTO = await _shoppingCartMsClient.GetShoppingCartByUserID(userID);

            //если она существует начинаем создание счета
            if (cartDTO != null && cartDTO.ShoppingCartID > 0 && cartDTO.Items.Count > 0)
            {
                Invoice invoiceFromDb = await _invoicesRepository.ByShoppingCartID(cartDTO.ShoppingCartID);

                if (invoiceFromDb != null)
                {
                    //если актуальная информация не сходится с информацией в бд то удаляем старый счет и создаем новый иначе возвращаем уже имеющийся счет
                    if (invoiceFromDb.Total != cartDTO.Total || invoiceFromDb.CountOfCommodities != cartDTO.Items.Count)
                    {
                        await _invoicesRepository.DeleteByID(invoiceFromDb.InvoiceID);

                        Invoice newInvoice       = CreateInvoiceFromCart(cartDTO);
                        Invoice newInvoiceFromDb = await _invoicesRepository.Add(newInvoice);

                        return(_mapper.Map <InvoiceDTO>(newInvoiceFromDb));
                    }
                    else
                    {
                        return(_mapper.Map <InvoiceDTO>(invoiceFromDb));
                    }
                    //если счета по айди корзины в базе нет то создаем новый
                }
                else
                {
                    Invoice newInvoice       = CreateInvoiceFromCart(cartDTO);
                    Invoice newInvoiceFromDb = await _invoicesRepository.Add(newInvoice);

                    return(_mapper.Map <InvoiceDTO>(newInvoiceFromDb));
                }
            }

            return(new InvoiceDTO());
        }
Beispiel #25
0
        public static QueryResponseDTO <bool> AddShoppingCartInfo(ShoppingCartDTO dto)
        {
            QueryResponseDTO <bool> response = new QueryResponseDTO <bool>();

            response.ResultEntity = false;

            var dataCommand = DataCommandManager.GetDataCommand("AddShoppingCartInfo");
            var updateRows  = dataCommand.ExecuteNonQuery(dto);

            if (updateRows > 0)
            {
                response.ResultEntity = true;
                response.Code         = ResponseStaticModel.Code.OK;
                response.Message      = ResponseStaticModel.Message.OK;
            }
            else
            {
                response.ResultEntity = false;
                response.Code         = ResponseStaticModel.Code.FAILED;
                response.Message      = ResponseStaticModel.Message.FAILED;
            }
            return(response);
        }
Beispiel #26
0
        // *******************************************************************************************************************************
        #region -  Cart  -

        public Task <string> InsertCartAsync(ShoppingCartDTO dto)
        {
            return(base.TryExecuteAsync(@"INSERT INTO ShoppingCart
(ID,
Address1_Shipping,
Address2_Shipping,
City_Shipping,
State_Shipping,
ZipCode_Shipping,
Country_Shipping,
Phone_Shipping,
Email_Shipping)
VALUES
(@ID,
@Address1_Shipping,
@Address2_Shipping,
@City_Shipping,
@State_Shipping,
@ZipCode_Shipping,
@Country_Shipping,
@Phone_Shipping,
@Email_Shipping)", dto));
        }
        public ActionResult <ShoppingCartDTO> MyShoppingCart([FromBody] UsernameDTO usernameDTO)
        {
            if (string.IsNullOrWhiteSpace(usernameDTO.Username))
            {
                return(BadRequest("Invalid username"));
            }

            Dictionary <NamedGuid, Dictionary <ProductData, int> >?result = MarketShoppingCartService.ViewShoppingCart(usernameDTO.Username);

            if (result == null)
            {
                return(InternalServerError());
            }

            Dictionary <Guid, double>?prices = MarketShoppingCartService.ViewShoppingCartsUpdatedPrice(usernameDTO.Username);

            if (prices == null)
            {
                return(InternalServerError());
            }

            return(Ok(ShoppingCartDTO.FromDictionaries(result, prices)));
        }
Beispiel #28
0
        private ShoppingCartDTO GetShoppingCart()
        {
            // turn the shopping cart file into a shopping cart

            var lines = File.ReadAllLines("ShoppingCart.txt");

            ShoppingCartDTO shoppingCart = new ShoppingCartDTO();

            shoppingCart.ShoppingCartItems = new List <ShoppingCartItemDTO>();

            foreach (string line in lines)
            {
                if (!String.IsNullOrWhiteSpace(line.Trim()))
                {
                    ShoppingCartItemDTO cartItem = new ShoppingCartItemDTO {
                        ProductCode = line
                    };
                    shoppingCart.ShoppingCartItems.Add(cartItem);
                }
            }

            return(shoppingCart);
        }
        public async Task <ShoppingCartDTO> GetCart()
        {
            var AllCartItems = (await _context.BooksAsCartItems.Include(i => i.Book).Include(c => c.Book.Category).ToListAsync()).Select(t => new BookAsCartItemDTO
            {
                Id = t.Id,

                Price = t.Price,

                Book = t.Book,

                Quantity = t.Quantity
            }).ToList();

            ShoppingCartDTO shoppingCart = new ShoppingCartDTO()
            {
                AllBooksInsideCart = AllCartItems,

                Total = AllCartItems.Sum(p => p.Price * p.Quantity)//calculate total bill
            };

            //when total amount is above 100 dollors then we give 10% discount i.e GrandTotal = Total * 0.1
            //otherwise GrandTotal = Total
            if (shoppingCart.Total > 100)
            {
                shoppingCart.Discount = shoppingCart.Total * 10 / 100;

                shoppingCart.GrandTotal = shoppingCart.Total - shoppingCart.Discount;
            }
            else
            {
                shoppingCart.Discount = 0;

                shoppingCart.GrandTotal = shoppingCart.Total;
            }

            return(shoppingCart);
        }
Beispiel #30
0
        public static QueryResponseDTO <List <ShoppingCartModel> > GetShoppingCartInfo(ShoppingCartDTO dto)
        {
            QueryResponseDTO <List <ShoppingCartModel> > responseDTO = new QueryResponseDTO <List <ShoppingCartModel> >();
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("GetShoppingCartInfo");

            using (DynamicQuerySqlBuilder sqlBuilder = new DynamicQuerySqlBuilder(
                       dataCommand.CommandText, dataCommand, dto.PagingInfo, "ID ASC"))
            {
                if (null != dto)
                {
                    if (!string.IsNullOrEmpty(dto.UserID))
                    {
                        sqlBuilder.ConditionConstructor
                        .AddCondition(QueryConditionRelationType.AND, "UserID", DbType.AnsiString, "@UserID", QueryConditionOperatorType.Equal, dto.UserID);
                    }

                    if (!string.IsNullOrEmpty(dto.SellerID))
                    {
                        sqlBuilder.ConditionConstructor
                        .AddCondition(QueryConditionRelationType.AND, "SellerID", DbType.AnsiString, "@SellerID", QueryConditionOperatorType.Equal, dto.SellerID);
                    }
                }
                //QueryData
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                var result = dataCommand.ExecuteEntityList <ShoppingCartModel>();

                responseDTO.ResultEntity = result;
            }
            responseDTO.TotalCount = dto.PagingInfo.TotalCount;
            responseDTO.Code       = ResponseStaticModel.Code.OK;
            responseDTO.Message    = ResponseStaticModel.Message.OK;
            return(responseDTO);
        }