public AllFiltersWindow(MainWindow mainWindow, Event eventEntity, FilterWindowData filterWindowData, List <ParticipationFormat> participationFormats, List <Participant> participants) { this.filterWindowData = filterWindowData; this.eventEntity = eventEntity; this.participants = participants; this.mainWindow = mainWindow; InitializeComponent(); bool toMaximize = WindowHelper.checkIfMaximizeWindow(this.Width, this.Height); if (toMaximize) { this.WindowState = FormWindowState.Maximized; } this.FormClosed += ClosedHandler; allActivateFilter.Add(CheckBox_FirstName); allActivateFilter.Add(CheckBox_LastName); allActivateFilter.Add(CheckBox_CompanyType); allActivateFilter.Add(CheckBox_JobTitle); allActivateFilter.Add(CheckBox_CompanyName); allActivateFilter.Add(CheckBox_PaymentStatus); allActivateFilter.Add(CheckBox_ParticipationFormat); allActivateFilter.Add(CheckBox_TicketSent); allActivateFilter.Add(CheckBox_Materials); allActivateFilter.Add(CheckBox_RegisteredInDay); allActivateFilter.Add(CheckBox_CheckedInDay); allActivateFilter.Add(CheckBox_Country); foreach (CompanyTypes companyType in (CompanyTypes[])Enum.GetValues(typeof(CompanyTypes))) { ComboBox_CompanyType.Items.Add(companyType.ToString()); } foreach (ParticipationFormat participationFormat in participationFormats) { ComboBox_ParticipationFormat.Items.Add(participationFormat.Value); } //Set payment status values to comboBox and select first item foreach (PaymentStatus paymentStatus in (PaymentStatus[])Enum.GetValues(typeof(PaymentStatus))) { ComboBox_PaymentStatus.Items.Add(paymentStatus.ToString()); } List <string> YesNoList = new List <string>(); foreach (YesNo yesNo in (YesNo[])Enum.GetValues(typeof(YesNo))) { ComboBox_TicketSent.Items.Add(yesNo.ToString()); ComboBox_RegisteredInDay.Items.Add(yesNo.ToString()); ComboBox_CheckedInDay.Items.Add(yesNo.ToString()); } LoadWindowData(); BringToFront(); }
public List <Participant> filterParticipants(List <Participant> allParticipants, FilterWindowData filterWindowData, Event eventEntity) { List <Participant> filteredParticipants = allParticipants; if (filterWindowData.firstNameActive) { if (filterWindowData.firstName.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToFirstName(filteredParticipants, filterWindowData.firstName); } } if (filterWindowData.lastNameActive) { if (filterWindowData.lastName.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToLastName(filteredParticipants, filterWindowData.lastName); } } if (filterWindowData.companyTypeActive) { if (filterWindowData.companyType.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToCompanyType(filteredParticipants, filterWindowData.companyType); } } if (filterWindowData.jobTitleActive) { if (filterWindowData.jobTitle.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToJobTitle(filteredParticipants, filterWindowData.jobTitle); } } if (filterWindowData.companyNameActive) { if (filterWindowData.companyName.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToCompanyName(filteredParticipants, filterWindowData.companyName); } } if (filterWindowData.paymentStatusActive) { if (filterWindowData.paymentStatus.Length >= 0) { filteredParticipants = filterAccordingToPaymentStatus(filteredParticipants, filterWindowData.paymentStatus); } } if (filterWindowData.participationFormatActive) { if (filterWindowData.participationFormat.Length >= 0) { filteredParticipants = filterAccordingToParticipationFormat(filteredParticipants, filterWindowData.participationFormat); } } if (filterWindowData.ticketSentActive) { if (filterWindowData.ticketSent) { filteredParticipants = filterAccordingToTicketSent(filteredParticipants, filterWindowData.ticketSent); } } if (filterWindowData.materialsActive) { if (filterWindowData.materials.Length >= 0) { filteredParticipants = filterAccordingToMaterials(filteredParticipants, filterWindowData.materials); } } if (filterWindowData.registrationDateActive) { int year; int month; int day; bool yearParsed = filterWindowData.RegistrationDateYear.Length > 0 ? Int32.TryParse(filterWindowData.RegistrationDateYear, out year) : true; bool monthParsed = filterWindowData.RegistrationDateMonth.Length > 0 ? Int32.TryParse(filterWindowData.RegistrationDateMonth, out month) : true; bool dayParsed = filterWindowData.RegistrationDateDay.Length > 0 ? Int32.TryParse(filterWindowData.RegistrationDateDay, out day) : true; if (yearParsed && monthParsed && dayParsed) { filteredParticipants = filterAccordingToRegistrationDate(filteredParticipants, filterWindowData.RegistrationDateYear, filterWindowData.RegistrationDateMonth, filterWindowData.RegistrationDateDay); } } if (filterWindowData.paymentDateActive) { int year; int month; int day; bool yearParsed = filterWindowData.PaymentDateYear.Length > 0 ? Int32.TryParse(filterWindowData.PaymentDateYear, out year) : true; bool monthParsed = filterWindowData.PaymentDateMonth.Length > 0 ? Int32.TryParse(filterWindowData.PaymentDateMonth, out month) : true; bool dayParsed = filterWindowData.PaymentDateDay.Length > 0 ? Int32.TryParse(filterWindowData.PaymentDateDay, out day) : true; if (yearParsed && monthParsed && dayParsed) { filteredParticipants = filterAccordingToPaymentDate(filteredParticipants, filterWindowData.PaymentDateYear, filterWindowData.PaymentDateMonth, filterWindowData.PaymentDateDay); } } if (filterWindowData.registeredInDayActive) { if (filterWindowData.materials.Length > 0) { List <Participant> part = filterAccordingToRegisteredInDay(eventEntity, filteredParticipants, filterWindowData.registeredInDay); if (part != null) { filteredParticipants = part; } } } if (filterWindowData.checkedInDayActive) { List <Participant> part = filterAccordingToCheckedInDay(eventEntity, filteredParticipants, filterWindowData.checkedInDay); if (part != null) { filteredParticipants = part; } } if (filterWindowData.countryActive) { if (filterWindowData.country.Replace(" ", "").Length > 0) { filteredParticipants = filterAccordingToCountry(filteredParticipants, filterWindowData.country); } } return(filteredParticipants); }