Beispiel #1
0
        public IQueryable <DSS1_RetailerDriverStockOptimisation.BO.Statistics> Get_StockSKUStatisticForm_UnitsSKUDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = DSS1_RetailerDriverStockOptimisation.BO.StatisticsExtensions.TotalForEachSKU(@model.WarehouseId).AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #2
0
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier> Get_SupplierListNoDT_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>().AsQueryable();

            return(__items.Where(@this => @this.SupplierStatus == "ActiveSupplier"));
        }
Beispiel #3
0
        public string SupplierListNoDT_ExportV2Implementation(DatasourceRequest datasourceRequest, ExportOptionsV2 exportOptions, List <AggregatorInfo <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier> > aggregatorsInfo)
        {
            var  watch = System.Diagnostics.Stopwatch.StartNew();
            long elapsedMilliseconds = 0;

            switch (exportOptions.Range)
            {
            case ExportHelper.Range.ALL:
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = int.MaxValue;
                break;

            case ExportHelper.Range.TOP100:
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = 100;
                break;
            }
            var queryable    = Get_SupplierListNoDT_DatasourceQueryable(datasourceRequest);
            var formattings  = new Dictionary <string, string>();
            var path         = "";
            var exportHelper = new ExportHelperV2 <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>(exportOptions, new Dictionary <string, Func <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier, object> >
            {
                { "UserName", item => item?.UserName }, { "Company", item => item?.Company }, { "Email", item => item?.Email }, { "Business", item => item?.Business }, { "SupplierStatus", item => item?.SupplierStatus },
            });

            if (exportHelper.Options.ColumnInfo == null)
            {
                exportHelper.Options.ColumnInfo = new List <ColumnOptionsV2>
                {
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_UserName"), Formatting = "", Name = "UserName", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Company"), Formatting = "", Name = "Company", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Email"), Formatting = "", Name = "Email", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Business"), Formatting = "", Name = "Business", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_SupplierStatus"), Formatting = "", Name = "SupplierStatus", ExcelFormat = @""
                    },
                };
            }
            if (string.IsNullOrWhiteSpace(exportHelper.Options.Filename))
            {
                exportHelper.Options.Filename = "SupplierListNoDT";
            }
            if (datasourceRequest.GroupBy.Any())
            {
                var groups      = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.UserName, aggregatorsInfo);
                var aggregators = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.UserName, aggregatorsInfo, true);
                GroupsHelper.FormatGroupedAggregators(aggregators, formattings);
                watch.Stop();
                elapsedMilliseconds = watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: SupplierListNoDT export query with grouping and range {exportOptions.Range} took {elapsedMilliseconds}ms");
                watch.Restart();
                path = exportHelper.Export(groups, aggregators);
                watch.Stop();
                elapsedMilliseconds += watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: SupplierListNoDT export to excel with grouping and range {exportOptions.Range} took {watch.ElapsedMilliseconds}ms");
            }
            else
            {
                var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
                var aggregators = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);
                foreach (var a in aggregators)
                {
                    var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                    a.Calculate(queryable, formatting);
                }
                var loadedItems = items.ToList();
                watch.Stop();
                elapsedMilliseconds = watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: SupplierListNoDT export query with range {exportOptions.Range} took {elapsedMilliseconds}ms");
                watch.Restart();
                path = exportHelper.Export(loadedItems, aggregators);
                watch.Stop();
                elapsedMilliseconds += watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: SupplierListNoDT export to excel with range {exportOptions.Range} took {elapsedMilliseconds}ms");
            }
            var content     = System.IO.File.ReadAllBytes(Path.Combine(Path.GetTempPath(), path));
            var fileName    = Path.GetFileName(path);
            var downloadKey = FileHelper.PendingDownloadInstance.Add("ActiveSuppliersList", content, fileName);

            _logger.Info($"ExportV2 Performance: Total export time for SupplierListNoDT: {elapsedMilliseconds}ms");
            return(downloadKey);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order> Get_InvestorOrdersList_OrderDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order>().AsQueryable();

            return(__items.Where(@this => true));
        }
        /*<Datasource:UserPreferences_LocaleBoxDataSet:1/>*/
        /*<DataSourceFilter:UserPreferences_LocaleBoxDataSet:2/>*/
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationLanguage> Get_UserPreferences_LocaleBoxDataSet_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_UserPreferences_LocaleBoxDataSet_DatasourceQueryableImplementation(__request);

            return(__items);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Invoice> Get_TestingForm_InvoiceDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = DSS5_SupplyChainFinancialsOptimisation.BO.InvoiceExtensions.FindAgreement().AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #7
0
        /*<Datasource:LetterOfCreditListNoDT:1/>*/
        /*<DataSourceFilter:LetterOfCreditListNoDT:2/>*/
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit> Get_LetterOfCreditListNoDT_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_LetterOfCreditListNoDT_DatasourceQueryableImplementation(__request);

            return(__items);
        }
Beispiel #8
0
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationPermission> Get_ManageOperation_Button2DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationPermission>().AsQueryable();

            return(__items);
        }
        /*<Datasource:DropdownBox:1/>*/

        /*<Datasource:DropdownBox1:1/>*/

        /*<Datasource:DropdownBox2:1/>*/

        /*<Datasource:ProofOfDeliveryForm_SelectOrder:1/>*/
        /*<DataSourceFilter:ProofOfDeliveryForm_SelectOrder:2/>*/
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order> Get_ProofOfDeliveryForm_SelectOrder_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_ProofOfDeliveryForm_SelectOrder_DatasourceQueryableImplementation(__request);

            return(__items);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction> Get_InvestorTransactionsList_TransactionDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>().AsQueryable();
            var _var0   = @model.InvestorUsername;

            return(__items.Where(@this => @this.CommercialAgreement.Agreement.Investor.UserName == _var0));
        }
Beispiel #11
0
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.MapPoint> Get_TrackingMapForm_MapPointDataset_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = model?.MapPoints?.AsQueryable();

            if (__items == null)
            {
                return(new List <DSS5_SupplyChainFinancialsOptimisation.BO.MapPoint>().AsQueryable());
            }
            return(__items.Where(@this => true));
        }
Beispiel #12
0
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation> Get_OperationsList_List1DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS1_RetailerDriverStockOptimisation.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>().AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #13
0
        /*<Datasource:OperationsList_List1DataSet:1/>*/
        /*<DataSourceFilter:OperationsList_List1DataSet:2/>*/
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation> Get_OperationsList_List1DataSet_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_OperationsList_List1DataSet_DatasourceQueryableImplementation(__request);

// Predefined Ordering
            if (!__request.OrderBy.Any() && !__request.GroupBy.Any())
            {
                __items = __items.OrderBy(@this => @this.ParentControllerName != null ? @this.ParentControllerName : null)
                ;
            }
            return(__items);
        }
Beispiel #14
0
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation> Get_Table_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>().AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #15
0
        /*<Datasource:RolesList_List1DataSet:1/>*/
        /*<DataSourceFilter:RolesList_List1DataSet:2/>*/
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> Get_RolesList_List1DataSet_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_RolesList_List1DataSet_DatasourceQueryableImplementation(__request);

            return(__items);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order> Get_ProofOfDeliveryForm_SelectOrder_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order>().AsQueryable();
            var _var0   = @model.ProofOfDelivery?.Transaction?.Id;

            return(__items.Where(@this => @this.Transaction.Id == _var0));
        }
Beispiel #17
0
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> Get_RolesList_List1DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS2_SynchromodalityCapacityOptimisation.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>().AsQueryable();

            return(__items);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatistic> Get_TurnoverForm_TurnoverStatisticDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatisticExtensions.GetTurnoverStatisticsForSupplier(@model.Supplier).AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #19
0
        /*<Datasource:CCDForm_TransactionDataSource:1/>*/
        /*<DataSourceFilter:CCDForm_TransactionDataSource:2/>*/
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction> Get_CCDForm_TransactionDataSource_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_CCDForm_TransactionDataSource_DatasourceQueryableImplementation(__request);

            return(__items);
        }
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationSetting> Get_ApplicationSettingsList_List1DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS4_ECompliance.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationSetting>().AsQueryable();

            return(__items);
        }
Beispiel #21
0
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit> Get_LetterOfCreditList_LetterOfCredit_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit>().AsQueryable();
            var _var0   = zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName();

            return(__items.Where(@this => @this.Transaction.Supplier.UserName == _var0));
        }
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationPermission> Get_ManageUser_Button1DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationPermission>().AsQueryable();

            return(__items);
        }
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Order> Get_InvestorOrdersList_InvestorOrderDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = DSS5_SupplyChainFinancialsOptimisation.BO.OrderExtensions.FindAgreement().AsQueryable();

            return(__items.Where(@this => @this.Transaction.Supplier.Roles.Any((a) => a.Name == "ActiveSupplier")));
        }
Beispiel #24
0
        /*<Datasource:Button2:1/>*/
        /*<DataSourceFilter:Button2:2/>*/
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> Get_Button2_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_Button2_DatasourceQueryableImplementation(__request);

            if (__request.ExcludeKeys != null && __request.ExcludeKeys.Any())
            {
                var keysToExclude = __request.ExcludeKeys.Select(x => x.ToString());
                __items = __items.Where(x => !keysToExclude.Contains(x.Id.ToString()));
            }
            return(__items);
        }
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationLanguage> Get_UserPreferences_LocaleBoxDataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = zAppDev.DotNet.Framework.Identity.ProfileHelper.GetAllAvailableLanguages().AsQueryable();

            return(__items.Where(@this => true));
        }
Beispiel #26
0
        public IQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> Get_ManageUser_Button2DataSet_DatasourceQueryableImplementation(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            var __items = new DSS1_RetailerDriverStockOptimisation.DAL.Repository().GetAsQueryable <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>().AsQueryable();

            return(__items);
        }
Beispiel #27
0
        public string SupplierListNoDT_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier> > aggregatorsInfo)
        {
            if (exportOptions.Range == ExportHelper.Range.TOP100)
            {
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = 100;
            }
            else if (exportOptions.Range == ExportHelper.Range.ALL)
            {
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = int.MaxValue;
            }
            if (string.IsNullOrWhiteSpace(exportOptions.Filename))
            {
                exportOptions.Filename = "SupplierListNoDT";
            }
            if (exportOptions.ColumnOptions == null)
            {
                exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions>
                {
                    new ExportHelper.ColumnOptions {
                        Column = "UserName", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Company", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Email", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Business", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "SupplierStatus", IsVisible = true
                    },
                };
            }
            var queryable   = Get_SupplierListNoDT_DatasourceQueryable(datasourceRequest);
            var totalRows   = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count();
            var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
            var dto         = items.Select(i => new SupplierDataSet_SupplierDTO(i));
            var formattings = new Dictionary <string, string>();
            var aggregators = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);

            foreach (var a in aggregators)
            {
                var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                a.Calculate(queryable, formatting);
            }
            var exportDataDTO = new List <ExportHelper.ExportRecordDTO>();

            foreach (var record in dto)
            {
                var recordDTO = new ExportHelper.ExportRecordDTO();
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.UserName),
                    Value          = record?.UserName,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_UserName")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Company),
                    Value          = record?.Company,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Company")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Email),
                    Value          = record?.Email,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Email")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Business),
                    Value          = record?.Business,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Business")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.SupplierStatus),
                    Value          = record?.SupplierStatus,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("ActiveSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_SupplierStatus")
                });
                exportDataDTO.Add(recordDTO);
            }
            if (aggregators.Count > 0)
            {
                foreach (AggregatorType aggregatorType in Enum.GetValues(typeof(AggregatorType)))
                {
                    var emptyAggregatorRow = true;
                    var recordDTO          = new ExportHelper.ExportRecordDTO();
                    foreach (var columnOption in exportOptions.ColumnOptions)
                    {
                        var aggregatorValue = "";
                        switch (aggregatorType)
                        {
                        case AggregatorType.COUNT:
                            if (columnOption.CountIsVisible)
                            {
                                var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.COUNT);
                                aggregatorValue    = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandCount")} {averageAggregator?.ValueFormatted}";
                                emptyAggregatorRow = false;
                            }
                            break;

                        case AggregatorType.SUM:
                            if (columnOption.SumIsVisible)
                            {
                                var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.SUM);
                                aggregatorValue    = $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandTotal")} {averageAggregator?.ValueFormatted}";
                                emptyAggregatorRow = false;
                            }
                            break;

                        case AggregatorType.AVERAGE:
                            if (columnOption.AverageIsVisible)
                            {
                                var averageAggregator = aggregators.SingleOrDefault(agg => agg.Column == columnOption.Column && agg.Type == AggregatorType.AVERAGE);
                                aggregatorValue   += $"{BaseViewPage<object>.GetResourceValue("GlobalResources", "RES_DATALIST_AGGREGATORS_GrandAverage")} {averageAggregator?.ValueFormatted}";
                                emptyAggregatorRow = false;
                            }
                            break;
                        }
                        recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                        {
                            ColumnName     = columnOption.Column,
                            Value          = aggregatorValue,
                            ColumnDataType = "string",
                            Format         = ""
                        });
                    }
                    if (!emptyAggregatorRow)
                    {
                        exportDataDTO.Add(recordDTO);
                    }
                }
            }
            var path     = ExportHelper.ExportList(exportDataDTO, exportOptions, totalRows);
            var content  = System.IO.File.ReadAllBytes(Path.Combine(Path.GetTempPath(), path));
            var fileName = Path.GetFileName(path);

            return(FileHelper.PendingDownloadInstance.Add("ActiveSuppliersList", content, fileName));
        }
Beispiel #28
0
        public string List_ExportV2Implementation(DatasourceRequest datasourceRequest, ExportOptionsV2 exportOptions, List <AggregatorInfo <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> > aggregatorsInfo)
        {
            var  watch = System.Diagnostics.Stopwatch.StartNew();
            long elapsedMilliseconds = 0;

            switch (exportOptions.Range)
            {
            case ExportHelper.Range.ALL:
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = int.MaxValue;
                break;

            case ExportHelper.Range.TOP100:
                datasourceRequest.StartRow = 0;
                datasourceRequest.PageSize = 100;
                break;
            }
            var queryable    = Get_List_DatasourceQueryable(datasourceRequest);
            var formattings  = new Dictionary <string, string>();
            var path         = "";
            var exportHelper = new ExportHelperV2 <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>(exportOptions, new Dictionary <string, Func <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole, object> >
            {
                { "Name", item => item?.Name }, { "Description", item => item?.Description }, { "IsCustom", item => item?.IsCustom },
            });

            if (exportHelper.Options.ColumnInfo == null)
            {
                exportHelper.Options.ColumnInfo = new List <ColumnOptionsV2>
                {
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("RolesList", "RES_LIST_List_COLUMN_Name"), Formatting = "", Name = "Name", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("RolesList", "RES_LIST_List_COLUMN_Description"), Formatting = "", Name = "Description", ExcelFormat = @""
                    },
                    new ColumnOptionsV2 {
                        Caption = BaseViewPage <object> .GetResourceValue("RolesList", "RES_LIST_List_COLUMN_IsCustom"), Formatting = "", Name = "IsCustom", ExcelFormat = @""
                    },
                };
            }
            if (string.IsNullOrWhiteSpace(exportHelper.Options.Filename))
            {
                exportHelper.Options.Filename = "List";
            }
            if (datasourceRequest.GroupBy.Any())
            {
                var groups      = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, aggregatorsInfo);
                var aggregators = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, aggregatorsInfo, true);
                GroupsHelper.FormatGroupedAggregators(aggregators, formattings);
                watch.Stop();
                elapsedMilliseconds = watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: List export query with grouping and range {exportOptions.Range} took {elapsedMilliseconds}ms");
                watch.Restart();
                path = exportHelper.Export(groups, aggregators);
                watch.Stop();
                elapsedMilliseconds += watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: List export to excel with grouping and range {exportOptions.Range} took {watch.ElapsedMilliseconds}ms");
            }
            else
            {
                var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
                var aggregators = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);
                foreach (var a in aggregators)
                {
                    var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                    a.Calculate(queryable, formatting);
                }
                var loadedItems = items.ToList();
                watch.Stop();
                elapsedMilliseconds = watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: List export query with range {exportOptions.Range} took {elapsedMilliseconds}ms");
                watch.Restart();
                path = exportHelper.Export(loadedItems, aggregators);
                watch.Stop();
                elapsedMilliseconds += watch.ElapsedMilliseconds;
                _logger.Info($"ExportV2 Performance: List export to excel with range {exportOptions.Range} took {elapsedMilliseconds}ms");
            }
            var content     = System.IO.File.ReadAllBytes(Path.Combine(Path.GetTempPath(), path));
            var fileName    = Path.GetFileName(path);
            var downloadKey = FileHelper.PendingDownloadInstance.Add("RolesList", content, fileName);

            _logger.Info($"ExportV2 Performance: Total export time for List: {elapsedMilliseconds}ms");
            return(downloadKey);
        }
Beispiel #29
0
        /*<Datasource:ActiveSuppliersList_SupplierDataSet:1/>*/
        /*<DataSourceFilter:ActiveSuppliersList_SupplierDataSet:2/>*/
        public IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier> Get_ActiveSuppliersList_SupplierDataSet_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_ActiveSuppliersList_SupplierDataSet_DatasourceQueryableImplementation(__request);

            return(__items);
        }
Beispiel #30
0
        /*<Datasource:StockSKUStatisticForm_UnitsSKUDataSet:1/>*/
        /*<DataSourceFilter:StockSKUStatisticForm_UnitsSKUDataSet:2/>*/
        public IQueryable <DSS1_RetailerDriverStockOptimisation.BO.Statistics> Get_StockSKUStatisticForm_UnitsSKUDataSet_DatasourceQueryable(DatasourceRequest __request = null, bool shouldEvict = true)
        {
            __request = __request ?? new DatasourceRequest(0, int.MaxValue);
            if (shouldEvict)
            {
                @model?.Evict();
            }
            var __items = Get_StockSKUStatisticForm_UnitsSKUDataSet_DatasourceQueryableImplementation(__request);

            return(__items);
        }