public ExtendSession(CustomerParkingSlotDetails customerParkingSlotDetails) { InitializeComponent(); ShowLoading(true); objCustomerParkingSlotDetails = customerParkingSlotDetails; VehicleTypeID = customerParkingSlotDetails.VehicleTypeID; CustomerID = customerParkingSlotDetails.CustomerID; CustomerVehicleID = customerParkingSlotDetails.CustomerVehicleID; CustomerParkingSlotID = customerParkingSlotDetails.CustomerParkingSlotID; LocationParkingLotID = customerParkingSlotDetails.LocationParkingLotID; LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName; dal_LocationParkingLot = new DALLocationParkingLots(); dal_Customer = new DALCustomer(); dal_Vehicle = new DALVehicle(); dal_Pass = new DALPass(); objCustomerParkingSlotDetails.LotOpenCloseTime = ("(" + objCustomerParkingSlotDetails.LotOpeningTime + " - " + objCustomerParkingSlotDetails.LotClosingTime + ")").ToLower(); if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.TwoWheelerTypeID)) { imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.TwoWheelerGreenSpots; } else if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.FourWheelerTypeID)) { imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.FourWheelerGreenSpots; } this.BindingContext = objCustomerParkingSlotDetails; VehicleTypeID = customerParkingSlotDetails.VehicleTypeID; CustomerID = customerParkingSlotDetails.CustomerID; CustomerVehicleID = customerParkingSlotDetails.CustomerVehicleID; RegistrationNumber = customerParkingSlotDetails.RegistrationNumber; CustomerParkingSlotID = customerParkingSlotDetails.CustomerParkingSlotID; LocationID = customerParkingSlotDetails.LocationID; LocationParkingLotID = customerParkingSlotDetails.LocationParkingLotID; LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName; dal_LocationParkingLot = new DALLocationParkingLots(); dal_Customer = new DALCustomer(); dal_Vehicle = new DALVehicle(); dal_Pass = new DALPass(); ParkingBayRange = customerParkingSlotDetails.ParkingBayRange; ParkingBayID = customerParkingSlotDetails.ParkingBayID; Duration = 1; IsFullDay = false; ShowLoading(false); }
public CustomerParkingSlotDetails GetVehicleDueAmountDetails(string accessToken, CustomerParkingSlot objCustomerParkingSlot) { CustomerParkingSlotDetails obj_CPSD = new CustomerParkingSlotDetails(); try { string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Add the Authorization header with the AccessToken. client.DefaultRequestHeaders.Add("Authorization", "bearer " + accessToken); // create the URL string. string url = "api/InstaConsumer/GetVehicleDueAmountDetails"; // make the request var json = JsonConvert.SerializeObject(objCustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { string jsonString = response.Content.ReadAsStringAsync().Result; if (jsonString != null) { APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString); if (apiResult.Result) { obj_CPSD = JsonConvert.DeserializeObject <CustomerParkingSlotDetails>(Convert.ToString(apiResult.Object)); } } } } } catch (Exception ex) { } return(obj_CPSD); }
public async void GetVehicleDueAmountDetails() { try { IsOnline = VerifyInternet(); if (IsOnline) { CustomerParkingSlot objCustomerParkingSlot = new CustomerParkingSlot(); objCustomerParkingSlot.CustomerParkingSlotID = DueCustomerParkingSlotID; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(objCustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.GetVehicleDueAmountDetails(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { lblDueRegNum.Text = resultObj.RegistrationNumber; lblDueLocation.Text = resultObj.LocationName + " - " + resultObj.LocationParkingLotName; lblDueTiming.Text = (resultObj.From).ToString("dd-MM-yyyy hh:mm tt") + " to " + (resultObj.To).ToString("dd-MM-yyyy hh:mm tt"); lblDueAmount.Text = "₹ " + Convert.ToString(resultObj.DueAmount); lblDueDuration.Text = resultObj.Duration; lblDueFOCReason.Text = resultObj.ClampReason; } } } else { DisplayAlert("", "Please check your network connectivity", "Ok"); } } catch (Exception ex) { DisplayAlert("Failed - GetVehicleDueAmountDetails", Convert.ToString(ex.Message), "Ok"); } }
private async void btn_CheckInClicked(object sender, EventArgs e) { IsOnline = VerifyInternet(); if (IsOnline) { ShowLoading(true); btnCheckIn.IsVisible = false; CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = CustomerParkingSlotID; obj_CustomerParkingSlot.CustomerID = CustomerID; obj_CustomerParkingSlot.VehicleTypeID = VehicleTypeID; obj_CustomerParkingSlot.PaymentTypeID = Convert.ToInt32(App.Current.Properties["PaymentTypeID"]); obj_CustomerParkingSlot.LocationParkingLotID = LocationParkingLotID; DateTime LotOpenTime = DateTime.Parse(objOCustomerVehiclePass.LotOpenTime); DateTime LotCloseTime = DateTime.Parse(objOCustomerVehiclePass.LotCloseTime); currentTime = DateTime.Now; if (currentTime <= LotOpenTime) { obj_CustomerParkingSlot.ExpectedStartTime = LotOpenTime.ToString("MM/dd/yyyy hh:mm tt"); TimeSpan ts = LotCloseTime - LotOpenTime; obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); } else { obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.To.ToString("MM/dd/yyyy hh:mm tt"); TimeSpan ts = LotCloseTime - objCustomerParkingSlotDetails.To; obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); } obj_CustomerParkingSlot.ExpectedEndTime = LotCloseTime.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualStartTime = obj_CustomerParkingSlot.ExpectedStartTime; obj_CustomerParkingSlot.ActualEndTime = LotCloseTime.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ExtendAmount = 0; obj_CustomerParkingSlot.Amount = 0; obj_CustomerParkingSlot.TransactionID = "0"; obj_CustomerParkingSlot.StatusID = Convert.ToInt32(App.Current.Properties["StatusID"]); obj_CustomerParkingSlot.CustomerVehicleID = CustomerVehicleID; obj_CustomerParkingSlot.ApplicationTypeID = Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]); obj_CustomerParkingSlot.PaidAmount = 0; obj_CustomerParkingSlot.ParkingBayID = ParkingBayID; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.InsertCustomerParkingSlot(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { btnCheckIn.IsVisible = true; ShowLoading(false); App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(resultObj.CustomerParkingSlotID); await Navigation.PushAsync(new SessionHomeReceipt(resultObj)); } else { btnCheckIn.IsVisible = true; ShowLoading(false); DisplayAlert("", "Payment Failed", "Ok"); } } else { btnCheckIn.IsVisible = true; ShowLoading(false); } } else { DisplayAlert("", "Please check your network connectivity", "Ok"); } }
public SessionHomeReceipt(CustomerParkingSlotDetails customerParkingSlotDetails) { this.IsBusy = true; InitializeComponent(); dal_Customer = new DALCustomer(); dal_LocationParkingLot = new DALLocationParkingLots(); if (customerParkingSlotDetails != null) { objCustomerParkingSlotDetails = customerParkingSlotDetails; lblLotName.Text = customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]) ? customerParkingSlotDetails.LocationParkingLotName + " - PASS CHECK IN" : customerParkingSlotDetails.LocationParkingLotName; lblAddress.Text = customerParkingSlotDetails.Address; lblFrom.Text = customerParkingSlotDetails.From.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US")); lblTo.Text = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US")); string fromdatesplit = lblFrom.Text.Split(',')[0]; string fromtimesplit = lblFrom.Text.Split(',')[1]; lblFrom.Text = fromdatesplit; lblFromTime.Text = fromtimesplit; string toDatesplit = lblTo.Text.Split(',')[0]; string toTimesplit = lblTo.Text.Split(',')[1]; lblTo.Text = toDatesplit; lblToTime.Text = toTimesplit; lblRegistrationNumber.Text = customerParkingSlotDetails.RegistrationNumber; lblModel.Text = customerParkingSlotDetails.Model; App.Current.Properties["CustomerParkingSlotID"] = customerParkingSlotDetails.CustomerParkingSlotID; App.Current.Properties["UserName"] = customerParkingSlotDetails.CustomerName; App.Current.Properties["PhoneNumber"] = customerParkingSlotDetails.CustomerPhoneNumber; App.Current.Properties["Email"] = customerParkingSlotDetails.CustomerEmail; App.Current.Properties["CustomerID"] = customerParkingSlotDetails.CustomerID; App.Current.Properties["ProfileImage"] = customerParkingSlotDetails.CustomerProfileImage; if (customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"])) { stkParkingFee.IsVisible = false; lblLotName.HeightRequest = 45; } else { stkParkingFee.IsVisible = true; // lblLotName.HeightRequest = 10; lblParkingFee.Text = customerParkingSlotDetails.PaidAmount; TimeSpan t_duration = (customerParkingSlotDetails.To - customerParkingSlotDetails.From); int d_duration = Convert.ToInt32(Math.Round(t_duration.TotalHours)); lblPaymentType.Text = " Paid for " + d_duration + " hour (Via " + customerParkingSlotDetails.PaymentTypeName + ")"; } OrderID.Text = "ID : #" + customerParkingSlotDetails.CustomerParkingSlotID; imgVehicle.Source = customerParkingSlotDetails.VehicleImage; currentTime = DateTime.Now; ActualEndTime = Convert.ToDateTime(customerParkingSlotDetails.To); DisabledParking.Source = customerParkingSlotDetails.DisabledParking; EvCharging.Source = customerParkingSlotDetails.EvCharging; CoveredParking.Source = customerParkingSlotDetails.CoveredParking; BikeWash.Source = customerParkingSlotDetails.BikeWash; CarWash.Source = customerParkingSlotDetails.CarWash; Mechanic.Source = customerParkingSlotDetails.Mechanic; lblWarning.Text = "'" + Convert.ToString(customerParkingSlotDetails.ViolationWarningCount) + "' Warning(s) Completed"; lblOverStayFee.Text = customerParkingSlotDetails.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.Price)); lblClampFee.Text = customerParkingSlotDetails.ClampFee == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.ClampFee)); lblTotal.Text = Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee) == 0 ? "0" : Convert.ToString(decimal.Truncate((Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee)))); lblClampReason.Text = customerParkingSlotDetails.ClampReason; if (customerParkingSlotDetails.IsClamp) { stkSupervisor.IsVisible = true; stkClampWarning.IsVisible = true; IsClamp = customerParkingSlotDetails.IsClamp; SupervisorPhoneNumber = customerParkingSlotDetails.PhoneNumber; lblSupervisor.Text = customerParkingSlotDetails.SupervisorName; lblPhoneNumber.Text = customerParkingSlotDetails.PhoneNumber; } if (ActualEndTime < currentTime) { lblSpotExpiry.Text = "Spot Expired At"; lblExpiryTime.Text = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US")); lblExpiryTime.FontSize = 20; } else { TimeSpan duration = ActualEndTime - currentTime; long durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond); long hours = durationTicks / (1000 * 60 * 60); long minutes = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60); lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m"); } Device.StartTimer(TimeSpan.FromSeconds(60), (Func <bool>)(() => { currentTime = DateTime.Now; if (ActualEndTime < currentTime) { lblSpotExpiry.Text = "Spot Expired At"; lblExpiryTime.Text = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US")); lblExpiryTime.FontSize = 20; return(false); } else { TimeSpan duration = ActualEndTime - currentTime; long durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond); long hours = durationTicks / (1000 * 60 * 60); long minutes = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60); lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m"); } return(true); // True = Repeat again, False = Stop the timer })); GenerateAPIToken(); this.IsBusy = false; } }
private async void stk_CheckOutTapped(object sender, EventArgs e) { try { IsOnline = VerifyInternet(); if (IsOnline) { ParkingFee objParkingFee = new ParkingFee(); this.IsBusy = true; DateTime ActualEndTime = Convert.ToDateTime(objCustomerParkingSlotDetails.To); TimeSpan ds; int days; currentTime = DateTime.Now; ds = (currentTime.Date - Convert.ToDateTime(objCustomerParkingSlotDetails.To).Date); days = Convert.ToInt32(ds.Days); ShowLoading(true); await Task.Run(() => { objParkingFee = ValidateVehicleClamped(); }); if (objParkingFee.CustomerParkingSlotID != 0 && objParkingFee.StatusID != 5 && objParkingFee.StatusID != 6) { lblWarning.Text = "'" + Convert.ToString(objParkingFee.ViolationWarningCount) + "' Warning(s) Completed"; lblOverStayFee.Text = objParkingFee.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.Price)); lblClampFee.Text = objParkingFee.ClampFee == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.ClampFee)); lblTotal.Text = Convert.ToDecimal(objParkingFee.Price) + Convert.ToDecimal(objParkingFee.ClampFee) == 0 ? "0" : Convert.ToString(decimal.Truncate((Convert.ToDecimal(objParkingFee.Price) + Convert.ToDecimal(objParkingFee.ClampFee)))); lblClampReason.Text = objParkingFee.ClampReason; if (objParkingFee.IsClamp) { stkSupervisor.IsVisible = true; stkClampWarning.IsVisible = true; IsClamp = objParkingFee.IsClamp; SupervisorPhoneNumber = objParkingFee.PhoneNumber; lblSupervisor.Text = objParkingFee.SupervisorName; lblPhoneNumber.Text = objParkingFee.PhoneNumber; ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Sorry! Your vehicle is clamped. Please visit the Parking Lot", "Ok"); return; } else { if (days <= 0) { if (objParkingFee.Price != 0) { if (ActualEndTime < currentTime) { var confirmed = await DisplayAlert("", "Please confirm that you want to Check Out your Vehicle " + lblRegistrationNumber.Text + "", "Yes", "No"); if (confirmed) { CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = objCustomerParkingSlotDetails.CustomerParkingSlotID; obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.From.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualEndTime = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.CustomerID = objCustomerParkingSlotDetails.CustomerID; obj_CustomerParkingSlot.LocationName = "CHECKOUT"; obj_CustomerParkingSlot.LocationParkingLotName = objCustomerParkingSlotDetails.LocationParkingLotName; obj_CustomerParkingSlot.PaidAmount = Convert.ToDecimal(objParkingFee.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(objParkingFee.Price))); obj_CustomerParkingSlot.Duration = Convert.ToString(objParkingFee.Hours); ShowLoading(false); await Navigation.PushAsync(new RazorPayment(obj_CustomerParkingSlot, null)); } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; } } } else { var confirmed = await DisplayAlert("", "Please confirm that you want to Check Out your Vehicle " + lblRegistrationNumber.Text + "", "Yes", "No"); if (confirmed) { CustomerParkingSlot obj_CustomerParkingSlot = new CustomerParkingSlot(); obj_CustomerParkingSlot.CustomerParkingSlotID = objCustomerParkingSlotDetails.CustomerParkingSlotID; obj_CustomerParkingSlot.ExpectedStartTime = objCustomerParkingSlotDetails.From.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.ActualEndTime = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); obj_CustomerParkingSlot.CustomerID = objCustomerParkingSlotDetails.CustomerID; TimeSpan ts = Convert.ToDateTime(DateTime.Now) - Convert.ToDateTime(objCustomerParkingSlotDetails.From); obj_CustomerParkingSlot.Duration = Convert.ToString(ts.Hours); obj_CustomerParkingSlot.PaidAmount = 0; if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.UpdateCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { App.Current.Properties["CustomerParkingSlotID"] = "0"; Application.Current.SavePropertiesAsync(); ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Thank you for parking with us!", "Ok"); int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } await Navigation.PushAsync(new Home(null, CustomerID)); } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Check Out failed", "Ok"); } } } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; } } } else { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "This Vehicle cannot be Checked Out. Please visit the Parking Lot.", "Ok"); return; } } } else { if (objParkingFee.StatusID == 5 || objParkingFee.StatusID == 6) { lblOverStayFee.Text = "0"; lblClampFee.Text = "0"; lblTotal.Text = "0"; ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("", "Your Vehicle has been Checked Out!", "Ok"); int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } await Navigation.PushAsync(new Home(null, CustomerID)); } else { //await DisplayAlert("Status - CustomerParkingSlotID : ", Convert.ToString(objParkingFee.StatusID) + " - " + Convert.ToString(objParkingFee.CustomerParkingSlotID), "Ok"); } } } else { await DisplayAlert("", "Please check your network connectivity", "Ok"); return; } } catch (Exception ex) { ShowLoading(false); StklauoutactivityIndicator.IsVisible = false; await DisplayAlert("Failed - CheckOut", Convert.ToString(ex.Message), "Ok"); } }
protected async void OnNavigated(object sender, WebNavigatedEventArgs e) { progress.IsVisible = false; try { if (e.Url.StartsWith("http://35.202.198.25:81/RazorPayAPI/Charge.aspx")) { await GetTransaction(); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(Convert.ToString(App.Current.Properties["BaseURL"])); // We want the response to be JSON. client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); List <System.Collections.Generic.KeyValuePair <string, string> > postData = new List <KeyValuePair <string, string> >(); postData.Add(new KeyValuePair <string, string>("grant_type", "password")); postData.Add(new KeyValuePair <string, string>("username", "Kiran")); postData.Add(new KeyValuePair <string, string>("password", "1234")); FormUrlEncodedContent content = new FormUrlEncodedContent(postData); // Post to the Server and parse the response. var response = client.PostAsync("Token", content).Result; if (response.IsSuccessStatusCode) { var jsonString = response.Content.ReadAsStringAsync(); OAuthToken responseData = JsonConvert.DeserializeObject <OAuthToken>(jsonString.Result); string Access_Token = responseData.access_token; App.Current.Properties["apitoken"] = Access_Token; } } if (App.Current.Properties.ContainsKey("apitoken")) { if (obj_CustomerParkingSlot != null && obj_CustomerVehiclePass == null) { if (obj_CustomerParkingSlot.LocationName != null && obj_CustomerParkingSlot.LocationName != "") { if (obj_CustomerParkingSlot.LocationName.ToUpper() == "CHECKOUT") { if (transactionID == "") { DisplayAlert("", "Payment Failed", "Ok"); App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerParkingSlotID); App.Current.Properties["CustomerID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerID); return; } obj_CustomerParkingSlot.TransactionID = transactionID; var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.UpdateCheckOut(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { App.Current.Properties["CustomerParkingSlotID"] = "0"; App.Current.Properties["CustomerID"] = obj_CustomerParkingSlot.CustomerID; Application.Current.SavePropertiesAsync(); DisplayAlert("", "Thank you for parking with us!", "Ok"); int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } await Navigation.PushAsync(new Home(null, CustomerID)); } else { DisplayAlert("", "Insert Payment Failed", "Ok"); App.Current.Properties["CustomerID"] = obj_CustomerParkingSlot.CustomerID; await Application.Current.SavePropertiesAsync(); } } else { if (transactionID == "") { DisplayAlert("", "Payment Failed", "Ok"); App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerParkingSlotID); App.Current.Properties["CustomerID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerID); return; } obj_CustomerParkingSlot.TransactionID = transactionID; var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.InsertCustomerParkingSlot(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(resultObj.CustomerParkingSlotID); App.Current.Properties["CustomerID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerID); await Application.Current.SavePropertiesAsync(); await Navigation.PushAsync(new SessionHomeReceipt(resultObj)); } else { DisplayAlert("", "Insert Payment Failed", "Ok"); App.Current.Properties["CustomerID"] = obj_CustomerParkingSlot.CustomerID; await Application.Current.SavePropertiesAsync(); } } } else { if (transactionID == "") { DisplayAlert("", "Payment Failed", "Ok"); App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerParkingSlotID); App.Current.Properties["CustomerID"] = Convert.ToString(obj_CustomerParkingSlot.CustomerID); return; } obj_CustomerParkingSlot.TransactionID = transactionID; var json = JsonConvert.SerializeObject(obj_CustomerParkingSlot); var content = new StringContent(json, Encoding.UTF8, "application/json"); CustomerParkingSlotDetails resultObj = dal_Customer.InsertCustomerParkingSlot(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerParkingSlot); if (resultObj.CustomerParkingSlotID != 0) { App.Current.Properties["CustomerParkingSlotID"] = Convert.ToString(resultObj.CustomerParkingSlotID); App.Current.Properties["CustomerID"] = obj_CustomerParkingSlot.CustomerID; await Application.Current.SavePropertiesAsync(); await Navigation.PushAsync(new SessionHomeReceipt(resultObj)); } else { DisplayAlert("", "Insert Payment Failed", "Ok"); App.Current.Properties["CustomerID"] = obj_CustomerParkingSlot.CustomerID; await Application.Current.SavePropertiesAsync(); } } } else if (obj_CustomerParkingSlot == null && obj_CustomerVehiclePass != null) { if (transactionID == "") { DisplayAlert("", "Payment Failed", "Ok"); App.Current.Properties["CustomerID"] = Convert.ToString(obj_CustomerVehiclePass.CustomerID); return; } obj_CustomerVehiclePass.TransactionID = transactionID; var json = JsonConvert.SerializeObject(obj_CustomerVehiclePass); var content = new StringContent(json, Encoding.UTF8, "application/json"); OCustomerVehiclePass resultObj; if (obj_CustomerVehiclePass.IsMultiLot) { resultObj = dal_Pass.InsertMultiStationCustomerVehiclePass(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerVehiclePass); } else { resultObj = dal_Pass.InsertCustomerVehiclePass(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerVehiclePass); } if (resultObj.CustomerVehiclePassID != 0) { App.Current.Properties["CustomerID"] = obj_CustomerVehiclePass.CustomerID; await Navigation.PushAsync(new PassReceipt(resultObj)); } else { DisplayAlert("", "Insert Payment Failed", "Ok"); App.Current.Properties["CustomerID"] = obj_CustomerVehiclePass.CustomerID; await Application.Current.SavePropertiesAsync(); } } } } } catch (Exception ex) { DisplayAlert("Failed - RazorPay", Convert.ToString(ex.Message), "Ok"); } }