public async Task <AddressApiData> FetchAddressUsingApiAsync(string DeliverAddressId)
        {
            var    app           = Application.Current as App;
            string DeliveryBoyId = app.UserId;
            string AccessKey     = app.UserKey;
            string PhoneNumber   = app.UserPhoneNumber;
            Dictionary <string, dynamic> payload = new Dictionary <string, dynamic>();

            payload.Add("phone_number", PhoneNumber);
            payload.Add("access_key", AccessKey);
            payload.Add("deliveraddress_id", DeliverAddressId);
            AddressApiResponse ApiResponseObject = await this.Post <AddressApiResponse>(this.getAuthUrl("getDeliverAddress"), payload, null);

            Console.WriteLine("Response Status is : " + ApiResponseObject.Status);
            if (ApiResponseObject.Status.ToLower() != "success")
            {
                System.Diagnostics.Debug.WriteLine("[BuildRequestNDisplay] Received non-success " + ApiResponseObject.Status);
                System.Diagnostics.Debug.WriteLine("[BuildRequestNDisplay] Received Response: " + ApiResponseObject.Data);
                return(null);
            }
            ResponseData = ApiResponseObject.Data;
            return(ResponseData);
        }
        public async Task <ObservableCollection <CustomerInvoiceDatum> > ExecuteLoadItemsCommand(string menuPage)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    ObservableCollection <CustomerInvoiceDatum> tempItems = new ObservableCollection <CustomerInvoiceDatum>();
                    if (OrderList.Count == 0)
                    {
                        pageNumber = 1;
                    }
                    int frameSize = 10;
                    var items     = await OrderApiService.Instance.RefreshOrderList((frameSize / 2), pageNumber, menuPage);

                    if (!(items.CustomerInvoiceData.Count == 0 && items.WooCommerceOrders.Count == 0))
                    {
                        ListFooterText = null;
                        pageNumber++;
                        foreach (var item in items.CustomerInvoiceData)
                        {
                            try
                            {
                                CustomerInfo = new CustomerDetails();
                                AddressInfo  = new AddressDetails();
                                CustomerApiData CustData = await CustomerApiService.Instance.FetchCustomerList(item.StoreCustomerId);

                                AddressApiData AddressItem = await AddressApiService.Instance.RefreshAddressList(item.DeliverAddressId);

                                try
                                {
                                    CustomerInfo        = CustData.CustomerInfo;
                                    item.PrimaryPhone   = CustomerInfo.PrimaryPhone;
                                    item.AddressTagName = AddressItem.CustAddress.TagName;
                                    item.FirstName      = CustomerInfo.FirstName;
                                }
                                catch { }
                                item.OrderSource = "App";
                                OrderList.Add(item);
                            }
                            catch
                            {
                            }
                        }

                        foreach (var item in items.WooCommerceOrders)
                        {
                            try
                            {
                                item.OrderSource = "Website";
                                OrderList.Add(item);
                            }
                            catch
                            { }
                        }
                    }
                    else
                    {
                        ListFooterText = "No more orders to load";
                    }
                    return(tempItems);
                }
                catch (Exception ex)
                {
                    DependencyService.Get <IToastMessage>().LongTime("Server Error E01: Please try again after sometime.");
                    ListFooterText = "Unable to load the orders";
                    Debug.WriteLine(ex.Message);
                }
                finally
                {
                    IsBusy = false;
                }
            }
            else
            {
                DependencyService.Get <IToastMessage>().LongTime("Check your Internet Connection and try again");
                ListFooterText = "Unable to load the orders";
            }
            return(null);
        }
        public async Task ExecuteLoadCustomerCommand(string storecust_id, string DeliverAddressId, CustomerInvoiceDatum InvoiceDetails)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                IsBusy = true;
                try
                {
                    if (!string.IsNullOrEmpty(storecust_id))
                    {
                        CustomerInfo = new CustomerDetails();
                        AddressInfo  = new AddressDetails();
                        CustomerApiData CustomerItems = await CustomerApiService.Instance.FetchCustomerList(storecust_id);

                        AddressApiData AddressItem = await AddressApiService.Instance.RefreshAddressList(DeliverAddressId);

                        CustomerInfo = CustomerItems.CustomerInfo;
                        AddressInfo  = AddressItem.CustAddress;
                        phoneNumberList.Add(AddressInfo.PrimaryPhone);
                        phoneNumberList.Add(AddressInfo.AlternatePhone);
                        if (String.IsNullOrEmpty(AddressInfo.AlternatePhone))
                        {
                            DisplayAltNumber = false;
                        }
                        else
                        {
                            DisplayAltNumber = true;
                        }
                        if (String.IsNullOrEmpty(AddressInfo.FlatNoDoorNo))
                        {
                            DisplayFlatNumber = false;
                        }
                        else
                        {
                            DisplayFlatNumber = true;
                        }
                        if (String.IsNullOrEmpty(AddressInfo.SocietyBuildingNo))
                        {
                            DisplaySociety = false;
                        }
                        else
                        {
                            DisplaySociety = true;
                        }
                    }
                    else
                    {
                        AddressInfo                   = new AddressDetails();
                        AddressInfo.FirstName         = InvoiceDetails.FirstName;
                        AddressInfo.PrimaryPhone      = InvoiceDetails.PrimaryPhone;
                        AddressInfo.AlternatePhone    = null;
                        DisplayAltNumber              = false;
                        DisplayFlatNumber             = false;
                        AddressInfo.Address1          = InvoiceDetails.Address1;
                        AddressInfo.PostalCodeZipCode = InvoiceDetails.ZipCode;
                        AddressInfo.Address2          = InvoiceDetails.Address2;
                        AddressInfo.TagName           = null;
                        phoneNumberList.Add(AddressInfo.PrimaryPhone);
                        phoneNumberList.Add(AddressInfo.AlternatePhone);
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    IsBusy = false;
                }
            }
            else
            {
                DependencyService.Get <IToastMessage>().LongTime("Check your Internet Connection and try again");
            }
        }