예제 #1
0
        private void OnCopyQuery()
        {
            Model.QueriesRow NewRow = ActiveModel.Queries.NewQueriesRow();
            foreach (DataColumn col in ActiveModel.Queries.Columns)
            {
                if (col.ColumnName != "PK")
                {
                    NewRow[col.ColumnName] = SelectedQuery[col.ColumnName];
                }
            }
            ActiveModel.Queries.AddQueriesRow(NewRow);

            foreach (Model.QueryTagMappingsRow Row in SelectedQuery.GetQueryTagMappingsRows())
            {
                Model.QueryTagMappingsRow NewTagMappingRow = ActiveModel.QueryTagMappings.NewQueryTagMappingsRow();
                foreach (DataColumn col in ActiveModel.QueryTagMappings.Columns)
                {
                    if (col.ColumnName == "Query")
                    {
                        NewTagMappingRow[col.ColumnName] = NewRow.PK;
                    }
                    else if (col.ColumnName != "PK")
                    {
                        NewTagMappingRow[col.ColumnName] = Row[col.ColumnName];
                    }
                }
                ActiveModel.QueryTagMappings.AddQueryTagMappingsRow(NewTagMappingRow);
            }
            ActiveModel.Queries.AcceptChanges();
            ActiveModel.QueryTagMappings.AcceptChanges();
        }
예제 #2
0
 public QueryWorker(Model m, Model.QueriesRow q)
 {
     try
     {
         ActiveModel       = (Model)m.Copy();
         ActiveQuery       = ActiveModel.Queries.First(p => p.PK == q.PK);
         TriggerController = m.Tags.First(p => p.PK == q.TriggerTag).ControllersRow.Controller;
         Status            = StatusEnum.Good;
     }
     catch (Exception e)
     {
         Status = StatusEnum.Error;
         Log.Error(this, e);
     }
 }
예제 #3
0
        private bool ServiceLogFilter(object item)
        {
            try
            {
                WcfEvent row = (WcfEvent)item;
                if (row.LogLevel == "Trace" && !LogFilterTrace)
                {
                    return(false);
                }
                else if (row.LogLevel == "Debug" && !LogFilterDebug)
                {
                    return(false);
                }
                else if (row.LogLevel == "Info" && !LogFilterInfo)
                {
                    return(false);
                }
                else if (row.LogLevel == "Warn" && !LogFilterWarn)
                {
                    return(false);
                }
                else if (row.LogLevel == "Error" && !LogFilterError)
                {
                    return(false);
                }
                else if (row.LogLevel == "Fatal" && !LogFilterFatal)
                {
                    return(false);
                }

                Model.QueriesRow Row = ActiveModel.Queries.FindByPK(row.Query);
                if (Row != null && !Row.Logged)
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(true);
            }
        }
예제 #4
0
        private void btnAddQuery_Click(object sender, RoutedEventArgs e)
        {
            QueryConfigPopup popup = new QueryConfigPopup();
            var vm = this.DataContext as MainWindowViewModel;

            Model.QueriesRow NewRow = vm.ActiveModel.Queries.NewQueriesRow();
            NewRow.Name        = "New Query";
            NewRow.MappingType = "";
            NewRow.MaxRows     = 1;
            NewRow.QueryText   = "";
            NewRow.QueryType   = "";
            NewRow.RefreshRate = 5000;
            vm.ActiveModel.Queries.AddQueriesRow(NewRow);


            popup.DataContext = new QueryPopupViewModel()
            {
                CurrentQuery = NewRow,
            };
            popup.ShowDialog();
        }