Esempio n. 1
0
        public void SetupLCCensus(Predicate <CensusIndividual> relationFilter, bool showEnteredLostCousins, Predicate <Individual> individualRelationFilter)
        {
            LostCousins = true;
            Predicate <CensusIndividual> predicate;
            Predicate <Individual>       individualPredicate;

            if (showEnteredLostCousins)
            {
                predicate           = x => x.IsLostCousinsEntered(CensusDate, false);
                individualPredicate = x => x.IsLostCousinsEntered(CensusDate, false);
            }
            else
            {
                predicate           = x => x.MissingLostCousins(CensusDate, false);
                individualPredicate = x => x.MissingLostCousins(CensusDate, false);
            }
            Predicate <CensusIndividual> filter           = FilterUtils.AndFilter(relationFilter, predicate);
            Predicate <Individual>       individualFilter = FilterUtils.AndFilter(individualRelationFilter, individualPredicate);
            IEnumerable <CensusFamily>   censusFamilies   = ft.GetAllCensusFamilies(CensusDate, true, false);
            List <CensusIndividual>      individuals      = censusFamilies.SelectMany(f => f.Members).Filter(filter).ToList();

            individuals = FilterDuplicateIndividuals(individuals);
            List <Individual> listToCheck = ft.AllIndividuals.Filter(individualFilter).ToList();

            //CompareLists(individuals, listToCheck);
            RecordCount = individuals.Count;
            SetupDataGridView(true, individuals);
        }
Esempio n. 2
0
        public void ApplyFilter(string filter)
        {
            var filterSet = FilterUtils.ParseTestFilterSet(filter);
            var command   = commandFactory.CreateApplyFilterCommand(filterSet);

            taskManager.QueueTask(command);
        }
Esempio n. 3
0
        /// <summary>
        /// Enables the corresponding UI Menu depending on game's new state
        /// </summary>
        /// <param name="newGameState"></param>
        public void OnGameStateChange(GameStates newGameState)
        {
            if (!FilterUtils.CheckGameStateChange(gameplayData.currentState, newGameState))
            {
                return;
            }

            Debug.Log("[UI_Manager] Game state changed to: " + newGameState);

            currentVisibleMenu.gameObject.SetActive(false);

            switch (newGameState)
            {
            case GameStates.MENU:
                mainMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = mainMenuPanel;
                break;

            case GameStates.SHOP:
                shopPanel.gameObject.SetActive(true);
                currentVisibleMenu = shopPanel;
                break;

            case GameStates.CREDITS:
                creditsPanel.gameObject.SetActive(true);
                currentVisibleMenu = creditsPanel;
                break;

            case GameStates.PRE_PLAY:
                prePlayMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = prePlayMenuPanel;
                break;

            case GameStates.FTUE:
                throw new System.NotImplementedException(
                          "[UI Manager] FTUE Menu functionality" +
                          "not implemented yet");
                break;

            case GameStates.PLAYING:
                gameplayMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = gameplayMenuPanel;
                break;

            case GameStates.PAUSE:
                pauseMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = pauseMenuPanel;
                break;

            case GameStates.GAME_OVER:
                gameOverMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = gameOverMenuPanel;
                break;

            default:
                gameplayMenuPanel.gameObject.SetActive(true);
                currentVisibleMenu = gameplayMenuPanel;
                break;
            }
        }
Esempio n. 4
0
        public Predicate <T> BuildFilter <T>(Func <T, int> relationType)
        {
            List <Predicate <T> > relationFilters = new List <Predicate <T> >();

            if (Blood)
            {
                relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.BLOOD));
            }
            if (Directs)
            {
                relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.DIRECT));
            }
            if (Marriage)
            {
                relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.MARRIAGE));
            }
            if (MarriedToDB)
            {
                relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.MARRIEDTODB));
            }
            if (Unknown)
            {
                relationFilters.Add(FilterUtils.IntFilter <T>(relationType, Individual.UNKNOWN));
            }
            return(FilterUtils.OrFilter <T>(relationFilters));
        }
        private void ApplyFilter(IProgressMonitor progressMonitor, FilterInfo filterInfo)
        {
            var filterSet = FilterUtils.ParseTestFilterSet(filterInfo.FilterExpr);
            var command   = commandFactory.CreateApplyFilterCommand(filterSet);

            command.Execute(progressMonitor);
        }
Esempio n. 6
0
        public Predicate <T> BuildFilter <T>(FactDate when, Func <FactDate, T, FactLocation> location)
        {
            Predicate <T> locationFilter = FilterUtils.TrueFilter <T>();

            string country(FactLocation x) => x.Country;

            if (Scotland)
            {
                locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.SCOTLAND);
            }
            else if (England)
            {
                locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.ENGLAND);
            }
            else if (Wales)
            {
                locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.WALES);
            }
            else if (UK)
            {
                locationFilter = FilterUtils.OrFilter <T>(FilterUtils.LocationFilter <T>(when, location, country, Countries.SCOTLAND),
                                                          FilterUtils.LocationFilter <T>(when, location, country, Countries.ENGLAND),
                                                          FilterUtils.LocationFilter <T>(when, location, country, Countries.WALES));
            }
            else if (Canada)
            {
                locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.CANADA);
            }
            else if (USA)
            {
                locationFilter = FilterUtils.LocationFilter <T>(when, location, country, Countries.UNITED_STATES);
            }
            return(locationFilter);
        }
Esempio n. 7
0
        public void RegularExpressions(string filter, string parsedFilterString)
        {
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), parsedFilterString);
        }
Esempio n. 8
0
        public void FilterSets(string filterSetExpr, string parsedFilterSetString)
        {
            FilterSet <ITestDescriptor> parsedFilterSet = FilterUtils.ParseTestFilterSet(filterSetExpr);

            Assert.IsNotNull(parsedFilterSet);
            Assert.AreEqual(parsedFilterSetString, parsedFilterSet.ToFilterSetExpr());
        }
Esempio n. 9
0
        public Predicate <Family> BuildFamilyFilter <Family>(Func <Family, IEnumerable <int> > relationTypes)
        {
            List <Predicate <Family> > relationFilters = new List <Predicate <Family> >();

            if (Blood)
            {
                relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.BLOOD));
            }
            if (Directs)
            {
                relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.DIRECT));
            }
            if (Marriage)
            {
                relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.MARRIAGE));
            }
            if (MarriedToDB)
            {
                relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.MARRIEDTODB));
            }
            if (Unknown)
            {
                relationFilters.Add(FilterUtils.FamilyRelationFilter <Family>(relationTypes, Individual.UNKNOWN));
            }
            return(FilterUtils.OrFilter <Family>(relationFilters));
        }
Esempio n. 10
0
            public async Task <IHandlerResult> ExecuteAsync(MiddlewareData middlewareData)
            {
                var filters      = _method.GetCustomAttributes <FilterAttribute>();
                var filterResult = await FilterUtils.ExecuteFilters(filters, _serviceProvider, middlewareData);

                if (filterResult.Action == FilterAction.SkipHandler)
                {
                    return(null);
                }

                if (filterResult.Action == FilterAction.BreakExecution)
                {
                    return(filterResult.MiddlewareData
                           .Map(HandlerResultCreators.UpdateMiddlewareData)
                           .OrElseGet(HandlerResultCreators.Empty));
                }

                var parameters = _parametersMatcher.MatchParameters(filterResult.MiddlewareData.Value, _method.GetParameters());

                if (!parameters.IsPresent)
                {
                    return(null);
                }

                var instance = _serviceProvider.GetInstance(_method.DeclaringType);
                var result   = _method.Invoke(instance, parameters.Value.Select(v => v.Value).ToArray());

                if (result is Task task)
                {
                    return(await task.ContinueWith(PrepareResult));
                }
                return(PrepareResult(result));
            }
Esempio n. 11
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void Run()
        {
            try
            {
                foreach (DataRow dr in DatabaseManager.prsOnPOsDt.Rows)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }

                    string[] strPoCreateDt   = (dr["PO Line Creat#DT"].ToString()).Split('/');
                    int      poCreateDtYear  = int.Parse(strPoCreateDt[2]);
                    int      poCreateDtMonth = int.Parse(strPoCreateDt[0]);
                    int      poCreateDtDay   = int.Parse(strPoCreateDt[1]);

                    //////////////////////////////////////////////////////////////////////////////
                    //
                    // The below if statement was added on 03/27/2018.
                    // -----------------------------------------------
                    // There was some issues with a few POs that conatined dates of 00/00/0000
                    // that were causing erros. This if else statement ignores those files.
                    //
                    //////////////////////////////////////////////////////////////////////////////
                    if (poCreateDtDay == 0 && poCreateDtMonth == 0 && poCreateDtYear == 0)
                    {
                        // This situation is a SAP issue. We should never have POs that dont
                        // have a PO creation date.
                        // Skip these records
                        continue;
                    }
                    else
                    {
                        // trim the zeros off of month and day if there is any.
                        poCreateDtMonth = int.Parse(strPoCreateDt[0].Trim('0'));
                        poCreateDtDay   = int.Parse(strPoCreateDt[1].Trim('0'));
                    }


                    DateTime poCreateDate = new DateTime(poCreateDtYear, poCreateDtMonth, poCreateDtDay);

                    template.TotalValue += decimal.Parse(dr["PO Value"].ToString());

                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (poCreateDate - today).TotalDays;
                    double   weeks       = Math.Floor(elapsedDays / 7);

                    // apply the weeks against the time span conditions
                    template.TimeSpanDumpV2(weeks, dr);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Other -> Total Spend - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
 public CheckInPageModel(CheckInListModel itemListModel, CheckInFilter filter, MapItem mapItem)
 {
     this.MapItemId   = mapItem.Id;
     this.TerritoryId = mapItem.TerritoryId;
     this.ListModel   = itemListModel;
     this.Pager       = FilterUtils.GetPager(itemListModel.PageCount, itemListModel.PageIndex);
     this.Filter      = filter;
 }
Esempio n. 13
0
        public void SetupLCDuplicates(Predicate <Individual> relationFilter)
        {
            Predicate <Individual> lcFacts     = i => i.DuplicateLCFacts > 0;
            Predicate <Individual> filter      = FilterUtils.AndFilter <Individual>(relationFilter, lcFacts);
            List <Individual>      individuals = ft.AllIndividuals.Filter(filter).ToList();

            SetIndividuals(individuals, "Lost Cousins with Duplicate Facts");
        }
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void RunOverall()
        {
            try
            {
                DataTable dt        = KpaUtils.PurchTotalQueries.GetPrReleaseToConfirmationEntry();
                double    totalDays = 0;

                foreach (DataRow dr in dt.Rows)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }


                    #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK

                    string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/');
                    int      prFullyRelYear    = int.Parse(strPrFullyRelDate[2]);
                    int      prFullyRelMonth   = int.Parse(strPrFullyRelDate[0]);
                    int      prFullyRelDay     = int.Parse(strPrFullyRelDate[1]);


                    if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0)
                    {
                        // This PR line or PR in general might have been delted
                        continue;
                    }


                    #endregion

                    DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay);

                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (today - prFullyRelDt).TotalDays;
                    totalDays  += elapsedDays;
                    elapsedDays = (int)elapsedDays;

                    // Apply the elapsed days against the time spand conditions
                    template.TimeSpanDump(elapsedDays);
                }

                // Calculate the average for this KPA
                template.CalculateAverage(totalDays);

                dt.Rows.Clear();
                dt = null;
                GC.Collect();
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Purch Total -> PR Release To Confirmation Entry - Average Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Esempio n. 15
0
        private FilterSet <ITestDescriptor> GetFilterSet()
        {
            if (String.IsNullOrEmpty(Filter))
            {
                return(FilterSet <ITestDescriptor> .Empty);
            }

            return(FilterUtils.ParseTestFilterSet(Filter));
        }
Esempio n. 16
0
        public void SetupLCDuplicates(Predicate <Individual> relationFilter)
        {
            bool lcFacts(Individual i) => i.DuplicateLCFacts > 0;

            Predicate <Individual> filter      = FilterUtils.AndFilter <Individual>(relationFilter, lcFacts);
            List <Individual>      individuals = FamilyTree.Instance.AllIndividuals.Filter(filter).ToList();

            SetIndividuals(individuals, "Lost Cousins with Duplicate Facts");
        }
Esempio n. 17
0
        public void ParseNoEqual()
        {
            var result = FilterUtils.ParseQuery("aline ne 1");

            Assert.Equal("aline", result.field);
            Assert.Equal(FilterOperator.ne, result.opera);
            Assert.Equal(1, int.Parse(result.value));
            Assert.True(true);
        }
Esempio n. 18
0
        public void ExactType(string filterType, bool shouldMatch)
        {
            string filter = filterType + "Type:" + fixture3TypeName;
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsTrue(parsedFilter.IsMatch(fixture3));
            Assert.AreEqual(parsedFilter.IsMatch(fixture4), shouldMatch);
            Assert.AreEqual(parsedFilter.ToString(), "Type(Equality('" + fixture3TypeName + "'), "
                            + (filterType == "Exact" ? "False" : "True") + ")");
        }
        /// <summary>
        /// Runs the comparison report against the supplied filter
        /// </summary>
        /// <param name="_fitler">The filter we want to run against this KPA</param>
        /// <param name="_option">The filter option where this fitler was obtained</param>
        public override void RunComparison(string _filter, FilterOptions.Options _filterOption)
        {
            try
            {
                // Remove any apostrophe's from the filter or an exception will be thrown
                CleanFilter(ref _filter);

                // Get the filtered data rows from the datatable
                DataRow[] filteredResult = DatabaseManager.pr2ndLvlRelDateDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter));

                foreach (DataRow dr in filteredResult)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }


                    #region EVASO_BUT_NOT_FULLY_RELEASED_CHECK

                    string[] strPrFullyRelDate = (dr["PR Fully Rel Date"].ToString()).Split('/');
                    int      prFullyRelYear    = int.Parse(strPrFullyRelDate[2]);
                    int      prFullyRelMonth   = int.Parse(strPrFullyRelDate[0]);
                    int      prFullyRelDay     = int.Parse(strPrFullyRelDate[1]);


                    if (prFullyRelYear == 0 && prFullyRelMonth == 0 && prFullyRelDay == 0)
                    {
                        // This PR line or PR in general might have been delted
                        continue;
                    }


                    #endregion

                    DateTime prFullyRelDt = new DateTime(prFullyRelYear, prFullyRelMonth, prFullyRelDay);
                    template.TotalValue += decimal.Parse(dr["PR Pos#Value"].ToString());

                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (prFullyRelDt - today).TotalDays;
                    double   weeks       = Math.Floor(elapsedDays / 7);


                    // Apply the weeks against the time span conditions
                    template.TimeSpanDump(weeks);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Other -> PRs Released - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Esempio n. 20
0
        public void FilterWithOneValue(string type)
        {
            string filter = "Type:" + type;
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), "Type(Equality('" + type + "'), True)");
            Assert.IsTrue(parsedFilter.IsMatch(fixture1));
            Assert.IsFalse(parsedFilter.IsMatch(fixture2));
            Assert.IsFalse(parsedFilter.IsMatch(fixture3));
        }
Esempio n. 21
0
        public void FilterWithTwoValues(string type1, string type2)
        {
            string filter = "Type:" + type1 + "," + type2;
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), "Type(Or({ Equality('" + type1 + "'), Equality('" + type2 + "') }), True)");
            Assert.IsTrue(parsedFilter.IsMatch(fixture1));
            Assert.IsTrue(parsedFilter.IsMatch(fixture2));
            Assert.IsFalse(parsedFilter.IsMatch(fixture3));
        }
Esempio n. 22
0
        public void NotFilter(string type1, string type2)
        {
            string filter = "Type:" + type1 + " and not Type:" + type2;
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), "And({ Type(Equality('" + type1 + "'), True), Not(Type(Equality('" + type2 + "'), True)) })");
            Assert.IsTrue(parsedFilter.IsMatch(fixture1));
            Assert.IsFalse(parsedFilter.IsMatch(fixture2));
            Assert.IsFalse(parsedFilter.IsMatch(fixture3));
        }
Esempio n. 23
0
        public void ComplexFilter2()
        {
            string filter = "not ((Type: " + fixture1TypeName + ") or (Type: " + fixture2TypeName + ")) and Type:" + fixture3TypeName + "";
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), "And({ Not(Or({ Type(Equality('" + fixture1TypeName + "'), True), Type(Equality('" + fixture2TypeName + "'), True) })), Type(Equality('" + fixture3TypeName + "'), True) })");
            Assert.IsFalse(parsedFilter.IsMatch(fixture1));
            Assert.IsFalse(parsedFilter.IsMatch(fixture2));
            Assert.IsTrue(parsedFilter.IsMatch(fixture3));
        }
Esempio n. 24
0
        public void RoundTripFormatting(string filterExpr)
        {
            Filter <ITestDescriptor> filter = FilterUtils.ParseTestFilter(filterExpr);

            string formattedFilterExpression = filter.ToFilterExpr();
            Filter <ITestDescriptor> filterFromFormattedFilterExpression = FilterUtils.ParseTestFilter(formattedFilterExpression);

            // The exact filter expression may be different (redundant parentheses are lost for
            // example), so we compare the final structure of the filters created by parsing the
            // original expression and the formatted filter expression
            Assert.AreEqual(filterFromFormattedFilterExpression.ToString(), filter.ToString());
        }
Esempio n. 25
0
        public void AnyFilterIsReturnedForStar()
        {
            string filter = "*";
            Filter <ITestDescriptor> parsedFilter = FilterUtils.ParseTestFilter(filter);

            Assert.IsNotNull(parsedFilter);
            Assert.AreEqual(parsedFilter.ToString(), "Any()");
            Assert.AreSame(parsedFilter.GetType(), typeof(AnyFilter <ITestDescriptor>));
            Assert.IsTrue(parsedFilter.IsMatch(fixture1));
            Assert.IsTrue(parsedFilter.IsMatch(fixture2));
            Assert.IsTrue(parsedFilter.IsMatch(fixture3));
        }
Esempio n. 26
0
        /// <summary>
        /// Runs the comparison report against the supplied filter
        /// </summary>
        /// <param name="_fitler">The filter we want to run against this KPA</param>
        /// <param name="_option">The filter option where this fitler was obtained</param>
        public override void RunComparison(string _filter, FilterOptions.Options _filterOption)
        {
            try
            {
                DataTable dt        = KpaUtils.ExcessStockStockQueries.GetPrsAgingNotReleased();
                double    totalDays = 0;

                // remove any apostraphe's from the filter as an exception will be thrown.
                CleanFilter(ref _filter);

                // Get the fitlered data rows from the datatable
                DataRow[] filteredResult = dt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter));

                foreach (DataRow dr in filteredResult)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }

                    string[] reqCreationDate = (dr["Requisn Date"].ToString()).Split('/');
                    int      year            = int.Parse(reqCreationDate[2]);
                    int      month           = int.Parse(reqCreationDate[0].TrimStart('0'));
                    int      day             = int.Parse(reqCreationDate[1].TrimStart('0'));

                    DateTime reqDate     = new DateTime(year, month, day);
                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (today - reqDate).TotalDays;
                    totalDays  += elapsedDays;
                    elapsedDays = (int)elapsedDays;

                    // Apply the elapsed days against the time span conditions
                    template.TimeSpanDump(elapsedDays);
                }


                // Calculate the average for this KPA
                template.CalculateAverage(totalDays);

                dt.Rows.Clear();
                dt = null;
                GC.Collect();
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Excess Stock - Stock -> PRs Aging (Not Released) - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Calculates the overall report for this KPA
        /// </summary>
        public override void RunOverall()
        {
            try
            {
                DataTable dt        = KpaUtils.FollowUpQueries.GetDueTodayOrLateToConfirmed();
                double    totalDays = 0;

                foreach (DataRow dr in dt.Rows)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }

                    string[] strDate = (dr["Latest Conf#Dt"].ToString()).Split('/');
                    int      year    = int.Parse(strDate[2]);
                    int      month   = int.Parse(strDate[0].TrimStart('0'));
                    int      day     = int.Parse(strDate[1].TrimStart('0'));

                    DateTime date  = new DateTime(year, month, day);
                    DateTime today = DateTime.Now.Date;

                    if (date > today)
                    {
                        continue;
                    }

                    double elapsedDays = (today - date).TotalDays;
                    totalDays  += elapsedDays;
                    elapsedDays = (int)elapsedDays;

                    // Apply the elapsed days against the time spand conditions
                    template.TimeSpanDump(elapsedDays);
                }

                // Calculate the average for this KPA
                template.CalculateAverage(totalDays);

                dt.Rows.Clear();
                dt = null;
                GC.Collect();
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Folow Up -> Due Today or Late to Confirmed - Overall Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
        protected override void BuildDelegate()
        {
            if (_delegateLock.CurrentCount <= 0)
            {
                // if we alreading building the delegate wait until the delegate is ready.
                _delegateLock.Wait();
                _delegateLock.Release();
                return;
            }

            _delegateLock.Wait();

            var filterFactories = GetFilterFactories();

            var components = filterFactories
                             .Select(a =>
            {
                CommandExceptionDelegate component(CommandExceptionDelegate next)
                {
                    var factory     = a;
                    var factoryType = factory.GetType();

                    return(async ctx =>
                    {
                        var instance = (ICommandExceptionFilter)factory.CreateInstance(ctx.CommandContext.CommandServices);

                        await instance.InvokeAsync(ctx, next);

                        await FilterUtils.SwitchDisposeAsync(instance, factoryType);
                    });
                }

                return((Func <CommandExceptionDelegate, CommandExceptionDelegate>)component);
            })
                             .ToList();

            CommandExceptionDelegate commandExceptionDelegate = ctx =>
            {
                return(Task.CompletedTask);
            };

            foreach (var component in components)
            {
                commandExceptionDelegate = component(commandExceptionDelegate);
            }

            Delegate = commandExceptionDelegate;

            _delegateLock.Release();
        }
        //not picking up
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
        {
            _launcher = new TestLauncher();
            _launcher.RuntimeSetup = new RuntimeSetup();
            //_launcher.TestProject.

            foreach (var test in tests)
            {
                _launcher.AddFilePattern(test.Source);
                _launcher.TestExecutionOptions.FilterSet = FilterUtils.ParseTestFilterSet("ExactType:" + test.DisplayName);
            }

            RunTests(testExecutionRecorder);
        }
Esempio n. 30
0
        /// <summary>
        /// Runs the comparison report against the supplied filter
        /// </summary>
        /// <param name="_fitler">The filter we want to run against this KPA</param>
        /// <param name="_option">The filter option where this fitler was obtained</param>
        public override void RunComparison(string _filter, FilterOptions.Options _filterOption)
        {
            try
            {
                // Remove any apostrophe's from the filter or an exception will be thrown
                CleanFilter(ref _filter);

                // Get the filtered data rows from the datatable
                DataRow[] filteredResult = DatabaseManager.AllDataDt.Select(FilterOptions.GetSelectStatement(_filterOption, _filter));

                foreach (DataRow dr in filteredResult)
                {
                    //Check if the datarow meets the conditions of any applied filters.
                    if (!FilterUtils.EvaluateAgainstFilters(dr))
                    {
                        // This datarow dos not meet the conditions of the filters applied.
                        continue;
                    }

                    // Check if this record is a hot job
                    if (dr["Purch# Group"].ToString() != "UHJ")
                    {
                        continue;
                    }

                    string[] strPrReqDt   = (dr["Requisn Date"].ToString()).Split('/');
                    int      reqDateYear  = int.Parse(strPrReqDt[2]);
                    int      reqDateMonth = int.Parse(strPrReqDt[0].TrimStart('0'));
                    int      reqDateDay   = int.Parse(strPrReqDt[1].TrimStart('0'));

                    DateTime prReqDate = new DateTime(reqDateYear, reqDateMonth, reqDateDay);

                    // Get the total value for this line item
                    template.TotalValue += decimal.Parse(dr["PR Pos#Value"].ToString());

                    DateTime today       = DateTime.Now.Date;
                    double   elapsedDays = (prReqDate - today).TotalDays;
                    double   weeks       = Math.Floor(elapsedDays / 7);

                    // Apply the weeks against the time span conditions
                    template.TimeSpanDump(weeks);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An argument out of range exception was thrown", "Other -> Hot Job PRs - Comparison Run Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }