public override void ViewDidAppear(bool animated) { DestinationTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Destination", null, UIColor.Red); HobbsInTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Hobbs Out", null, UIColor.Red); HobbsOutTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Hobbs In", null, UIColor.Red); HobbsTotalTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Total Hobbs", null, UIColor.Red); CashSpentTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Cash Spent", null, UIColor.Red); FlightTypeTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Flight Type", null, UIColor.Red); PlaneTypeTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Plane Type", null, UIColor.Red); leaseTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Lease Name", null, UIColor.Red); pilotTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Pilot", null, UIColor.Red); passengerAddTextField.AttributedPlaceholder = new Foundation.NSAttributedString("Enter Passengers", null, UIColor.Red); base.ViewDidLoad(); UIViewController vc = this; val = new validation(vc); var update = DataManip.GetIsUpdate(); var temp = DataManip.GetIsTemp(); DateOutTextField.Text = DateTime.Now.ToString("MM/dd/yyyy"); DateInTextField.Text = DateTime.Now.ToString("MM/dd/yyyy"); datePickerMaker(DateOutTextField); datePickerMaker(DateInTextField); HobbsInTextField.KeyboardType = UIKeyboardType.DecimalPad; HobbsOutTextField.KeyboardType = UIKeyboardType.DecimalPad; HobbsTotalTextField.KeyboardType = UIKeyboardType.DecimalPad; CashSpentTextField.KeyboardType = UIKeyboardType.DecimalPad; var flightList = new List <string> { "Whole Day", "Half Day", "Two Days", "Three Days", "Four Days", "Five Days", "Six Days", "Seven Days", "Eight Days", "Nine Days", "Ten Days", "_________Days" }; pickerMaker(flightList, FlightTypeTextField); stringList = dm.FillPilotPicker(); pickerMaker(stringList, pilotTextField); stringList = dm.FillLeasePicker(); pickerMaker(stringList, leaseTextField); stringList = dm.FillPlanePicker(); pickerMaker(stringList, PlaneTypeTextField); DestinationTextField.Text = ""; HobbsInTextField.Text = ""; HobbsOutTextField.Text = ""; HobbsTotalTextField.Text = ""; CashSpentTextField.Text = ""; FlightTypeTextField.Text = ""; pilotTextField.Text = ""; leaseTextField.Text = ""; if (update) { card = DataManip.GetEditCard(); DataManip.clearPassengerList(); var dateOut = card.dateOut.ToString("MM/dd/yyyy"); var dateIn = card.dateIn; var modDateOut = dateOut.Substring(0, 10); dateIn = card.dateIn.Substring(0, 10); DateOutTextField.Text = modDateOut; DateInTextField.Text = dateIn; HobbsInTextField.Text = card.hobbsIn; HobbsOutTextField.Text = card.hobbsOut; if ((card.hobbsIn != "") && (card.hobbsOut != "")) { var number = (double.Parse(card.hobbsOut) - double.Parse(card.hobbsIn)).ToString("F1"); HobbsTotalTextField.Text = number; } CashSpentTextField.Text = card.cashSpent; DestinationTextField.Text = card.destination; foreach (var passenger in card.getPassengers()) { if (passenger != "") { dm.addPassengerToList(passenger); } } PlaneTypeTextField.Text = card.planeType; pilotTextField.Text = card.pilot; leaseTextField.Text = card.leaseName; FlightTypeTextField.Text = card.flightType; } if (temp) { tempList = DataManip.GetTemp(); DateOutTextField.Text = tempList[0]; DateInTextField.Text = tempList[1]; HobbsInTextField.Text = tempList[2]; HobbsOutTextField.Text = tempList[3]; HobbsTotalTextField.Text = tempList[4]; CashSpentTextField.Text = tempList[5]; pilotTextField.Text = tempList[6]; leaseTextField.Text = tempList[7]; FlightTypeTextField.Text = tempList[8]; PlaneTypeTextField.Text = tempList[9]; DestinationTextField.Text = tempList[10]; DataManip.SetIsTemp(false); DataManip.ClearTempInfo(); } }
partial void SaveButton2_TouchUpInside(UIButton sender) { List <string> passengers = new List <string>(); var update = DataManip.GetIsUpdate(); if ((HobbsInTextField.Text != "") && (HobbsOutTextField.Text != "")) { var number = (double.Parse(HobbsOutTextField.Text) - double.Parse(HobbsInTextField.Text)).ToString("F1"); HobbsTotalTextField.Text = number; } passengers = DataManip.returnPassengerList(); if (passengers.Count != 24) { for (int i = passengers.Count; i < 24; i++) { passengers.Add(""); } } string destination = DestinationTextField.Text.Replace(',', '.'); var dateOutFromTextField = DateTime.Parse(DateOutTextField.Text); var dateOut = dateOutFromTextField.Add(DateTime.Now.TimeOfDay); var newCard = new FlightCards( dateOut, DateInTextField.Text, destination, HobbsInTextField.Text, HobbsOutTextField.Text, HobbsTotalTextField.Text, CashSpentTextField.Text, FlightTypeTextField.Text, pilotTextField.Text, PlaneTypeTextField.Text, leaseTextField.Text, passengers[0], passengers[1], passengers[2], passengers[3], passengers[4], passengers[5], passengers[6], passengers[7], passengers[8], passengers[9], passengers[10], passengers[11], passengers[12], passengers[13], passengers[14], passengers[15], passengers[16], passengers[17], passengers[18], passengers[19], passengers[20], passengers[21], passengers[22], passengers[23]); if (update) { FlightCards old = DataManip.GetEditCard(); newCard.dateOut = old.dateOut; if (Reachability.IsHostReachable("https://www.google.com")) { Toast.MakeText("Flight Card Saved!", Toast.LENGTH_LONG).Show(); dm.updateFlightCardTable(newCard); ws.updateFlightCard(newCard); } else { dm.updateFlightCardTable(newCard); dm.AddtoUpdateTable(newCard); } } else { if (Reachability.IsHostReachable("https://www.google.com")) { ws.SaveToServiceAsync(newCard); } else { dm.AddToAddTable(newCard); dm.SaveFlightCard(newCard); dm.saveAll(); } } DataManip.clearPassengerList(); DataManip.SetIsUpdate(false); UIStoryboard board = UIStoryboard.FromName("Main", null); UIViewController ctrl = (UIViewController)board.InstantiateViewController("TableController"); ctrl.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal; this.PresentViewController(ctrl, true, null); }