private void DeleteCurrentDocument()
        {
            MaterialPermit document = (MaterialPermit)bsDocumentList.Current;

            if (MessageBox.Show(DispatcherService.Resources.Message.DeleteDocument, document.ToString(),
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                bsDocumentList.Remove(document);
                document.Delete();
                document.Save(Database, User);
            }
        }
 private void SignMaterialDocument(MaterialPermit document, MaterialPermit.MaterialPermitFlag flag)
 {
     try
     {
         document.SetSigned(Database, flag, DateTime.Now);
         RefreshMaterialDocumentList();
         bsMaterialDocumentList.Position = bsMaterialDocumentList.IndexOf(document);
     }
     catch (Exception e)
     {
         MessageBox.Show(EntryControl.Resources.Message.Error.SavingError, document.ToString());
     }
 }
        private void btnLockMd_Click(object sender, EventArgs e)
        {
            MaterialPermit document = bsMaterialDocumentItem.DataSource as MaterialPermit;

            if (document != null &&
                MessageBox.Show(EntryControl.Resources.Message.Question.FailMaterialDocument, document.ToString(), MessageBoxButtons.YesNo)
                == DialogResult.Yes)
            {
                SignMaterialDocument(document, MaterialPermit.MaterialPermitFlag.Failed);
            }
        }