private void btnAddCharter_Click(object sender, EventArgs e) { if (tbxName.Text == string.Empty) { MessageBox.Show("Please enter a Customer Name.", "Missing Input", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cbxYachtType.Text == string.Empty) { MessageBox.Show("Please select a Yacht type.", "Missing Input", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cbxYachtSize.Text == string.Empty) { MessageBox.Show("Please select a Yacht size.", "Missing Input", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string customerName, yachtType; int yachtSize; decimal charterhours, yachtFee; Charter aCharter; customerName = tbxName.Text; yachtSize = Convert.ToInt32(cbxYachtSize.SelectedItem); yachtType = Convert.ToString(cbxYachtType.SelectedItem); charterhours = (nudHoursChartered.Value); aCharter = new Charter(customerName, yachtType, yachtSize, charterhours); yachtFee = aCharter.CharterFee; //aCharter = new Charter(customerName, yachtType, yachtSize, charterhours); if (aCharterManager is null) { aCharterManager = new CharterManager(); } aCharterManager.AddCharter(aCharter); allChartersToolStripMenuItem.Enabled = true; noChartersForAYachtSizeToolStripMenuItem.Enabled = true; chartersSummaryToolStripMenuItem.Enabled = true; resetForNextCharterToolStripMenuItem.Enabled = true; charterSummaryToolStripMenuItem.Enabled = true; //contextMenuStrip2.Items[0].Enabled = true; //contextMenuStrip2 = true; }
public void AddCharter(string customerName, string yachtType, int yachtSize, decimal charterHours) { Charter aCharter = new Charter(customerName, yachtType, yachtSize, charterHours); Charters.Add(aCharter); }
public void AddCharter(Charter aCharter) { Charters.Add(aCharter); }