Exemplo n.º 1
0
        void Timer(int id, int index)
        {
            Slipcs slip = _slip.FindOne(id);
            int    re   = slip.Remaining;

            if (re != 0)
            {
                Device.StartTimer(TimeSpan.FromSeconds(5), () => {
                    slip.Remaining -= 2;
                    _slip.SaveSlipcs(slip);
                    MakeSlipList();
                    if (slip.Remaining == 30)
                    {
                        var array   = this.cellList.ToArray();
                        slip.Status = "30分経過";
                        _slip.SaveSlipcs(slip);

                        MakeSlipList();
                        return(true);
                    }
                    else if (slip.Remaining <= 0)
                    {
                        var array   = this.cellList.ToArray();
                        slip.Status = "会計";
                        _slip.SaveSlipcs(slip);

                        MakeSlipList();
                        return(false);
                    }
                    return(true);
                });
            }
        }
Exemplo n.º 2
0
        void CreateView(SaveSlip relay)
        {
            var label = new Label
            {
                Text      = "伝票詳細:",
                FontSize  = 40,
                TextColor = Color.White
            };

            var slipId = new Label
            {
                Text              = relay.SlipId.ToString(),
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 40
            };

            var time = new Label
            {
                Text            = "入店日時:",
                TextColor       = Color.White,
                VerticalOptions = LayoutOptions.Center,
                FontSize        = 20
            };

            var visitTime = new Label
            {
                Text              = _slip.FindOne(relay.SlipId).VisitTime.ToLongDateString() + _slip.FindOne(relay.SlipId).VisitTime.ToShortTimeString(),
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15
            };

            var num = new Label
            {
                Text            = "客数:",
                TextColor       = Color.White,
                VerticalOptions = LayoutOptions.Center,
                FontSize        = 20
            };

            var numA = new Label
            {
                Text              = _guest.CountGuest(relay.SlipId).ToString(),
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15
            };

            var table = new Label
            {
                Text            = "テーブル:",
                TextColor       = Color.White,
                VerticalOptions = LayoutOptions.Center,
                FontSize        = 20
            };

            var tName = new Label
            {
                Text              = _slip.FindOne(relay.SlipId).TableName,
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15
            };

            var guest = new Label
            {
                Text              = "注文者",
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            var menu = new Label
            {
                Text              = "メニュー",
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            var count = new Label
            {
                Text              = "数量",
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };



            var detail = new Label
            {
                Text              = "対象",
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            var sum = new Label
            {
                Text              = "小計",
                TextColor         = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };



            var total = new Label
            {
                Text = "合計:  " + string.Format("{0:C}", _order.GetTotal(relay.SlipId)),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                FontSize          = 40,
                TextColor         = Color.Black
            };

            var listView = new ListView
            {
                ItemsSource  = _order.SaveOrderHistory(relay.SlipId),
                ItemTemplate = new DataTemplate(typeof(SaveSlipCell))
            };



            var backButton = new Button
            {
                Text      = "戻る",
                TextColor = Color.Black
            };

            backButton.Clicked += (s, e) =>
            {
                Navigation.PopModalAsync();
            };


            Content = new StackLayout
            {
                Padding  = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                Children =
                {
                    new StackLayout
                    {
                        Padding         = 5,
                        BackgroundColor = Color.Gray,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { label, slipId    }
                    },
                    new StackLayout
                    {
                        Padding         = 5,
                        BackgroundColor = Color.Gray,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { time,  visitTime }
                    },
                    new StackLayout
                    {
                        Padding         = 5,
                        BackgroundColor = Color.Gray,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { num,   numA      }
                    },
                    new StackLayout
                    {
                        Padding         = 5,
                        BackgroundColor = Color.Gray,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { table, tName     }
                    },
                    new StackLayout
                    {
                        BackgroundColor = Color.Gray,
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { guest, menu, count, detail, sum }
                    },
                    listView,
                    total,
                    backButton
                }
            };
        }