示例#1
0
        private void EditSchoolClass()
        {
            try
            {
                var SC = olvKlasa.SelectedObject as SchoolClass;
                using (var dlg = new dlgSchoolClass(false))
                {
                    FillDialog(dlg, SC);

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        if (UpdateData(dlg, SC).Result > 0)
                        {
                            NewRecord(SC.ID);
                            return;
                        }
                        throw new Exception("Aktualizacja danych nie powiodła się!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
 private void cmdAddNew_Click(object sender, EventArgs e)
 {
     using (var dlg = new dlgSchoolClass(true))
     {
         dlg.NewRecordAdded += NewRecord;
         dlg.ShowDialog();
         dlg.NewRecordAdded -= NewRecord;
     }
 }