Beispiel #1
0
 private void personsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (DialogView == true)
         {
             FModalDialog frmSaveDialog = new FModalDialog("Сохранить", "Сохранить данные?", true);
             frmSaveDialog.ShowDialog();
             if (frmSaveDialog.DialogResult == DialogResult.OK)
             {
                 this.Validate();
                 this.personsBindingSource.EndEdit();
                 this.tableAdapterManager.UpdateAll(this.dataSetMainForm);
                 FPersonAdd.ActiveForm.Close();
             }
             else if (frmSaveDialog.DialogResult == DialogResult.Cancel)
             {
                 psn_fnameTextBox.Focus();
             }
         }
         else
         {
             FPersonAdd.ActiveForm.Close();
         }
     }
     catch
     {
         FModalDialog frmErrorOfAdd = new FModalDialog("Ошибка", "Ошибка сохранения данных!", false);
         frmErrorOfAdd.ShowDialog();
         psn_fnameTextBox.Focus();
     }
 }
Beispiel #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (DialogView == true)
     {
         FModalDialog frmCancelDialog = new FModalDialog("Отмена", "Закрыть и отменить изменения?", true);
         frmCancelDialog.ShowDialog();
         if (frmCancelDialog.DialogResult == DialogResult.OK)
         {
             this.personsBindingSource.CancelEdit();
             FPersonAdd.ActiveForm.Close();
         }
         else if (frmCancelDialog.DialogResult == DialogResult.Cancel)
         {
             psn_fnameTextBox.Focus();
         }
     }
     else
     {
         FPersonAdd.ActiveForm.Close();
     }
 }
Beispiel #3
0
        private void FormAdd()
        {
            DataSetMainForm.cardsRow newCardsRow = dataSetMainForm.cards.NewcardsRow();

            try
            {
                newCardsRow.crd_psncode      = Buffer.MFPersonBuffer;
                newCardsRow.crd_spccode      = Convert.ToInt32(crd_spccodeListBox.SelectedValue);
                newCardsRow.crd_workplace    = crd_workplaceTextBox.Text;
                newCardsRow.crd_workpost     = crd_workpostTextBox.Text;
                newCardsRow.crd_outschool    = Convert.ToInt32(crd_OutScoolListBox.SelectedValue);
                newCardsRow.crd_inschool     = Convert.ToInt32(crd_InScoolListBox.SelectedValue);
                newCardsRow.crd_remanded     = Convert.ToByte(crd_remadnstatuscomboBox.SelectedValue);
                newCardsRow.crd_remandreason = crd_remandreasonTextBox.Text;
                newCardsRow.crd_bdate        = crd_bdateDateTimePicker.Value;
                newCardsRow.crd_edate        = crd_edateDateTimePicker.Value;
                newCardsRow.crd_docdate      = crd_docdateDateTimePicker.Value;
                newCardsRow.crd_docname      = crd_docnameTextBox.Text;
                newCardsRow.crd_docorg       = crd_docorgTextBox.Text;
                newCardsRow.crd_dipdate      = dtpDipdate.Value;
                newCardsRow.crd_dipregnum    = tbDipregnum.Text;
                newCardsRow.crd_dipserial    = tbDipserial.Text;


                dataSetMainForm.cards.Rows.Add(newCardsRow);
                cardsTableAdapter.Update(dataSetMainForm.cards);
            }
            catch
            {
                FModalDialog frmErrorDialog = new FModalDialog("Ошибка", "Ошибка обновления данных", false);
                frmErrorDialog.ShowDialog();
                if (frmErrorDialog.DialogResult == DialogResult.OK)
                {
                    crd_spccodeListBox.Focus();
                }
            }
        }