public OrderCollection FetchByQuery(Query qry) { OrderCollection coll = new OrderCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public OrderCollection FetchAll() { OrderCollection coll = new OrderCollection(); Query qry = new Query(Order.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
public OrderCollection FetchByID(object OrderId) { OrderCollection coll = new OrderCollection().Where("OrderId", OrderId).Load(); return(coll); }