コード例 #1
0
        private List <EducationPlace> GetCurrentEducations()
        {
            var educationPlaceDao       = new EducationPlaceDao();
            var educationPlaceConverter = new EducationPlaceListConverter();

            return(educationPlaceConverter.Convert(educationPlaceDao.GetListByDraftee(DrafteeId)));
        }
コード例 #2
0
        private void SaveButton_OnClick(object sender, RoutedEventArgs e)
        {
            draftee.ForeignLanguages = ForeignLanguagesText.Text;
            var validator = new EducationPlacesValidator();

            if (validator.Validate(educationPlaces, draftee.ForeignLanguages))
            {
                var drafteeDao   = new DrafteeDao();
                var educationDao = new EducationPlaceDao();
                drafteeDao.Update(draftee);
                foreach (long id in idsForDelete)
                {
                    educationDao.Delete(id);
                }
                foreach (var place in educationPlaces)
                {
                    if (place.Id > 0)
                    {
                        educationDao.Update(place);
                    }
                    else
                    {
                        educationDao.Insert(place);
                    }
                }
                Close();
            }
            else
            {
                MessageBox.Show(
                    this,
                    string.Format("Данные не прошли проверку.\nСообщение об ошибке: \"{0}\"", validator.Message),
                    "Сообщение");
            }
        }