public PilotStudent(PilotProfile profile, DateTime startDate, Instructor instructor)
 {
     this.Profile = profile;
     this.StartDate = startDate;
     this.EndDate = this.StartDate.AddDays(90);
     this.Instructor = instructor;
 }
Exemple #2
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile       = profile;
     this.EducationTime = educationTime;
     this.Rating        = rating;
     this.Aircrafts     = new List <string>();
 }
 public PilotStudent(PilotProfile profile, DateTime startDate, Instructor instructor)
 {
     this.Profile    = profile;
     this.StartDate  = startDate;
     this.EndDate    = this.StartDate.AddDays(90);
     this.Instructor = instructor;
 }
Exemple #4
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile = profile;
     this.EducationTime = educationTime;
     this.Rating = rating;
     this.Aircrafts = new List<string>();
 }
Exemple #5
0
 public PilotStudent(PilotProfile profile, DateTime startDate, Instructor instructor, PilotRating rating,string airlinerfamily)
 {
     this.Rating = rating;
     this.Profile = profile;
     this.StartDate = startDate;
     this.EndDate = this.StartDate.AddDays(this.Rating.TrainingDays);
     this.Instructor = instructor;
     this.AirlinerFamily = airlinerfamily;
 }
Exemple #6
0
 public PilotStudent(PilotProfile profile, DateTime startDate, Instructor instructor, PilotRating rating, string airlinerfamily)
 {
     this.Rating         = rating;
     this.Profile        = profile;
     this.StartDate      = startDate;
     this.EndDate        = this.StartDate.AddDays(this.Rating.TrainingDays);
     this.Instructor     = instructor;
     this.AirlinerFamily = airlinerfamily;
 }
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile = profile;
     this.EducationTime = educationTime;
     this.Rating = rating;
 }
Exemple #8
0
 public Instructor(PilotProfile profile, PilotRating rating)
 {
     this.Profile = profile;
     this.Rating = rating;
     this.Students = new List<PilotStudent>();
 }
Exemple #9
0
 public Instructor(PilotProfile profile, PilotRating rating)
 {
     this.Profile  = profile;
     this.Rating   = rating;
     this.Students = new List <PilotStudent>();
 }
        private void btnHire_Click(object sender, RoutedEventArgs e)
        {
            var aircraftsTypesFree = this.FlightSchool.Aircrafts.Select(a => a.Type);

            Dictionary<TrainingAircraftType,int> types = this.FlightSchool.Aircrafts.GroupBy(a=>a.Type).
                     Select(group =>
                         new
                         {
                             Type = group.Key,
                             Count = group.Sum(g=>g.Type.MaxNumberOfStudents)
                         }).ToDictionary(g => g.Type, g => g.Count); ;

            foreach (PilotStudent student in this.FlightSchool.Students)
            {
                var firstAircraft = student.Rating.Aircrafts.OrderBy(a=>a.TypeLevel).FirstOrDefault(a=>types.ContainsKey(a) && types[a] > 0);

                if (firstAircraft != null && types.ContainsKey(firstAircraft))
                    types[firstAircraft]--;

            }

            List<PilotRating> possibleRatings = new List<PilotRating>();

            foreach (PilotRating rating in PilotRatings.GetRatings())
            {
                if (rating.Aircrafts.Exists(a => types.ContainsKey(a) && types[a] > 0))
                    possibleRatings.Add(rating);
            }

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2811"), string.Format(Translator.GetInstance().GetString("MessageBox", "2811", "message")), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {

                List<Town> towns = Towns.GetTowns(this.FlightSchool.FlightSchool.Airport.Profile.Country);

                Town town = towns[rnd.Next(towns.Count)];
                DateTime birthdate = MathHelpers.GetRandomDate(GameObject.GetInstance().GameTime.AddYears(-35), GameObject.GetInstance().GameTime.AddYears(-23));
                PilotProfile profile = new PilotProfile(Names.GetInstance().getRandomFirstName(town.Country), Names.GetInstance().getRandomLastName(town.Country), birthdate, town);

                Instructor instructor = (Instructor)cbInstructor.SelectedItem;
                string airlinerFamily = cbTrainAircraft.SelectedItem.ToString();

                PilotStudent student = new PilotStudent(profile, GameObject.GetInstance().GameTime,instructor ,GeneralHelpers.GetPilotStudentRating(instructor,possibleRatings),airlinerFamily);

                TrainingAircraft aircraft = getStudentAircraft(student);

                student.Aircraft = aircraft;

                this.FlightSchool.addStudent(student);
                instructor.addStudent(student);

                setHireStudentsStatus();

                double studentPrice = GeneralHelpers.GetInflationPrice(PilotStudent.StudentCost);

                AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -studentPrice);
            }
        }
        private void btnHire_Click(object sender, RoutedEventArgs e)
        {
            Random rnd = new Random();

            ComboBox cbInstructor = new ComboBox();
            cbInstructor.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbInstructor.Width = 200;
            cbInstructor.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbInstructor.DisplayMemberPath = "Profile.Name";
            cbInstructor.SelectedValuePath = "Profile.Name";

            foreach (Instructor instructor in this.FlightSchool.Instructors.Where(i => i.Students.Count < Model.PilotModel.FlightSchool.MaxNumberOfStudentsPerInstructor))
                cbInstructor.Items.Add(instructor);

            cbInstructor.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PanelFlightSchool", "1005"), cbInstructor) == PopUpSingleElement.ButtonSelected.OK && cbInstructor.SelectedItem != null)
            {
                List<Town> towns = Towns.GetTowns(this.FlightSchool.FlightSchool.Airport.Profile.Country);

                Town town = towns[rnd.Next(towns.Count)];
                DateTime birthdate = MathHelpers.GetRandomDate(GameObject.GetInstance().GameTime.AddYears(-55), GameObject.GetInstance().GameTime.AddYears(-23));
                PilotProfile profile = new PilotProfile(Names.GetInstance().getRandomFirstName(), Names.GetInstance().getRandomLastName(), birthdate, town);

                PilotStudent student = new PilotStudent(profile, GameObject.GetInstance().GameTime, (Instructor)cbInstructor.SelectedItem);

                this.FlightSchool.addStudent(student);
                ((Instructor)cbInstructor.SelectedItem).addStudent(student);

                setHireStudentsStatus();

                double studentPrice = GeneralHelpers.GetInflationPrice(PilotStudent.StudentCost);

                AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -studentPrice);
            }
        }
Exemple #12
0
 public Pilot(PilotProfile profile, DateTime educationTime, PilotRating rating)
 {
     this.Profile       = profile;
     this.EducationTime = educationTime;
     this.Rating        = rating;
 }