private async void OnOkTapped(object sender, EventArgs e) { CompanyService service = new CompanyService(); try { RequestCheckin requestCheckin = new RequestCheckin(); requestCheckin.CompanyId = _company.Id; requestCheckin.ClientQuantity = txtQtd.Text; requestCheckin.ClientId = Helpers.Settings.DisplayUserId; requestCheckin.Occupation = txtOccupation.Text; requestCheckin.LocationId = ""; Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); bool result = false; if (string.IsNullOrEmpty(txtQtd.Text) && txtQtd.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, AppResource.alertInformQtdPeople, AppResource.textOk); return; } else if (string.IsNullOrEmpty(txtOccupation.Text) && txtOccupation.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, string.Format(AppResource.alertNeedInformOccupation, txtOccupation.Text), AppResource.textOk); return; } result = await service.AddRemoveCheckinPost(requestCheckin); if (result) { await this.DisplayAlert(AppResource.textCheckin, AppResource.alertCheckinSucess, AppResource.textOk); await App.AppCurrent.NavigationService.ModalGoBack(); } else { await this.DisplayAlert(AppResource.alertAlert, AppResource.alertErrorOcured, AppResource.textOk); } } catch (Exception ex) { this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }
private async void OnOkTapped(object sender, EventArgs e) { CompanyService service = new CompanyService(); try { RequestCheckin requestCheckin = new RequestCheckin(); requestCheckin.CompanyId = _company.Id; requestCheckin.ClientQuantity = txtQtd.Text; requestCheckin.ClientId = Helpers.Settings.DisplayUserId; requestCheckin.Occupation = txtOccupation.Text; requestCheckin.LocationId = _locationId; Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); bool result = false; if (_company.CheckedIn && !string.IsNullOrEmpty(_locationId)) { var sub = new CheckinSub(); sub.LocationId = _locationId; sub.Occupation = requestCheckin.Occupation; sub.ClientQuantity = requestCheckin.ClientQuantity; sub.ClientId = Helpers.Settings.DisplayUserId; result = await service.RequestCheckinSub(sub); } else { if (string.IsNullOrEmpty(txtQtd.Text) && txtQtd.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, "Você precisa informar o número de pessoas.", AppResource.textOk); return; } else if (string.IsNullOrEmpty(txtOccupation.Text) && txtOccupation.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, "Você precisa preencher " + lblOcuupation.Text + ". Por favor contate o atendente.", AppResource.textOk); return; } result = await service.AddRemoveCheckinPost(requestCheckin); } if (result) { await this.DisplayAlert(AppResource.textCheckin, "Checkin feito com sucesso. Aguarde a aprovação realizar pedidos.", AppResource.textOk); await App.AppCurrent.NavigationService.ModalGoBack(); } else { await this.DisplayAlert(AppResource.alertAlert, "Ocorreu um erro. Tente novamente em alguns minutos.", AppResource.textOk); } } catch (Exception ex) { this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }
private async void OnOkTapped(object sender, EventArgs e) { //20190403 if (_location.LocationType == Enums.LocationType.Room) { if (string.IsNullOrEmpty(txtOccupation.Text)) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, AppResource.alertFillRoomNumber, AppResource.textOk); return; } //OnOkTapped(null, null); } //20190621 https://trello.com/c/8nkPZzgl/281-25-room-not-mandatory-for-other-locations-as-guest-restaurant-spa-pool-etc-all-except-room //if (string.IsNullOrEmpty(txtOccupation.Text) && stkOccupation.IsVisible) //{ // await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, AppResource.alertFillRoomNumber, AppResource.textOk); // return; //} CompanyService service = new CompanyService(); try { if (string.IsNullOrEmpty(txtQtd.Text) && stkQtd.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, AppResource.alertInformNumberOfPeople, AppResource.textOk); return; } else if (string.IsNullOrEmpty(txtAllocationNumber.Text) && stkAlocationNumber.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, string.Format(AppResource.alertNeedToFillAllocation, lblAllocation.Text.ToLower()), AppResource.textOk); return; } RequestCheckin requestCheckin = new RequestCheckin(); requestCheckin.CompanyId = _company.Id; requestCheckin.ClientQuantity = txtQtd.Text; requestCheckin.ClientId = Helpers.Settings.DisplayUserId; requestCheckin.Occupation = string.IsNullOrEmpty(_ocuppation) ? txtOccupation.Text : _ocuppation; requestCheckin.AllocationNumber = txtAllocationNumber.Text; requestCheckin.LocationId = _locationId; Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); bool result = false; if (_company.CheckedIn && !string.IsNullOrEmpty(_locationId)) { var sub = new CheckinSub(); sub.LocationId = _locationId; sub.AllocationNumber = txtAllocationNumber.Text; sub.Occupation = string.IsNullOrEmpty(_ocuppation) ? txtOccupation.Text : _ocuppation; sub.ClientQuantity = txtQtd.Text; sub.ClientId = Helpers.Settings.DisplayUserId; result = await service.RequestCheckinSub(sub); } else { result = await service.AddRemoveCheckinPost(requestCheckin); } if (result) { //await this.DisplayAlert(AppResource.textCheckin, AppResource.alertCheckinSucess, AppResource.textOk); await App.AppCurrent.Cart.AddOrder(_createOrder, _company, _location); App.AppCurrent.NavigationService.ModalGoBack(); //App.AppCurrent.NavigationService.ModalGoBack(); } else { await this.DisplayAlert(AppResource.alertAlert, AppResource.alertSomethingWentWrong, AppResource.textOk); } } catch (Exception ex) { this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }