Exemple #1
0
        public static DateTime[] GetDateRangeByQueueField(QueueQuery queueQuery, string queueFieldName)
        {
            DateTime[] dateRange = new DateTime[0];

            QueueFilter filter = queueQuery.QueueFilters.Find(f => f.Filter1.FieldName == queueFieldName && f.Filter1.QueueFilterOperator == QueueFilterOperator.DateRange);

            if (filter != null)
            {
                int dateFilterIndex;
                if (int.TryParse(filter.Filter1.Value, out dateFilterIndex) == true)
                {
                    dateRange = GetDateRangeByDateFilterIndex(dateFilterIndex);
                }
                else
                {
                    DateTime startDate       = DateTime.MinValue;
                    DateTime endDate         = DateTime.MaxValue;
                    string[] dateRangeValues = filter.Filter1.Value.Split('|');
                    DateTime.TryParse(dateRangeValues[0], out startDate);
                    DateTime.TryParse(dateRangeValues[1], out endDate);
                    dateRange = new DateTime[] { startDate, endDate };
                }
            }

            return(dateRange);
        }
Exemple #2
0
 public void Initialize(Task task)
 {
     this.task      = task;
     filter         = task.GetFilter();
     task.Scheduler = Scheduler.EarliestTime;
     fixPacketQueue.ConnectInbound(task);
     heartbeatTimer = Factory.Parallel.CreateTimer("Heartbeat", task, HeartbeatTimerEvent);
     IncreaseHeartbeat();
     task.Start();
     ListenToFIX();
     MainLoopMethod = Invoke;
     if (debug)
     {
         log.Debug("Starting FIX Simulator.");
     }
     if (allTests)
     {
         foreach (var kvp in simulators)
         {
             var simulator = kvp.Value;
             if (!simulator.Enabled && simulator.Minimum > 0)
             {
                 log.Error(simulator + " is disabled");
             }
         }
         if (!simulateReceiveFailed)
         {
             log.Error("SimulateReceiveFailed is disabled.");
         }
         if (!simulateSendFailed)
         {
             log.Error("SimulateSendFailed is disabled.");
         }
     }
 }
Exemple #3
0
 public void Initialize(Task task)
 {
     this.task      = task;
     task.Scheduler = Scheduler.EarliestTime;
     filter         = task.GetFilter();
     task.Start();
     task.Pause();
 }
Exemple #4
0
        /// <summary>
        /// Custom filters for Report Queues (In Progress, Administrator, My Reports, Pending Approval)
        /// </summary>
        public static Expression <Func <Report, bool> > ReportCustomFilterExpression(QueueFilter queueFilter)
        {
            var filter = (queueFilter != null && queueFilter.Filter1 != null) ? queueFilter.Filter1 : null;

            if (filter == null || string.IsNullOrEmpty(filter.Value))
            {
                return(report => true);
            }

            QueueMap queueFieldMap;

            if (GetQueueMapping <Report>(filter.FieldName, out queueFieldMap))
            {
                return(null);
            }

            if (queueFieldMap == null || !queueFieldMap.CustomFilter)
            {
                return(report => true);
            }

            if (filter.FieldName == "reportingOfficerName")
            {
                return(ReportQueuesCustomExpressions.ReportingOfficerNameExpression(filter));
            }

            if (filter.FieldName == "reportingOfficerId")
            {
                return(ReportQueuesCustomExpressions.ReportingOfficerIdExpression(filter));
            }

            if (filter.FieldName == "agency")
            {
                return(ReportQueuesCustomExpressions.AgencyExpression(filter));
            }

            if (filter.FieldName == "moduleType")
            {
                return(ReportQueuesCustomExpressions.ModuleTypeExpression(filter));
            }

            if (filter.FieldName == "priority")
            {
                return(ReportQueuesCustomExpressions.PriorityExpression(filter));
            }

            if (filter.FieldName == "workflowInstanceReportState")
            {
                return(ReportQueuesCustomExpressions.ReportStateExpression(filter));
            }

            if (filter.FieldName == "createdBy")
            {
                return(ReportQueuesCustomExpressions.ReportCreatorsExpression(filter));
            }

            return(report => true);
        }
Exemple #5
0
        protected virtual void StartAppendThread()
        {
            string baseName = Path.GetFileNameWithoutExtension(tickFile.FileName);

            appendTask           = Factory.Parallel.Loop(baseName + " writer", OnException, Invoke);
            filter               = appendTask.GetFilter();
            appendTask.Scheduler = Scheduler.EarliestTime;
            writeQueue.ConnectInbound(appendTask);
            appendTask.Start();
        }
 public void Initialize(Task task)
 {
     this.task      = task;
     filter         = task.GetFilter();
     task.Scheduler = Scheduler.EarliestTime;
     task.Start();
     if (debug)
     {
         log.Debug("Starting Provider Simulator Support.");
     }
 }
 public void Initialize(Task task)
 {
     this.task      = task;
     filter         = task.GetFilter();
     task.Scheduler = Scheduler.EarliestTime;
     quotePacketQueue.ConnectInbound(task);
     task.Start();
     ListenToQuotes();
     if (debug)
     {
         log.Debug("Starting FIX Simulator.");
     }
 }
Exemple #8
0
        public void Test_GetSortedTransaction_HavingAnActiveTransaction()
        {
            var transactionQueue = new Mock <ITransactionQueueRepository>();
            var sortStrategy     = new Mock <ISortStrategy>();
            var Ipriority        = new Mock <IPriorityRules>();

            TestDataGeneratorTransaction testData = new TestDataGeneratorTransaction();
            var activepending = testData.GetPendingTransaction();
            var active        = testData.GetActiveTransaction();
            var hold          = testData.GetHoldTransaction();
            var priority      = testData.GetTransactionPriority();

            Ipriority.Setup(x => x.GetPriorityRules()).Returns(priority);

            var queueFilter = new QueueFilter(Ipriority.Object, transactionQueue.Object);
        }
Exemple #9
0
        //Summary StoryId <> Default Sort Functionality by Status and Type
        public void Test_DefaultSorting_OrderBySmartColLocation(string PatientName1, string PatientName2, string PatientName3)
        {
            var tq   = new Mock <ITransactionQueueRepository>();
            var tp   = new Mock <IPriorityRules>();
            var mock = new Mock <ISortStrategy>();
            //var ISA = new Mock<List<int?>>();
            string sortedColumnName = string.Empty;
            int    sortedDirection  = 1;
            int    page             = 1;
            int    pageSize         = 10;
            TestDataGeneratorQueueFilter testDataGenerator = new TestDataGeneratorQueueFilter();
            var transactionQueueEntities = testDataGenerator.GetTransactionQueueEntityByColumn();
            var transactionPriorities    = testDataGenerator.GetTransactionPriorityEntity();

            //tq.Setup(x => x.GetTransactionsByISAId(ISA.Object)).Returns(transactionQueueEntities);
            tp.Setup(x => x.GetPriorityRules()).Returns(transactionPriorities);

            IQueueFilter queueFilter = new QueueFilter(tp.Object, tq.Object);
            SortedQueue  sortedqueue = queueFilter.GetAllSortedTransaction(transactionQueueEntities, sortedColumnName, sortedDirection, page, pageSize);

            Assert.Equal(PatientName1, sortedqueue.QueueList[0].Location);
            Assert.Equal(PatientName2, sortedqueue.QueueList[1].Location);
            Assert.Equal(PatientName3, sortedqueue.QueueList[2].Location);
        }
Exemple #10
0
        /// <summary>
        /// Build up a dynamic linq expression based based up queue filtering
        /// </summary>
        public static QueuePredicate GetQueuePredicate <T>(QueueFilter queueFilter)
        {
            var expression1 = GetExpressionForFilter <T>(queueFilter.Filter1);
            var expression2 = GetExpressionForFilter <T>(queueFilter.Filter2);

            if (expression1 == null && expression2 == null)
            {
                return(null);
            }

            const string param1 = "(@0)";
            const string param2 = "(@1)";

            if (expression1 != null)
            {
                expression1 += param1;
            }

            if (expression2 != null)
            {
                expression2 += param2;
            }

            var predicate           = new QueuePredicate();
            var bothConditionsExist = (expression1 != null && expression2 != null);

            switch (queueFilter.FilterLogic)
            {
            case FilterLogic.And:

                if (bothConditionsExist)
                {
                    predicate.Predicate = expression1 + " and " + expression2;
                }
                else
                {
                    predicate.Predicate = expression1 ?? expression2;
                }

                break;

            case FilterLogic.Or:

                if (bothConditionsExist)
                {
                    predicate.Predicate = expression1 + " or " + expression2;
                }
                else
                {
                    predicate.Predicate = expression1 ?? expression2;
                }

                break;
            }

            if (predicate.Predicate == null)
            {
                return(null);                             // ensure that the predicate was populated
            }
            // build up params
            if (bothConditionsExist)
            {
                if (queueFilter.Filter1 == null || string.IsNullOrEmpty(queueFilter.Filter1.Value))
                {
                    return(null);
                }
                if (queueFilter.Filter2 == null || string.IsNullOrEmpty(queueFilter.Filter2.Value))
                {
                    return(null);
                }

                predicate.PredicateParms = new object[] { queueFilter.Filter1.Value, queueFilter.Filter2.Value };
            }
            else if (expression1 != null)
            {
                if (queueFilter.Filter1 == null || string.IsNullOrEmpty(queueFilter.Filter1.Value))
                {
                    return(null);
                }

                predicate.PredicateParms = new object[] { queueFilter.Filter1.Value };
            }
            else
            {
                if (queueFilter.Filter2 == null || string.IsNullOrEmpty(queueFilter.Filter2.Value))
                {
                    return(null);
                }

                predicate.PredicateParms = new object[] { queueFilter.Filter2.Value };
            }

            return(predicate);
        }
Exemple #11
0
        public static Expression <Func <T, bool> > SummaryQueueCustomFilterExpression <T>(QueueFilter queueFilter, params Func <Filter, Expression <Func <T, bool> > >[] customFilterExpressions) where T : Summary
        {
            var filter = (queueFilter != null && queueFilter.Filter1 != null) ? queueFilter.Filter1 : null;

            if (filter == null || string.IsNullOrEmpty(filter.Value))
            {
                return(summary => true);
            }

            QueueMap queueFieldMap;

            if (GetQueueMapping <T>(filter.FieldName, out queueFieldMap))
            {
                return(null);
            }

            if (queueFieldMap == null || !queueFieldMap.CustomFilter)
            {
                return(summary => true);
            }

            if (filter.FieldName == "agency")
            {
                return(SummeryQueueCustomExpressions <T> .AgencyExpression(filter));
            }
            if (customFilterExpressions != null)
            {
                foreach (var e in customFilterExpressions)
                {
                    Expression <Func <T, bool> > result = e(filter);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }
            return(summary => true);
        }
Exemple #12
0
 public static Expression <Func <CitationSummary, bool> > CitationQueueCustomFilterExpression(QueueFilter queueFilter)
 {
     return(SummaryQueueCustomFilterExpression <CitationSummary>(queueFilter));
 }
Exemple #13
0
 public static Expression <Func <CallForServiceSummary, bool> > CallForServiceQueueCustomFilterExpression(QueueFilter queueFilter)
 {
     return(SummaryQueueCustomFilterExpression <CallForServiceSummary>(queueFilter));
 }
        public AggregatedViewResponse GetAggregatedView(AggregatedViewRequest request)
        {
            ExTraceGlobals.DiagnosticsAggregationTracer.TraceFunction <string, string, string>(0L, "GetAggregatedView called. ClientMachineName={0}; ClientProcessName={1}; ClientProcessId={2}", (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientMachineName, (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientProcessName, (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientProcessId.ToString());
            AggregatedViewResponse response = null;

            this.ServiceRequest(delegate
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                this.log.LogOperationFromClient(DiagnosticsAggregationEvent.AggregatedViewRequestReceived, request.ClientInformation, null, "");
                DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNull(request, "request");
                DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNullOrEmpty(request.RequestType, "request.RequestType");
                RequestType requestType;
                bool flag = Enum.TryParse <RequestType>(request.RequestType, out requestType);
                if (!flag || requestType != RequestType.Queues)
                {
                    throw DiagnosticsAggregationServiceImpl.NewUnsupportedParameterFault(request.RequestType, "request.RequestType");
                }
                DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNull(request.QueueAggregatedViewRequest, "request.QueueAggregatedViewRequest");
                IQueueFilter filter;
                if (!QueueFilter.TryParse(request.QueueAggregatedViewRequest.QueueFilter, out filter))
                {
                    throw DiagnosticsAggregationServiceImpl.NewInvalidParameterFault(request.QueueAggregatedViewRequest.QueueFilter, "request.QueueAggregatedViewRequest.QueueFilter");
                }
                DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNullOrEmpty(request.QueueAggregatedViewRequest.GroupByKey, "request.QueueAggregatedViewRequest.GroupByKey");
                QueueDigestGroupBy groupByKey;
                if (!Enum.TryParse <QueueDigestGroupBy>(request.QueueAggregatedViewRequest.GroupByKey, out groupByKey))
                {
                    throw DiagnosticsAggregationServiceImpl.NewUnsupportedParameterFault(request.QueueAggregatedViewRequest.GroupByKey, "request.QueueAggregatedViewRequest.GroupByKey");
                }
                DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNullOrEmpty(request.QueueAggregatedViewRequest.DetailsLevel, "request.QueueAggregatedViewRequest.DetailsLevel");
                DetailsLevel detailsLevel;
                if (!Enum.TryParse <DetailsLevel>(request.QueueAggregatedViewRequest.DetailsLevel, out detailsLevel))
                {
                    throw DiagnosticsAggregationServiceImpl.NewUnsupportedParameterFault(request.QueueAggregatedViewRequest.DetailsLevel, "request.QueueAggregatedViewRequest.DetailsLevel");
                }
                QueueAggregator queueAggregator = new QueueAggregator(groupByKey, detailsLevel, filter, new TimeSpan?(this.GetTimeSpanForQueueDataBeingCurrent()));
                bool flag2 = request.ServersToInclude != null && request.ServersToInclude.Count > 0;
                HashSet <string> hashSet = flag2 ? new HashSet <string>(request.ServersToInclude, StringComparer.InvariantCultureIgnoreCase) : new HashSet <string>();
                IDictionary <ADObjectId, ServerQueuesSnapshot> currentGroupServerToQueuesMap = this.groupQueuesDataProvider.GetCurrentGroupServerToQueuesMap();
                currentGroupServerToQueuesMap.Add(this.localQueuesDataProvider.GetLocalServerId(), this.localQueuesDataProvider.GetLocalServerQueues());
                List <ServerSnapshotStatus> list = new List <ServerSnapshotStatus>();
                foreach (KeyValuePair <ADObjectId, ServerQueuesSnapshot> keyValuePair in currentGroupServerToQueuesMap)
                {
                    ADObjectId key             = keyValuePair.Key;
                    ServerQueuesSnapshot value = keyValuePair.Value;
                    if (!flag2 || hashSet.Contains(key.ToString()))
                    {
                        string message;
                        if (value.IsEmpty())
                        {
                            value.SetAsFailed(DiagnosticsAggregationServiceImpl.NewFault(ErrorCode.LocalQueueDataNotAvailable, value.LastError).Detail.ToString());
                        }
                        else if (this.LocalQueueDataTooOld(value.TimeStampOfQueues, out message))
                        {
                            value.SetAsFailed(DiagnosticsAggregationServiceImpl.NewFault(ErrorCode.LocalQueueDataTooOld, message).Detail.ToString());
                        }
                        else
                        {
                            queueAggregator.AddLocalQueues(value.Queues, value.TimeStampOfQueues);
                        }
                        list.Add(value.GetServerSnapshotStatus());
                    }
                }
                response = new AggregatedViewResponse(list);
                response.QueueAggregatedViewResponse = new QueueAggregatedViewResponse(queueAggregator.GetResultSortedByMessageCount(request.ResultSize));
                stopwatch.Stop();
                this.log.LogOperationFromClient(DiagnosticsAggregationEvent.AggregatedViewResponseSent, request.ClientInformation, new TimeSpan?(stopwatch.Elapsed), "");
            }, "GetAggregatedView", request.ClientInformation);
            return(response);
        }
Exemple #15
0
 public static Expression <Func <IncidentSummary, bool> > IncidentQueueCustomFilterExpression(QueueFilter queueFilter)
 {
     return(SummaryQueueCustomFilterExpression <IncidentSummary>(queueFilter,
                                                                 f => (f.FieldName == "reportingOfficerName" || f.FieldName == "reportingOfficerId") ? SummeryQueueCustomExpressions <IncidentSummary> .ReportingOfficerExpression(f) : null,
                                                                 f => (f.FieldName == "assistingOfficerName" || f.FieldName == "assistingOfficerId")?SummeryQueueCustomExpressions <IncidentSummary> .OfficerExpression(f, OfficerInvolvementTypes.Assisting.Code):null,
                                                                 f => (f.FieldName == "approvingOfficerName" || f.FieldName == "approvingOfficerId")?SummeryQueueCustomExpressions <IncidentSummary> .OfficerExpression(f, OfficerInvolvementTypes.Approving.Code):null,
                                                                 f => (f.FieldName == "investigatingOfficerName" || f.FieldName == "investigatingOfficerId")?SummeryQueueCustomExpressions <IncidentSummary> .OfficerExpression(f, OfficerInvolvementTypes.Investigating.Code):null,
                                                                 f => (f.FieldName == "supplementingOfficerName" || f.FieldName == "supplementingOfficerId") ? SummeryQueueCustomExpressions <IncidentSummary> .SupplementingOfficerExpression(f) : null
                                                                 ));
 }
Exemple #16
0
 public static Expression <Func <ArrestSummary, bool> > ArrestQueueCustomFilterExpression(QueueFilter queueFilter)
 {
     return(SummaryQueueCustomFilterExpression <ArrestSummary>(queueFilter,
                                                               f => (f.FieldName == "reportingOfficerName" || f.FieldName == "reportingOfficerId") ? SummeryQueueCustomExpressions <ArrestSummary> .ReportingOfficerExpression(f) : null,
                                                               f => (f.FieldName == "supplementingOfficerName" || f.FieldName == "supplementingOfficerId") ? SummeryQueueCustomExpressions <ArrestSummary> .SupplementingOfficerExpression(f) : null));
 }
Exemple #17
0
        public static Expression <Func <Case, bool> > CaseQueueCustomFilterExpression(QueueFilter queueFilter)
        {
            var filter = (queueFilter != null && queueFilter.Filter1 != null) ? queueFilter.Filter1 : null;

            if (filter == null || string.IsNullOrEmpty(filter.Value))
            {
                return(summary => true);
            }

            QueueMap queueFieldMap;

            if (GetQueueMapping <Case>(filter.FieldName, out queueFieldMap))
            {
                return(null);
            }

            if (queueFieldMap == null || !queueFieldMap.CustomFilter)
            {
                return(summary => true);
            }

            if (filter.FieldName == "agency")
            {
                return(CaseQueueCustomExpressions.AgencyExpression(filter));
            }

            return(summary => true);
        }