Esempio n. 1
0
        public void receiver_should_save_one_order()
        {
            var url = "http://localhost:1701/shopify/receiver";

            Ping(url, GetJson());
            Assert.AreEqual(1, _orders.All().Count());
        }
Esempio n. 2
0
        public void RemoveOrder(Order order)
        {
            var transactionId = order.AccountTransactionTypeId;

            Orders.Remove(order);
            if (Orders.All(x => x.AccountTransactionTypeId != transactionId))
            {
                TransactionDocument.AccountTransactions.Where(x => x.AccountTransactionTypeId == transactionId)
                .ToList().ForEach(x => TransactionDocument.AccountTransactions.Remove(x));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到支付方式
 /// </summary>
 /// <returns></returns>
 protected virtual void SetPayTypes()
 {
     if (Orders == null || PayTypes == null || PayTypes.Count == 0)
     {
         return;
     }
     PayTypes = PayTypes.Where(it => Orders.All(s => s.PayTypes == null || s.PayTypes.Length == 0 || s.PayTypes.Contains(it.Name))).ToList();
     foreach (var payType in PayTypes)
     {
         payType.SetUrl();
     }
 }
        protected void OnParentViewModelChanged()
        {
            var ordersStorage = (ParentViewModel as IHaveOrdersStorage)?.OrdersStorage;

            if (ordersStorage == null)
            {
                throw new ArgumentNullException("Orders Storage не может быть равным null!");
            }

            ordersStorage.AlgoChanging += OrdersStorage_AlgoChanging;
            ordersStorage.AlgoChanged  += OrdersStorage_AlgoChanged;

            OrdersStorage_AlgoChanged(ordersStorage, null, null);

            ordersStorage.Entities
            .Where(o => o.Server == Server)
            .ForEach(o =>
            {
                if (Orders.All(oo => o.Id != oo.Id))
                {
                    Orders.Add((Order)o.Clone());
                }
            });
        }
Esempio n. 5
0
        public static void LoadLogs()
        {
            var     vidlog      = new VideoLog();
            dynamic productions = new Productions();
            dynamic episodes    = new Episodes();
            dynamic orderItems  = new OrderItems();
            dynamic channels    = new Channels();
            var     orders      = new Orders();

            var rand = new Random();

            Console.WriteLine("Deleting logs...");
            vidlog.Delete();

            foreach (var order in orders.All())
            {
                //pull the orderItems
                var items = orderItems.Find(OrderID: order.ID);

                //loop the items
                foreach (var item in items)
                {
                    var slug = item.SKU;
                    if (slug == "yearly")
                    {
                        Console.WriteLine("Loading Productions and Episodes for Annual...");

                        //create a download log for each production and episode
                        foreach (var p in productions.All())
                        {
                            var eps = episodes.Find(ProductionID: p.ID);
                            foreach (var e in eps)
                            {
                                var log = new {
                                    Slug          = item.SKU,
                                    EpisodeNumber = e.Number,
                                    Email         = order.Email,
                                    //the download file for the episode
                                    FileName = p.Slug + "_" + e.Number + ".zip",
                                    FileSize = e.HDFileSize,
                                    //1 day lag
                                    LogDate     = order.CreatedAt.AddDays(1),
                                    OrderItemID = item.ID
                                };
                                vidlog.Insert(log);
                            }
                        }
                    }
                    else if (slug == "monthly")
                    {
                        //create a stream log for each production and episode
                        Console.WriteLine("Loading Productions and Episodes for Monthly...");
                        foreach (var p in productions.All())
                        {
                            var eps = episodes.Find(ProductionID: p.ID);
                            foreach (var e in eps)
                            {
                                var log = new {
                                    Slug          = item.SKU,
                                    EpisodeNumber = e.Number,
                                    Email         = order.Email,
                                    //the download file for the episode
                                    FileName = p.Slug + "_" + e.Number + ".flv",
                                    FileSize = e.StreamFileSize,
                                    //1 day lag
                                    LogDate     = order.CreatedAt.AddDays(1),
                                    OrderItemID = item.ID
                                };
                                vidlog.Insert(log);
                            }
                        }
                    }
                    else
                    {
                        var p   = productions.First(Slug: item.SKU);
                        var eps = episodes.Find(ProductionID: p.ID);
                        Console.WriteLine("Loading log for {0}...", p.Slug);
                        foreach (var e in eps)
                        {
                            var log = new {
                                Slug          = item.SKU,
                                EpisodeNumber = e.Number,
                                Email         = order.Email,
                                //the download file for the episode
                                FileName = p.Slug + "_" + e.Number + ".zip",
                                FileSize = e.HDFileSize,
                                //1 day lag
                                LogDate     = order.CreatedAt.AddDays(1),
                                OrderItemID = item.ID
                            };
                            vidlog.Insert(log);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public static void LoadLogs() {
            var vidlog = new VideoLog();
            dynamic productions = new Productions();
            dynamic episodes = new Episodes();
            dynamic orderItems = new OrderItems();
            dynamic channels = new Channels();
            var orders = new Orders();

            var rand = new Random();
            Console.WriteLine("Deleting logs...");
            vidlog.Delete();

            foreach (var order in orders.All()) {
                //pull the orderItems
                var items = orderItems.Find(OrderID: order.ID);

                //loop the items
                foreach (var item in items) {

                    var slug = item.SKU;
                    if (slug == "yearly") {
                        Console.WriteLine("Loading Productions and Episodes for Annual...");

                        //create a download log for each production and episode
                        foreach (var p in productions.All()) {
                            var eps = episodes.Find(ProductionID: p.ID);
                            foreach (var e in eps) {
                                var log = new {
                                    Slug = item.SKU,
                                    EpisodeNumber = e.Number,
                                    Email = order.Email,
                                    //the download file for the episode
                                    FileName = p.Slug + "_"+e.Number+".zip",
                                    FileSize = e.HDFileSize,
                                    //1 day lag
                                    LogDate = order.CreatedAt.AddDays(1),
                                    OrderItemID = item.ID
                                };
                                vidlog.Insert(log);
                            }
                        }
                    } else if (slug == "monthly") {
                        //create a stream log for each production and episode
                        Console.WriteLine("Loading Productions and Episodes for Monthly...");
                        foreach (var p in productions.All()) {
                            var eps = episodes.Find(ProductionID: p.ID);
                            foreach (var e in eps) {
                                var log = new {
                                    Slug = item.SKU,
                                    EpisodeNumber = e.Number,
                                    Email = order.Email,
                                    //the download file for the episode
                                    FileName = p.Slug + "_" + e.Number + ".flv",
                                    FileSize = e.StreamFileSize,
                                    //1 day lag
                                    LogDate = order.CreatedAt.AddDays(1),
                                    OrderItemID = item.ID
                               };
                                vidlog.Insert(log);
                            }
                        }
                    } else {
                        var p = productions.First(Slug:item.SKU);
                        var eps = episodes.Find(ProductionID: p.ID);
                        Console.WriteLine("Loading log for {0}...",p.Slug);
                        foreach (var e in eps) {
                            var log = new {
                                Slug = item.SKU,
                                EpisodeNumber = e.Number,
                                Email = order.Email,
                                //the download file for the episode
                                FileName = p.Slug + "_" + e.Number + ".zip",
                                FileSize = e.HDFileSize,
                                //1 day lag
                                LogDate = order.CreatedAt.AddDays(1),
                                OrderItemID = item.ID
                            };
                            vidlog.Insert(log);
                        }
                    }

                }
            }
            
        }