Exemplo n.º 1
0
 public GetComplianceReport(ComplianceReportDates dateType,
                            DateTime from,
                            DateTime to,
                            ComplianceTextFields?textFieldType,
                            TextFieldOperator?operatorType,
                            string textSearch)
 {
     DateType      = dateType;
     From          = from;
     To            = to;
     TextFieldType = textFieldType;
     OperatorType  = operatorType;
     TextSearch    = textSearch;
 }
Exemplo n.º 2
0
        public async Task <ActionResult> Download(ComplianceReportDates dateType,
                                                  DateTime from,
                                                  DateTime to,
                                                  ComplianceTextFields?textFieldType,
                                                  TextFieldOperator?operatorType,
                                                  string textSearch)
        {
            var report =
                await
                mediator.SendAsync(new GetComplianceReport(dateType, from, to, textFieldType, operatorType, textSearch));

            var fileName = string.Format("compliance-report-{0}-{1}.xlsx", from.ToShortDateString(), to.ToShortDateString());

            var guidance = new ComplianceDataGuidance
            {
                NotificationNumber     = Resources.NotificationNumber,
                NoPrenotificationCount = Resources.NoPrenotificationCount,
                PreNotificationColour  = Resources.PreNotificationColour,
                MissingShipments       = Resources.MissingShipments,
                MissingShipmentsColour = Resources.MissingShipmentsColour,
                OverLimitShipments     = Resources.OverLimitShipments,
                OverActiveLoads        = Resources.OverActiveLoads,
                OverTonnage            = Resources.OverTonnage,
                OverTonnageColour      = Resources.OverTonnageColour,
                OverShipments          = Resources.OverShipments,
                OverShipmentsColour    = Resources.OverShipmentsColour,
                Notifier    = Resources.Notifier,
                Consignee   = Resources.Consignee,
                FileExpired = Resources.FileExpired
            };

            var colourGuidance = new ComplianceDataColourGuidance
            {
                HeaderText = Resources.ColourHeaderText,
                GreenText  = Resources.GreenText,
                AmberText  = Resources.AmberText,
                RedText    = Resources.RedText
            };

            return(new ComplianceXlsxActionResult(report, new List <ComplianceDataGuidance> {
                guidance
            }, colourGuidance,
                                                  fileName, true));
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <ComplianceData> > GetComplianceReport(ComplianceReportDates dateType,
                                                                              DateTime from,
                                                                              DateTime to,
                                                                              ComplianceTextFields?textFieldType,
                                                                              TextFieldOperator?operatorType,
                                                                              string textSearch,
                                                                              UKCompetentAuthority competentAuthority)
        {
            var reportlist = await context.Database.SqlQuery <ComplianceDataReport>(@"EXEC [Reports].[Compliance] 
                @DateType,
                @CompetentAuthority,
                @From,
                @To",
                                                                                    new SqlParameter("@DateType", dateType.ToString()),
                                                                                    new SqlParameter("@CompetentAuthority", (int)competentAuthority),
                                                                                    new SqlParameter("@From", from),
                                                                                    new SqlParameter("@To", to)).ToArrayAsync();

            if (!textFieldType.HasValue ||
                !operatorType.HasValue ||
                string.IsNullOrEmpty(textSearch))
            {
                return(reportlist);
            }
            else if (reportlist.Length > 0)
            {
                var predicate = CreatePredicate(textFieldType.Value.ToString(), textSearch, operatorType);
                var query     = reportlist.AsQueryable <ComplianceDataReport>();

                return(query.Where(predicate));
            }
            else
            {
                return(reportlist);
            }
        }