コード例 #1
0
        private async Task <bool> PostAllRequests(string status, string statusText, List <DiscountDetailsModel> discountList)
        {
            try
            {
                foreach (var item in discountList)
                {
                    DiscountPayload discountPayload = new DiscountPayload();
                    discountPayload.ImHotelId       = Constants._hotel_number;
                    discountPayload.ImReservaId     = Convert.ToInt32(item.ReservationID).ToString();
                    discountPayload.ImOrderId       = "1";
                    discountPayload.ImScoodApprover = Settings.Username;
                    discountPayload.ImStatus        = status;
                    discountPayload.ImReason        = $"{statusText} by {Settings.Username}";


                    var responce = await POSTServicesAPI.ApproveDiscount(discountPayload);

                    if (responce == "Success")
                    {
                        continue;
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #2
0
        private async void RejectDiscount()
        {
            var responce = await Application.Current.MainPage.DisplayAlert("Reject Discount ?", "Please press Yes to reject the discount requests or No to cancel.", "Yes", "No");

            if (responce)
            {
                IsRunningIndicator = true;
                IsListVisible      = false;

                DiscountPayload discountPayload = new DiscountPayload();
                discountPayload.ImHotelId       = Constants._hotel_number;
                discountPayload.ImReservaId     = Convert.ToInt32(TempSelectedModel.ReservationID).ToString();
                discountPayload.ImOrderId       = "1";
                discountPayload.ImScoodApprover = Settings.Username;
                discountPayload.ImStatus        = "R";
                discountPayload.ImReason        = $"Rejected by {Settings.Username}";


                var serviceRes = await POSTServicesAPI.ApproveDiscount(discountPayload);

                if (serviceRes == "Success")
                {
                    //Changing status on view
                    ChangeStatus("Rejected");

                    await Application.Current.MainPage.DisplayAlert("Rejected!", serviceRes, "OK");

                    IsRunningIndicator = false;
                    IsListVisible      = true;
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Error!", serviceRes, "OK");

                    IsRunningIndicator = false;
                    IsListVisible      = true;
                }
            }
        }