Beispiel #1
0
        /// <summary>
        /// Design time constructor
        /// </summary>
        public MainWindowViewModel()
        {
            Categories = new[]
            {
                new ExampleCategoryViewModel {
                    Category = "3D Charts"
                },
                new ExampleCategoryViewModel {
                    Category = "2D Charts"
                },
                new ExampleCategoryViewModel {
                    Category = "Featured Apps"
                },
            };

            var stubExamples = new Dictionary <Guid, Example>
            {
                { Guid.NewGuid(), new Example(null, new ExampleDefinition {
                        Title = "An Example"
                    }) },
                { Guid.NewGuid(), new Example(null, new ExampleDefinition {
                        Title = "Another Example"
                    }) },
                { Guid.NewGuid(), new Example(null, new ExampleDefinition {
                        Title = "SuperCool Example"
                    }) },
            };

            EverythingViewModel = new EverythingViewModel(stubExamples);
        }
Beispiel #2
0
        public ActionResult GetAmountOfPeople(ChosenListViewModel chosenData)
        {
            chosenData.EndTime = chosenData.EndTime.AddHours(23).AddMinutes(59).AddSeconds(59);
            if (chosenData.Zone == null || chosenData.DiscountType == null || chosenData.PaymentType == null)
            {
                return(View());
            }
            var findEverything = new EverythingViewModel()
            {
                ChosenData   = chosenData,
                DetailedInfo = (from tr in ctx.Transactions
                                join t in ctx.Tickets on tr.Id equals t.Transaction.Id
                                join c in ctx.TransportCards on t.Card.Id equals c.Id
                                join u in ctx.Users on c.User.Id equals u.Id
                                where DateTime.Compare(tr.Date, chosenData.StartTime) >= 0 &&
                                DateTime.Compare(tr.Date, chosenData.EndTime) <= 0 &&
                                (!chosenData.DiscountType.Any() || chosenData.DiscountType.Contains(t.TicketType.DiscountType)) &&
                                (!chosenData.PaymentType.Any() || chosenData.PaymentType.Contains(tr.PaymentType)) &&
                                (!chosenData.Zone.Any() || chosenData.Zone.Contains(t.TicketType.Zone))
                                select new DetailedInfoViewModel()
                {
                    TransactionId = tr.Id,
                    PaymentType = tr.PaymentType,
                    TicketId = t.Id,
                    TicketIssuedPrice = t.IssuedPrice,
                    TicketType = t.TicketType,
                    CardId = c.Id,
                    UserId = u.Id,
                    TransactionDate = tr.Date
                })
                               .Union(from tr in ctx.Transactions
                                      join t in ctx.Tickets on tr.Id equals t.Transaction.Id
                                      where t.Card == null &&
                                      DateTime.Compare(tr.Date, chosenData.StartTime) >= 0 &&
                                      DateTime.Compare(tr.Date, chosenData.EndTime) <= 0 &&
                                      (!chosenData.DiscountType.Any() || chosenData.DiscountType.Contains(t.TicketType.DiscountType)) &&
                                      (!chosenData.PaymentType.Any() || chosenData.PaymentType.Contains(tr.PaymentType)) &&
                                      (!chosenData.Zone.Any() || chosenData.Zone.Contains(t.TicketType.Zone))
                                      select new DetailedInfoViewModel
                {
                    TransactionId     = tr.Id,
                    PaymentType       = tr.PaymentType,
                    TicketId          = t.Id,
                    TicketIssuedPrice = t.IssuedPrice,
                    TicketType        = t.TicketType,
                    CardId            = -1,
                    UserId            = -1,
                    TransactionDate   = tr.Date
                }
                                      ).ToList(),

                TotalAmount = (from tr in ctx.Transactions
                               join t in ctx.Tickets on tr.Id equals t.Transaction.Id
                               join c in ctx.TransportCards on t.Card.Id equals c.Id
                               join u in ctx.Users on c.User.Id equals u.Id
                               where DateTime.Compare(tr.Date, chosenData.StartTime) >= 0 &&
                               DateTime.Compare(tr.Date, chosenData.EndTime) <= 0 &&
                               (!chosenData.DiscountType.Any() || chosenData.DiscountType.Contains(t.TicketType.DiscountType)) &&
                               (!chosenData.PaymentType.Any() || chosenData.PaymentType.Contains(tr.PaymentType)) &&
                               (!chosenData.Zone.Any() || chosenData.Zone.Contains(t.TicketType.Zone))
                               select t.Id
                               ).Count()
            };


            return(View(findEverything));
        }