예제 #1
0
        public ListLocationBillsPage(Checkin checkin = null, Company company = null, bool back = false)
        {
            InitializeComponent();

            if (Device.RuntimePlatform == "Android")
            {
                frmXaml.CornerRadius = 30;
            }

            NavigationPage.SetHasNavigationBar(this, false);

            _checkin = checkin;
            _company = checkin.Company;
            _sub     = checkin.ActiveLocation;

            ColorPage();
            lblTitle.Text = checkin.Company.Title;

            goBackOneMore = back;

            listView.ItemSelected += ListView_ItemSelected;

            //20190409
            if (_company.CompanyType == CompanyType.Hotel)
            {
                //btnPayNow.IsVisible = true;
                //btnPayNowCard.IsVisible = true;//20190412
            }
        }
예제 #2
0
        public AcceptDeclineCheckinPage(Checkin checkin, CheckinSub sub = null)
        {
            InitializeComponent();

            _checkin = checkin;

            this.BindingContext = _checkin;

            if (Device.RuntimePlatform == "iOS")
            {
                btnAceitar.WidthRequest  = 110;
                btnRejeitar.WidthRequest = 100;
            }
            _sub = sub;
            if (_checkin.Company.HasLocation && sub != null)
            {
                txtAllocation.Text = _sub.AllocationNumber;
                txtPeopleQtd.Text  = _sub.ClientQuantity;
            }

            switch (_checkin.Company.CompanyType)
            {
            case Enums.CompanyType.Hotel:
                lblAloc.Text = AppResource.lblRoom + " #";
                break;

            case Enums.CompanyType.Restaurante:
                lblAloc.Text = AppResource.lblTable + " #";
                break;

            case Enums.CompanyType.Praia:
                lblAloc.Text = AppResource.lblLocation + " #";
                break;
            }

            if (string.IsNullOrEmpty(_checkin.Occupation))
            {
                stkhaOccupation.IsVisible = false;
            }
            else
            {
                stkhaOccupation.IsVisible = true;
            }



            if (_checkin.Company.HasLocation && _checkin.LocationType == Enums.LocationType.Room)
            {
                txtPeopleQtd.IsVisible  = false;
                lblPeopleQtd.IsVisible  = false;
                stkAllocation.IsVisible = false;
            }
            else
            {
                txtPeopleQtd.IsVisible  = true;
                lblPeopleQtd.IsVisible  = true;
                stkAllocation.IsVisible = true;
            }
        }
        public AddOrderToClientPage(Checkin checkin, string locationId = "", CheckinSub checkinSub = null)
        {
            InitializeComponent();

            _locationId = locationId;
            if (checkinSub != null)
            {
                _locationId = checkinSub.LocationId;
            }
            _checkinSub = checkinSub;
            _checkin    = checkin;
            LoadCategories();

            listView.ItemTapped += ListView_ItemTapped;
        }
예제 #4
0
        public OrderToClientPage(Checkin checkin, Product product, CheckinSub checkinSub = null)
        {
            InitializeComponent();

            _checkin                   = checkin;
            Product                    = product;
            _checkinSub                = checkinSub;
            lblProductName.Text        = Product.Name;
            lblProductDescription.Text = product.Description;
            imgProduct.Source          = product.ImageUri;

            lblPrice.Text = product.PriceStr;

            this.BindingContext = _checkin;
        }
        public async void LoadCompany()
        {
            try
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);
                ShowLoading(true);
                lblAddress.Text = _company.Address;
                lblPhone.Text   = _company.Cellphone;

                //pegar o subCheckin
                string result = await _service.GetCheckinSubByLocationId(_location.Id);

                CheckinSub subCheckin = JsonConvert.DeserializeObject <CheckinSub>(result);

                if (subCheckin != null)
                {
                    _checkinSub = subCheckin;
                }

                string resultCategories = await _service.GetAllProductCategoryByLocationId(_location.Id, false);

                List <Category> categories = JsonConvert.DeserializeObject <List <Category> >(resultCategories);

                _categories = categories;
                if (categories != null && categories.Count > 0)
                {
                    LoadCategories(categories.Count());
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                ShowLoading(false);
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
            }
        }
        public OrdersBySubCheckinPage(CheckinSub sub, Checkin checkin)
        {
            InitializeComponent();

            BindingContext = new OrderBySubCheckinPageViewModel();
            _instance      = this;
            _sub           = sub;
            _checkin       = checkin;

            listView.ItemTapped += ListView_ItemTapped;
            Title = sub.Location.Name;

            var printer = new ToolbarItem(AppResource.lblPrint, "", () =>
            {
                PrintNow();
            }, 0, 0);

            printer.Priority = 1;
            ToolbarItems.Add(printer);

            btnPayNowCard.IsVisible = true;
        }
예제 #7
0
        public async void LoadCompany()
        {
            try
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading);
                ShowLoading(true);
                lblAddress.Text = Company.Address;
                lblPhone.Text   = Company.Cellphone;

                //pegar o subCheckin
                var result = await service.GetCheckinSubByLocationId(location.Id);

                var subCheckin = JsonConvert.DeserializeObject <CheckinSub>(result);

                if (subCheckin != null)
                {
                    CheckinSub = subCheckin;
                }

                var resultMenus = await service.GetAllInformativeMenus(location.Id, false);

                var menus = JsonConvert.DeserializeObject <List <InformativeMenu> >(resultMenus);

                InformativeMenus = menus;
                if (menus != null && menus.Count > 0)
                {
                    LoadMenus(menus.Count());
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ShowLoading(false);
                Acr.UserDialogs.UserDialogs.Instance.HideLoading();
            }
        }
예제 #8
0
        public LocationBillOrderPage(CheckinSub sub, Checkin checkin)
        {
            InitializeComponent();

            if (Device.RuntimePlatform == "Android")
            {
                frmXaml.CornerRadius = 30;
            }

            NavigationPage.SetHasNavigationBar(this, false);

            _sub          = sub;
            _checkin      = checkin;
            lblTitle.Text = sub.Location.Name;

            ColorPage();
            LoadOrders();

            //if(_checkin.Company.CompanyType == CompanyType.Hotel)
            //{
            //    btnPayNow.IsVisible = true;
            //    btnPayNowCard.IsVisible = true;
            //}
        }
        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)
        {
            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, 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)
        {
            //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();
            }
        }