Exemple #1
0
        private void MenuItem_Click_6(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dataGrid.SelectedItems.Count > 0)
                {
                    int Id = ((Remout)dataGrid.SelectedItem).Id;

                    Remout RemEdit = db.remonts.Find(Id);

                    WinEdit EditWindow = new WinEdit();
                    EditWindow.DescriptionText.Text = RemEdit.description;
                    EditWindow.ERROR.Text           = RemEdit.Neispravnost;
                    EditWindow.OriginTimeedit       = RemEdit.OriginRemont;
                    EditWindow.ENDTimeedit          = RemEdit.EndRemont;
                    EditWindow.AuthorBox.Text       = RemEdit.directAuthors;
                    EditWindow.ImageNameedit        = RemEdit.FotoNeispr;
                    EditWindow.DevicesIn.Text       = RemEdit.MarkaDevices;
                    EditWindow.ShowDialog();
                    if (EditWindow.DialogResult.HasValue && EditWindow.DialogResult.Value)
                    {
                        RemEdit.description   = EditWindow.DescriptionText.Text;
                        RemEdit.OriginRemont  = EditWindow.OriginTimeedit;
                        RemEdit.EndRemont     = EditWindow.ENDTimeedit;
                        RemEdit.Neispravnost  = EditWindow.ERROR.Text;
                        RemEdit.FotoNeispr    = EditWindow.ImageNameedit;
                        RemEdit.directAuthors = EditWindow.AuthorBox.Text;
                        RemEdit.MarkaDevices  = EditWindow.MarkaDevices.Text;
                        db.SaveChanges();
                        dataGrid.ItemsSource = null;
                        dataGrid.ItemsSource = db.remonts.Local.ToBindingList();



                        MessageBox.Show("Объект изменен!!!");
                    }
                    else
                    {
                        return;
                    }
                }

                else
                {
                    MessageBox.Show("Ошибка выделите редактируемый элемент!!");
                }
            }
            catch (Exception exs)
            {
                MessageBox.Show("Ошибка !!" + exs.Message);
            }
        }
Exemple #2
0
 private void BtnEdit_Click(object sender, RoutedEventArgs e)
 {
     FolderWindow.WinEdit winEdit = new WinEdit();
     winEdit.ShowDialog();
 }