示例#1
0
        private void OnTipsTapped(object sender, EventArgs e)
        {
            if (_checkin.CheckinStatus != Enums.CheckinStatus.Checkin)
            {
                return;
            }

            var popup = new EntryPopup(AppResource.alertFillTips, "", AppResource.textOk, AppResource.alertCancel);

            popup.PopupClosed += async(o, closedArgs) =>
            {
                if (closedArgs.Button == AppResource.textOk)
                {
                    try
                    {
                        _checkin.PriceTipPaid = Convert.ToDecimal(closedArgs.Text);
                        lblTip.Text           = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", _checkin.PriceTipPaid);
                        //var newtotal = _checkin.SubTotal + Convert.ToDecimal(_checkin.PriceTipPaid) - _checkin.PriceDiscount;


                        var newtotal = _checkin.CalcTotalToBePaidByTip(_checkin.TotalToBePaid, _checkin.Company.RecommendedTipPercentage, _checkin.Company.TaxPercentage, _checkin.PriceTipPaid, _sub);

                        if (newtotal < 0)
                        {
                            newtotal = 0;
                        }

                        lblTotalBePaid.Text = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", newtotal);
                        //lblTotalBePaid.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", newtotal);

                        lblTipTitle.Text = AppResource.lblTips;
                    }
                    catch (Exception ex)
                    {
                        this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, AppResource.alertOnlyNumber, AppResource.textOk);
                    }
                }
            };

            popup.Show();
        }