public string search(InputCase inputCase) { IEnumerable <Alumn> found = this.Alumns.Where( alumn => alumn.Age == inputCase.Age && alumn.AcademicYear == inputCase.AcademicYear && alumn.Gender == inputCase.Gender && alumn.Studies == inputCase.Studies ); if (found.Count() > 0) { return(found.OrderBy(alumn => alumn.Name).Select(alumn => alumn.Name).Aggregate((x, y) => x + ", " + y)); } return(null); }
private void InitializeForm() { // Create the list of user data categories given the appropriate type from that supplied _listCategories = new UserDataCategoryList(_category.Scope); // Populate the 'Categories' combo with possible values _listCategories.Populate(); foreach (UserDataCategory availableCategory in _listCategories) { ValueListItem item = cbCategories.Items.Add(availableCategory, availableCategory.Name); if (availableCategory.CategoryID == _category.CategoryID) { cbCategories.SelectedItem = item; } } // Set the form title Text = (_field.FieldID == 0) ? "New User Data Field" : "User Data Field Properties"; Text += " [" + _category.ScopeAsString + "]"; // Populate the 'Type' combo with possible types Dictionary <UserDataField.FieldType, string> fieldTypes = _field.FieldTypes; foreach (KeyValuePair <UserDataField.FieldType, string> kvp in fieldTypes) { cbFieldType.Items.Add(kvp.Key, kvp.Value); } // Populate the Case Combo with possible input cases Dictionary <UserDataField.FieldCase, string> fieldCases = _field.FieldInputCases; foreach (KeyValuePair <UserDataField.FieldCase, string> kvp in fieldCases) { InputCase.Items.Add(kvp.Key, kvp.Value); } InputCase.SelectedIndex = 0; // Populate the Picklists combo with the names of any picklists that have been defined PickListList picklists = new PickListList(); picklists.Populate(); foreach (PickList picklist in picklists) { Picklist.Items.Add(picklist, picklist.Name); } if (Picklist.Items.Count != 0) { Picklist.SelectedIndex = 0; } // Set the initial data tbFieldName.Text = _field.Name; //TabOrder.Value = field.TabOrder; cbMandatory.Checked = _field.IsMandatory; cbInteractiveInclude.Checked = (_field.ParentScope == UserDataCategory.SCOPE.Asset); // Set the field type in the combo box int selectedIndex = cbFieldType.FindStringExact(fieldTypes[_field.Type]); cbFieldType.SelectedIndex = selectedIndex == -1 ? 0 : selectedIndex; // The remainder of the fields depend on the field type switch ((int)_field.Type) { // For text fields the input length is stored in 'Value1' and Input Case encoded into Value2 case (int)UserDataField.FieldType.Text: selectedIndex = InputCase.FindStringExact(_field.InputCase == "title" ? "TitleCase" : _field.InputCase); InputCase.SelectedIndex = (selectedIndex == -1) ? 0 : selectedIndex; break; // Numeric fields - Minimum is 'Value1' Maximum is 'Value2' case (int)UserDataField.FieldType.Number: break; // For a picklist, the name of the picklist (if any) is stored in 'Value1' case (int)UserDataField.FieldType.Picklist: selectedIndex = (Picklist.FindStringExact(_field.Picklist)); Picklist.SelectedIndex = (selectedIndex == -1) ? 0 : selectedIndex; break; // Environment Variable - the permitted length is stored as 'Value1' with the name of the variable // in question stored as 'Value2' case (int)UserDataField.FieldType.Environment: tbEnvironmentVariableName.Text = _field.EnvironmentVariable; break; // Registry Keys : The Key name is stored as value1 with the value name as Value2 case (int)UserDataField.FieldType.Registry: tbRegistryKey.Text = _field.RegistryKey; tbRegistryValue.Text = _field.RegistryValue; break; //// Boolean Fields - no additional fields required //case (int)UserDataField.FieldType.boolean: // break; // Date Fields - no additional fields required case (int)UserDataField.FieldType.Date: break; // Currency Fields - no additional fields required case (int)UserDataField.FieldType.Currency: break; default: MessageBox.Show("An invalid type has been identified in the User Data Field Definition"); break; } }