public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     val        = new validation(this);
     vc         = this;
     stringList = dm.FillPilotPicker();
     pickerMaker(stringList, DeletePilotTextField);
     stringList = dm.FillLeasePicker();
     pickerMaker(stringList, DeleteLeaseTextField);
     stringList = dm.FillPlanePicker();
     pickerMaker(stringList, DeletePlaneTextField);
 }
Exemplo n.º 2
0
        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();
            }
        }