private void searchClientButton_Click(object sender, EventArgs e) { clientsFoundListBox.Items.Clear(); clientCarsLabel.Visible = false; bool containsResults = false; List <Client> foundClients = new List <Client>(sessionData.clientRepository.PartialSearchClients(clientFirstNameInput.Text, clientLastNameInput.Text)); foreach (var client in foundClients) { if (client.Nume.ToLower().StartsWith(clientFirstNameInput.Text.ToLower())) { containsResults = true; } } if (containsResults == true) { foreach (var client in foundClients) { if (client.Nume.ToLower().StartsWith(clientFirstNameInput.Text.ToLower())) { clientsFoundListBox.Items.Add(ClientMapper.fromEntityToModel(client)); } } clientsFoundListBox.Visible = true; modifyClientButton.Visible = true; deleteClientButton.Visible = true; } else { MessageBox.Show("No client found"); modifyClientButton.Visible = false; deleteClientButton.Visible = false; clientsFoundListBox.Visible = false; } }
public AutoPopupForm(SessionData sessionData) { InitializeComponent(); clonnedSessionData = sessionData; if (clonnedSessionData.Operation_Type == OperationTypes.MODIFY_AUTO || clonnedSessionData.Operation_Type == OperationTypes.ADD_AUTO) { foreach (var client in sessionData.clientRepository.GetClients()) { if (client.ClientId == clonnedSessionData.selectedClient.ClientId) { selectedOwnerIndex = sessionData.clientRepository.GetClients().IndexOf(client); } autoOwnersComboBox.Items.Add(ClientMapper.fromEntityToModel(client)); } foreach (var chassis in sessionData.chassisRepository.GetAllChassis()) { chassisComboBox.Items.Add(ChassisMapper.FromEntityToModel(chassis)); } //chassisComboBox.SelectedItem = ChassisMapper.FromEntityToModel(clonnedSessionData.chassisRepository.GetChassis(chassisId)).ToString(); } }