示例#1
0
        private void EditSubjectScheme()
        {
            try
            {
                if (olvObsada.SelectedObject == null)
                {
                    return;
                }
                var P = olvObsada.SelectedObject as SubjectSchemeModel;
                using (var dlg = new dlgObsada(false))
                {
                    FillDialog(dlg, P);

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        //IsqlCommand cmd = new SqlCommand();
                        if (UpdateSubjectAsync(dlg, P).Result > 0)
                        {
                            //cmd.CommitTransaction();
                            NewRecord(P.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 dlgObsada(true))
     {
         //dlg.SchoolYearDateRange = new DateRange();
         dlg.cbKlasa.SelectedIndexChanged += dlg.cbKlasa_SelectedIndexChanged;
         dlg.NewRecordAdded += NewRecord;
         dlg.ShowDialog();
         dlg.NewRecordAdded -= NewRecord;
         dlg.cbKlasa.SelectedIndexChanged -= dlg.cbKlasa_SelectedIndexChanged;
     }
 }