private void CreateDocument()
        {
            // Добавление документа в БД с инструкцией
            Document document = new Document();
            document.Instruction = SelectedInstruction;

            document.Products = SelectedTemplate.Products;

            mvm.dc.Documents.Add(document);

            ButtonCreateDocEnabled = false;
            if ((mvm.cdProcessor != null) && (mvm.cdProcessor.isWorking())) {
                mvm.cdProcessor.Stop();
            }
            CreateDocumentDone_delegete done_del = new CreateDocumentDone_delegete(CreateDocumentDone_Proc);
            mvm.cdProcessor = new CreateDocumentProcessor(document, SelectedTemplate, done_del);
            mvm.cdProcessor.Operate();
        }
 public CreateDocumentProcessor(Document _document, Template _template, CreateDocumentDone_delegete _done_del)
 {
     document = _document;
     template = _template;
     done_del = _done_del;
 }