示例#1
0
        public ResultsModel WhoBuiltWhatDetails(string fromDate, string toDate, int userNumber)
        {
            var from    = DateTime.Parse(fromDate);
            var to      = DateTime.Parse(toDate);
            var results = this.repository
                          .FilterBy(a => a.CreatedBy == userNumber && a.SernosDate >= from && a.SernosDate <= to).ToList();

            var model = new ResultsModel();

            model.AddColumn("articleNumber", "Article Number");
            model.AddColumn("sernosNumber", "Serial Number");
            model.AddColumn("sernosDate", "Date Built");
            model.ReportTitle = new NameModel(
                $"Products built by {results.First().UserName} between {from.ToString("dd-MMM-yyyy")} and {to.ToString("dd-MMM-yyyy")}");
            model.RowHeader = "Part Number Built";

            foreach (var wbw in results.OrderBy(a => a.ArticleNumber).ThenBy(b => b.SernosNumber))
            {
                var row = model.AddRow(wbw.SernosNumber.ToString());
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("articleNumber"), wbw.ArticleNumber);
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("sernosNumber"), wbw.SernosNumber.ToString());
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("sernosDate"), wbw.SernosDate?.ToString("dd-MMM-yyyy"));
            }

            return(model);
        }
        public IActionResult Results(string username)
        {
            username = username.Replace("@", string.Empty);
            ThemeSong theme = new ThemeSong(username);
            Track     track = theme.GetThemeSong();

            if (track != null)
            {
                ResultsModel results = new ResultsModel()
                {
                    Username  = username,
                    Track     = track,
                    ListenUrl = "https://open.spotify.com/embed?uri=spotify:album:" + track.album.id + "&theme=white&view=coverart",
                    Sentiment = theme.GetSentiment()
                };
                return(View(results));
            }
            else
            {
                ResultsModel results = new ResultsModel()
                {
                    Username = username
                };
                return(View("Error", results));
            }
        }
示例#3
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.PartsReportFacadeService.GetPartFailDetailsReport(123, "fw", "tw", "et", "fc", "pn", "de").Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel {
                    ReportTitle = new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/quality/part-fails/detail-report/report",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("supplierId", "123");
                with.Query("fromWeek", "fw");
                with.Query("toWeek", "tw");
                with.Query("errorType", "et");
                with.Query("faultCode", "fc");
                with.Query("partNumber", "pn");
                with.Query("department", "de");
            }).Result;
        }
示例#4
0
 public void SetUp()
 {
     this.result = this.Sut.GetAssemblyFailsMeasuresReport(
         1.June(2020),
         30.June(2020),
         AssemblyFailGroupBy.FaultCode);
 }
示例#5
0
        public async Task <ActionResult> Index(string imageUrl)
        {
            if (!imageUrl.IsEmpty())
            {
                try
                {
                    var isGoat = await _goatDetector.IsGoat(imageUrl);

                    var model = new ResultsModel
                    {
                        IsGoat   = isGoat,
                        ImageUrl = imageUrl,
                        Quote    = isGoat ? (await _goatApiClient.GetQuoteAsync()).Value : null
                    };
                    return(View(model));
                }
                catch (ClientException)
                {
                    return(RedirectToAction("Error"));
                }
                catch (Exception)
                {
                    return(RedirectToAction("Error"));
                }
            }

            return(View());
        }
示例#6
0
        public void SetUp()
        {
            var statistics = new List <PtlStat>
            {
                new PtlStat {
                    PtlPriority = 1, WorkingDays = 0.5m, BuildGroup = "PP"
                },
                new PtlStat {
                    PtlPriority = 1, WorkingDays = 1, BuildGroup = "PP"
                },
                new PtlStat {
                    PtlPriority = 1, WorkingDays = 2.3m, BuildGroup = "PP"
                },
                new PtlStat {
                    PtlPriority = 1, WorkingDays = 10m, BuildGroup = "PP"
                },
                new PtlStat {
                    PtlPriority = 2, WorkingDays = 4.1m, BuildGroup = "PP"
                },
                new PtlStat {
                    PtlPriority = 2, WorkingDays = 4.1m, BuildGroup = "PP"
                }
            };

            this.PtlStatRepository.FilterBy(Arg.Any <Expression <Func <PtlStat, bool> > >())
            .Returns(statistics.AsQueryable());

            this.LinnWeekService.LinnWeekStartDate(Arg.Any <DateTime>()).Returns(new DateTime(2019, 12, 14));
            this.LinnWeekService.LinnWeekEndDate(Arg.Any <DateTime>()).Returns(new DateTime(2020, 1, 10));

            this.result = this.Sut.GetDeliveryPerformanceByPriority("S");
        }
        public IHttpActionResult Search(string search_criteria = "", int page_number = 1, int page_size = 10)
        {
            if (page_size > maxPageSize)
            {
                page_size = maxPageSize;
            }

            if (page_size == 0)
            {
                page_size = maxPageSize; //avoid possible division by zero
            }
            var items = _service.Search(search_criteria);

            int _totalItems    = items.Count();
            int _numberOfPages = ((_totalItems + page_size - 1) / page_size);

            var pagedItems = items.OrderBy(a => a.Name).Skip((page_number - 1) * page_size).Take(page_size);
            var models     = pagedItems.Select(_modelFactory.Create).ToList();

            var results = new ResultsModel
            {
                Artist                = models,
                page                  = page_number,
                pageSize              = page_size,
                numberOfPages         = _numberOfPages,
                numberOfSearchResults = models.Count
            };

            return(Ok(results));
        }
示例#8
0
        public ResultsModel GetPartDataAtLocation(int locationId)
        {
            var table   = this.databaseService.GetPartDataAtLocation(locationId);
            var results = new ResultsModel(new[] { "Trigger Level", "Max Capacity", "Qty At Location", "Total Qty At EK-2 Locations" })
            {
                ReportTitle = new NameModel($"Stock Trigger Levels")
            };

            results.SetColumnType(0, GridDisplayType.TextValue);
            results.SetColumnType(1, GridDisplayType.Value);
            results.SetColumnType(2, GridDisplayType.Value);
            results.SetColumnType(3, GridDisplayType.Value);

            foreach (DataRow tableRow in table.Rows)
            {
                var eK2Total = this.databaseService.GetQtyAvailableAtEk2Location((string)tableRow[1]);
                var row      = results.AddRow(tableRow[1].ToString().Replace("/", "%2F"), tableRow[1].ToString());
                results.SetGridValue(row.RowIndex, 0, NullOrNumber(tableRow[2]));
                results.SetGridValue(row.RowIndex, 1, NullOrNumber(tableRow[3]));
                results.SetGridValue(row.RowIndex, 2, NullOrNumber(tableRow[6]));
                results.SetGridValue(row.RowIndex, 3, NullOrNumber(eK2Total));
            }

            results.RowDrillDownTemplates.Add(new DrillDownModel("name", $"/products/reports/stock-trigger-levels/{locationId}/" + "{rowId}"));

            return(results);
        }
示例#9
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" }).ConvertToCsvList();

            this.BuildsByDepartmentReportFacadeService.GetBuildsDetailExport(
                DateTime.UnixEpoch,
                DateTime.UnixEpoch,
                "001",
                "Value",
                false)
            .Returns(
                new SuccessResult <IEnumerable <IEnumerable <string> > >(results)
            {
                Data = new List <List <string> > {
                    new List <string> {
                        "string"
                    }
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/builds-detail/export",
                with =>
            {
                with.Header("Accept", "text/csv");
                with.Header("Accept", "application/json");
                with.Query("fromDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("toDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("monthly", "false");
                with.Query("quantityOrValue", "Value");
                with.Query("department", "001");
            }).Result;
        }
        public ResultsModel GetProductsOnHold()
        {
            var salesArticlesOnHold = this.salesArticleRepository.FindAll().Where(s => s.LastHoldStoryId != null);
            var results             = new ResultsModel(new[] { "Article Number", "Invoice Description", "Put On Hold By", "Date Started", "Anticipated End Date", "Reason Started" })
            {
                RowHeader   = "Name",
                ReportTitle = new NameModel("Products On Hold")
            };

            results.SetColumnType(0, GridDisplayType.TextValue);
            results.SetColumnType(1, GridDisplayType.TextValue);
            results.SetColumnType(2, GridDisplayType.TextValue);
            results.SetColumnType(3, GridDisplayType.TextValue);
            results.SetColumnType(4, GridDisplayType.TextValue);
            results.SetColumnType(5, GridDisplayType.TextValue);

            foreach (var salesArticleOnHold in salesArticlesOnHold)
            {
                var holdStory = this.saHoldStoryRepository.FindById((int)salesArticleOnHold.LastHoldStoryId);
                var row       = results.AddRow(salesArticleOnHold.ArticleNumber.Replace("/", "%2F"), salesArticleOnHold.ArticleNumber);
                results.SetGridTextValue(row.RowIndex, 0, salesArticleOnHold.ArticleNumber);
                results.SetGridTextValue(row.RowIndex, 1, salesArticleOnHold.InvoiceDescription);
                results.SetGridTextValue(row.RowIndex, 2, holdStory.PutOnHoldByEmployee.FullName);
                results.SetGridTextValue(row.RowIndex, 3, holdStory.DateStarted.ToShortDateString());
                results.SetGridTextValue(row.RowIndex, 4, holdStory.AnticipatedEndDate?.ToShortDateString());
                results.SetGridTextValue(row.RowIndex, 5, holdStory.ReasonStarted);
            }

            results.RowDrillDownTemplates.Add(new DrillDownModel("stories", "/products/maint/sales-articles/{rowId}"));

            return(results);
        }
示例#11
0
        public void SetUp()
        {
            var report = new ResultsModel {
                ReportTitle = new NameModel("Title")
            };

            this.AteReportsFacadeService.GetStatusReport(
                Arg.Any <string>(),
                Arg.Any <string>(),
                Arg.Any <string>(),
                Arg.Any <string>(),
                Arg.Any <string>())
            .Returns(new SuccessResult <ResultsModel>(report));

            this.Response = this.Browser.Get(
                "/production/reports/ate/status/report",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("fromDate", "isoDate1");
                with.Query("toDate", "isoDate2");
                with.Query("smtOrPcb", "smt");
                with.Query("placeFound", "somewhere");
                with.Query("groupBy", "groupBy");
            }).Result;
        }
        public ResultsModel GetBuiltThisWeekReport(string citCode)
        {
            var results = this.builtThisWeekStatisticRepository.FilterBy(c => c.CitCode == citCode).ToList();

            var model = new ResultsModel {
                ReportTitle = new NameModel("Built this Week Detail")
            };

            model.AddColumn("partNumber", "Part Number");
            model.AddColumn("description", "Description");
            model.AddColumn("builtThisWeek", "Built This Week");
            model.AddColumn("value", "Value");
            model.AddColumn("days", "Days");
            model.RowHeader = results.FirstOrDefault()?.CitName;

            foreach (var statistic in results)
            {
                var row = model.AddRow(statistic.PartNumber);
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("partNumber"), statistic.PartNumber);
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("description"), statistic.Description);
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("builtThisWeek"), statistic.BuiltThisWeek.ToString());
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("value"), statistic.Value.ToString());
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("days"), statistic.Days.ToString());
            }

            return(model);
        }
示例#13
0
        public ResultsModel GetHoldStoriesForRootProduct(string rootProduct)
        {
            var stories = this.saHoldStoryRepository.FindAll().Where(s => s.RootProduct.Name == rootProduct);

            var results = new ResultsModel(new[] { "Date Started", "Date Finished" })
            {
                RowHeader = "Name", ReportTitle = new NameModel("Hold Stories")
            };

            results.SetColumnType(0, GridDisplayType.TextValue);

            foreach (var story in stories.OrderByDescending(a => a.DateStarted))
            {
                var row = results.AddRow(story.HoldStoryId.ToString().Replace("/", "%2F"));
                results.SetGridTextValue(row.RowIndex, 0, story.DateStarted.ToShortDateString());
                results.SetGridTextValue(
                    row.RowIndex,
                    1,
                    story.DateFinished != null
                        ? ((DateTime)story.DateFinished).ToShortDateString()
                        : story.DateFinished.ToString());
            }

            results.RowDrillDownTemplates.Add(new DrillDownModel("story", "/products/reports/sa-hold-stories/{rowId}"));

            return(results);
        }
示例#14
0
        public void SetUp()
        {
            this.testDate = DateTime.UnixEpoch.ToString("d");

            var results = new ResultsModel(new[] { "col1" });

            this.OrdersReportsFacadeService
            .GetOverdueOrdersReport("RB", "DM")
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel {
                    ReportTitle = new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/overdue-orders/report",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("jobId", "123");
                with.Query("fromDate", this.testDate);
                with.Query("toDate", this.testDate);
                with.Query("accountingCompany", "AC");
                with.Query("stockPool", "SP");
                with.Query("reportBy", "RB");
                with.Query("daysMethod", "DM");
            }).Result;
        }
示例#15
0
        public IActionResult Index()
        {
            ModelState.Clear();
            ResultsModel model = new ResultsModel();

            return(View(model));
        }
示例#16
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" }).ConvertToCsvList();

            this.Service.GetManufacturingTimingsExport(
                DateTime.UnixEpoch,
                DateTime.UnixEpoch,
                Arg.Any <string>())
            .Returns(
                new SuccessResult <IEnumerable <IEnumerable <string> > >(results)
            {
                Data = new List <List <string> > {
                    new List <string> {
                        "string"
                    }
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/manufacturing-timings/export",
                with =>
            {
                with.Header("Accept", "text/csv");
                with.Header("Accept", "application/json");
                with.Query("startDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("endDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("citCode", "MW");
            }).Result;
        }
示例#17
0
        public ResultsModel GetStockTriggerLevelReportForPartAtLocation(int locationId, string partNumber)
        {
            var table   = this.databaseService.GetStockTriggerLevelsForPartAtLocation(locationId, partNumber);
            var results =
                new ResultsModel(
                    new[] { "Pallet Number", "Location Code", "Qty Available", "Qty Allocated", "Stock Rotation Date" })
            {
                ReportTitle = new NameModel($"Part {partNumber} Availability")
            };

            results.SetColumnType(0, GridDisplayType.Value);
            results.SetColumnType(1, GridDisplayType.TextValue);
            results.SetColumnType(2, GridDisplayType.Value);
            results.SetColumnType(3, GridDisplayType.Value);
            results.SetColumnType(4, GridDisplayType.TextValue);
            var rowId = 0;

            foreach (DataRow tableRow in table.Rows)
            {
                var row = results.AddRow((rowId++).ToString());

                results.SetGridValue(row.RowIndex, 0, NullOrNumber(tableRow[1]));
                results.SetGridTextValue(row.RowIndex, 1, tableRow[3] == DBNull.Value ? null : tableRow[3].ToString());
                results.SetGridValue(row.RowIndex, 2, NullOrNumber(tableRow[4]));
                results.SetGridValue(row.RowIndex, 3, NullOrNumber(tableRow[5]));
                results.SetGridTextValue(row.RowIndex, 4, tableRow[6] == DBNull.Value ? null : tableRow[6].ToString());
            }

            return(results);
        }
示例#18
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.BuildsByDepartmentReportFacadeService.GetBuildsDetailReport(
                DateTime.UnixEpoch,
                DateTime.UnixEpoch,
                "001",
                "Value",
                false)
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel
                {
                    ReportTitle =
                        new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/builds-detail",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Accept", "application/json");
                with.Query("fromDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("toDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("monthly", "false");
                with.Query("quantityOrValue", "Value");
                with.Query("department", "001");
            }).Result;
        }
        public void SetUp()
        {
            _expectedSingleGas = new List <EnergySupply>();
            _expectedDualFuels = new List <EnergySupply>();

            var futureSupplies = new FutureSupplies
            {
                Results = new List <Result>
                {
                    new Result
                    {
                        SupplyType = new SupplyType
                        {
                            Id = "4"
                        },
                        EnergySupplies = _expectedDualFuels
                    },
                    new Result
                    {
                        SupplyType = new SupplyType
                        {
                            Id = "1"
                        },
                        EnergySupplies = _expectedSingleGas
                    }
                }
            };

            _sut = new ResultsModel(futureSupplies);
        }
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.AssemblyFailsReportsFacade.GetAssemblyFailsMeasuresReport(
                1.May(2020).ToString("O"),
                1.July(2020).ToString("O"),
                "part-number")
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel
                {
                    ReportTitle =
                        new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/assembly-fails-measures/report",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("fromDate", 1.May(2020).ToString("O"));
                with.Query("toDate", 1.July(2020).ToString("O"));
                with.Query("groupBy", "part-number");
            }).Result;
        }
示例#21
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.SmtReportsFacade.GetPartsForOutstandingWorksOrders(Arg.Any <string>(), Arg.Any <string[]>())
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel
                {
                    ReportTitle = new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/smt/outstanding-works-order-parts/report",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("fromDate", 1.May(2020).ToString("O"));
                with.Query("smtLine", "SMT1");
                with.Query("parts", "P1");
                with.Query("parts", "P2");
            }).Result;
        }
示例#22
0
        public ResultsModel GetOutstandingWorksOrders(string reportType, string searchParameter)
        {
            var table = this.databaseService.GetReport(reportType, searchParameter);

            var results =
                new ResultsModel(
                    new[]
            {
                "Part Number",
                "Description",
                "Date Raised",
                "Qty Outstanding"
            })
            {
                RowHeader   = "Order Number",
                ReportTitle = new NameModel("Outstanding Works Orders")
            };

            for (var i = 0; i < 3; i++)
            {
                results.SetColumnType(i, GridDisplayType.TextValue);
            }

            foreach (DataRow tableRow in table.Rows)
            {
                var row = results.AddRow(tableRow[0]?.ToString());

                results.SetGridTextValue(row.RowIndex, 0, tableRow[1]?.ToString());
                results.SetGridTextValue(row.RowIndex, 1, tableRow[5]?.ToString());
                results.SetGridTextValue(row.RowIndex, 2, tableRow[3]?.ToString());
                results.SetGridValue(row.RowIndex, 3, tableRow[2]?.ToString().ParseDecimal());
            }

            return(results);
        }
示例#23
0
        public ResultsModel GetDeliveryPerformanceDetail(string citCode, int priority)
        {
            var dates = this.GetDefaultDateRange();
            var stats = this.ptlStatRepository.FilterBy(s =>
                                                        s.CitCode == citCode && s.PtlPriority == priority && s.DateCompleted >= dates.fromDate && s.DateCompleted <= dates.toDate).ToList();

            var model = new ResultsModel();

            model.ReportTitle = new NameModel($"Production Delivery Performance {dates.fromDate.ToString("dd-MMM-yy")} - {dates.toDate.ToString("dd-MMM-yy")} Priority {priority} Cit {citCode}");



            model.AddColumn("workingDays", "Working Days");
            model.AddColumn("partNumber", "Part Number");
            model.AddColumn("triggerDate", "Trigger Date");
            model.AddColumn("dateCompleted", "dateCompleted");
            model.AddColumn("triggerId", "Trigger Id");

            foreach (var stat in stats.OrderByDescending(s => s.WorkingDays))
            {
                var row = model.AddRow(stat.TriggerId.ToString());
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("workingDays"), stat.WorkingDays.ToString("##0.0"));
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("partNumber"), stat.PartNumber);
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("triggerDate"), stat.TriggerDate?.ToString("dd-MMM-yy"));
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("dateCompleted"), stat.DateCompleted?.ToString("dd-MMM-yy"));
                model.SetGridTextValue(row.RowIndex, model.ColumnIndex("triggerId"), stat.TriggerId.ToString());
            }

            var priorities = stats.Select(s => s.PtlPriority).Distinct().OrderBy(s => s);

            return(model);
        }
示例#24
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.Service.GetManufacturingTimingsReport(
                DateTime.UnixEpoch,
                DateTime.UnixEpoch, Arg.Any <string>())
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel
                {
                    ReportTitle =
                        new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/manufacturing-timings",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Accept", "application/json");
                with.Query("startDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("endDate", DateTime.UnixEpoch.ToString("d"));
                with.Query("citCode", "K");
            }).Result;
        }
示例#25
0
        public void SetUp()
        {
            var statistics = new List <BuiltThisWeekStatistic>()
            {
                new BuiltThisWeekStatistic
                {
                    PartNumber    = "KLI SYS HUB",
                    Description   = "KLIMAX SYSTEM HUB",
                    BuiltThisWeek = 1,
                    Value         = 977,
                    Days          = 0.13,
                    CitCode       = "S",
                    CitName       = "FinalAssembly"
                },
                new BuiltThisWeekStatistic
                {
                    PartNumber    = "LP12 OIL KIT",
                    Description   = "OIL BOTTLE",
                    BuiltThisWeek = 36,
                    Value         = 9,
                    Days          = 0.44,
                    CitCode       = "S",
                    CitName       = "FinalAssembly"
                }
            };

            this.BuiltThisWeekStatisticRepository.FilterBy(Arg.Any <Expression <Func <BuiltThisWeekStatistic, bool> > >())
            .Returns(statistics.AsQueryable());

            this.result = this.Sut.GetBuiltThisWeekReport("S");
        }
 public void SetUp()
 {
     this.result = this.Sut.GetAssemblyFailsMeasuresReport(
         1.June(2020),
         30.June(2020),
         AssemblyFailGroupBy.BoardPartNumber);
 }
示例#27
0
        public ResultsModel GetEanCodeReport(bool includePhasedOut = false, bool cartonisedOnly = false)
        {
            var articles = this.salesArticleService.GetByDiscountFamily("HIFI", includePhasedOut);

            if (cartonisedOnly)
            {
                articles = articles.Where(c => !string.IsNullOrEmpty(c.CartonType));
            }

            var results = new ResultsModel(new[] { "Description", "EAN Code" })
            {
                RowHeader   = "Article Number",
                ReportTitle = new NameModel("Sales Article EAN Codes")
            };

            results.SetColumnType(0, GridDisplayType.TextValue);
            results.SetColumnType(1, GridDisplayType.TextValue);

            foreach (var salesArticle in articles.OrderBy(a => a.ArticleNumber))
            {
                var row = results.AddRow(salesArticle.ArticleNumber);
                results.SetGridTextValue(row.RowIndex, 0, salesArticle.InvoiceDescription);
                results.SetGridTextValue(row.RowIndex, 1, salesArticle.EanCode);
            }

            return(results);
        }
示例#28
0
        public void SetUp()
        {
            var results = new ResultsModel(new[] { "col1" });

            this.DeliveryPerfResultFacadeService.GenerateDelPerfSummaryForCit(
                "S")
            .Returns(
                new SuccessResult <ResultsModel>(results)
            {
                Data = new ResultsModel
                {
                    ReportTitle =
                        new NameModel("title")
                }
            });

            this.Response = this.Browser.Get(
                "/production/reports/delperf",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Accept", "application/json");
                with.Query("citCode", "S");
            }).Result;
        }
示例#29
0
        public void verify_page_displayed_when_calculation_results_are_in_tempdata()
        {
            // Arrange
            var httpContext           = new DefaultHttpContext();
            var modelState            = new ModelStateDictionary();
            var actionContext         = new ActionContext(httpContext, new RouteData(), new PageActionDescriptor(), modelState);
            var modelMetadataProvider = new EmptyModelMetadataProvider();
            var viewData    = new ViewDataDictionary(modelMetadataProvider, modelState);
            var tempData    = new TempDataDictionary(httpContext, A.Fake <ITempDataProvider>());
            var pageContext = new PageContext(actionContext)
            {
                ViewData = viewData
            };
            var objectUnderTest = new ResultsModel()
            {
                PageContext = pageContext,
                TempData    = tempData,
                Url         = new UrlHelper(actionContext)
            };

            objectUnderTest.TempData.Set(Web.Code.Constants.RESULTS_TEMP_DATA_KEY, new DeductionCalculationResults());

            // Act
            var result = objectUnderTest.OnGet();

            // Assert
            Assert.IsInstanceOfType(result, typeof(PageResult));
        }
示例#30
0
        public void verify_return_to_index_if_tempdata_is_null()
        {
            // Arrange
            var httpContext           = new DefaultHttpContext();
            var modelState            = new ModelStateDictionary();
            var actionContext         = new ActionContext(httpContext, new RouteData(), new PageActionDescriptor(), modelState);
            var modelMetadataProvider = new EmptyModelMetadataProvider();
            var viewData    = new ViewDataDictionary(modelMetadataProvider, modelState);
            var tempData    = new TempDataDictionary(httpContext, A.Fake <ITempDataProvider>());
            var pageContext = new PageContext(actionContext)
            {
                ViewData = viewData
            };
            var objectUnderTest = new ResultsModel()
            {
                PageContext = pageContext,
                TempData    = tempData,
                Url         = new UrlHelper(actionContext)
            };

            // Act
            var result = objectUnderTest.OnGet();

            // Assert
            Assert.IsInstanceOfType(result, typeof(RedirectToPageResult));
            Assert.IsTrue(((RedirectToPageResult)result).PageName == Paylocity.CodingChallenge.Web.Code.Constants.INDEX_PAGE);
        }
示例#31
0
 public SessionModel()
 {
     Navigation = new NavigationModel();
     CurrentWorkspace = new WorkspaceModel();
     Results = new ResultsModel();
 }
示例#32
0
        public ActionResult Results()
        {
            if (Session["UserId"] == null)
                return RedirectToAction("Index", "Home");

            using (var electionRepository = new ElectionRepository())
            {
                var election = electionRepository.GetElectionByElectionId(ElectionConductor.ElectionId((int)Session["UserId"]));

                var resultsModel = new ResultsModel
                {
                    MaxVotes = election.MaxVotes
                };

                return View(resultsModel);
            }
        }