Exemplo n.º 1
0
        public OrderCollection FetchByQuery(Query qry)
        {
            OrderCollection coll = new OrderCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemplo n.º 2
0
        public OrderCollection FetchAll()
        {
            OrderCollection coll = new OrderCollection();
            Query           qry  = new Query(Order.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Fetches the associated orders.
        /// </summary>
        /// <param name="orderId">The order id.</param>
        /// <returns></returns>
        public OrderCollection FetchAssociatedOrders(int orderId)
        {
            IDataReader     reader          = SPs.FetchAssociatedOrders(orderId).GetReader();
            OrderCollection orderCollection = new OrderCollection();

            orderCollection.LoadAndCloseReader(reader);
            orderCollection.Sort(Order.Columns.CreatedOn, true);
            return(orderCollection);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Fetches the orders for user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        public OrderCollection FetchOrdersForUser(string userName)
        {
            IDataReader reader = new Query(Order.Schema).
                                 AddWhere(Order.Columns.UserName, Comparison.Equals, userName).
                                 AddWhere(Order.Columns.OrderStatusDescriptorId, Comparison.NotEquals, (int)OrderStatus.NotProcessed).
                                 ExecuteReader();
            OrderCollection orderCollection = new OrderCollection();

            orderCollection.LoadAndCloseReader(reader);
            return(orderCollection);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Fetches the order.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <returns></returns>
        public Order FetchOrder(Guid guid)
        {
            Order           order           = new Order();
            Query           query           = new Query(Order.Schema).AddWhere(Order.Columns.OrderGuid, guid.ToString());
            OrderCollection orderCollection = this.FetchByQuery(query);

            if (orderCollection.Count > 1)
            {
                throw new InvalidOperationException(EXCEPTION_TOO_MANY_CARTS);
            }
            if (orderCollection.Count == 1)
            {
                order = orderCollection[0];
            }
            return(order);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Fetches the order.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        public Order FetchOrder(string userName)
        {
            Order order = new Order();
            Query query = new Query(Order.Schema).
                          AddWhere(Order.Columns.UserName, userName).
                          AddWhere(Order.Columns.OrderStatusDescriptorId, (int)OrderStatus.NotProcessed);
            OrderCollection orderCollection = this.FetchByQuery(query);

            if (orderCollection.Count > 1)
            {
                throw new InvalidOperationException(EXCEPTION_TOO_MANY_CARTS);
            }
            if (orderCollection.Count == 1)
            {
                order = orderCollection[0];
            }
            return(order);
        }
Exemplo n.º 7
0
        public OrderCollection FetchByID(object OrderId)
        {
            OrderCollection coll = new OrderCollection().Where("OrderId", OrderId).Load();

            return(coll);
        }