Beispiel #1
0
        public async Task <String> StatusChangeRoomAsync(StatusChangeRoom StatusChangeRoom)
        {
            string url    = "/sap/opu/odata/sap/ZTMS_ASSIGN_ROOM_SRV_03/ZTMS_ASSIGN_ROOMSet";
            String result = await this.GetODataService(url, JsonConvert.SerializeObject(StatusChangeRoom));

            //If result is success
            if (result == "success")
            {
                if (StatusChangeRoom.ImHotelId == Constants._hotel_code)
                {
                    return("Room Assigned Successfully!");
                }
                else
                {
                    return("Sorry. Unable to update room details!");
                }
            }
            else if (result == "Error")
            {
                return("Sorry. Sorry. Unable to update room details!");
            }
            else
            {
                var jObj = JObject.Parse(result);
                return(Convert.ToString(jObj["error"]["message"]["value"]));
            }
        }
        //Room Selected
        async void RoomsListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            pageLoading();
            roomDetails roomDetailsObject = (roomDetails)e.SelectedItem;

            //Add details to payload
            StatusChangeRoom statusChangedRoom = new StatusChangeRoom(Constants._hotel_code, Constants._reservation_id, roomDetailsObject.roomNumber);

            //Data Service
            PostServiceManager postServiceManager = new PostServiceManager();

            //Post Details
            String result = await postServiceManager.StatusChangeRoomAsync(statusChangedRoom);

            if (result == "No updatable data")
            {
                result = "The room is already selected.";
            }

            //SetRoomDetails
            Constants.result.RoomNumber = roomDetailsObject.roomNumber;

            stopLoading();

            await DisplayAlert(Constants._headerMessage, result, Constants._buttonOkay);

            if (string.Equals(result, Constants._roomSccuessfullyassigned) == true)
            {
                //Room Assigned Idicator
                MessagingCenter.Send <Rooms, string>(this, Constants._roomAssigned, "");
                this.Navigation.RemovePage(this);
            }
        }