Exemplo n.º 1
0
 //protected override void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
 //{
 //    try
 //    {
 //        Validate();
 //        positionBindingSource.EndEdit();
 //        positionTableAdapter.Update(documentsUsersDataSet.position);
 //    }
 //    catch (SqlException er)
 //    {
 //        if ((int)er.Class == 14)
 //        {
 //            MessageBox.Show("Такой тип организации уже существует", "",
 //                MessageBoxButtons.OK, MessageBoxIcon.Information);
 //        }
 //        else if ((int)er.Class == 16)
 //        {
 //            MessageBox.Show("Невозможно удалить запись", "",
 //                MessageBoxButtons.OK, MessageBoxIcon.Information);
 //        }
 //        else
 //        {
 //            MessageBox.Show("Невозможно сохранить изменения. " + er.Message,
 //                            "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 //        }
 //    }
 //    catch (Exception ex)
 //    {
 //        MessageBox.Show("Невозможно сохранить изменения. " + ex.Message,
 //                        "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 //    }
 //}
 protected override void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     frm_AddPosition frm_addpostion = new frm_AddPosition(0, "INS");
     frm_addpostion.ShowDialog();
     this.SetProperties();
 }
Exemplo n.º 2
0
 protected override void tsb_Edit_Click(object sender, EventArgs e)
 {
     if (positionDataGridView.RowCount > 0)
     {
         try
         {
             frm_AddPosition frm_addposition = new frm_AddPosition((int)positionDataGridView.SelectedRows[0].Cells[0].Value,
                 "EDIT");
             if (frm_addposition.ShowDialog() == DialogResult.OK)
                 this.SetProperties();
         }
         catch { }
     }
 }