private bool ModuleCanCreateDoVerb(IDynamicModule module) { bool? result = module.DoVerb(VerboseCommand.CanCreate) as bool?; return result ?? false; }
/// <summary> /// !!! ВСЕ ЭТО НАДО ПЕРЕДЕЛАТЬ КАК ЗДЕСЬ --> http://www.devexpress.com/Support/Center/Example/Details/E1487 /// </summary> private void ImportExamination_Execute(object sender, EventArgs e) { importPatient = null; importExamination = null; isImportCompleted = false; importWizard = null; showWelcomePage = true; OpenFileDialog openFileDialog = new OpenFileDialog() { CheckFileExists = true, Multiselect = true, //false, CheckPathExists = true, Filter = GetDialogFilter(), //CaptionHelper.GetLocalizedText("CustomFomrsMessages", "importFileDialogFileter"), Title = CaptionHelper.GetLocalizedText("CustomFomrsMessages", "importFiledialogTitle") }; if (openFileDialog.ShowDialog() == DialogResult.OK) { //importFileFullName = openFileDialog.FileName; var importFiles= openFileDialog.FileNames; int totalFiles = importFiles.Count(); int currentNumber = 0; foreach (string file in importFiles) { if (importWizard != null) { if (importWizard.Canceled == true) return; } currentNumber++; importFileFullName = file; // находим модуль по расширению файла string extension = Path.GetExtension(importFileFullName); dynamicModule = GetModuleByAssociationAttributeFileExtension(extension); if (dynamicModule == null) { string error = String.Format(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "FileImportError"), importFileFullName); string desctiption = CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportModuleError"); XtraMessageBox.Show(String.Format("{0}\n{1}",error, desctiption),"",MessageBoxButtons.OK, MessageBoxIcon.Error); continue; //return; } XElement header = null; // получаем данные пациента из файла try { header = dynamicModule.DoVerb(VerboseCommand.ExtractData, importFileFullName) as XElement; } catch (Exception ex) { if (ex.Message == "ExaminationImportNoPatientDataFound") { header = null; //XtraMessageBox.Show(CaptionHelper.GetLocalizedText("Exceptions", "ExaminationImportNoPatientDataFound")); } else { string error = String.Format(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "FileImportError"), importFileFullName); string desctiption = CaptionHelper.GetLocalizedText("Exceptions", "ExaminationImportWrongFileType"); XtraMessageBox.Show(String.Format("{0}\n{1}", error, desctiption),"",MessageBoxButtons.OK, MessageBoxIcon.Error); isImportCompleted = false; continue; //return; } } importData = CreateImportData(header); //проверяем дату if (importData.StartExaminationDateTime == DateTime.MinValue) {// если дату из файла извлеч не удалось то ставим дату создания файла FileInfo info = new FileInfo(importFileFullName); importData.StartExaminationDateTime = info.CreationTime; } // Запускаем мастер импорта обследования в БД importWizard = new ImportWizardForm(); string fullName = String.Format("{0} {1} {2}", importData.LastName, importData.FirstName, importData.MiddleName); string title = String.Format("{0} ({1}/{2})", importFileFullName, currentNumber, totalFiles); importWizard.SetTitle(title); importWizard.SetMessage(string.Format(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportPatientCaptionSearch"), fullName), 1); importWizard.SetMessage(CaptionHelper.GetLocalizedText("CustomFomrsMessages", "ImportPatientClosiestMatch"), 2); importWizard.isLocalized = true; // Коллекция пациентов для мастера импорта XPCollection patientsCollection = (XPCollection)Application.MainWindow.View.ObjectSpace.CreateCollection(typeof(IPatient)); importWizard.WelcomePage.Visible = (showWelcomePage == true);// скрываем страницу приветствия если она уже показывалась importWizard.DisplayPatientCollection(patientsCollection, fullName); importWizard.WizardControl.NextClick += new WizardCommandButtonClickEventHandler(importWizardControl_NextClick); importWizard.WizardControl.SelectedPageChanging += new WizardPageChangingEventHandler(importWizardControl_SelectedPageChanging); importWizard.WizardControl.CustomizeCommandButtons += (o,a) => { if (currentNumber != totalFiles) {// если файл не последний CompletionWizardPage page = a.Page as CompletionWizardPage; if (page != null) {// см. Предложение #4587 page.AllowCancel = true; page.ProceedText = CaptionHelper.GetLocalizedText("CustomFomrsMessages", "DataImportMasterProceed"); a.FinishButton.Text = a.NextButton.Text; //"Далее >"; } } }; importWizard.WizardControl.CancelClick += (o, a) => { }; importWizard.WizardCompleted += (args) => { isImportCompleted = args; }; importWizard.ShowDialog(); } } }
//private DoVerbResult ModuleIsReadyDoVerb(IDynamicModule module, Guid oid, ExecuteCommand command = ExecuteCommand.Null) //{ // DoVerbResult result = module.DoVerb(VerboseCommand.CheckReady, command) as DoVerbResult; // return result ?? new DoVerbResult {IsSuccess =false}; //} private bool ModuleSupportMultiModeDoVerb(IDynamicModule module) { bool? result = module.DoVerb(VerboseCommand.SupportMultiMode) as bool?; return result ?? false; }
/// <summary> /// Метод проверяет готовность модуля к работе /// </summary> private bool ModuleIsReadyDoVerb(IDynamicModule module, Guid oid, ExecuteCommand command = ExecuteCommand.Null) { bool? result = module.DoVerb(VerboseCommand.CheckReady, command) as bool?; return result ?? false; }
private IEnumerable<ModuleActionInformation> ModuleGetModeInformationDoVerb(IDynamicModule module) { return module.DoVerb(VerboseCommand.GetModeInformation) as IEnumerable<ModuleActionInformation>; }
/// <summary> /// Метод запускает новое обследование /// </summary> /// <param name="module"></param> /// <param name="examination"></param> /// <param name="patient"></param> protected void NewExaminationExecute(IDynamicModule module, Guid id, IPatient patient, ExaminationType type = null, bool block = false) { ExecuteCommand command = ExecuteCommand.New; // Проверяем готовность модуля if (ModuleIsReady(module, id, command) == false) return; // Получаем представление содержащие объекты IExamination ListView list = GetListViewFromControllerByType(this, typeof(IExamination)); // Получаем объектное пространство для данного представления IObjectSpace os = list.ObjectSpace; bool allowEmpty = (bool)module.DoVerb(VerboseCommand.AllowEmptyFile); // Создаем новое обследование IExamination examination = CreateNewExamination(list.ObjectSpace, patient, id, type, allowEmpty); ExecuteModule(module, command, os, examination); // переводим фокус на новый объект int count = list.CollectionSource.List.Count - 1; if (count > 0) list.CurrentObject = list.CollectionSource.List[count]; //list.ObjectSpace.Refresh(); // Блокируем доступ в БД если надо if (block == true) { WindowsFormsModule owner = Application.Modules.FirstOrDefault(form => form is WindowsFormsModule) as WindowsFormsModule; //owner.BlockingAccessToDatabase(module, context); } }
private bool ModuleHasLaunchedProcesses(IDynamicModule module) { return (bool)module.DoVerb(VerboseCommand.HasLaunchedProcess, null); }