//This method is used to add a solider the roster variable //If the roster variable has not been instanced yet it will do that here public void AddSoliderToRoster(Solider solider) { if (_roster == null) { _roster = new Roster(); } _roster.addSolider(solider); }
//Out and Rest Pool constructures public PoolData(Solider solider, DateTime timeStartPool, Pool pool) { this._solider = solider; this._timeStartPool = timeStartPool; this._maxTimeJob = TimeSpan.MaxValue; //TODO Calulate this value based on the pool value this._job = Jobs.Job.NA; this._emergency = false; this._currentPool = pool; }
TimeSpan CalculateMaxTimeJob(Job job, Solider solider) { //TODO ADD logic change return type to some kind of timespan return(TimeSpan.FromHours(1)); }
//CRCM and HalfSuit Pool constructures public PoolData(Solider solider, DateTime timeStartPool, Jobs.Job job, Pool pool) { //TODO use pool and job data to detemine max time job }
//Adds a solider to the roster public void addSolider(Solider solider) { _soliders.Add(solider); }
//Submit button private void button1_Click(object sender, EventArgs e) { //First Name validiation and parsing string firstName = firstNameTextBox.Text; if (firstName.Length < 1 || firstName.Length > 32) { MessageBox.Show("First Name must be between 1-32 characters long"); return; } if (!Regex.IsMatch(firstName, @"^[a-zA-Z]+$")) { MessageBox.Show("First Name can only contain alphabetic characters"); return; } //Last Name validiation and parsing string lastName = lastNameTextBox.Text; if (lastName.Length < 1 || lastName.Length > 32) { MessageBox.Show("Last Name must be between 1-32 characters long"); return; } if (!Regex.IsMatch(lastName, @"^[a-zA-Z]+$")) { MessageBox.Show("Last Name can only contain alphabetic characters"); return; } //BattleRosterNumber validation and parsing string battleRosterNumber = battleRosterNumberTextBox.Text; if (!Regex.IsMatch(battleRosterNumber, @"^[A-Z][A-Z][0-9][0-9][0-9][0-9]$")) { MessageBox.Show("Battle Roster Number must first 2 intials of last name in upercase and last 4 SSN numbers. (ie. AB1234)"); return; } //Height validation and parsing float height; if (float.TryParse(HeightTextBox.Text, out height)) { if (height < 1.0 || height > 12.0) { MessageBox.Show("Enter a valid height"); return; } } else { MessageBox.Show("Enter a valid height"); return; } //Weight validation and parsing float weight; if (float.TryParse(WeightTextBox.Text, out weight)) { if (weight < 1.0 || weight > 600.0) { MessageBox.Show("Enter a valid weight"); return; } } else { MessageBox.Show("Enter a valid weight"); return; } //Age validation and parsing int age; if (int.TryParse(AgeTextBox.Text, out age)) { if (age < 17 || age > 110) { MessageBox.Show("Enter a valid age"); return; } } else { MessageBox.Show("Enter a valid age"); return; } //Heat Casualty selection bool heatCat = true; if (HeatCatNoRadioButton.Checked) { heatCat = false; } if (HeatCatYesRadioButton.Checked) { heatCat = true; } //Male Female selection char sex = 'M'; if (SexMaleRadioButton.Checked) { sex = 'M'; } if (SexFemaleRadioButton.Checked) { sex = 'F'; } //Add data to the xmloader class Solider solider = new Solider(firstName, lastName, battleRosterNumber, heatCat, height, weight, sex); Program.xLoader.AddSoliderToRoster(solider); //Clear all data from textboxs and reset radio buttons firstNameTextBox.Clear(); lastNameTextBox.Clear(); battleRosterNumberTextBox.Clear(); HeightTextBox.Clear(); WeightTextBox.Clear(); AgeTextBox.Clear(); HeatCatYesRadioButton.Checked = true; SexMaleRadioButton.Checked = true; //Hide Form and return to previous form menuButtonPressed = true; FormProvider.AddSolider.Close(); FormProvider.RosterDisplay.Show(); }