void CreateSlips(OrderInfo[] orderInfos) { var slip = new Slipcs { VisitTime = DateTime.Now, TableName = this.TableId, Remaining = this.remaining, Status = "在席" }; _slip.SaveSlipcs(slip); int slipId = _slip.GetSlipId(this.TableId); int tId = _table.GetId(this.TableId); var table = new Tabel { Id = tId, Name = this.TableId, Use = true }; _table.SaveTable(table); foreach (OrderInfo oi in orderInfos) { var user = new Gest { Name = oi.GuestId, TableId = this.TableId, SlipId = slipId, InsertDate = DateTime.Now }; _gest.SaveGest(user); var set = _set.FindOne(oi.MenuId); var order = new OrderInfo { SlipId = slipId.ToString(), GuestId = oi.GuestId, MenuId = set.Name, Count = 1, Back = oi.Back, TargetId = oi.TargetId, Sum = set.Price }; _order.SaveOrderInfo(order); } }
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); }); } }
void CreateView(Slipcs slip) { var listView = new ListView { ItemsSource = _guest.getGests(slip.TableName), ItemTemplate = new DataTemplate(typeof(TextCell)) }; listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Name"); listView.ItemTemplate.SetBinding(TextCell.DetailProperty, "Id"); listView.ItemTapped += async(s, e) => { var guest = (Gest)e.Item; this.info = new OrderInfo { SlipId = slip.Id.ToString(), GuestId = guest.Name }; await Navigation.PushModalAsync(new OrderView(this.info)); }; var label = new Label { Text = "注文者を選択してください。", HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.White, TextColor = Color.Black }; var backButton = new Button { Text = "戻る", WidthRequest = 60, TextColor = Color.White, }; backButton.Clicked += (s, e) => { Navigation.PopModalAsync(); }; Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0), Children = { new StackLayout { BackgroundColor = Color.Navy, Padding = 5, Orientation = StackOrientation.Horizontal, Children = { label } }, listView, backButton } }; }
public int SaveSlipcs(Slipcs slip) { lock (Locker) { if (slip.Id != 0) { _db.Update(slip); return(slip.Id); } return(_db.Insert(slip)); } }
void DeleteSlip(Slipcs slip) { //伝票をDelete slip.Delete = true; _slip.SaveSlipcs(slip); //履歴にDeleteとして登録 var hist = new SaveSlip { EndTime = DateTime.Now, SlipId = slip.Id, Delete = true }; _history.SaveSSlip(hist); //オーダー情報をDelete var orderList = _order.GetSlipId(slip.Id); foreach (OrderInfo oi in orderList) { oi.Delete = true; _order.SaveOrderInfo(oi); } //ゲストをDelete var guestList = _guest.getGests(slip.TableName); foreach (Gest g in guestList) { g.Delete = true; _guest.SaveGest(g); } //卓のUSE解除 Tabel table = _table.FindOne(slip.TableName); table.Use = false; _table.SaveTable(table); }
public OrderTableView(Slipcs slip) { InitializeComponent(); CreateView(slip); }
void CreateView(Slipcs relay) { var label = new Label { Text = "伝票詳細", FontSize = 40, TextColor = Color.White }; var slipId = new Label { Text = relay.Id.ToString(), TextColor = Color.White, VerticalOptions = LayoutOptions.Center, FontSize = 40 }; var guest = new Label { Text = "注文者", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.StartAndExpand }; var menu = new Label { Text = "メニュー", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand }; var count = new Label { Text = "数量", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand }; var back = new Label { Text = "バック", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand }; var sum = new Label { Text = "小計", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.EndAndExpand }; var total = new Label { Text = string.Format("{0:C}", _order.GetTotal(relay.Id)), HorizontalOptions = LayoutOptions.EndAndExpand, FontSize = 40, TextColor = Color.Black }; var listView = new ListView { ItemsSource = _order.GetSlipId(relay.Id), ItemTemplate = new DataTemplate(typeof(SlipDetailCell)) }; listView.ItemTapped += async(s, e) => { var item = (OrderInfo)e.Item; string menuName = _menu.GetMenuName(item.MenuId); if (await DisplayAlert("削除しますか?", item.GuestId + ":" + menuName + ":" + item.Sum, "OK", "cancel")) { item.Delete = true; _order.SaveOrderInfo(item); listView.ItemsSource = _order.GetSlipId(relay.Id); total.Text = _order.GetTotal(relay.Id).ToString(); } }; var paymaster = new Button { Text = "会計", TextColor = Color.Red, FontSize = 30 }; paymaster.Clicked += async(s, e) => { if (await DisplayAlert("会計", "会計します、よろしいですか?", "OK", "キャンセル")) { PayMaster(); await Navigation.PushModalAsync(new MainPage()); } }; 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 { BackgroundColor = Color.Gray, Orientation = StackOrientation.Horizontal, Children = { guest, menu, count, back, sum } }, listView, total, paymaster, backButton } }; }
public SlipDetailView(Slipcs relay) { InitializeComponent(); this.detail = relay; CreateView(relay); }