public EditAircraft(Aircraft ThisAircraft, FormRole FR) { InitializeComponent(); // Устанавливаем название формы и подпись кнопки в зависимости от роли формы if (FR == FormRole.Adding) { Text = "Добавить самолет"; button_edit.Text = "Добавить"; } else if (FR == FormRole.Changing) { Text = "Изменить самолет"; button_edit.Text = "Изменить"; } // Заполняем форму textBox_aircraftModel.Text = ThisAircraft.AircraftModel; textBox_aircraftSerialNumber.Text = ThisAircraft.AircraftSerialNumber; numericUpDown_aircraftSeats.Value = Convert.ToDecimal(ThisAircraft.AircraftSeats); textBox_pilotFullName.Text = ThisAircraft.AircraftСhiefPilot.HumanFullName; textBox_pilotPhoneNumber.Text = ThisAircraft.AircraftСhiefPilot.CrewPhoneNumber; textBox_pilotHomeAddress.Text = ThisAircraft.AircraftСhiefPilot.CrewHomeAddress; textBox_pilotLicenseNumber.Text = ThisAircraft.AircraftСhiefPilot.PilotLicenseNumber; // По умолчанию пользователь не ввел данные IfNotLeft = false; this.ThisAircraft = ThisAircraft; }
public FormAddEntry(FormDisplay main, FormRole role, int EditedID) { this.main = main; this.role = role; this.editedEntryID = EditedID; InitializeComponent(); }
public EditAirport(Airport ThisAirport, FormRole FR) { InitializeComponent(); // Устанавливаем название формы и подпись кнопки в зависимости от роли формы if (FR == FormRole.Adding) { Text = "Добавить аэропорт"; button_edit.Text = "Добавить"; } else if (FR == FormRole.Changing) { Text = "Изменить аэропорт"; button_edit.Text = "Изменить"; } // Заполняем форму textBox_name.Text = ThisAirport.AirportName; textBox_address.Text = ThisAirport.AirportAddress; // По умолчанию пользователь не ввел данные IfNotLeft = false; this.ThisAirport = ThisAirport; }
public FormAddEntry(FormDisplay main, FormRole role) { this.main = main; this.role = role; InitializeComponent(); }
public FormAddEntry() { role = FormRole.ROLE_ADD; InitializeComponent(); }
public EditFlight(Flight ThisFlight, FormRole FR, Airport ThisAirport, List <Airport> Airports, List <Aircraft> Aircrafts) { InitializeComponent(); // Устанавливаем название формы и подпись кнопки в зависимости от роли формы if (FR == FormRole.Adding) { Text = "Добавить самолет"; button_edit.Text = "Добавить"; groupBox_tickets.Enabled = false; } else if (FR == FormRole.Changing) { Text = "Изменить самолет"; button_edit.Text = "Изменить"; comboBox_plane.Enabled = false; } // Заполняем форму comboBox_flightType.Items.Add("Отправка"); comboBox_flightType.Items.Add("Прибытие"); comboBox_flightType.Items.Add("Транзит"); comboBox_flightType.SelectedIndex = (int)ThisFlight.FlightType; textBox_departureTime.Text = Convert.ToString(ThisFlight.FlightDepartureTime); textBox_arrivalTime.Text = Convert.ToString(ThisFlight.FlightArrivalTime); textBox_number.Text = ThisFlight.FlightNumber; comboBox_departurePoint.Items.Add(ThisFlight.FlightDeparturePoint.AirportName + " : " + ThisFlight.FlightDeparturePoint.AirportAddress); comboBox_arrivalPoint.Items.Add(ThisFlight.FlightArrivalPoint.AirportName + " : " + ThisFlight.FlightArrivalPoint.AirportAddress); comboBox_departurePoint.Items.Add(ThisAirport.AirportName + " : " + ThisAirport.AirportAddress); comboBox_arrivalPoint.Items.Add(ThisAirport.AirportName + " : " + ThisAirport.AirportAddress); foreach (Airport Airport in Airports) { comboBox_departurePoint.Items.Add(Airport.AirportName + " : " + Airport.AirportAddress); comboBox_arrivalPoint.Items.Add(Airport.AirportName + " : " + Airport.AirportAddress); } comboBox_departurePoint.SelectedIndex = 0; comboBox_arrivalPoint.SelectedIndex = 0; if (!(comboBox_departurePoint.Items.Count == 0 || comboBox_arrivalPoint.Items.Count == 0)) { if (comboBox_flightType.SelectedIndex == (int)FlightType.Depart) { comboBox_departurePoint.SelectedIndex = 1; comboBox_departurePoint.Enabled = false; comboBox_arrivalPoint.Enabled = true; } else if (comboBox_flightType.SelectedIndex == (int)FlightType.Arrival) { comboBox_departurePoint.Enabled = true; comboBox_arrivalPoint.SelectedIndex = 1; comboBox_arrivalPoint.Enabled = false; } else if (comboBox_flightType.SelectedIndex == (int)FlightType.Transit) { comboBox_departurePoint.Enabled = true; comboBox_arrivalPoint.Enabled = true; } } comboBox_plane.Items.Add(ThisFlight.FlightPlane.AircraftModel + " : " + ThisFlight.FlightPlane.AircraftSerialNumber); foreach (Aircraft Aircraft in Aircrafts) { comboBox_plane.Items.Add(Aircraft.AircraftModel + " : " + Aircraft.AircraftSerialNumber); } comboBox_plane.SelectedIndex = 0; button_removeTicket.Enabled = false; comboBox_travelClass.Items.Add("Первый класс"); comboBox_travelClass.Items.Add("Бизнесс класс"); comboBox_travelClass.Items.Add("Комфорт класс"); comboBox_travelClass.Items.Add("Эконом класс"); comboBox_travelClass.SelectedIndex = 3; // По умолчанию пользователь не ввел данные IfNotLeft = false; // Устанавливаем данные this.ThisFlight = ThisFlight; this.ThisAirport = ThisAirport; this.Airports = Airports; this.Aircrafts = Aircrafts; // Выводим данные на таблицу initializeDataGridView(); showDataOnDataGridView(); // Выводим свободные места updateComboBoxWithFreeSeats(); }
private void DoClick(object sender, EventArgs e) { if (sender == btnAdd) { if (cboRole.Items.Count > 0) { FormInsertEmployee insert = new FormInsertEmployee(); insert.ShowDialog(); } else { MessageError("Please add role before add new Employee!", "Required"); FormRole frm = new FormRole(); frm.Exited += frm_Exited; frm.ShowDialog(); } } else if (sender == btnUpdate) { emp = dgvEmployee.CurrentRow.Tag as Employee; FormInsertEmployee update = new FormInsertEmployee(emp); update.ShowDialog(); } else if (sender == btnDelete) { DialogResult dr = this.MessageVerify("Do you want to delete?", "Delete"); if (dr == DialogResult.Yes) { foreach (DataGridViewRow row in dgvEmployee.SelectedRows) { int index = employeeList.IndexOf(row.Tag as Employee); int id = employeeList[index].ID; if (Delete(id)) { MessageSuccess("Deleted successfully", "Delete"); employeeList.RemoveAt(index); dgvEmployee.Rows.Remove(row); RefreshBottomInformation(); } else { MessageError("Deleted Unsuccessfully", "Delete"); } } if (employeeList.Count == 0) { btnRefresh.Enabled = false; } if (dgvEmployee.Rows.Count == 0) { SetEnableButton(false); } } } else if (sender == btnExport) { Exporter.DataGridViewToExel(dgvEmployee); } else if (sender == btnRefresh) { LoadData(); /* * femaleNumber = 0; * AccoutNumber = 0; * cboRole.SelectedIndex = -1; * cboSearch.SelectedIndex = 0; * txtSearch.Text = searchBy[0]; * * if (employeeList.Count == 0 || employeeList.Count == dgvEmployee.Rows.Count) return; * dgvEmployee.Rows.Clear(); * foreach (Employee emp in employeeList) * { * if (emp.Gender == "Female") femaleNumber ++; * if (emp.UserName != "") AccoutNumber ++; * AddDataRowToDataGridView(emp); * } * SetBottomInformationToTextBox(); * SetEnableButton(true); */ } else if (sender == btnRoleDetails) { FormRole frm = new FormRole(); frm.Exited += frm_Exited; frm.ShowDialog(); } }