private async void MBtnCarHire_Click(object sender, EventArgs e) { // Intent intent = new Intent(Resource.Layout); if (mEdtDropOff.Text == "") { mEdtDropOff.Error = "Dropoff address required"; } else if (mEdtPickUp.Text == "") { mEdtPickUp.Error = "Pickup address required"; } else if (mEdtPickUp_D.Text == "") { mEdtPickUp_D.Error = "Pickup date required"; } else { Carhire carhire; carhire = new Carhire { DropOff = mEdtDropOff.Text, pickUp = mEdtPickUp.Text, CarName = mCarName, IsReturn = mRadio_return.Checked, PickDate = DateTime.Parse(mEdtPickUp_D.Text) }; /* HttpClient client = new HttpClient(); * * var uri = new System.Uri(url.rootUrl + url.UrlCarhirePost); * var data = JsonConvert.SerializeObject(carhire); * var httpContent = new StringContent(data, Encoding.UTF8, "application/json"); * client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); * HttpResponseMessage httpResponse = await client.PostAsync(uri, httpContent); * * if (httpResponse.StatusCode == System.Net.HttpStatusCode.OK) * { * FragmentTransaction transaction; * PaymentFragment payment = new PaymentFragment(); * Intent intent = new Intent(); * intent.PutExtra("IsFlightPayment", false); * transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, payment); * transaction.Commit(); * } * else Toast.MakeText(thisContext, "Server Errror "+httpResponse.StatusCode, ToastLength.Long).Show();*/ FragmentTransaction transaction; PaymentFragment payment = new PaymentFragment(); Intent intent = new Intent(); intent.PutExtra("IsFlightPayment", false); transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, payment); transaction.Commit(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.receipt_fragment, container, false); Context = view.Context; txt_receiptA = view.FindViewById <TextView>(Resource.Id.txt_receiptA); txt_receiptA2 = view.FindViewById <TextView>(Resource.Id.txt_receiptA2); txt_receiptB = view.FindViewById <TextView>(Resource.Id.txt_receiptB); txt_receiptB2 = view.FindViewById <TextView>(Resource.Id.txt_receiptB2); txt_receiptC = view.FindViewById <TextView>(Resource.Id.txt_receiptC); txt_receiptC2 = view.FindViewById <TextView>(Resource.Id.txt_receiptC2); txt_receiptD = view.FindViewById <TextView>(Resource.Id.txt_receiptD); txt_receiptD2 = view.FindViewById <TextView>(Resource.Id.txt_receiptD2); txt_receiptE = view.FindViewById <TextView>(Resource.Id.txt_receiptE); txt_receiptE2 = view.FindViewById <TextView>(Resource.Id.txt_receiptE2); txtDateStamp = view.FindViewById <TextView>(Resource.Id.txt_receiptDate); Intent intent = new Intent(); if (intent.GetBooleanExtra("IsFlightPayment", false)) { FlightReceiptPost(); SeatReceiptPost(); } else { CarReceiptPost(); } Carhire c = new Carhire(); c.CarName = "Toyota"; c.DropOff = "Sandton"; c.pickUp = "Alex"; c.IsReturn = true; c.memberIDC = "Sakie"; c.PickDate = DateTime.Now; SetData(c); return(view); }