private void InitFields() { var context = new PSOConnect(); var team = context.team.FirstOrDefault(teams => teams.idTeam == Login.CurrentUser.idTeam); var missingPeople = context.GetPeopleData(); foreach (var people in missingPeople) { SelectMissingPeopleField.Items.Add($"{people.idPeople}-ФАМИЛИЯ: {people.family} ИМЯ: {people.name} ОТЧЕСТВО: {people.middleName} ДАТА РОЖДЕНИЯ: {people.dateOfBirth.Value.ToLongDateString()}\n ДАТА ПРОПАЖИ: {people.dateOfLoss.Value.ToLongDateString()} ПОСЛЕДНЕЕ МЕСТО: {people.lastLocation} ОПИСАНИЕ: {people.specialSign}"); if (team.idPeople == null || team.idPeople != people.idPeople) { continue; } SelectMissingPeopleField.SelectedItem = SelectMissingPeopleField.Items[SelectMissingPeopleField.Items.Count - 1]; IdPeopleText.Text = people.idPeople.ToString(); FioResultText.Text = $"{people.family} {people.name} {people.middleName}"; DateOfBirthResultText.Text = people.dateOfBirth.Value.ToShortDateString(); SpecialSignResultText.Text = people.specialSign; LastLocationResultText.Text = people.lastLocation; DateOfLossResultText.Text = people.dateOfLoss.Value.ToShortDateString(); } IdPeopleText.Hide(); NoFoundMissingPeopleText.Hide(); if (team.idPeople == null) { FioResultText.Hide(); DateOfBirthResultText.Hide(); SpecialSignResultText.Hide(); LastLocationResultText.Hide(); DateOfLossResultText.Hide(); FIOText.Hide(); DateOfBirthText.Hide(); SpecialSignText.Hide(); LastLocationText.Hide(); DateOfLossText.Hide(); SelectMissingPeopleField.Show(); SelectMissingPeopleText.Show(); SelectedButton.Show(); CompletedButton.Hide(); if (SelectMissingPeopleField.Items.Count > 0) { SelectMissingPeopleField.SelectedIndex = 0; } else { SelectedButton.Hide(); NoFoundMissingPeopleText.Show(); SelectMissingPeopleField.Hide(); } } else { FioResultText.Show(); DateOfBirthResultText.Show(); SpecialSignResultText.Show(); LastLocationResultText.Show(); DateOfLossResultText.Show(); FIOText.Show(); DateOfBirthText.Show(); SpecialSignText.Show(); LastLocationText.Show(); DateOfLossText.Show(); SelectMissingPeopleField.Hide(); SelectMissingPeopleText.Hide(); SelectedButton.Hide(); CompletedButton.Show(); } if (SelectMissingPeopleField.Items.Count == 0) { SelectMissingPeopleField.Hide(); NoFoundMissingPeopleText.Show(); CompletedButton.Hide(); } }
private void InitFields() { var context = new PSOConnect(); var team = context.team.FirstOrDefault(teams => teams.idTeam == Login.CurrentUser.idTeam); foreach (var disaster in context.disaster) { SelectDisasterField.Items.Add($"{ disaster.idDisaster}-СТРАНА: { disaster.country} ГОРОД: { disaster.city} ДАТА: { disaster.date.Value.ToLongDateString()}"); if (team.idDisaster == null || team.idDisaster != disaster.idDisaster) { continue; } SelectDisasterField.SelectedItem = SelectDisasterField.Items[SelectDisasterField.Items.Count - 1]; _disaster = disaster; CountyResultText.Text = disaster.country.ToString(); CityResultText.Text = disaster.city.ToString(); DateResultText.Text = disaster.date.Value.ToShortDateString(); ReasonText.Text = disaster.reason.Count > 1 ? "Причины" : "Причина"; foreach (var reason in disaster.reason) { ListInfo.Items.Add($"ТИП: {reason.typeReason} ПРИЧИНА: {reason.reason1}"); } } NoFoundDisasterText.Hide(); if (team.idDisaster == null) { ListInfo.Hide(); ReasonText.Hide(); DateResultText.Hide(); DateText.Hide(); CountryText.Hide(); CountyResultText.Hide(); CityResultText.Hide(); CityText.Hide(); SelectDisasterField.Show(); SelectDisasterText.Show(); SelectedButton.Show(); CompletedButton.Hide(); if (SelectDisasterField.Items.Count > 0) { SelectDisasterField.SelectedIndex = 0; } else { SelectedButton.Hide(); NoFoundDisasterText.Show(); SelectDisasterField.Hide(); } } else { ListInfo.Show(); ReasonText.Show(); DateResultText.Show(); DateText.Show(); CountryText.Show(); CountyResultText.Show(); CityResultText.Show(); CityText.Show(); SelectDisasterField.Hide(); SelectDisasterText.Hide(); SelectedButton.Hide(); CompletedButton.Show(); } if (SelectDisasterField.Items.Count == 0) { SelectDisasterField.Hide(); NoFoundDisasterText.Show(); CompletedButton.Hide(); } }