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); } }
private async void LoginEvent(Entry userNameEntry) { Console.WriteLine("Tapped"); Message = string.Empty; IsRunningIndicator = true; if (!string.IsNullOrEmpty(UserName) || !string.IsNullOrEmpty(Password)) { var responce = await POSTServicesAPI.LDAPAuthenticateUser(UserName, Password); if (responce) { Settings.Username = UserName; Settings.Password = Password; await System.Threading.Tasks.Task.Delay(2000); Application.Current.MainPage = new MasterDetailView(); } Message = "Username or password is invalid"; IsRunningIndicator = false; UserName = string.Empty; Password = string.Empty; await System.Threading.Tasks.Task.Delay(1000); userNameEntry?.Focus(); } else { Message = "Fields can't be empty"; IsRunningIndicator = false; UserName = string.Empty; Password = string.Empty; Settings.Username = string.Empty; Settings.Password = string.Empty; await System.Threading.Tasks.Task.Delay(1000); userNameEntry?.Focus(); } }
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; } } }