private void uniDialog_DialogEvent(object source, Kesco.Lib.Win.DialogEventArgs e)
 {
     Kesco.Lib.Win.Document.Select.SelectDocUniversalDialog dialog = e.Dialog as Kesco.Lib.Win.Document.Select.SelectDocUniversalDialog;
     if (dialog != null && dialog.DialogResult == DialogResult.OK)
     {
         ((DocumentOption)currentOption).Document =
             new Document(dialog.DocID);
         RefreshAll();
     }
     Enabled = true;
     Focus();
 }
        private void EditDocumentOption_DialogEvent(object source, Kesco.Lib.Win.DialogEventArgs e)
        {
            var dialog = e.Dialog as XmlSearchForm;

            if (dialog != null && dialog.DialogResult == DialogResult.OK)
            {
                if (Environment.DocData.FoundDocsCount() > 0) // есть найденные документы
                {
                    var uniDialog =
                        new Kesco.Lib.Win.Document.Select.SelectDocUniversalDialog(
                            Environment.DocData.GetFoundDocsIDQuery(Environment.CurEmp.ID), dialog.DocID, null, false);
                    uniDialog.DialogEvent += uniDialog_DialogEvent;
                    ShowSubForm(uniDialog);
                }
                else
                {
                    if (MessageBox.Show(Environment.StringResources.GetString("Search.NotFound.Message1")
                                        + System.Environment.NewLine + System.Environment.NewLine +
                                        Environment.StringResources.GetString("Search.NotFound.Message2"),
                                        Environment.StringResources.GetString("Search.NotFound.Title"),
                                        MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                                        MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        EditDocumentOption((DocumentOption)currentOption);
                    }
                    else
                    {
                        Enabled = true;
                        Focus();
                    }
                }
            }
            else
            {
                Enabled = true;
                Focus();
            }
        }