public TableOrderView() { InitializeComponent(); viewModel = new TableOrderViewModel(); CreateContent(); BindingContext = viewModel; cbbListFloor.SelectionChanged += CbbListFloor_SelectionChanged; }
public async Task <ActionResult> Index() { var tableOrder = _productsDb.Where(p => !p.Value.IsPublished).OrderBy(p => p.Value.Title).Select(p => new ServicePublicData() { Id = p.Value.Id.ToString() }).ToList(); var model = new TableOrderViewModel(UIKeysProductDrafts.Index.ProductTableOrder, tableOrder); return(ViewModel(model)); }
public async Task <ActionResult> IndexDiff() { var tableOrder = _productsDb.Where(p => !p.Value.IsPublished).OrderBy(p => p.Value.Title).Select(p => new ServicePublicData() { Id = p.Value.Id.ToString() }).ToList(); var tableOrderVM = new TableOrderViewModel(UIKeysProductDrafts.Index.ProductTableOrder, tableOrder); var titleVM = new TableViewModel(UIKeysProductDrafts.IndexDiff.ProductTitleColumn, page => page.Html.Action("IndexDiff")); var authorVM = new TableViewModel(UIKeysProductDrafts.IndexDiff.ProductAuthorColumn, page => MvcHtmlString.Empty); return(ViewModels(tableOrderVM, titleVM, authorVM)); }
public async void Scan() { try { var options = new MobileBarcodeScanningOptions { AutoRotate = false, UseFrontCameraIfAvailable = false, TryHarder = true, }; var overlay = new ZXingDefaultOverlay { TopText = "Please scan QR code", BottomText = "Align the QR code within the frame" }; var grid = new Grid(); RowDefinition row1 = new RowDefinition() { Height = 100 }; RowDefinition row2 = new RowDefinition(); RowDefinition row3 = new RowDefinition() { Height = 150 }; grid.RowDefinitions.Add(row1); grid.RowDefinitions.Add(row2); grid.RowDefinitions.Add(row3); Label edit = new Label() { Text = "Đặt mã QR vào khung hình", FontSize = 24, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Red, }; Grid grid1 = new Grid() { BackgroundColor = Color.Black, Opacity = 0.4f, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; grid1.Children.Add(edit); Grid.SetRow(grid1, 0); grid.Children.Add(grid1); var QRScanner = new ZXingScannerPage(options, grid); await Navigation.PushModalAsync(QRScanner); QRScanner.OnScanResult += (result) => { // Stop scanning QRScanner.IsScanning = false; // Pop the page and show the result Device.BeginInvokeOnMainThread(async() => { TableOrderViewModel model = new TableOrderViewModel(); try { await Navigation.PopModalAsync(false); if (result.Text.Contains("TABLE")) { IRES_Global.GlobalInfo.TableCode = result.Text; string s = result.Text.Replace("TABLE", ""); var res = await model.OrderTable(int.Parse(s), DateTime.Now); BtnMenu_Clicked(null, null); } else if (result.Text.Contains("ORDER")) { string z = result.Text.Replace("ORDER", ""); model.getOrderByCode(z); } } catch { await Navigation.PopModalAsync(false); if (result.Text.Contains("TABLE")) { IRES_Global.GlobalInfo.TableCode = result.Text; string s = result.Text.Replace("TABLE", ""); var res = await model.OrderTable(int.Parse(s), DateTime.Now); BtnMenu_Clicked(null, null); } else if (result.Text.Contains("ORDER")) { string z = result.Text.Replace("ORDER", ""); model.getOrderByCode(z); } } }); }; } catch (Exception ex) { // GlobalScript.SeptemberDebugMessages("ERROR", "BtnScanQR_Clicked", "Opening ZXing Failed: " + ex); Device.BeginInvokeOnMainThread(() => { // DisplayAlert("Scanned Barcode", ex.ToString(), "OK"); }); } }