예제 #1
0
 public RSOrderItem(RSProduct product, RSOrder order)
     : this()
 {
     Product = product;
     Order = order;
     Price = product.Price;
 }
예제 #2
0
 public RSOrderItem(RSProduct product, RSOrder order)
     : this()
 {
     Product = product;
     Order   = order;
     Price   = product.Price;
 }
예제 #3
0
        private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (e.NavigationParameter is RSOrder)
                order = e.NavigationParameter as RSOrder;

            if (order != null)
            {
                grdOrderItems.ItemsSource = order.Items.Where(oi => oi.State < 2);
            }
        }
예제 #4
0
        private async void btnReload_Click(object sender, RoutedEventArgs e)
        {
            if (order != null)
            {
                order = await Service.GetOrder(order.Id);

                lstOrderItems.ItemsSource = order.Items.Where(oi => oi.State < 2);
                this.DataContext = order;
            }
        }
예제 #5
0
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (e.NavigationParameter is int)
                order = await Service.GetOrder((int)e.NavigationParameter);

            if (e.NavigationParameter is RSOrder)
                order = await Service.GetOrder((e.NavigationParameter as RSOrder).Id);

            lstOrderItems.ItemsSource = order.Items.Where(oi => oi.State < 2);
            this.DataContext = order;
        }
예제 #6
0
        private async void btnCreateReceipt_Click(object sender, RoutedEventArgs e)
        {
            btnAcceptReceipt.IsEnabled = false;
            grdOrderItems.IsEnabled = false;

            if (grdOrderItems.SelectedItems.Count == 0)
            {
                MessageDialog md = new MessageDialog("Potvrzení účtenky nebylo možno provést. Musíte označit alespoň jednu položku.", "Potvrzení účtenky");
                await md.ShowAsync();
                btnAcceptReceipt.IsEnabled = true;
                grdOrderItems.IsEnabled = true;
                return;
            }

            int receiptId = await Service.CreateReceipt(order.Id, grdOrderItems.SelectedItems.OfType<RSOrderItem>().Select(oi => oi.Id).ToList());
            if (receiptId >= 0)
            {
                string receiptHtml = await Service.GenerateReceipt(receiptId);
                webReceipt.NavigateToString(receiptHtml);
                await PrintManager.ShowPrintUIAsync();
            }
            else
            {
                MessageDialog md = new MessageDialog("Potvrzení účtenky nebylo možno provést. Je možné že jde konflikt mezi zařízeními. Prosíme zkuste vytvořit účtenku znovu s aktuálními daty, které pro Vás aplikace načte.", "Potvrzení účtenky");
                await md.ShowAsync();
                order = await Service.GetOrder(order.Id);
                grdOrderItems.ItemsSource = order.Items.Where(oi => oi.State < 2);
                btnAcceptReceipt.IsEnabled = true;
                grdOrderItems.IsEnabled = true;
            }
        }
예제 #7
0
 public async Task<RSOrder> CreateOrder([FromBody]string title)
 {
     RSOrder order = new RSOrder();
     order.Title = title;
     db.Orders.Add(order);
     await db.SaveChangesAsync();
     return order;
 }