private void OnClickNew(object sender, RoutedEventArgs e)
        {
            ContextWorkSection ContextWorkSection = new ContextWorkSection();

            Adds.WindowAddWorkSection window = new Adds.WindowAddWorkSection(ContextWorkSection);
            if (window.ShowDialog() == true)
            {
                DBConnection.BeginTransaction();
                try
                {
                    ContextWorkSection.WorkSection.Save();
                    foreach (var item in ContextWorkSection.Comentaries)
                    {
                        item.WorkSectionId = ContextWorkSection.WorkSection.Id;
                        item.Save();
                    }
                    list.Add(new WorkSectionView(ContextWorkSection.WorkSection));
                    DBConnection.CommitTransaction();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString());
                    DBConnection.RollbackTransaction();
                }
            }
        }
        private void OnEditing(object sender, RoutedEventArgs e)
        {
            using (var db = new SmetaDbAppContext())
            {
                if (data.SelectedItem == null)
                {
                    return;
                }
                ContextWorkSection ContextWorkSection = new ContextWorkSection();
                ContextWorkSection.WorkSection = list[data.SelectedIndex].WorkSection;
                var comentlist = db.Commentaries.Where(x => x.WorkSectionId == list[data.SelectedIndex].WorkSection.Id);
                if (comentlist.Count() != 0)
                {
                    foreach (var item in comentlist)
                    {
                        ContextWorkSection.Comentaries.Add(item);
                    }
                }
                ContextWorkSection.SetSelectedWorkType();
                Adds.WindowAddWorkSection window = new Adds.WindowAddWorkSection(ContextWorkSection);
                ContextWorkSection.WorkSection.WorkTypeId = ContextWorkSection.SelectedWorkType.Id;

                if (window.ShowDialog() == true)
                {
                    ContextWorkSection.WorkSection.Update();
                    foreach (var item in ContextWorkSection.Comentaries)
                    {
                        if (item.Id == 0)
                        {
                            item.WorkSectionId = ContextWorkSection.WorkSection.Id;
                            item.Save();
                        }
                        else
                        {
                            item.Update();
                        }
                    }
                    list[data.SelectedIndex].OnPropertyChanged("Book");
                    list[data.SelectedIndex].OnPropertyChanged("Place");
                }
            }
        }