Exemple #1
0
 public void CustomerAdvanceSearch()
 {
     try
     {
         Initialize();
         int i        = 1;
         var datarows = ExcelReader.ImportSpreadsheet(ExcelFileNames.CustomerAdvancedSearch);
         foreach (var dataRow in datarows.Where(v => !String.IsNullOrWhiteSpace(v.ItemArray[3].ToString())).Take(6))
         {
             Debug.WriteLine("Test Case " + i++ + " - " + dataRow.ItemArray[24]);
             SearchWindow.SelectSearchElements(null, "Customer", SearchWindow.SearchTypeConstants.Advanced);
             CustomerAdvanceSearchWindow.EnterAdvancedSearchData(dataRow);
             CustomerAdvanceSearchWindow.ClickOnSearchButton();
             Factory.AssertIsTrue(CustomerAdvanceSearchWindow.VerifySearchResultsWindowDisplayed(),
                                  "Search validation error window was not displayed");
         }
     }
     finally
     {
         Cleanup();
     }
 }
        //---[Initialization]-------------------------------------------------------------------------------------------/

        public void Initialize(SerializedProperty property)
        {
            serializedObject = new SerializedObject(property.serializedObject.targetObject);
            arrayProperty    = serializedObject.FindProperty(property.propertyPath);
            arrayProperty.Next(true);

            black     = "#191919".ToColor();
            softBlack = "#272727".ToColor();
            darkGrey  = "#2D2D2D".ToColor();
            midGrey   = "#353535".ToColor();
            grey      = "#383838".ToColor();

            inactiveStyle = new GUIStyle("flow node 1")
            {
                alignment = TextAnchor.MiddleCenter, clipping = TextClipping.Clip
            };
            activeStyle = new GUIStyle("flow node 5")
            {
                alignment = TextAnchor.MiddleCenter, clipping = TextClipping.Clip
            };
            interactiveStyle = new GUIStyle("flow node 5 on")
            {
                alignment = TextAnchor.MiddleCenter, clipping = TextClipping.Clip
            };

            activeSegmentIndex      = -1;
            interactiveSegmentIndex = -1;

            searchWindow = ScriptableObject.CreateInstance <TypeSearchWindow>();
            searchWindow.Initialize("Create segment", typeof(Segment), this);
            searchWindow.onSelectEntry += AddSegment;

            menu = new GenericMenu();
            menu.AddItem(new GUIContent("Add"), false, () => SearchWindow.Open(new SearchWindowContext(cachedPosition), searchWindow));
            menu.AddItem(new GUIContent("Remove"), false, RemoveSegment);

            minSize = new Vector2(850.0f, 500.0f);
            Undo.undoRedoPerformed += OnUndo;
        }
 public ItemTransferController(
     CefBrowserHandler browser,
     Action <string> feedback,
     Action <string> setTooltip,
     ISettingsReadController settingsController,
     SearchWindow searchWindow,
     DynamicPacker dynamicPacker,
     IPlayerItemDao playerItemDao,
     //StashManager stashManager,
     ItemStatService itemStatService
     )
 {
     this._browser            = browser;
     this._setFeedback        = feedback;
     this._setTooltip         = setTooltip;
     this._settingsController = settingsController;
     this._searchWindow       = searchWindow;
     this._dynamicPacker      = dynamicPacker;
     this._dao = playerItemDao;
     //this._stashManager = stashManager;
     this._itemStatService = itemStatService;
 }
Exemple #4
0
        private Port InstantiateOutputPort()
        {
            var outputPort = InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(float));

            outputPort.portName = string.Empty;

            var selectConditionButton = new Button(() =>
            {
                var searchWindow = ScriptableObject.CreateInstance <ConditionSearchWindow>();
                searchWindow.Init(this, FSMGraphView.AvailableConditions, outputPort, outputContainer.childCount - 1);
                SearchWindow.Open(new SearchWindowContext(), searchWindow);
            })
            {
                text = "Select Condition", name = "Select Condition"
            };

            selectConditionButton.style.backgroundColor = new StyleColor(Color.clear);
            outputPort.contentContainer.Add(selectConditionButton);

            // Delete button
            Button deleteButton = new Button(() =>
            {
                outputPort.RemoveFromHierarchy();
                outputPort.DisconnectAll();
                foreach (var edge in outputPort.connections)
                {
                    edge.input.Disconnect(edge);
                    fsmGraphView.Remove(edge);
                }
            })
            {
                text = "x",
            };

            outputPort.contentContainer.Add(deleteButton);

            return(outputPort);
        }
        protected void Setup <PickerType>(PickerProvider <PickerType> provider, ValueType value) where PickerType : class
        {
            var button = new Button();

            button.AddToClassList(ButtonUssClassName);
            button.clickable.clicked += () => SearchWindow.Open(new SearchWindowContext(GUIUtility.GUIToScreenPoint(new Vector2(button.worldBound.center.x, button.worldBound.yMax + button.worldBound.height * 0.5f)), button.worldBound.width), provider);
            // this position to open isn't perfect because they positioned the search window origin from the middle of it's search box instead of the top like a sane person.

            _icon = new Image();
            _icon.AddToClassList(IconUssClassName);

            _label = new TextElement();
            _label.AddToClassList(LabelUssClassName);

            button.Add(_icon);
            button.Add(_label);

            Add(button);
            SetValueWithoutNotify(value);

            this.AddStyleSheet(Configuration.ElementsPath, Stylesheet);
            AddToClassList(UssClassName);
        }
Exemple #6
0
 private void OnRequestNodeCreation(NodeCreationContext context)
 {
     // started on empty space
     if (context.target == null)
     {
         // If we have a node selected (but not set as context.target because that's a container for new nodes to go into), search within that node's registry
         if (Settings.SearchOnSelectedNodeRegistry && _view.selection.Count > 0 && _view.selection.First() is UdonNode)
         {
             _focusedSearchWindow.targetRegistry = (_view.selection.First() as UdonNode).Registry;
             SearchWindow.Open(new SearchWindowContext(context.screenMousePosition, 360, 360), _focusedSearchWindow);
         }
         else
         {
             // Create Search Window that only searches Top-Level Registries
             SearchWindow.Open(new SearchWindowContext(context.screenMousePosition, 360, 360), _registrySearchWindow);
         }
     }
     else if (context.target is UdonGraph)
     {
         // Slightly hacky method to figure out that we want a full-search window
         SearchWindow.Open(new SearchWindowContext(context.screenMousePosition, 360, 360), _fullSearchWindow);
     }
 }
Exemple #7
0
        private App()
        {
            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }

            _mutex = new Mutex(false, $"h3x4d3c1m4l BrightLight - {Environment.UserName}", out bool createdNew);
            if (!createdNew)
            {
                // app already running
                MessageBox.Show("BrightLight is already running!", "BrightLight - Already running", MessageBoxButton.OK, MessageBoxImage.Information);
                Environment.Exit(0);
            }

            InitializeComponent();
            AppBuilder.Configure <AvaloniaApp>().UseWin32().UseDirect2D1().SetupWithoutStarting();

            var test = new SearchWindow(new MainViewModel(new RunUsingWpfDispatcherHelper(Dispatcher)));

            Container = new Container();
            Container.RegisterInstance(Dispatcher);
            Container.RegisterSingleton <IRunOnUiThreadHelper, RunUsingWpfDispatcherHelper>();
            Container.RegisterSingleton <MainViewModel>();
            Container.RegisterSingleton <SettingsViewModel>();
            Container.RegisterSingleton <SearchWindow>();
            Container.RegisterSingleton <SettingsWindow>();
            Container.RegisterSingleton <TaskbarIcon>();
            Container.RegisterSingleton(() => Settings.LoadOrDefault());
            Container.Verify();

            _showHotKey = new HotKey(Key.Space, KeyModifier.Ctrl | KeyModifier.Shift, key =>
            {
                Container.GetInstance <MainViewModel>().Reset();
                Container.GetInstance <SearchWindow>().Show();
            });
        }
        public BehaviourGraphView(EditorWindow window, BehaviourGraph graph)
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());
            this.AddManipulator(new FreehandSelector());

            graphViewChanged = OnGraphViewChanged;

            _graph = graph;

            _searchWindow = ScriptableObject.CreateInstance <NodeSearchWindow>();
            _searchWindow.Init(window, this);
            nodeCreationRequest = context =>
                                  SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), _searchWindow);

            _inspectorObject           = ScriptableObject.CreateInstance <InspectorObject>();
            _inspectorObject.name      = "Node Inspector";
            _inspectorObject.hideFlags = HideFlags.HideAndDontSave ^ HideFlags.NotEditable;
            _inspectorObject.View      = this;

            Properties = new List <ExposedProperty>();

            RegisterCallback <MouseUpEvent>(OnMouseUp);
            RegisterCallback <MouseDownEvent>(OnMouseDown);

            RegisterCallback <KeyDownEvent>(OnKeyDown);

            styleSheets.Add(Resources.Load <StyleSheet>("Styles/GraphView"));

            Insert(0, new GridBackground());

            Undo.undoRedoPerformed += UpdateInspectorSelection;
        }
        public void CustomerSimpleSearch()
        {
            try
            {
                var datarows = Initialize();
                foreach (var dataRow in datarows.Where(dataRow => dataRow.ItemArray[4].ToString().Equals("Customer")))
                {
                    Debug.WriteLine(dataRow.ItemArray[3]);
                    SearchWindow.SelectSearchElements(dataRow.ItemArray[5].ToString(), "Customer",
                                                      SearchWindow.SearchTypeConstants.Simple);
                    Playback.Wait(3000);
                    Globals.CustomerName = dataRow.ItemArray[6].ToString();

                    Factory.AssertIsTrue(SimpleSearchWindow.VerifyCustomerProfileDisplayed(dataRow.ItemArray[6].ToString()),
                                         "Customer profile for " + dataRow.ItemArray[5] + " Is not displayed");

                    TitlebarActions.ClickClose((WinWindow)CustomerProfileWindow.GetCustomerProfileWindowProperties());
                }
            }
            finally
            {
                Cleanup();
            }
        }
        public NodeGraphEditorView(EditorWindow window)
        {
            m_Window = window;
            m_View   = new NodeView()
            {
                name           = "GraphView",
                persistenceKey = "NodeView"
            };

            m_SearchProvider      = ScriptableObject.CreateInstance <NodeSearchWindowProvider>();
            m_SearchProvider.view = m_View;

            m_View.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);

            m_SelectionDragger.panSpeed          *= 1f;
            m_SelectionDragger.clampToParentEdges = true;
            m_ContentDragger.panSpeed            *= 1f;
            m_SelectionDragger.clampToParentEdges = true;
            m_View.AddManipulator(m_SelectionDragger);
            m_View.AddManipulator(m_ContentDragger);
            m_View.AddManipulator(new RectangleSelector());
            m_View.AddManipulator(new ClickSelector());

            m_View.graphViewChanged += GraphViewChanged;


            m_View.nodeCreationRequest = (c) =>
            {
                //Debug.Log("node create request: " + c);
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition, 256, 128), m_SearchProvider);
            };

            //LoadElements();

            Add(m_View);
        }
Exemple #11
0
        public void RaChangeWorkerStatus()
        {
            try
            {
                WindowsActions.KillEllisProcesses();
                App = EllisHome.LaunchEllisAsRAUser();
                var datarows = ExcelReader.ImportSpreadsheet(ExcelFileNames.WorkerAdvancedSearch);
                foreach (var datarow in datarows)
                {
                    SearchWindow.SelectSearchElements(null, "Worker", SearchWindow.SearchTypeConstants.Advanced);
                    WorkerAdvancedSearchWindow.EnterWorkerNameAsSearchData("TEST");
                    var worker = WorkerAdvancedSearchWindow.SelectWorkerfromSearchResults(datarow.ItemArray[36].ToString());
                    Factory.AssertIsTrue(worker, "Requested Worker not found");
                    if (!worker)
                    {
                        continue;
                    }

                    Playback.Wait(2000);
                    WorkerAdvancedSearchWindow.SelectApplicationChkBox(datarow);
                    WorkerSummaryWindow.SelectMainTab(WorkerSummaryWindow.WorkerProfileTabConstants.Survey);
                    Playback.Wait(1000);
                    Factory.AssertIsTrue(WorkerSurveyWindow.VerifyWorkerProfileWindowDisplayed(), "Workers Survey not Displayed");
                    WorkerSurveyWindow.EnterDatainSsn(datarow);
                    WorkerSurveyWindow.EnterDataInSurveyGrid();
                    WorkerSurveyWindow.EnterNotes(datarow);
                    Playback.Wait(1000);
                    Factory.AssertIsTrue(WorkerSurveyWindow.VerifyWorkerProfileWindowDisplayed(),
                                         "Worker Profile Window Not Displayed");
                }
            }
            finally
            {
                Cleanup();
            }
        }
        public void CreditCardSearch()
        {
            try
            {
                var datarows = Initialize();
                foreach (var datarow in datarows.Where(datarow => datarow.ItemArray[4].ToString().Equals("CreditCard")))
                {
                    Debug.WriteLine(datarow.ItemArray[3]);
                    SearchWindow.SelectSearchElements(datarow.ItemArray[5].ToString(), "CreditCard",
                                                      SearchWindow.SearchTypeConstants.Simple);
                    SearchWindow.SelectCardFromResults();

                    Factory.AssertIsTrue(SimpleSearchWindow.VerifyViewCreditCardPaymentWindowDisplayed(datarow.ItemArray[5].ToString()),
                                         "View Credit card payment window is not displayed for the search criteria");

                    TitlebarActions.ClickClose((WinWindow)SimpleSearchWindow.GetViewCreditCardPaymentWindowProperties());
                    SimpleSearchWindow.CloseResultsWindow();
                }
            }
            finally
            {
                Cleanup();
            }
        }
 private void Search_Menu(object sender, RoutedEventArgs e)
 {
     SearchWindow SearchWindow = new SearchWindow();
 }
 private void AddSearchWindow(EditorWindow editorWindow)
 {
     _searchWindow = ScriptableObject.CreateInstance <NodeSearchWindow>();
     _searchWindow.Init(editorWindow, this);
     nodeCreationRequest = context => SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), _searchWindow);
 }
 void OnRequestNodeCreation(NodeCreationContext context)
 {
     SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), this);
 }
Exemple #16
0
        public override VisualElement Build()
        {
            var root = Resources.TypeInspector.Clone();

            var label = root.Q <Label>("label");

            label.text = DisplayName;

            var input = root.Q <VisualElement>("input");

            input.RegisterCallback <MouseDownEvent>(e =>
            {
                var items = new List <SearchView.Item>();
                var types = TypeCache.GetTypesDerivedFrom <T>();
                foreach (var type in types)
                {
                    if (type.IsAbstract || type.IsInterface ||
                        type.HasAttribute <HideInInspector>() ||
                        type.HasAttribute <ObsoleteAttribute>())
                    {
                        continue;
                    }

                    if (!TypeConstruction.CanBeConstructed(type))
                    {
                        continue;
                    }

                    if (TypeFilter != null && !TypeFilter(type))
                    {
                        continue;
                    }

                    var name     = GetName(type);
                    var category = GetCategory(type);
                    items.Add(new SearchView.Item
                    {
                        Path = !string.IsNullOrEmpty(category) ? $"{category}/{name}" : name,
                        Icon = GetIcon(type),
                        Data = type
                    });
                }
                items = items.OrderBy(item => item.Path).ToList();

                SearchWindow searchWindow = SearchWindow.Create();
                searchWindow.Title        = Title;
                searchWindow.Items        = items;
                searchWindow.OnSelection += item =>
                {
                    var type = (Type)item.Data;
                    if (TypeConstruction.TryConstruct <T>(type, out var instance))
                    {
                        Target             = instance;
                        m_TextElement.text = GetName(type);
                    }
                };

                var rect              = EditorWindow.focusedWindow.position;
                var button            = input.worldBound;
                searchWindow.position = new Rect(rect.x + button.x, rect.y + button.y + button.height, 230, 315);
                searchWindow.ShowPopup();

                e.StopPropagation();
            });

            m_TextElement      = input.Q <TextElement>("text");
            m_TextElement.text = GetName(Target?.GetType());

            return(root);
        }
Exemple #17
0
 protected override void InitSearchWindow()
 {
     nodeCreationRequest = (c) => SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), createCovnertNodeMenu);
 }
Exemple #18
0
 private void OnShowCreateNode(NodeCreationContext context)
 {
     _createPosition = context.screenMousePosition;
     SearchWindow.Open(new SearchWindowContext(_createPosition), _nodeProvider);
 }
Exemple #19
0
 private void RunSearchFileCommand()
 {
     var searchWindow = new SearchWindow<string>(FindFileMatches);
     Application.Run(searchWindow);
     if (searchWindow.SelectedItem != null)
         //We need to return the file that has been found, the visual studio plugin uses the return value
         //to open the selected file.
         Console.WriteLine(Path.Combine(Module.WorkingDir, searchWindow.SelectedItem));
 }
        protected VisualElement CreateParameterControl(SingularSerializableParameter parameter, string controlName, Action <SingularSerializableParameter> clampAction = null)
        {
            VisualElement control;

            switch (parameter.Type)
            {
            case ParameterType.behaviorAction:

                control = new VisualElement();

                var buttons = new VisualElement {
                    style = { flexDirection = FlexDirection.Row, paddingRight = 2f, paddingLeft = 2f }
                };
                var actionLabel = new Label {
                    style = { paddingLeft = 8f, paddingRight = 8f }
                };

                var configureButton = new Button {
                    text = "Configure"
                };
                configureButton.clickable.clickedWithEventInfo +=
                    clickEvent =>
                {
                    var worldPosition = clickEvent.originalMousePosition + GraphView.editorWindow.position.position;

                    GraphView.actionSearcher.TargetParameter = parameter;
                    SearchWindow.Open(new SearchWindowContext(worldPosition), GraphView.actionSearcher);
                };

                var removeButton = new Button(() => parameter.BehaviorActionValue = null)
                {
                    text = "Remove"
                };

                buttons.Add(configureButton);
                buttons.Add(removeButton);

                control.Add(actionLabel);
                control.Add(buttons);

                parameter.OnValueChangedMethods += OnBehaviorActionChanged;
                OnBehaviorActionChanged();                         //Trigger a refresh

                void OnBehaviorActionChanged()
                {
                    parameter.LoadBehaviorAction(GraphView.editorWindow.ImportData);                             //Refresh action name
                    actionLabel.text = parameter.BehaviorActionValue == null ? "Missing Action" : parameter.BehaviorActionValue.ToString();

                    //Behavior action parameter controls
                    const string  ParameterGroupName = "Behavior Action Parameters Group";
                    VisualElement group = control.Q <VisualElement>(ParameterGroupName);

                    if (group != null)
                    {
                        control.Remove(group);                                            //If had old group remove/destroy it
                    }
                    var parameters = parameter.BehaviorActionValue?.method.Parameters;

                    if (parameters == null || parameters.Count == 0)
                    {
                        return;                                                                          //If no parameter for this action
                    }
                    group = new VisualElement {
                        name = ParameterGroupName
                    };                                                                                 //Create group
                    var accessor = ((SerializableParameter)parameter).BehaviorActionParameters;

                    for (int i = 0; i < parameters.Count; i++)
                    {
                        BehaviorActionParameterInfo parameterInfo = parameters[i];
                        group.Add(CreateParameterControl(accessor[i], parameterInfo.name));
                    }

                    control.Add(group);
                }

                break;

            case ParameterType.boolean:

                var toggle = new Toggle(controlName)
                {
                    value = parameter.BooleanValue
                };
                toggle.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.BooleanValue = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    toggle.SetValueWithoutNotify(parameter.BooleanValue);
                }
                    );

                control = toggle;
                break;

            case ParameterType.enumeration:

                control = new EnumField();
                //TODO

                break;

            case ParameterType.integer1:

                var integerField = new IntegerField(controlName)
                {
                    value = parameter.Integer1Value
                };
                integerField.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Integer1Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    integerField.SetValueWithoutNotify(parameter.Integer1Value);
                }
                    );

                control = integerField;
                break;

            case ParameterType.integer2:

                var vector2IntField = new Vector2IntField(controlName)
                {
                    value = parameter.Integer2Value
                };
                vector2IntField.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Integer2Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    vector2IntField.SetValueWithoutNotify(parameter.Integer2Value);
                }
                    );

                control = vector2IntField;
                break;

            case ParameterType.integer3:

                var vector3IntField = new Vector3IntField(controlName)
                {
                    value = parameter.Integer3Value
                };
                vector3IntField.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Integer3Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    vector3IntField.SetValueWithoutNotify(parameter.Integer3Value);
                }
                    );

                control = vector3IntField;
                break;

            case ParameterType.float1:

                var floatField = new FloatField(controlName)
                {
                    value = parameter.Float1Value
                };
                floatField.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Float1Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    floatField.SetValueWithoutNotify(parameter.Float1Value);
                }
                    );

                control = floatField;
                break;

            case ParameterType.float2:

                var vector2Field = new Vector2Field(controlName)
                {
                    value = parameter.Float2Value
                };
                vector2Field.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Float2Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    vector2Field.SetValueWithoutNotify(parameter.Float2Value);
                }
                    );

                control = vector2Field;
                break;

            case ParameterType.float3:

                var vector3Field = new Vector3Field(controlName)
                {
                    value = parameter.Float3Value
                };
                vector3Field.RegisterValueChangedCallback(
                    changeEvent =>
                {
                    parameter.Float3Value = changeEvent.newValue;
                    clampAction?.Invoke(parameter);
                    vector3Field.SetValueWithoutNotify(parameter.Float3Value);
                }
                    );

                control = vector3Field;
                break;

            default: throw ExceptionHelper.Invalid(nameof(parameter.Type), parameter.Type, InvalidType.unexpected);
            }

            control.Query <FloatField>().ForEach(field => field.style.minWidth = 60f);
            Label label = control.Q <Label>();

            if (label != null)
            {
                label.style.minWidth     = 0f;
                label.style.paddingRight = 20f;
            }

            return(control);
        }
 private void RunSearchFileCommand()
 {
     var searchWindow = new SearchWindow<string>(FindFileMatches);
     Application.Run(searchWindow);
     if (searchWindow.SelectedItem != null)
         Console.WriteLine(Module.WorkingDir + searchWindow.SelectedItem);
 }
Exemple #22
0
        public LogicGraphEditorView(LogicGraphEditorWindow editorWindow, LogicGraphEditorObject logicGraphEditorObject)
        {
            Debug.Log(logicGraphEditorObject.GetInstanceID());
            _editorWindow           = editorWindow;
            _logicGraphEditorObject = logicGraphEditorObject;
            _logicGraphEditorObject.Deserialized += LogicGraphEditorDataOnDeserialized;

            this.LoadAndAddStyleSheet("Styles/LogicGraphEditorView");

            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    saveRequested?.Invoke();
                }

                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    showInProjectRequested?.Invoke();
                }

                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                _graphView = new LogicGraphView(_logicGraphEditorObject)
                {
                    name = "GraphView",
//                    persistenceKey = "LogicGraphView",
                };

                _graphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                _graphView.AddManipulator(new ContentDragger());
                _graphView.AddManipulator(new SelectionDragger());
                _graphView.AddManipulator(new RectangleSelector());
                _graphView.AddManipulator(new ClickSelector());
                _graphView.RegisterCallback <KeyDownEvent>(KeyDown);
                content.Add(_graphView);

                _graphView.graphViewChanged = GraphViewChanged;
            }

            _searchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            _searchWindowProvider.Initialize(editorWindow, this, _graphView);

            _edgeConnectorListener = new EdgeConnectorListener(this, _searchWindowProvider);

            _graphView.nodeCreationRequest = (c) =>
            {
                _searchWindowProvider.ConnectedLogicPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), _searchWindowProvider);
            };

            LoadElements();

            Add(content);
        }
Exemple #23
0
 private void findInDiffToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var searchWindow = new SearchWindow<GitItemStatus>(FindDiffFilesMatches)
     {
         Owner = this
     };
     searchWindow.ShowDialog(this);
     GitItemStatus selectedItem = searchWindow.SelectedItem;
     if (selectedItem != null)
     {
         DiffFiles.SelectedItem = selectedItem;
     }
 }
Exemple #24
0
 public ModChangeProcessor(ISettingsReadController settingsController, SearchWindow searchWindow)
 {
     this.settingsController = settingsController;
     this.searchWindow       = searchWindow;
 }
        public GraphEditorView(EditorWindow editorWindow, AbstractMaterialGraph graph, string assetName)
        {
            m_Graph = graph;
            AddStyleSheetPath("Styles/GraphEditorView");
            m_EditorWindow = editorWindow;
            previewManager = new PreviewManager(graph);

            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Reset Layout", EditorStyles.toolbarButton))
                {
                    m_MasterPreviewView.layout             = m_FloatingWindowsLayout.defaultPreviewLayout.GetLayout(layout);
                    m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.defaultBlackboardLayout.GetLayout(layout);
                    m_MasterPreviewView.UpdateRenderTextureOnNextLayoutChange();
                    UpdateSerializedWindowLayout();
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new MaterialGraphView(graph)
                {
                    name = "GraphView", persistenceKey = "MaterialGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.AddManipulator(new GraphDropTarget(graph));
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                content.Add(m_GraphView);

                // Uncomment to enable pixel caching profiler
//                m_ProfilerView = new PixelCacheProfilerView(this);
//                m_GraphView.Add(m_ProfilerView);

                m_BlackboardProvider = new BlackboardProvider(assetName, graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);
                m_BlackboardProvider.blackboard.layout = new Rect(new Vector2(10f, 10f), m_BlackboardProvider.blackboard.layout.size);

                m_MasterPreviewView = new MasterPreviewView(assetName, previewManager, graph)
                {
                    name = "masterPreview"
                };

                WindowDraggable masterPreviewViewDraggable = new WindowDraggable();
                m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
                m_GraphView.Add(m_MasterPreviewView);

                ResizeBorderFrame masterPreviewResizeBorderFrame = new ResizeBorderFrame(m_MasterPreviewView)
                {
                    name = "resizeBorderFrame"
                };
                masterPreviewResizeBorderFrame.stayWithinParentBounds = true;
                masterPreviewResizeBorderFrame.maintainAspectRatio    = true;
                masterPreviewResizeBorderFrame.OnResizeFinished      += UpdateSerializedWindowLayout;
                m_MasterPreviewView.Add(masterPreviewResizeBorderFrame);

                m_BlackboardProvider.onDragFinished             += UpdateSerializedWindowLayout;
                m_BlackboardProvider.onResizeFinished           += UpdateSerializedWindowLayout;
                masterPreviewViewDraggable.OnDragFinished       += UpdateSerializedWindowLayout;
                masterPreviewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;

                m_GraphView.graphViewChanged = GraphViewChanged;

                RegisterCallback <PostLayoutEvent>(ApplySerializewindowLayouts);
            }

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var node in graph.GetNodes <INode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.edges)
            {
                AddEdge(edge);
            }

            Add(content);
        }
Exemple #26
0
        public void FindFileOnClick(object sender, EventArgs e)
        {
            string selectedItem;
            using (var searchWindow = new SearchWindow<string>(FindFileMatches)
            {
                Owner = this
            })
            {
                searchWindow.ShowDialog(this);
                selectedItem = searchWindow.SelectedItem;
            }
            if (string.IsNullOrEmpty(selectedItem))
            {
                return;
            }

            string[] items = selectedItem.Split(new[] { '/' });
            TreeNodeCollection nodes = GitTree.Nodes;

            for (int i = 0; i < items.Length - 1; i++)
            {
                TreeNode selectedNode = Find(nodes, items[i]);

                if (selectedNode == null)
                {
                    return; //Item does not exist in the tree
                }

                selectedNode.Expand();
                nodes = selectedNode.Nodes;
            }

            var lastItem = Find(nodes, items[items.Length - 1]);
            if (lastItem != null)
            {
                GitTree.SelectedNode = lastItem;
            }
        }
Exemple #27
0
        public MainForm()
        {
            InitializeComponent();

            patientByIdQueries = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            visitsByPatientIdQueries = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            patientsByNameQueries = new Dictionary<string, Func<string, string, Task<IList<dynamic>>>>();
            visitsByNumbersQueries = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            patientsByVisitNumbersQueries = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            visitDetailsByVisitNumbersQuery = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            doctorsByNumbersQuery = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            bedOccupationByWardIdsQuery = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            searchAdtQuery = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();
            searchMfnQuery = new Dictionary<string, Func<dynamic, Task<IList<dynamic>>>>();

            propertyWindows = new Dictionary<string, PropertyWindow>();
            listWindows = new Dictionary<string, ListWindow>();

            treeWindows = new Dictionary<string, HL7TreeWindow>();
            syntaxHighlightingWindows = new Dictionary<string, SyntaxHighlightingWindow>();

            MenuItem menuItem;
            int menuItemViewIndex = 4;

            // get all sections inside group
            foreach (var key in dbs)
            {
                switch (key)
                {
                    case "Oazis":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @";
with mergedpatients (pat_id, pat_id_old, level)
as
(
	select u.pat_id, null, 0
	from oazp..unisuper u with (nolock)
	where pat_id = @0
	union all
	select auo.pat_id, auo.pat_id_old, 1
	from oazp..adt_unipat_old auo  with (nolock)
	where auo.pat_id_old = @0 or auo.pat_id = @0
	union all
	select auo.pat_id, auo.pat_id_old, level + 1
	from oazp..adt_unipat_old auo with (nolock)
	inner join mergedpatients m on m.pat_id = auo.pat_id_old
)
select au.*, u.pat_id_mother
from oazp..unisuper u with (nolock)
inner join oazp..adt_unipat au with (nolock) on u.pat_id = au.pat_id
where from_date = (select max(from_date) from oazp..adt_unipat with (nolock) where pat_id = u.pat_id)
and (u.pat_id = (select top 1 pat_id from mergedpatients with (nolock) order by level desc))";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from oazp..adt_visit with (nolock)
where pat_id = @0
order by adm_date, adm_time";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select top 100 au.*, u.pat_id_mother
from oazp..unisuper u with (nolock)
inner join oazp..adt_unipat au with (nolock) on u.pat_id = au.pat_id
where from_date = (select max(from_date) from oazp..adt_unipat with (nolock) where pat_id = u.pat_id)
and lastname like @0 and firstname like @1
order by lastname, firstname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from oazp..adt_visit with (nolock)
where visit_id in (@0)
order by adm_date, adm_time";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select au.*, u.pat_id_mother
from oazp..unisuper u with (nolock)
inner join oazp..adt_unipat au with (nolock) on u.pat_id = au.pat_id
where from_date = (select max(from_date) from oazp..adt_unipat with (nolock) where pat_id = u.pat_id)
and u.pat_id in 
(
	select v.pat_id
	from oazp..adt_visit v with (nolock)
	where v.visit_id in (@0)
)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select vh.*
from oazp..adt_visit_hist vh with (nolock)
where vh.visit_id in (@0)
order by visit_id, from_date, from_time";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @";
with mergeddoctors (dokid, dokid_old, level)
as
(
	select dokid, dokid_old, 0
	from oazp..dokid with (nolock)
	where dokid in (@0) or dokid_old in (@0)
	union all
	select d.dokid, d.dokid_old, level + 1
	from oazp..dokid d with (nolock)
	inner join mergeddoctors m on m.dokid = d.dokid_old    
)
select d.*
from oazp..dokid di with (nolock)
inner join oazp..doctors d with (nolock) on d.uni_pers_no = di.dokid
where from_date = (select max(from_date) from oazp..doctors with (nolock) where uni_pers_no = d.uni_pers_no)
and (d.uni_pers_no = (select top 1 dokid from mergeddoctors with (nolock) order by level desc))";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(6, '0')));
                            }
                        });
                        bedOccupationByWardIdsQuery.Add(key, async (ids) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select au.lastname, au.firstname, bo.*
from oazp..bedocc bo with (nolock)
inner join oazp..adt_unipat au with (nolock) on bo.pat_id = au.pat_id and au.from_date = (select max(from_date) from oazp..adt_unipat with (nolock) where pat_id = bo.pat_id)
where bo.ward_id in (@0) and bo.visit_id is not null
order by bo.room_id, bo.bed_id";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from id in ids as IEnumerable<string> select id.PadLeft(4, '0')));
                            }
                        });
                        break;
                    case "ZISv21":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @";
with mergedpatients (id, mergedpatientid, level)
as
(
	select p.id, p.mergedpatientid, 0 as level 
	from zisv21..patient p with (nolock)
	where p.id = @0 or p.mergedpatientid = @0
	union all
	select p.id, p.mergedpatientid, level + 1
	from zisv21..patient p with (nolock)
	inner join mergedpatients m on m.mergedpatientid = p.id
	where p.id <> 0
)
select * 
from zisv21..patient with (nolock)
where id = (select top 1 id from mergedpatients with (nolock) order by level desc)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from zisv21..visit with (nolock)
where patientid = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select top 100 * 
from zisv21..patient with (nolock)
where name like @0 and firstname like @1
order by name, firstname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from zisv21..visit with (nolock)
where number in (@0)
order by admissiondate";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select * 
from zisv21..patient with (nolock)
where id in
(
	select patientid
	from zisv21..visit with (nolock)
	where number in (@0)
)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from zisv21..visitdetail with (nolock)
where visitnumber in (@0)
order by visitnumber, fromdate";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from zisv21..doctor with (nolock)
where number in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        break;
                    case "ZISv23":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_patient/_all_docs?include_docs=true&key=""{0}""", id.PadLeft(10, '0'));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_visit/_design/docs/_view/by_patientid?include_docs=true&key=""{0}""", id.PadLeft(8, '0'));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //var task = Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                var patientIds = /*return*/ (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                                             where ((IDictionary<string, Object>)row).ContainsKey("doc") && (IDictionary<string, Object>)row.doc != null && ((IDictionary<string, Object>)row.doc).ContainsKey("PatientId")
                                                             select row.doc.PatientId as string).ToList();
                                //});
                                //await task.ConfigureAwait(false);

                                requestUri = string.Format(@"zis_patient/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in patientIds select string.Concat("\"", number.PadLeft(10, '0'), "\""))));
                                Console.WriteLine("{0}: {1}", key, requestUri);
                                return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //return await Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                return (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                        where ((IDictionary<string, Object>)row).ContainsKey("doc") && (IDictionary<string, Object>)row.doc != null && ((IDictionary<string, Object>)row.doc).ContainsKey("Transfers")
                                        from transfer in ((IDictionary<string, Object>)row.doc)["Transfers"] as IEnumerable<dynamic>
                                        orderby row.doc.Id, transfer.FromDate
                                        select transfer).ToList();
                                //}).ConfigureAwait(false);
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_doctor/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(6, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        bedOccupationByWardIdsQuery.Add(key, async (ids) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"zis_ward/_design/docs/_view/by_id?include_docs=true&keys=[{0}]", string.Join(",", (from id in ids as IEnumerable<string> select string.Concat("\"", id.PadLeft(4, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //return await Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                return (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                        where ((IDictionary<string, Object>)row).ContainsKey("doc") && (IDictionary<string, Object>)row.doc != null && ((IDictionary<string, Object>)row.doc).ContainsKey("Beds")
                                        from bed in ((IDictionary<string, Object>)row.doc)["Beds"] as IEnumerable<dynamic>
                                        let location = string.Concat((bed as IDictionary<string, Object>).ContainsKey("RoomId") ? bed.RoomId : string.Empty, "-", (bed as IDictionary<string, Object>).ContainsKey("BedId") ? bed.BedId : string.Empty)
                                        orderby location
                                        select bed).ToList();
                                //}).ConfigureAwait(false);
                            }
                        });
                        break;
                    case "XdeCache":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"patient/_design/docs/_view/by_id?include_docs=true&key=""{0}""", id.PadLeft(10, '0'));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //return await Task.Run(async () =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                var mergedPatid = (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                                   where row.doc.PAT_ID != id
                                                   select row.doc.PAT_ID as string).FirstOrDefault();
                                if (!mergedPatid.IsNullOrEmpty())
                                    return await patientByIdQueries[key](mergedPatid);

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                return (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                        where ((IDictionary<string, Object>)row).ContainsKey("doc")
                                        select row.doc).ToList();
                                //}).ConfigureAwait(false);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"visit/_design/docs/_view/by_patid?include_docs=true&key=""{0}""", id.PadLeft(8, '0'));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //var task = Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                var patientIds = (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                                  where ((IDictionary<string, Object>)row).ContainsKey("doc") && ((IDictionary<string, Object>)row.doc).ContainsKey("PAT_ID")
                                                  select row.doc.PAT_ID as string).ToList();
                                //});
                                //await task.ConfigureAwait(false);

                                requestUri = string.Format(@"patient/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in patientIds select string.Concat("\"", number.PadLeft(10, '0'), "\""))));
                                Console.WriteLine("{0}: {1}", key, requestUri);
                                return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"visit/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(8, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //return await Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                return (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                        where ((IDictionary<string, Object>)row).ContainsKey("doc") && ((IDictionary<string, Object>)row.doc).ContainsKey("Transfers")
                                        from transfer in ((IDictionary<string, Object>)row.doc)["Transfers"] as IEnumerable<dynamic>
                                        orderby transfer.VISIT_ID, transfer.FROM_DATE, transfer.FROM_TIME
                                        select transfer).ToList();
                                //}).ConfigureAwait(false);
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"doctor/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("\"", number.PadLeft(6, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            return await HttpGet(connectionString, requestUri).ConfigureAwait(false);
                        });
                        bedOccupationByWardIdsQuery.Add(key, async (ids) =>
                        {
                            var connectionString = ConfigurationManager.ConnectionStrings[key].ConnectionString;
                            var requestUri = string.Format(@"bedocc/_all_docs?include_docs=true&keys=[{0}]", string.Join(",", (from id in ids as IEnumerable<string> select string.Concat("\"", id.PadLeft(4, '0'), "\""))));
                            Console.WriteLine("{0}: {1}", key, requestUri);
                            using (var client = CreateHttpClient(new Uri(connectionString)))
                            {
                                var response = await client.GetAsync(requestUri).ConfigureAwait(false);
                                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                //return await Task.Run(() =>
                                //{
                                var result = JsonConvert.DeserializeObject<ExpandoObject>(content, new ExpandoObjectConverter());

                                if (((dynamic)result).rows.Count == 0)
                                    return null;

                                return (from row in ((dynamic)result).rows as IEnumerable<dynamic>
                                        where ((IDictionary<string, Object>)row).ContainsKey("doc") && ((IDictionary<string, Object>)row.doc).ContainsKey("Beds")
                                        from bed in ((IDictionary<string, Object>)row.doc)["Beds"] as IEnumerable<dynamic>
                                        where !string.IsNullOrEmpty(bed.VISIT_ID)
                                        orderby bed.ROOM_ID, bed.BED_ID
                                        select bed).ToList();
                                //}).ConfigureAwait(false);
                            }
                        });
                        break;
                    case "Glims":
                    case "Glims Test":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Identification
inner join PUB.Correspondent on crsp_Id = idnt_Target
inner join PUB.Person on prsn_Correspondent = crsp_Id
left outer join PUB.Municipality on mncp_Id = crsp_Municipality
left outer join PUB.Country on cnty_Id = mncp_Country
left outer join PUB.CountryName on ml68_Name = cnty_Id and ml68_Language = 3
left outer join PUB.HCProvider on hcpr_Id = prsn_FamilyDoctor
where idnt_Code = ?";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Encounter
left outer join PUB.EncounterType on entp_Id = enct_Type
left outer join PUB.HCProvider on hcpr_Id = enct_Physician
left outer join PUB.Institution on inst_Id = enct_Institution
where enct_Person = 
(
   select prsn_Id
   from PUB.Identification
   inner join PUB.Correspondent on idnt_Target = crsp_Id
   inner join PUB.Person on prsn_Correspondent = crsp_Id
   where idnt_Code = ?
)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select top 100 *
from PUB.Identification
inner join PUB.Correspondent on crsp_Id = idnt_Target
inner join PUB.Person on prsn_Correspondent = crsp_Id
left outer join PUB.Municipality on mncp_Id = crsp_Municipality
left outer join PUB.Country on cnty_Id = mncp_Country
left outer join PUB.CountryName on ml68_Name = cnty_Id and ml68_Language = 3
left outer join PUB.HCProvider on hcpr_Id = prsn_FamilyDoctor
where prsn_LastName like ? and prsn_FirstName like ?
order by prsn_LastName, prsn_FirstName";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                //return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%"); //NOT WORKING
                                sql = string.Format(@"select top 100 *
from PUB.Identification
inner join PUB.Correspondent on crsp_Id = idnt_Target
inner join PUB.Person on prsn_Correspondent = crsp_Id
left outer join PUB.Municipality on mncp_Id = crsp_Municipality
left outer join PUB.Country on cnty_Id = mncp_Country
left outer join PUB.CountryName on ml68_Name = cnty_Id and ml68_Language = 3
left outer join PUB.HCProvider on hcpr_Id = prsn_FamilyDoctor
where prsn_LastName like '{0}' and prsn_FirstName like '{1}'
order by prsn_LastName, prsn_FirstName", lastName + "%", firstName + "%");
                                return await db.FetchAsync<dynamic>(sql);
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Encounter
left outer join PUB.EncounterType on entp_Id = enct_Type
left outer join PUB.HCProvider on hcpr_Id = enct_Physician
left outer join PUB.Institution on inst_Id = enct_Institution
where enct_ExternalId in (?)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                //return await db.FetchAsync<dynamic>(sql, numbers); //NOT WORKING
                                sql = string.Format(@"select *
from PUB.Encounter
left outer join PUB.EncounterType on entp_Id = enct_Type
left outer join PUB.HCProvider on hcpr_Id = enct_Physician
left outer join PUB.Institution on inst_Id = enct_Institution
where enct_ExternalId in ({0})", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("'", number.PadLeft(8, '0'), "'"))));
                                return await db.FetchAsync<dynamic>(sql);
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Identification
inner join PUB.Correspondent on idnt_Target = crsp_Id
inner join PUB.Person on prsn_Correspondent = crsp_Id
where prsn_Id in 
(
	select enct_Person
	from PUB.Encounter
	where enct_ExternalId in (?)
)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                //return await db.FetchAsync<dynamic>(sql, numbers); //NOT WORKING
                                sql = string.Format(@"select enct_Person
from PUB.Encounter
where enct_ExternalId in ({0})", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("'", number.PadLeft(8, '0'), "'"))));
                                var patientIds = await db.FetchAsync<int>(sql);
                                sql = string.Format(@"select *
from PUB.Identification
inner join PUB.Correspondent on idnt_Target = crsp_Id
inner join PUB.Person on prsn_Correspondent = crsp_Id
where prsn_Id in ({0})", string.Join(",", (from id in patientIds select id.ToString())));
                                return await db.FetchAsync<dynamic>(sql);
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Stay
where stay_Encounter in 
(
	select enct_Id
	from PUB.Encounter
	where enct_ExternalId in (?)
)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                //return await db.FetchAsync<dynamic>(sql, numbers); //NOT WORKING
                                sql = string.Format(@"select enct_Id
from PUB.Encounter
where enct_ExternalId in ({0})", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("'", number.PadLeft(8, '0'), "'"))));
                                var visitIds = await db.FetchAsync<int>(sql);
                                if (!visitIds.Any())
                                    return Enumerable.Empty<dynamic>().ToList();
                                sql = string.Format(@"select *
from PUB.Stay
where stay_Encounter in ({0})", string.Join(",", (from id in visitIds select id.ToString())));
                                return await db.FetchAsync<dynamic>(sql);
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key) { EnableNamedParams = false })
                            {
                                var sql = @"select *
from PUB.Encounter
left outer join PUB.EncounterType on entp_Id = enct_Type
left outer join PUB.HCProvider on hcpr_Id = enct_Physician
left outer join PUB.Institution on inst_Id = enct_Institution
where enct_ExternalId in (?)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                //return await db.FetchAsync<dynamic>(sql, numbers); //NOT WORKING
                                sql = string.Format(@"select *
from PUB.HCProvider
left outer join PUB.Correspondent on crsp_Id = hcpr_Correspondent
left outer join PUB.Organization on org_Id = hcpr_Practice
where hcpr_Code in ({0})", string.Join(",", (from number in numbers as IEnumerable<string> select string.Concat("'", number.PadLeft(5, '0'), "'"))));
                                return await db.FetchAsync<dynamic>(sql);
                            }
                        });
                        break;
                    case "Agfa":
                    case "Agfa Test":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*, d_hospitalkey
from patients p
inner join doctors d on d_key = p_physician
where p_code = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select se.*, p_code
from service_episodes se
inner join patients p on p_key = se_p_key
where p_code = @0
order by se.se_admission_date_hospital";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*, d_hospitalkey
from patient p
inner join doctors d on d_key = p_physician
where lower(pat_lastname) like @0 and lower(pat_firstname) like @1
and rownum <= 100
order by pat_lastname, pat_firstname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select se.*, p_code
from service_episodes se
inner join patients p on p_key = se_p_key
where se_admission_number in (@0)
order by se_admission_date_hospital";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*, d_hospitalkey
from patients p
inner join doctors d on d_key = p_physician
inner join service_episodes se on se_p_key = p_key
where se_admission_number in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from transfers
where tr_admission_nr in (@0)
order by tr_admission_nr, tr_date_from";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from doctors
left outer join services on s_key = d_service
left outer join hospitals on h_key = d_hospital
left outer join specialism on sp_key = d_specialism
where d_hospitalkey in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, numbers);
                            }
                        });
                        break;
                    case "Cyberlab":
                    case "Cyberlab Test":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from patient
left outer join account on acnt_patient = pat_id
where pat_code = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from visit 
inner join patient on pat_id = vst_patient
inner join ""GROUP"" on grp_id = vst_group
where pat_code = @0
order by vst_startdate";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from patient
left outer join account on acnt_patient = pat_id
where lower(pat_lastname) like @0 and lower(pat_firstname) like @1
and rownum <= 100
order by pat_lastname, pat_firstname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from visit 
inner join ""GROUP"" on grp_id = vst_group
where vst_code in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select patient.*, account.*
from patient 
left outer join account on acnt_patient = pat_id
inner join visit on vst_patient = pat_id
where vst_code in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            return await visitsByNumbersQueries[key](numbers);
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from issuer
where iss_code in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(6, '0')));
                            }
                        });
                        break;
                    case "Infohos Prs":
                    case "Infohos Prs Test":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select p.*, dr.nr_id as huisarts_id
from {0}..tab_pat p with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = p.huisarts
where p.nr_pat = @0", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select d.*, dr.nr_id as dok_verwezen_id
from {0}..dossier d with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = d.nr_dok_verwezen
where d.nr_pat = @0
order by d.dat_opn", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var visits = await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));

                                sql = string.Format(@"select vo.*, dr.nr_id as dok_verwezen_id
from {0}..vooropname vo with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = vo.nr_dok
where vo.nr_pat = @0
order by vo.dat_begin", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                visits.AddRange(await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0')));
                                return visits;
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 100 p.*, dr.nr_id as huisarts_id
from {0}..tab_pat p with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = p.huisarts
where p.fnaam_pat like @0 and p.vnaam_pat like @1
order by p.fnaam_pat, p.vnaam_pat", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select d.*, dr.nr_id as dok_verwezen_id
from {0}..dossier d with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = d.nr_dok_verwezen
where d.nr_dos in (@0)
order by d.dat_opn", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var visits = await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));

                                sql = string.Format(@"select vo.*, dr.nr_id as dok_verwezen_id
from {0}..vooropname vo with (nolock)
left outer join {0}..tab_dokters dr with (nolock) on dr.nr_dok = vo.nr_dok
where vo.nr_vooropname in (@0)
order by vo.dat_begin", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                visits.AddRange(await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0'))));
                                return visits;
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select p.*, dr.nr_id as huisarts_id
from {0}..tab_pat p with (nolock)
inner join {0}..tab_dokters dr with (nolock) on dr.nr_dok = p.huisarts
inner join {0}..dossier d on p.nr_pat = d.nr_pat
where d.nr_dos in (@0)", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select vp.*--, v.veoms
from {0}..verper vp with (nolock)
--left outer join {1}..verpleeg v with (nolock) on v.venr = vp.nr_ve
where vp.nr_dos in (@0)
order by vp.nr_dos, vp.dat_begin", key == "Infohos Prs" ? "prs054" : "prs954", key == "Infohos Prs" ? "sql05.apot054" : "sql05.apot954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select dr.*
from {0}..tab_dokters dr with (nolock)
where dr.nr_id in (@0)", key == "Infohos Prs" ? "prs054" : "prs954");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(6, '0')));
                            }
                        });
                        break;
                    case "Infohos CPD":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*, 
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'SEXES' and luv.LUValueID = p.SexId
) as SexDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'NATIONALITIES' and luv.LUValueID = p.NationalityID
) as NationalityDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'LANGUAGES' and luv.LUValueID = p.LanguageID
) as LanguageDescription,
dr.administrativeid as GeneralPractitionerAdministrativeId, dr.LastName as GeneralPractitionerLastName, dr.FirstName as GeneralPractitionerFirstName
from cpd_azdelta_prod..cpdpatient p with (nolock)
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = p.generalpractitionerid 
where p.patientnr = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select p.PatientNr, d.*, dr.DoctorNbr as TransmittingGpDoctorNbr, 
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'DOSSIERTYPES' and luv.LUValueID = d.DossierTypeID
) as DossierTypeDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'DOSSIERCDS' and luv.LUValueID = d.DossierCdID
) as DossierCodeDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'ACCIDENTCDS' and luv.LUValueID = d.AccidentCdID
) as AccidentDescription
from cpd_azdelta_prod..cpddossier d with (nolock)
inner join cpd_azdelta_prod..cpdpatient p with (nolock) on p.cpdpatientid = d.cpdpatientid
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = d.transmittinggpid 
where p.patientnr = @0
order by d.startdate");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 100 p.*, 
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'SEXES' and luv.LUValueID = p.SexId
) as SexDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'NATIONALITIES' and luv.LUValueID = p.NationalityID
) as NationalityDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'LANGUAGES' and luv.LUValueID = p.LanguageID
) as LanguageDescription,
dr.administrativeid as GeneralPractitionerAdministrativeId, dr.LastName as GeneralPractitionerLastName, dr.FirstName as GeneralPractitionerFirstName
from cpd_azdelta_prod..cpdpatient p with (nolock)
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = p.generalpractitionerid 
where p.LastName like @0 and p.FirstName like @1
order by p.LastName, p.FirstName");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.PatientNr, d.*, dr.DoctorNbr as TransmittingGpDoctorNbr, 
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'DOSSIERTYPES' and luv.LUValueID = d.DossierTypeID
) as DossierTypeDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'DOSSIERCDS' and luv.LUValueID = d.DossierCdID
) as DossierCodeDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'ACCIDENTCDS' and luv.LUValueID = d.AccidentCdID
) as AccidentDescription
from cpd_azdelta_prod..cpddossier d with (nolock)
inner join cpd_azdelta_prod..cpdpatient p with (nolock) on p.cpdpatientid = d.cpdpatientid
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = d.transmittinggpid 
where d.dossiernr in (@0)
order by d.startdate";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 100 p.*, 
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'SEXES' and luv.LUValueID = p.SexId
) as SexDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'NATIONALITIES' and luv.LUValueID = p.NationalityID
) as NationalityDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'LANGUAGES' and luv.LUValueID = p.LanguageID
) as LanguageDescription,
dr.administrativeid as GeneralPractitionerAdministrativeId, dr.LastName as GeneralPractitionerLastName, dr.FirstName as GeneralPractitionerFirstName
from cpd_azdelta_prod..cpdpatient p with (nolock)
inner join cpd_azdelta_prod..cpddossier d with (nolock) on d.cpdpatientid = p.cpdpatientId
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = p.generalpractitionerid 
where d.dossiernr in (@0)
order by p.LastName, p.FirstName");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select p.PatientNr, d.dossiernr, c.campusnbr, c.campusdescription, cu.nbrcareunit, cu.description as careunitdescription, r.roomnbr, b.bednbr, cup.*,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'BEDTYPE' and luv.LUValueID = b.bedtype
) as BedTypeDescription,
dr.administrativeid as ResponsibleAdministrativeId, dr.LastName as ResponsibleDoctorLastName, dr.FirstName as ResponsibleDoctorFirstName,
cd.departmentnbr, cd.description as ConsultDepartmentDescription,
(
	select luv.ExtraInfo
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'LuBedIndex' and luv.LUValueID = cup.lubedindexid
) as DepartmentCode,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'LuBedIndex' and luv.LUValueID = cup.lubedindexid
) as BedIndex,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'RoomFare' and luv.LUValueID = cup.roomfareid
) as RoomFareDescription,
(
	select luv.Description
	from cpd_azdelta_prod..LUValue luv with (nolock)
	inner join cpd_azdelta_prod..lutable lut with (nolock) on lut.LUTableID = luv.LUTableID
	where lut.TableName = 'ReasonRoomFare' and luv.LUValueID = cup.reasonroomfareid
) as ReasonRoomFareDescription
from cpd_azdelta_prod..cpdcareunitperiod cup with (nolock)
inner join cpd_azdelta_prod..cpddossier d with (nolock) on cup.cpddossierid = d.cpddossierid
inner join cpd_azdelta_prod..cpdpatient p with (nolock) on p.cpdpatientid = d.cpdpatientid
left outer join cpd_azdelta_prod..cpdcampus c with (nolock) on c.cpdcampusid = cup.campusid
left outer join cpd_azdelta_prod..cpdcareunithosp cu with (nolock) on cu.cpdcareunithospid = cup.careunitid
left outer join cpd_azdelta_prod..cpdroom r with (nolock) on r.cpdroomid = cup.roomid
left outer join cpd_azdelta_prod..cpdbed b with (nolock) on b.cpdbedid = cup.bedid
left outer join cpd_azdelta_prod..cpddoctor dr with (nolock) on dr.cpddoctorid = cup.doctorid 
left outer join cpd_azdelta_prod..consultdepartment cd with (nolock) on cd.consultdepartmentid = cup.consultdepartmentid 
where d.dossiernr in (@0)
order by cup.startdate");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select dr.*
from cpd_azdelta_prod..cpddoctor dr with (nolock)
where dr.administrativeid in (@0)");
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(6, '0')));
                            }
                        });
                        break;
                    case "Aexis":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from MLINE.m_patient
where code = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select v.*
from MLINE.m_patvisit v
inner join MLINE.m_patient p on p.id = v.patid
where p.code = @0
order by v.admitdate";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select top 100 *
from MLINE.m_patient
where lower(name) like @0 and lower(fname) like @1
order by name, fname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName.ToLower() + "%", firstName.ToLower() + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from MLINE.m_patvisit
where visitnumber in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*
from MLINE.m_patient p
inner join MLINE.m_patvisit v on v.patid = p.id
where v.code in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            return await visitsByNumbersQueries[key](numbers);
                        });
                        break;
                    case "Acertis":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select *
from stammdaten
where kis_patid = @0";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select v.*
from behandlungsfaelle v
inner join stammdaten p on p.patid = v.patid
where p.kis_patid = @0
order by v.aufnahme_datum";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id.PadLeft(10, '0'));
                            }
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select top 100 *
from stammdaten
where lower(name) like @0 and lower(vorname) like @1
order by name, vorname";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName.ToLower() + "%", firstName.ToLower() + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select v.*
from behandlungsfaelle v
where v.aufnahme_nr in (@0)
order by v.aufnahme_datum";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = @"select p.*
from stammdaten p
inner join behandlungsfaelle v on v.patid =  p.patid
where v.aufnahme_nr in (@0)";
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));
                            }
                        });
                        break;
                    case "Infohos COZO":
                        var patCozoSql = @"select l.*
from CPDGzo054_PROD..LOG l with (nolock)
inner join CPDGzo054_PROD..LOGArgument la with (nolock) on la.logid = l.logid and la.logkey = 'eventid'
where convert(uniqueidentifier, la.logvalue) in
(
	select ea.EventID
	from CPDGzo054_PROD..EventArgument ea with (nolock) 
	where ea.ArgumentKey = 'cpdpatientid' and ea.isdeleted = 0 and
	convert(uniqueidentifier, ea.ArgumentValue) in (@0)
)
order by l.InsertDt desc";
                        var patCpdSql = @"select p.CPDPatientID
	from cpd_azdelta_prod..cpdpatient p with (nolock)
	where p.PatientNr in (@0)";
                        var visitCozoSql = @"select l.*
from CPDGzo054_PROD..LOG l with (nolock)
inner join CPDGzo054_PROD..LOGArgument la with (nolock) on la.logid = l.logid and la.logkey = 'eventid'
where convert(uniqueidentifier, la.logvalue) in
(
	select ea.EventID
	from CPDGzo054_PROD..EventArgument ea with (nolock) 
	where ea.ArgumentKey = 'cpdcontactid' and ea.isdeleted = 0 and
	convert(uniqueidentifier, ea.ArgumentValue) in (@0)
)
order by l.InsertDt desc";
                        var visitCpdSql = @"select em.OrdContactID
from cpd_azdelta_prod..emergemergency em with (nolock)
inner join cpd_azdelta_prod..CPDDossier d with (nolock) on d.cpddossierid = em.cpddossierid 
where d.DossierNr in (@0)
union
select oc.OrdContactID
from cpd_azdelta_prod..OrdContact oc with (nolock)
inner join cpd_azdelta_prod..CPDDossier d with (nolock) on d.cpddossierid = oc.DossierId 
where d.DossierNr in (@0)
union
select doc.OrdContactID
from cpd_azdelta_prod..cpddossierjordcontact doc with (nolock)
inner join cpd_azdelta_prod..CPDDossier d with (nolock) on d.cpddossierid = doc.cpddossierid 
where d.DossierNr in (@0)";
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var dbCpd = new Database("Infohos CPD"))
                            {
                                Console.WriteLine("{0}: {1}", "Infohos CPD", patCpdSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var guids = await dbCpd.FetchAsync<Guid>(patCpdSql, id.PadLeft(10, '0'));

                                using (var db = new Database(key))
                                {
                                    Console.WriteLine("{0}: {1}", key, patCozoSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                    return await db.FetchAsync<dynamic>(patCozoSql, guids);
                                }
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            using (var dbCpd = new Database("Infohos CPD"))
                            {
                                Console.WriteLine("{0}: {1}", "Infohos CPD", patCpdSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var guids = await dbCpd.FetchAsync<Guid>(patCpdSql, id.PadLeft(10, '0'));

                                using (var db = new Database(key))
                                {
                                    Console.WriteLine("{0}: {1}", key, patCozoSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                    return await db.FetchAsync<dynamic>(patCozoSql, guids);
                                }
                            }
                        });
                        //patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        //{
                        //    using (var db = new Database(key))
                        //    {
                        //        var sql = string.Format(@"");
                        //        Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                        //        return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                        //    }
                        //});
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var dbCpd = new Database("Infohos CPD"))
                            {
                                Console.WriteLine("{0}: {1}", "Infohos CPD", visitCpdSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var guids = await dbCpd.FetchAsync<Guid>(visitCpdSql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));

                                using (var db = new Database(key))
                                {
                                    Console.WriteLine("{0}: {1}", key, visitCozoSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                    return await db.FetchAsync<dynamic>(visitCozoSql, guids);
                                }
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var dbCpd = new Database("Infohos CPD"))
                            {
                                Console.WriteLine("{0}: {1}", "Infohos CPD", visitCpdSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var guids = await dbCpd.FetchAsync<Guid>(visitCpdSql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));

                                using (var db = new Database(key))
                                {
                                    Console.WriteLine("{0}: {1}", key, visitCozoSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                    return await db.FetchAsync<dynamic>(visitCozoSql, guids);
                                }
                            }
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var dbCpd = new Database("Infohos CPD"))
                            {
                                Console.WriteLine("{0}: {1}", "Infohos CPD", visitCpdSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                var guids = await dbCpd.FetchAsync<Guid>(visitCpdSql, (from number in numbers as IEnumerable<string> select number.PadLeft(8, '0')));

                                using (var db = new Database(key))
                                {
                                    Console.WriteLine("{0}: {1}", key, visitCozoSql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                    return await db.FetchAsync<dynamic>(visitCozoSql, guids);
                                }
                            }
                        });
                        //doctorsByNumbersQuery.Add(key, async (numbers) =>
                        //{
                        //    using (var db = new Database(key))
                        //    {
                        //        var sql = string.Format(@"");
                        //        Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                        //        return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.PadLeft(6, '0')));
                        //    }
                        //});
                        break;
                    case "CMeal":
                        break;
                    case "Allgeier":
                        break;
                    default:
                        continue;
                }

                //propertyWindows.Add(key, new PropertyWindow());
                //propertyWindows[key].Text = key + " Detail";

                //menuItem = new MenuItem();
                //menuItem.Text = key + " Detail";
                //menuItem.Click += new EventHandler(menuItemViewWindow_Click);
                //this.menuItemView.MenuItems.Add(menuItem);
                //menuItem.Index = menuItemViewIndex++;

                listWindows.Add(key, new ListWindow());
                listWindows[key].Text = key + " DB Result";
                listWindows[key].List += new HHR.HL7.Search.ListWindow.ListEventHandler(m_listWindow_List);
                listWindows[key].SearchPatientId += new HHR.HL7.Search.ListWindow.SearchPatientIdEventHandler(SearchPatientId);
                listWindows[key].SearchVisitNumber += new HHR.HL7.Search.ListWindow.SearchVisitNumberEventHandler(SearchVisitNumber);
                listWindows[key].SearchDoctorNumber += new HHR.HL7.Search.ListWindow.SearchDoctorNumberEventHandler(SearchDoctorNumber);

                menuItem = new MenuItem();
                menuItem.Text = key + " Result";
                menuItem.Click += new EventHandler(menuItemViewWindow_Click);
                this.menuItemView.MenuItems.Add(menuItem);
                menuItem.Index = menuItemViewIndex++;
            }

            menuItemViewIndex++;
            foreach (var key in hl7Versions)
            {
                switch (key)
                {
                    case "HL7v21":
                    case "HL7v23":
                        patientByIdQueries.Add(key, async (id) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 10000 h.MessageTimeStamp, h.MessageType, h.EventType, a.*, h.Message, h.FileName, h.Creator
from {0}..adt a with (nolock)
inner join {0}..hl7 h with (nolock) on h.MessageControlId = a.MessageControlId
where a.PatientId = @0
order by a.MessageControlId", key);
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, id);
                            }
                        });
                        visitsByPatientIdQueries.Add(key, async (id) =>
                        {
                            return await patientByIdQueries[key](id);
                        });
                        patientsByNameQueries.Add(key, async (lastName, firstName) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 10000 h.MessageTimeStamp, h.MessageType, h.EventType, a.*, h.Message, h.FileName, h.Creator
from {0}..adt a with (nolock)
inner join {0}..hl7 h with (nolock) on h.MessageControlId = a.MessageControlId
where a.FamilyName like @0 and a.FirstName like @1
order by a.MessageControlId", key);
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, lastName + "%", firstName + "%");
                            }
                        });
                        visitsByNumbersQueries.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 10000 h.MessageTimeStamp, h.MessageType, h.EventType, a.*, h.Message, h.FileName, h.Creator
from {0}..adt a with (nolock)
inner join {0}..hl7 h with (nolock) on h.MessageControlId = a.MessageControlId
where a.VisitNumber in (@0)
order by a.MessageControlId", key);
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.ToDecimal()));
                            }
                        });
                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                        {
                            return await visitsByNumbersQueries[key](numbers);
                        });
                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                        {
                            return await visitsByNumbersQueries[key](numbers);
                        });
                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                        {
                            using (var db = new Database(key))
                            {
                                var sql = string.Format(@"select top 10000 h.MessageTimeStamp, h.MessageType, h.EventType, m.*, h.Message, h.FileName, h.Creator
from {0}..mfn m with (nolock)
inner join {0}..hl7 h with (nolock) on h.MessageControlId = m.MessageControlId
where m.DoctorNumber in (@0)
order by m.MessageControlId", key);
                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                                return await db.FetchAsync<dynamic>(sql, (from number in numbers as IEnumerable<string> select number.ToDecimal()));
                            }
                        });
                        //searchAdtQuery.Add(key, async (eventArgs) =>
                        //{

                        //});
                        break;
                    //                    case "Biztalk":
                    //                    case "Biztalk Test":
                    //                        patientByIdQueries.Add(key, async (id) =>
                    //                        {
                    //                            using (var db = new Database(key))
                    //                            {
                    //                                var sql = string.Format(@"select top 1000 mi.CreationDate, mi.SendTransportType, mi.ReceivePortName, mi.ReceiveMessageName,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'SubType' and MessageId = mi.SendMessageid) as SubType,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'PatientNumber' and MessageId = mi.SendMessageid) as PatientNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'VisitNumber' and MessageId = mi.SendMessageid) as VisitNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'StaffNumber' and MessageId = mi.SendMessageid) as StaffNumber, 
                    //	sendMessage.Content as Message
                    //FROM {0}.BizTalk.MessageInstance mi with (nolock)
                    //inner join {0}.BizTalk.Message sendMessage on sendMessage.MessageId = mi.SendMessageid
                    //left outer join {0}.BizTalk.Metadata sendMeta on sendMeta.MessageId = mi.SendMessageid
                    //where mi.sendPortname = @0", key == "Biztalk" ? "Messagebox054" : "Messagebox_Beta");
                    //                                var args = new List<object>() { biztalk };
                    //                                if (!showOnlyLast100BiztalkHL7s)
                    //                                {
                    //                                    sql = string.Concat(sql, Environment.NewLine, @"and sendMeta.[key] = @1
                    //and sendMeta.value = @2");
                    //                                    args.Add("PatientNumber");
                    //                                    args.Add(id);
                    //                                }
                    //                                sql = string.Concat(sql, Environment.NewLine, @"order by mi.CreationDate desc");
                    //                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                    //                                return await db.FetchAsync<dynamic>(sql, args.ToArray());
                    //                            } 
                    //                        });
                    //                        visitsByPatientIdQueries.Add(key, async (id) =>
                    //                        {
                    //                            return await patientByIdQueries[key](id);
                    //                        });
                    //                        visitsByNumbersQueries.Add(key, async (numbers) =>
                    //                        {
                    //                            using (var db = new Database(key))
                    //                            {
                    //                                var sql = string.Format(@"select top 1000 mi.CreationDate, mi.SendTransportType, mi.ReceivePortName, mi.ReceiveMessageName,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'SubType' and MessageId = mi.SendMessageid) as SubType,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'PatientNumber' and MessageId = mi.SendMessageid) as PatientNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'VisitNumber' and MessageId = mi.SendMessageid) as VisitNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'StaffNumber' and MessageId = mi.SendMessageid) as StaffNumber, 
                    //	sendMessage.Content as Message
                    //FROM {0}.BizTalk.MessageInstance mi with (nolock)
                    //inner join {0}.BizTalk.Message sendMessage on sendMessage.MessageId = mi.SendMessageid
                    //left outer join {0}.BizTalk.Metadata sendMeta on sendMeta.MessageId = mi.SendMessageid
                    //where mi.sendPortname = @0", key == "Biztalk" ? "Messagebox054" : "Messagebox_Beta");
                    //                                var args = new List<object>() { biztalk };
                    //                                if (!showOnlyLast100BiztalkHL7s)
                    //                                {
                    //                                    sql = string.Concat(sql, Environment.NewLine, @"and sendMeta.[key] = @1
                    //and sendMeta.value in (@2)");
                    //                                    args.Add("VisitNumber");
                    //                                    args.Add(numbers);
                    //                                }
                    //                                sql = string.Concat(sql, Environment.NewLine, @"order by mi.CreationDate desc");
                    //                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                    //                                return await db.FetchAsync<dynamic>(sql, args.ToArray());
                    //                            }
                    //                        });
                    //                        patientsByVisitNumbersQueries.Add(key, async (numbers) =>
                    //                        {
                    //                            return await visitsByNumbersQueries[key](numbers);
                    //                        });
                    //                        visitDetailsByVisitNumbersQuery.Add(key, async (numbers) =>
                    //                        {
                    //                            return await visitsByNumbersQueries[key](numbers);
                    //                        });
                    //                        doctorsByNumbersQuery.Add(key, async (numbers) =>
                    //                        {
                    //                            using (var db = new Database(key))
                    //                            {
                    //                                var sql = string.Format(@"select top 1000 mi.CreationDate, mi.SendTransportType, mi.ReceivePortName, mi.ReceiveMessageName,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'SubType' and MessageId = mi.SendMessageid) as SubType,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'PatientNumber' and MessageId = mi.SendMessageid) as PatientNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'VisitNumber' and MessageId = mi.SendMessageid) as VisitNumber,
                    //	(select top 1 value from {0}.BizTalk.Metadata  where [key] = 'StaffNumber' and MessageId = mi.SendMessageid) as StaffNumber, 
                    //	sendMessage.Content as Message
                    //FROM {0}.BizTalk.MessageInstance mi with (nolock)
                    //inner join {0}.BizTalk.Message sendMessage on sendMessage.MessageId = mi.SendMessageid
                    //left outer join {0}.BizTalk.Metadata sendMeta on sendMeta.MessageId = mi.SendMessageid
                    //where mi.sendPortname = @0", key == "Biztalk" ? "Messagebox054" : "Messagebox_Beta");
                    //                                var args = new List<object>() { biztalk };
                    //                                if (!showOnlyLast100BiztalkHL7s)
                    //                                {
                    //                                    sql = string.Concat(sql, Environment.NewLine, @"and sendMeta.[key] = @1
                    //and sendMeta.value in (@2)");
                    //                                    args.Add("StaffNumber");
                    //                                    args.Add(numbers);
                    //                                }
                    //                                sql = string.Concat(sql, Environment.NewLine, @"order by mi.CreationDate desc");
                    //                                Console.WriteLine("{0}: {1}", key, sql.Replace(Environment.NewLine, Environment.NewLine + "\t"));
                    //                                return await db.FetchAsync<dynamic>(sql, args.ToArray());
                    //                            }
                    //                        });
                    //                        break;
                }

                treeWindows.Add(key, new HL7TreeWindow());
                treeWindows[key].Text = key + " Tree";

                menuItem = new MenuItem();
                menuItem.Text = key + " Tree";
                menuItem.Click += new EventHandler(menuItemViewWindow_Click);
                this.menuItemView.MenuItems.Add(menuItem);
                menuItem.Index = menuItemViewIndex++;

                syntaxHighlightingWindows.Add(key, new SyntaxHighlightingWindow(key));
                syntaxHighlightingWindows[key].Text = key + " Message";
                syntaxHighlightingWindows[key].SearchPatientId += new HHR.HL7.Search.SyntaxHighlightingWindow.SearchPatientIdEventHandler(SearchPatientId);
                syntaxHighlightingWindows[key].SearchVisitNumber += new HHR.HL7.Search.SyntaxHighlightingWindow.SearchVisitNumberEventHandler(SearchVisitNumber);

                menuItem = new MenuItem();
                menuItem.Text = key + " Message";
                menuItem.Click += new EventHandler(menuItemViewWindow_Click);
                this.menuItemView.MenuItems.Add(menuItem);
                menuItem.Index = menuItemViewIndex++;

                listWindows.Add(key, new ListWindow());
                listWindows[key].Text = key + " HL7 Result";
                listWindows[key].List += new HHR.HL7.Search.ListWindow.ListEventHandler(m_listWindow_List);
                listWindows[key].SearchPatientId += new HHR.HL7.Search.ListWindow.SearchPatientIdEventHandler(SearchPatientId);
                listWindows[key].SearchVisitNumber += new HHR.HL7.Search.ListWindow.SearchVisitNumberEventHandler(SearchVisitNumber);

                menuItem = new MenuItem();
                menuItem.Text = key + " Result";
                menuItem.Click += new EventHandler(menuItemViewWindow_Click);
                this.menuItemView.MenuItems.Add(menuItem);
                menuItem.Index = menuItemViewIndex++;
            }

            m_searchWindow = new SearchWindow(patientByIdQueries.Keys.ToList());
            m_searchHL7ADTWindow = new SearchHL7ADTWindow(hl7Versions);
            m_searchHL7MFNWindow = new SearchHL7MFNWindow(hl7Versions);

            m_outputWindow = new OutputWindow();
            m_exportHL7Form = new ExportHL7Form(hl7Versions);

            dockPanel.AllowEndUserDocking = false;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            //dockable panels settings
            m_searchWindow.SearchByPatientName += new HHR.HL7.Search.SearchWindow.SearchByPatientNameEventHandler(m_searchWindow_SearchByPatientName);
            m_searchWindow.SearchByPatientId += new HHR.HL7.Search.SearchWindow.SearchByPatientIdEventHandler(m_searchWindow_SearchByPatientId);
            m_searchWindow.SearchByVisitNumbers += new HHR.HL7.Search.SearchWindow.SearchByVisitNumbersEventHandler(m_searchWindow_SearchByVisitNumbers);
            m_searchWindow.SearchByDoctorNumbers += new HHR.HL7.Search.SearchWindow.SearchByDoctorNumbersEventHandler(m_searchWindow_SearchByDoctorNumbers);
            m_searchWindow.SearchByWardIds += m_searchWindow_SearchByWardIds;
            m_searchWindow.DalChecked += m_searchWindow_DalChecked;
            m_searchHL7ADTWindow.Search += new HHR.HL7.Search.SearchHL7ADTWindow.SearchEventHandler(m_searchHL7ADTWindow_Search);
            m_searchHL7MFNWindow.Search += new HHR.HL7.Search.SearchHL7MFNWindow.SearchEventHandler(m_searchHL7MFNWindow_Search);
        }
Exemple #28
0
        public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManager messageManager)
        {
            m_Graph          = graph;
            m_MessageManager = messageManager;
            styleSheets.Add(Resources.Load <StyleSheet>("Styles/GraphEditorView"));
            previewManager = new PreviewManager(graph, messageManager);

            string serializedToggle = EditorUserSettings.GetConfigValue(k_ToggleSettings);

            if (!string.IsNullOrEmpty(serializedToggle))
            {
                m_ToggleSettings = JsonUtility.FromJson <ToggleSettings>(serializedToggle);
            }

            string serializedWindowLayout = EditorUserSettings.GetConfigValue(k_FloatingWindowsLayoutKey);

            if (!string.IsNullOrEmpty(serializedWindowLayout))
            {
                m_FloatingWindowsLayout = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);
            }
            else
            {
                m_FloatingWindowsLayout = new FloatingWindowsLayout
                {
                    blackboardLayout =
                    {
                        dockingTop       = true,
                        dockingLeft      = true,
                        verticalOffset   =              16,
                        horizontalOffset =              16,
                        size             = new Vector2(200, 400)
                    }
                };
            }

            if (m_FloatingWindowsLayout.masterPreviewSize.x > 0f && m_FloatingWindowsLayout.masterPreviewSize.y > 0f)
            {
                previewManager.ResizeMasterPreview(m_FloatingWindowsLayout.masterPreviewSize);
            }

            previewManager.RenderPreviews();
            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }

                GUILayout.FlexibleSpace();

                EditorGUI.BeginChangeCheck();
                m_ToggleSettings.isBlackboardVisible = GUILayout.Toggle(m_ToggleSettings.isBlackboardVisible, "Blackboard", EditorStyles.toolbarButton);

                GUILayout.Space(6);

                m_ToggleSettings.isPreviewVisible = GUILayout.Toggle(m_ToggleSettings.isPreviewVisible, "Main Preview", EditorStyles.toolbarButton);
                if (EditorGUI.EndChangeCheck())
                {
                    m_MasterPreviewView.visible             = m_ToggleSettings.isPreviewVisible;
                    m_BlackboardProvider.blackboard.visible = m_ToggleSettings.isBlackboardVisible;
                    string serializedToggleables            = JsonUtility.ToJson(m_ToggleSettings);
                    EditorUserSettings.SetConfigValue(k_ToggleSettings, serializedToggleables);
                }
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new MaterialGraphView(graph)
                {
                    name = "GraphView", viewDataKey = "MaterialGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                m_GraphView.groupTitleChanged        = OnGroupTitleChanged;
                m_GraphView.elementsAddedToGroup     = OnElementsAddedToGroup;
                m_GraphView.elementsRemovedFromGroup = OnElementsRemovedFromGroup;
                content.Add(m_GraphView);

                m_BlackboardProvider = new BlackboardProvider(graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);

                // Initialize toggle settings if it doesnt exist.
                if (m_ToggleSettings == null)
                {
                    m_ToggleSettings = new ToggleSettings();
                }
                m_BlackboardProvider.blackboard.visible = m_ToggleSettings.isBlackboardVisible;

                m_MasterPreviewView = new MasterPreviewView(previewManager, graph)
                {
                    name = "masterPreview"
                };

                WindowDraggable masterPreviewViewDraggable = new WindowDraggable(null, this);
                m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
                m_GraphView.Add(m_MasterPreviewView);

                //m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout;
                //m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout;
                masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout;
                m_MasterPreviewView.previewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;
                m_MasterPreviewView.visible = m_ToggleSettings.isPreviewVisible;

                m_GraphView.graphViewChanged = GraphViewChanged;

                RegisterCallback <GeometryChangedEvent>(ApplySerializewindowLayouts);
            }

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var graphGroup in graph.groups)
            {
                AddGroup(graphGroup);
            }

            foreach (var node in graph.GetNodes <AbstractMaterialNode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.edges)
            {
                AddEdge(edge);
            }

            Add(content);
        }
 public void Execute()
 {
     var searchWindow = new SearchWindow<string>(FindFileMatches);
     Application.Run(searchWindow);
     Console.WriteLine(Settings.WorkingDir + searchWindow.SelectedItem);
 }
 protected void OnRequestNodeCreation(NodeCreationContext context)
 {
     m_InsertStack = context.target as StackNode;
     m_InsertIndex = context.index;
     SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), this);
 }
 public void BringSearchWindowToFront() => SearchWindow.SetAtFront(true, false);
Exemple #32
0
        private void findInDiffToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var candidates = DiffFiles.GitItemStatuses;

            Func<string, IList<GitItemStatus>> FindDiffFilesMatches = (string name) =>
            {

                string nameAsLower = name.ToLower();

                return candidates.Where(item =>
                    {
                        return item.Name != null && item.Name.ToLower().Contains(nameAsLower)
                            || item.OldName != null && item.OldName.ToLower().Contains(nameAsLower);
                    }
                    ).ToList();
            };

            GitItemStatus selectedItem;
            using (var searchWindow = new SearchWindow<GitItemStatus>(FindDiffFilesMatches)
            {
                Owner = this
            })
            {
                searchWindow.ShowDialog(this);
                selectedItem = searchWindow.SelectedItem;
            }
            if (selectedItem != null)
            {
                DiffFiles.SelectedItem = selectedItem;
            }
        }
Exemple #33
0
        public GraphEditorView(EditorWindow editorWindow, AbstractMaterialGraph graph, string assetName)
        {
            m_Graph = graph;
            AddStyleSheetPath("Styles/MaterialGraph");
            m_EditorWindow = editorWindow;
            previewManager = new PreviewManager(graph);

            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new MaterialGraphView(graph)
                {
                    name = "GraphView", persistenceKey = "MaterialGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.AddManipulator(new GraphDropTarget(graph));
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                content.Add(m_GraphView);

                m_BlackboardProvider = new BlackboardProvider(assetName, graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);
                m_BlackboardProvider.blackboard.layout = new Rect(new Vector2(10f, 10f), m_BlackboardProvider.blackboard.layout.size);

                m_MasterPreviewView = new MasterPreviewView(assetName, previewManager, graph)
                {
                    name = "masterPreview"
                };

                WindowDraggable masterPreviewViewDraggable = new WindowDraggable();
                m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
                m_GraphView.Add(m_MasterPreviewView);

                ResizeBorderFrame masterPreviewResizeBorderFrame = new ResizeBorderFrame(m_MasterPreviewView)
                {
                    name = "resizeBorderFrame"
                };
                masterPreviewResizeBorderFrame.stayWithinParentBounds = true;
                masterPreviewResizeBorderFrame.OnResizeFinished      += UpdateSerializedWindowLayout;
                m_MasterPreviewView.Add(masterPreviewResizeBorderFrame);

                m_BlackboardProvider.onDragFinished             += UpdateSerializedWindowLayout;
                m_BlackboardProvider.onResizeFinished           += UpdateSerializedWindowLayout;
                masterPreviewViewDraggable.OnDragFinished       += UpdateSerializedWindowLayout;
                masterPreviewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;

                m_GraphView.graphViewChanged = GraphViewChanged;

                m_FloatingWindowsLayoutKey = "UnityEditor.ShaderGraph.FloatingWindowsLayout";
                string serializedWindowLayout = EditorUserSettings.GetConfigValue(m_FloatingWindowsLayoutKey);

                if (!String.IsNullOrEmpty(serializedWindowLayout))
                {
                    m_FloatingWindowsLayout    = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);
                    m_MasterPreviewView.layout = m_FloatingWindowsLayout.previewLayout;
                    if (m_FloatingWindowsLayout.blackboardLayout.width > 0)
                    {
                        m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.blackboardLayout;
                    }
                }
                else
                {
                    m_FloatingWindowsLayout = new FloatingWindowsLayout();
                }
            }

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var node in graph.GetNodes <INode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.edges)
            {
                AddEdge(edge);
            }

            Add(content);
        }
Exemple #34
0
        public GraphEditorView(EditorWindow editorWindow, AbstractMaterialGraph graph)
        {
            m_Graph = graph;
            AddStyleSheetPath("Styles/GraphEditorView");
            previewManager = new PreviewManager(graph);

            string serializedWindowLayout = EditorUserSettings.GetConfigValue(k_FloatingWindowsLayoutKey);

            if (!string.IsNullOrEmpty(serializedWindowLayout))
            {
                m_FloatingWindowsLayout = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);
                if (m_FloatingWindowsLayout.masterPreviewSize.x > 0f && m_FloatingWindowsLayout.masterPreviewSize.y > 0f)
                {
                    previewManager.ResizeMasterPreview(m_FloatingWindowsLayout.masterPreviewSize);
                }
            }

            previewManager.RenderPreviews();

            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new MaterialGraphView(graph)
                {
                    name = "GraphView", persistenceKey = "MaterialGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                content.Add(m_GraphView);

                m_BlackboardProvider = new BlackboardProvider(graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);
                Rect blackboardLayout = m_BlackboardProvider.blackboard.layout;
                blackboardLayout.x = 10f;
                blackboardLayout.y = 10f;
                m_BlackboardProvider.blackboard.layout = blackboardLayout;

                m_MasterPreviewView = new MasterPreviewView(previewManager, graph)
                {
                    name = "masterPreview"
                };

                WindowDraggable masterPreviewViewDraggable = new WindowDraggable(null, this);
                m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
                m_GraphView.Add(m_MasterPreviewView);

                //m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout;
                //m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout;
                masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout;
                m_MasterPreviewView.previewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;

                m_GraphView.graphViewChanged = GraphViewChanged;

                RegisterCallback <GeometryChangedEvent>(ApplySerializewindowLayouts);
            }

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var node in graph.GetNodes <INode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.edges)
            {
                AddEdge(edge);
            }

            Add(content);
        }
Exemple #35
0
        public GraphEditorView(EditorWindow editorWindow, AbstractNodeGraph graph)
        {
            m_Graph = graph;
            AddStyleSheetPath("Styles/GraphEditorView");

            string serializedWindowLayout = EditorUserSettings.GetConfigValue(k_FloatingWindowsLayoutKey);

            if (!string.IsNullOrEmpty(serializedWindowLayout))
            {
                m_FloatingWindowsLayout = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);
            }

            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Compile", EditorStyles.toolbarButton))
                {
                    compileRequested?.Invoke();
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new NodeGraphView(m_Graph)
                {
                    name = "GraphView", persistenceKey = "NodeGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                content.Add(m_GraphView);

                m_BlackboardProvider = new BlackboardProvider(graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);
                Rect blackboardLayout = m_BlackboardProvider.blackboard.layout;
                blackboardLayout.x = 10f;
                blackboardLayout.y = 10f;
                m_BlackboardProvider.blackboard.layout = blackboardLayout;

                m_GraphView.graphViewChanged = GraphViewChanged;

                RegisterCallback <GeometryChangedEvent>(ApplySerializewindowLayouts);
            }

            m_Tooltip = new VisualElement();
            m_Tooltip.AddToClassList("tooltip-container");
            m_TooltipText = new Label(tooltip);
            m_Tooltip.Add(m_TooltipText);
            content.Add(m_Tooltip);
            RegisterCallback <MouseMoveEvent>(OnMouseMove);
            m_Tooltip.visible = !string.IsNullOrEmpty(tooltip);

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var node in graph.GetNodes <INode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.GetEdges())
            {
                AddEdge(edge);
            }

            Add(content);
        }
 public void Setup()
 {
     mainWindow   = new MainWindow();
     recordWindow = new RecordWindow();
     searchWindow = new SearchWindow();
 }
Exemple #37
0
 private static void RunSearchFileCommand()
 {
     var searchWindow = new SearchWindow<string>(FindFileMatches);
     Application.Run(searchWindow);
     Console.WriteLine(Settings.WorkingDir + searchWindow.SelectedItem);
 }
 public ItemReceivedProcessor(SearchWindow searchWindow, StashManager stashManager, IPlayerItemDao playerItemDao)
 {
     this.searchWindow  = searchWindow;
     this.stashManager  = stashManager;
     this.playerItemDao = playerItemDao;
 }
Exemple #39
0
        private static void RunCommand(string[] args)
        {
            Dictionary<string, string> arguments = new Dictionary<string, string>();

            for (int i = 2; i < args.Length; i++)
            {
                if (args[i].StartsWith("--") && i + 1 < args.Length && !args[i + 1].StartsWith("--"))
                    arguments.Add(args[i].TrimStart('-'), args[++i]);
                else
                    if (args[i].StartsWith("--"))
                        arguments.Add(args[i].TrimStart('-'), null);
            }

            if (args.Length > 1)
            {
                switch (args[1])
                {
                    case "mergetool":
                    case "mergeconflicts":
                        if (!arguments.ContainsKey("quiet") || Settings.Module.InTheMiddleOfConflictedMerge())
                            GitUICommands.Instance.StartResolveConflictsDialog();

                        return;
                    case "gitbash":
                        Settings.Module.RunBash();
                        return;
                    case "gitignore":
                        GitUICommands.Instance.StartEditGitIgnoreDialog();
                        return;
                    case "remotes":
                        GitUICommands.Instance.StartRemotesDialog();
                        return;
                    case "blame":
                        if (args.Length > 2)
                        {
                            // Remove working dir from filename. This is to prevent filenames that are too
                            // long while there is room left when the workingdir was not in the path.
                            string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/');

                            GitUICommands.Instance.StartBlameDialog(fileName);
                        }
                        else
                            MessageBox.Show("Cannot open blame, there is no file selected.", "Blame");
                        return;
                    case "browse":
                        GitUICommands.Instance.StartBrowseDialog(GetParameterOrEmptyStringAsDefault(args, "-filter"));
                        return;
                    case "cleanup":
                        new FormCleanupRepository().ShowDialog();
                        return;
                    case "add":
                    case "addfiles":
                        GitUICommands.Instance.StartAddFilesDialog();
                        return;
                    case "apply":
                    case "applypatch":
                        GitUICommands.Instance.StartApplyPatchDialog();
                        return;
                    case "branch":
                        GitUICommands.Instance.StartCreateBranchDialog();
                        return;
                    case "checkout":
                    case "checkoutbranch":
                        GitUICommands.Instance.StartCheckoutBranchDialog();
                        return;
                    case "checkoutrevision":
                        GitUICommands.Instance.StartCheckoutRevisionDialog();
                        return;
                    case "init":
                        if (args.Length > 2)
                            GitUICommands.Instance.StartInitializeDialog(args[2]);
                        else
                            GitUICommands.Instance.StartInitializeDialog();
                        return;
                    case "clone":
                        if (args.Length > 2)
                            GitUICommands.Instance.StartCloneDialog(args[2]);
                        else
                            GitUICommands.Instance.StartCloneDialog();
                        return;
                    case "commit":
                        Commit(arguments);
                        return;
                    case "filehistory":
                        if (args.Length > 2)
                        {
                            //Remove working dir from filename. This is to prevent filenames that are too
                            //long while there is room left when the workingdir was not in the path.
                            string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/');

                            GitUICommands.Instance.StartFileHistoryDialog(fileName);
                        }
                        else
                            MessageBox.Show("Cannot open file history, there is no file selected.", "File history");
                        return;
                    case "fileeditor":
                        if (args.Length > 2)
                        {
                            using (var formEditor = new FormEditor(args[2]))
                            {
                                if (formEditor.ShowDialog() == DialogResult.Cancel)
                                    System.Environment.ExitCode = -1;
                            }
                        }
                        else
                            MessageBox.Show("Cannot open file editor, there is no file selected.", "File editor");
                        return;
                    case "formatpatch":
                        GitUICommands.Instance.StartFormatPatchDialog();
                        return;
                    case "pull":
                        Pull(arguments);
                        return;
                    case "push":
                        Push(arguments);
                        return;
                    case "settings":
                        GitUICommands.Instance.StartSettingsDialog();
                        return;
                    case "searchfile":
                        var searchWindow = new SearchWindow<string>(FindFileMatches);
                        Application.Run(searchWindow);
                        Console.WriteLine(Settings.WorkingDir + searchWindow.SelectedItem);
                        return;
                    case "viewdiff":
                        GitUICommands.Instance.StartCompareRevisionsDialog();
                        return;
                    case "rebase":
                        {
                            string branch = null;
                            if (arguments.ContainsKey("branch"))
                                branch = arguments["branch"];
                            GitUICommands.Instance.StartRebaseDialog(branch);
                            return;
                        }
                    case "merge":
                        {
                            string branch = null;
                            if (arguments.ContainsKey("branch"))
                                branch = arguments["branch"];
                            GitUICommands.Instance.StartMergeBranchDialog(branch);
                            return;
                        }
                    case "cherry":
                        GitUICommands.Instance.StartCherryPickDialog();
                        return;
                    case "revert":
                        Application.Run(new FormRevert(args[2]));
                        return;
                    case "tag":
                        GitUICommands.Instance.StartCreateTagDialog();
                        return;
                    case "about":
                        Application.Run(new AboutBox());
                        return;
                    case "stash":
                        GitUICommands.Instance.StartStashDialog();
                        return;
                    case "synchronize":
                        Commit(arguments);
                        Pull(arguments);
                        Push(arguments);
                        return;
                    case "openrepo":
                        if (args.Length > 2)
                        {
                            if (File.Exists(args[2]))
                            {
                                string path = File.ReadAllText(args[2]);
                                if (Directory.Exists(path))
                                {
                                    Settings.WorkingDir = path;
                                }
                            }
                        }

                        GitUICommands.Instance.StartBrowseDialog();
                        return;
                    default:
                        Application.Run(new FormCommandlineHelp());
                        return;
                }
            }
        }