コード例 #1
0
        private SearchAllCustomerResponse getCustomerDetails(SearchAllCustomerRequest searchAllCustomerRequest, string token)
        {
            ReservationController reservationController = new ReservationController();

            searchAllCustomerResponse = reservationController.getCustomerDetails(searchAllCustomerRequest, token);
            return(searchAllCustomerResponse);
        }
コード例 #2
0
        public SearchAllCustomerResponse getCustomerDetails(SearchAllCustomerRequest searchAllCustomerRequest, string token)
        {
            SearchAllCustomerResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "CustomerMobile/SearchAllCustomerMobile");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(searchAllCustomerRequest);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <SearchAllCustomerResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #3
0
        public SearchAllCustomerResponse getCustomerDetails(SearchAllCustomerRequest searchAllCustomerRequest, string token)
        {
            SearchAllCustomerResponse mobileResponse = null;

            try
            {
                mobileResponse = reservationservice.getCustomerDetails(searchAllCustomerRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(mobileResponse);
        }
コード例 #4
0
        public AddAditionalDriver(ReservationView reservationView)
        {
            InitializeComponent();

            //want to edit
            selectedVehicle = null;


            this.reservationView = reservationView;
            if (reservationView.CustomerDriverList == null)
            {
                reservationView.CustomerDriverList = new List <Driver>();
            }
            searchAllCustomerRequest  = new SearchAllCustomerRequest();
            searchAllCustomerResponse = null;
            token = App.Current.Properties["currentToken"].ToString();
        }
コード例 #5
0
        private async void submitBtn_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(FnameEntry.Text))
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter First name."));
            }
            else if (string.IsNullOrEmpty(LnameEntry.Text))
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter Last name."));
            }
            else if (string.IsNullOrEmpty(phoneEntry.Text) || phoneEntry.Text.Length < 10)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter valid phone number."));
            }

            else
            {
                searchAllCustomerRequest.filter           = new CustomerSerach();
                searchAllCustomerRequest.filter.FirstName = FnameEntry.Text;
                searchAllCustomerRequest.filter.LastName  = LnameEntry.Text;
                searchAllCustomerRequest.filter.hPhone    = phoneEntry.Text;

                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("Checking for existing customers..."));

                        await Task.Run(() =>
                        {
                            try
                            {
                                searchAllCustomerResponse = getCustomerDetails(searchAllCustomerRequest, token);
                            }
                            catch (Exception ex)
                            {
                                PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                        });
                    }
                    finally
                    {
                        busy = false;
                        if (PopupNavigation.Instance.PopupStack.Count == 1)
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                        if (PopupNavigation.Instance.PopupStack.Count > 1)
                        {
                            if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                            {
                                await PopupNavigation.Instance.PopAllAsync();
                            }
                        }
                        if (searchAllCustomerResponse != null)
                        {
                            if (searchAllCustomerResponse.message.ErrorCode == "200")
                            {
                                if (searchAllCustomerResponse.serachResult.Count > 0)
                                {
                                    Driver driver = new Driver();
                                    driver.FirstName           = searchAllCustomerResponse.serachResult[0].FirstName;
                                    driver.LastName            = searchAllCustomerResponse.serachResult[0].LastName;
                                    driver.CustomerId          = (int)searchAllCustomerResponse.serachResult[0].cust.CustomerId;
                                    driver.DateofBirth         = searchAllCustomerResponse.serachResult[0].DateOfbirth;
                                    driver.DateofBirthStr      = searchAllCustomerResponse.serachResult[0].DateOfbirth.ToString();
                                    driver.CreatedBy           = searchAllCustomerResponse.serachResult[0].CreatedBy;
                                    driver.LastName            = searchAllCustomerResponse.serachResult[0].LastName;
                                    driver.Email               = searchAllCustomerResponse.serachResult[0].Email;
                                    driver.bPhone              = searchAllCustomerResponse.serachResult[0].bPhone;
                                    driver.cPhone              = searchAllCustomerResponse.serachResult[0].cPhone;
                                    driver.hPhone              = searchAllCustomerResponse.serachResult[0].hPhone;
                                    driver.Address1            = searchAllCustomerResponse.serachResult[0].Address1;
                                    driver.StateId             = searchAllCustomerResponse.serachResult[0].StateId;
                                    driver.DriverLicenseNumber = searchAllCustomerResponse.serachResult[0].LicenseNumber;
                                    driver.LastName            = searchAllCustomerResponse.serachResult[0].LastName;
                                    driver.DriverType          = NativeCamperVansModel.Constants.DriverTypes.Additional;
                                    reservationView.CustomerDriverList.Add(driver);

                                    await Navigation.PushAsync(new SummaryOfChargesPage(reservationView, selectedVehicle));
                                }

                                else
                                {
                                    if (await DisplayAlert("No customers found", "No customers found on your details. Do you want to add a new customer as your driver?", "Yes", "Cancel"))
                                    {
                                        await Navigation.PushAsync(new AddNewDriver(reservationView, searchAllCustomerRequest.filter));
                                    }
                                    else
                                    {
                                        await Navigation.PopAsync();
                                    }
                                }
                            }
                            else
                            {
                                await PopupNavigation.PushAsync(new ErrorWithClosePagePopup(searchAllCustomerResponse.message.ErrorMessage));
                            }
                        }
                        else
                        {
                            // if (await DisplayAlert("No customers found", "No customers found on your details. Do you want to add a new customer as your driver?", "Yes", "Cancel"))
                            //{
                            //    await Navigation.PushAsync(new AddNewDriver(reservationView));
                            //}
                            await PopupNavigation.PushAsync(new ErrorWithClosePagePopup("Error in searching customers"));
                        }


                        //if (termsandConditionByTypeResponse != null)
                        //{
                        //    if (termsandConditionByTypeResponse.message.ErrorCode == "200")
                        //    {
                        //        if (termsandConditionByTypeResponse.termlist != null)
                        //        {
                        //            if (termsandConditionByTypeResponse.termlist.Count > 0)
                        //            {
                        //                //terms.Text = termsandConditionByTypeResponse.termlist[0].Term;
                        //                //tacDescription.Text = termsandConditionByTypeResponse.termlist[0].Description;
                        //                termList.ItemsSource = termsandConditionByTypeResponse.termlist;
                        //            }
                        //        }
                        //    }
                        //    else
                        //    {
                        //        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(termsandConditionByTypeResponse.message.ErrorMessage));
                        //    }
                        //}
                    }
                }
            }
        }