コード例 #1
0
        internal static List <Order> FindOrdersByOrderNumber(int storeId, List <string> orderNumbers)
        {
            var q = new OrderQuery();

            q.Where(q.StoreId == storeId, q.OrderNumber.In(orderNumbers.ToArray()));
            q.OrderBy(q.OrderNumber.Ascending);

            var collection = new OrderCollection();

            collection.Load(q);

            return(collection.ToList());
        }
コード例 #2
0
        internal static List <Order> GetOrdersByIds(List <int> orderIds)
        {
            var q = new OrderQuery();

            q.Where(q.Id.In(orderIds.ToArray()));
            q.OrderBy(q.OrderNumber.Ascending);

            var collection = new OrderCollection();

            collection.Load(q);

            return(collection.ToList());
        }
コード例 #3
0
        public static List <Order> GetAllOrders(int?storeId)
        {
            OrderQuery q = new OrderQuery();

            q.Where(q.StoreId == storeId);
            q.Where(q.IsDeleted == false);
            q.OrderBy(q.CreatedOn.Descending);

            OrderCollection collection = new OrderCollection();

            collection.Load(q);

            return(collection.ToList());
        }
コード例 #4
0
        internal static List <Order> GetCompletedOrders(int storeId)
        {
            OrderQuery q = new OrderQuery();

            q.Where(q.StoreId == storeId);
            q.Where(q.OrderStatusId == (short)OrderStatusName.Completed);
            q.Where(q.IsDeleted == false);
            q.OrderBy(q.CreatedOn.Descending);

            OrderCollection collection = new OrderCollection();

            collection.Load(q);

            return(collection.ToList());
        }
コード例 #5
0
        internal static List <Order> FindOrders(int storeId, DateTime?fromDate, DateTime?toDate, string customerFirstName, string customerLastName, string customerEmail, List <OrderStatusName> orderStatuses, int?maxResults)
        {
            OrderQuery q = new OrderQuery();

            q.Where(q.StoreId == storeId);

            if (maxResults.HasValue)
            {
                q.es.Top = maxResults.Value;
            }

            if (fromDate.HasValue)
            {
                q.Where(q.CreatedOn >= fromDate.Value);
            }
            if (toDate.HasValue)
            {
                q.Where(q.CreatedOn <= toDate.Value);
            }
            if (!string.IsNullOrEmpty(customerFirstName))
            {
                q.Where(q.CustomerFirstName.Like("%" + customerFirstName + "%"));
            }
            if (!string.IsNullOrEmpty(customerLastName))
            {
                q.Where(q.CustomerLastName.Like("%" + customerLastName + "%"));
            }
            if (!string.IsNullOrEmpty(customerEmail))
            {
                q.Where(q.CustomerEmail.Like("%" + customerEmail + "%"));
            }
            if (orderStatuses.Count > 0)
            {
                short[] orderStatusIds = orderStatuses.ConvertAll(x => (short)x).ToArray();
                q.Where(q.OrderStatusId.In(orderStatusIds));
            }
            q.OrderBy(q.CreatedOn.Descending);

            OrderCollection collection = new OrderCollection();

            collection.Load(q);

            return(collection.ToList());
        }
コード例 #6
0
        internal static List <Order> GetOrdersForUser(int userId, int?storeId, bool includeDeleted)
        {
            OrderQuery q = new OrderQuery();

            q.Where(q.UserId == userId);
            if (storeId.HasValue)
            {
                q.Where(q.StoreId == storeId);
            }
            if (!includeDeleted)
            {
                q.Where(q.IsDeleted == false);
            }
            q.OrderBy(q.CreatedOn.Descending);

            OrderCollection collection = new OrderCollection();

            if (collection.Load(q))
            {
                return(collection.ToList());
            }
            return(new List <Order>());
        }
コード例 #7
0
ファイル: Store.cs プロジェクト: thenotandy/DNNspot.Store
        public static List <CustomerInfo> GetCustomers(int storeId)
        {
            //OrderQuery q = new OrderQuery();
            //q.es.Distinct = true;
            //q.Select(q.UserId);
            //q.Where(q.StoreId == storeId, q.UserId.IsNotNull());
            //OrderCollection orderUsers = new OrderCollection();
            //orderUsers.Load(q);

            //Dictionary<int,bool> orderUserIdHash = new Dictionary<int, bool>(orderUsers.Count);
            //((List<Order>)orderUsers).ForEach(o => orderUserIdHash[o.UserId.Value] = true);

            //Store theStore = GetStore(storeId);
            //ArrayList userArray = UserController.GetUsers(theStore.PortalId.Value); // Normal Users
            //userArray.AddRange(UserController.GetUsers(Null.NullInteger));  // Super Users

            //List<UserInfo> userInfos = userArray.ToList<UserInfo>();
            //userInfos.RemoveAll(ui => !orderUserIdHash.ContainsKey(ui.UserID));

            //return userInfos;

            OrderQuery q = new OrderQuery();

            q.es.Distinct = true;
            q.Select(
                q.UserId,
                q.CustomerFirstName,
                q.CustomerLastName,
                q.CustomerEmail,
                q.BillAddress1,
                q.BillAddress2,
                q.BillCity,
                q.BillRegion,
                q.BillPostalCode,
                q.BillCountryCode,
                q.BillTelephone,
                q.ShipRecipientName,
                q.ShipRecipientBusinessName,
                q.ShipAddress1,
                q.ShipAddress2,
                q.ShipCity,
                q.ShipRegion,
                q.ShipPostalCode,
                q.ShipCountryCode,
                q.ShipTelephone
                );
            q.Where(q.StoreId == storeId);

            OrderCollection collection = new OrderCollection();

            collection.Load(q);
            List <Order> orders = collection.ToList();

            List <CustomerInfo> customerInfos = orders.ConvertAll(c => new CustomerInfo()
            {
                UserId                    = c.UserId,
                FirstName                 = c.CustomerFirstName,
                LastName                  = c.CustomerLastName,
                Email                     = c.CustomerEmail,
                BillAddress1              = c.BillAddress1,
                BillAddress2              = c.BillAddress2,
                BillCity                  = c.BillCity,
                BillRegion                = c.BillRegion,
                BillPostalCode            = c.BillPostalCode,
                BillCountryCode           = c.BillCountryCode,
                BillTelephone             = c.BillTelephone,
                ShipRecipientName         = c.ShipRecipientName,
                ShipRecipientBusinessName = c.ShipRecipientBusinessName,
                ShipAddress1              = c.ShipAddress1,
                ShipAddress2              = c.ShipAddress2,
                ShipCity                  = c.ShipCity,
                ShipRegion                = c.ShipRegion,
                ShipPostalCode            = c.ShipPostalCode,
                ShipCountryCode           = c.ShipCountryCode,
                ShipTelephone             = c.ShipTelephone
            });

            return(customerInfos);
        }