Ejemplo n.º 1
0
        private void SaveQuery()
        {
            QueryExpression model = queryVM.Model as QueryExpression;

            SerializationService serializer = new SerializationService();
            string json = serializer.ToJson(model);

            try
            {
                HermesService Hermes  = new HermesService();
                Request       request = Hermes.GetTestRequest();
                request.ParseTree = json;
                request.Save();

                Z.Notify(new Notification()
                {
                    Title = CONST_ModuleDialogsTitle, Content = "The query has been saved."
                });
            }
            catch (Exception ex)
            {
                Z.Notify(new Notification()
                {
                    Title = CONST_ModuleDialogsTitle, Content = Z.GetErrorText(ex)
                });
            }
        }
Ejemplo n.º 2
0
        private void OpenQuery()
        {
            string          json  = string.Empty;
            QueryExpression query = null;

            try
            {
                HermesService Hermes  = new HermesService();
                Request       request = Hermes.GetTestRequest();
                json = request.ParseTree;

                SerializationService serializer = new SerializationService();
                query = serializer.FromJson(json);
            }
            catch (Exception ex)
            {
                Z.Notify(new Notification()
                {
                    Title = CONST_ModuleDialogsTitle, Content = Z.GetErrorText(ex)
                });
                return;
            }

            try
            {
                string path = GetQueryFilePath();
                using (StreamWriter writer = new StreamWriter(path, false))
                {
                    writer.Write(json);
                }
                //using (StreamReader reader = new StreamReader(path))
                //{
                //    json = reader.ReadToEnd();
                //}
                ProcessStartInfo psi = new ProcessStartInfo(@"notepad.exe")
                {
                    Arguments       = $"\"{path}\"",
                    UseShellExecute = false,
                    CreateNoWindow  = true
                };
                Process.Start(psi);
            }
            catch (Exception ex)
            {
                Z.Notify(new Notification()
                {
                    Title = CONST_ModuleDialogsTitle, Content = Z.GetErrorText(ex)
                });
            }

            //Z.ClearRightRegion(this.regionManager);
            //IRegion rightRegion = this.regionManager.Regions[RegionNames.RightRegion];
            //if (rightRegion == null) return;
            //queryVM = new QueryExpressionViewModel(null, query);
            //QueryExpressionView queryView = new QueryExpressionView(queryVM);
            //rightRegion.Add(queryView);
        }
Ejemplo n.º 3
0
        private void ShowSQL()
        {
            QueryExpression model = this.Model as QueryExpression;

            if (model == null)
            {
                return;
            }

            HermesService service = new HermesService();

            this.SQLText          = service.ToSQL(model);
            this.IsSQLTabSelected = true;
        }
Ejemplo n.º 4
0
        private void ExecuteQuery()
        {
            QueryExpression model = this.Model as QueryExpression;

            if (model == null)
            {
                return;
            }

            HermesService service = new HermesService();

            try
            {
                this.QueryResultTable         = service.ExecuteQuery(model);
                this.IsQueryResultTabSelected = true;
            }
            catch (Exception ex)
            {
                Z.Notify(new Notification()
                {
                    Title = "Hermes", Content = Z.GetErrorText(ex)
                });
            }
        }