Exemplo n.º 1
0
        public CheckedIn()
        {
            this.Title      = "Checked In";
            BackgroundColor = Constants.BackgroundColor;

            StackLayout stacklayout = new StackLayout();

            Padding = new Thickness(60, 0, 60, 0);
            Image chkin = new Image {
                Source = "Checkin.png", HeightRequest = Constants.LoginIconHeight, Margin = new Thickness(0, 60, 0, 0)
            };

            var lbl_greet = new Label {
                Text = "Hello Krishna!! ", TextColor = Color.Green, HorizontalTextAlignment = TextAlignment.Center
            };
            var lbl_table = new Label {
                Text = "You are checked in table no. " + Constants.tableid, TextColor = Color.Green, HorizontalTextAlignment = TextAlignment.Center
            };
            var assist = new Button {
                Text = "Call Server", BackgroundColor = Color.Red, TextColor = Color.White, FontAttributes = FontAttributes.Bold
            };
            var pay = new Button {
                Text = "Pay", BackgroundColor = Color.Green, TextColor = Color.White, FontAttributes = FontAttributes.Bold
            };
            var water = new Button {
                Text = "Drink Refil", BackgroundColor = Color.Green, TextColor = Color.White, FontAttributes = FontAttributes.Bold
            };
            var sauce = new Button {
                Text = "Sauce Refil", BackgroundColor = Color.Green, TextColor = Color.White, FontAttributes = FontAttributes.Bold
            };

            assist.Clicked += (object s, EventArgs e) =>
            {
                HttpClient httpClient = new HttpClient();
                Attention  dto        = new Attention();
                dto.TableId = int.Parse(Constants.tableid);
                var         content     = JsonConvert.SerializeObject(dto);
                HttpContent httpContent = new StringContent(content);
                httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                var response = httpClient.PutAsync("https://fancypos-sp19-p05-g01-lopsided-desk.azurewebsites.net/api/Tables/NeedAttention", httpContent);
            };
            sauce.Clicked += (object s, EventArgs e) =>
            {
                HttpClient httpClient = new HttpClient();
                RefilDto   dto        = new RefilDto();
                dto.TableId = int.Parse(Constants.tableid);
                dto.refil   = 's';
                var         content     = JsonConvert.SerializeObject(dto);
                HttpContent httpContent = new StringContent(content);
                httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                var response = httpClient.PutAsync("https://fancypos-sp19-p05-g01-lopsided-desk.azurewebsites.net/api/Tables/NeedRefil", httpContent);
            };
            water.Clicked += (object s, EventArgs e) =>
            {
                HttpClient httpClient = new HttpClient();
                RefilDto   dto        = new RefilDto();
                dto.TableId = int.Parse(Constants.tableid);
                dto.refil   = 'w';
                var         content     = JsonConvert.SerializeObject(dto);
                HttpContent httpContent = new StringContent(content);
                httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                var response = httpClient.PutAsync("https://fancypos-sp19-p05-g01-lopsided-desk.azurewebsites.net/api/Tables/NeedRefil", httpContent);
            };

            Content = new StackLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { chkin, lbl_greet, lbl_table, assist, water, sauce, pay }
            };
        }
Exemplo n.º 2
0
        public async Task <ActionResult> NeedRefil(RefilDto refilDto)
        {
            await hubContext.Clients.All.SendAsync("needRefil", refilDto.TableId, refilDto.refil);

            return(Ok());
        }