public JsonResult InvestorForm_DomainFocusChoices_GetFullRecordset()
        {
            var postedData    = _ParsePostedData();
            var dataType      = postedData["dataType"].ToString();
            var keysToExclude = postedData["keys"] == null
                                ? new List <object>()
                                : postedData["keys"].ToString()
                                .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(x => x as object)
                                .ToList();
            var indexes = postedData["indexes"] == null
                          ? null
                          : postedData["indexes"].ToString()
                          .Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(x => int.Parse(x))
                          .ToArray();
            var postedDatasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());

            _LoadViewModel();
            var datasourceRequest = new DatasourceRequest(0, 2147483647, postedDatasourceRequest.Filters, null, keysToExclude, indexes);
            var queryable         = Get_InvestorForm_DomainFocusChoices_DatasourceQueryable(datasourceRequest);
            var items             = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable);
            var __result          = Json(new
            {
                Type = "UpdateInstance", Data = Utilities.Serialize(items)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult OperationsList_List1DataSet_GetFullRecordset()
        {
            var postedData    = _ParsePostedData();
            var dataType      = postedData["dataType"].ToString();
            var keysToExclude = postedData["keys"] == null
                                ? new List <object>()
                                : postedData["keys"].ToString()
                                .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(x => x as object)
                                .ToList();
            var indexes = postedData["indexes"] == null
                          ? null
                          : postedData["indexes"].ToString()
                          .Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(x => int.Parse(x))
                          .ToArray();
            var postedDatasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());

            _LoadViewModel();
            var datasourceRequest = new DatasourceRequest(0, 2147483647, postedDatasourceRequest.Filters, null, keysToExclude, indexes);
            var queryable         = Get_OperationsList_List1DataSet_DatasourceQueryable(datasourceRequest);
            var items             = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable);
            //The following method of creating DTO responses has been changed due to the fact that the returned objects were missing properties that were not used by the client.
            //It now uses the UpdateInstance method. To be removed after some testing if no problems occur.
            //var data = items.Select(i => new List1DataSet_ApplicationOperationDTO(i, true)).ToList();
            var data     = CreateDtoInstancesFromKeys(typeof(OperationsListViewModel), dataType, items.Select(i => i.Id.ToString()).ToList(), "OperationsList_List1DataSet");
            var __result = Json(new
            {
                Type = "UpdateInstance", Data = Utilities.Serialize(data)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult DropdownApplicationThemeDataSet_Datasource()
        {
            var postedData        = _LoadViewModel();
            var datasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var queryable         = Get_DropdownApplicationThemeDataSet_DatasourceQueryable(datasourceRequest);
            var response          = new ListResponse
            {
                TotalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(),
            };

            //Total items count
            if (CLMS.AppDev.Cache.CacheManager.Current.HasKey($"{Request.RequestContext.HttpContext.Session.SessionID}_DropdownApplicationThemeDataSet_TotalItems"))
            {
                CLMS.AppDev.Cache.CacheManager.Current.Set($"{Request.RequestContext.HttpContext.Session.SessionID}_DropdownApplicationThemeDataSet_TotalItems", response.TotalRows);
            }
            else
            {
                CLMS.AppDev.Cache.CacheManager.Current.Add($"{Request.RequestContext.HttpContext.Session.SessionID}_DropdownApplicationThemeDataSet_TotalItems", response.TotalRows);
            }
            if (response.TotalRows < datasourceRequest.StartRow + 1)
            {
                datasourceRequest.StartRow = 0;
            }
            var items = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;

            response.Data = items.Select(i => new ApplicationThemeDataSet_ApplicationThemeDTO(i, true)).ToList();
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(response)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
Example #4
0
        public JsonResult NewMap_Datasource()
        {
            var postedData        = _LoadViewModel();
            var datasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var queryable         = Get_NewMap_DatasourceQueryable(datasourceRequest);
            var response          = new ListResponse
            {
                TotalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(),
            };

            //Total items count
            if (CLMS.AppDev.Cache.CacheManager.Current.HasKey($"{Request.RequestContext.HttpContext.Session.SessionID}_NewMap_TotalItems"))
            {
                CLMS.AppDev.Cache.CacheManager.Current.Set($"{Request.RequestContext.HttpContext.Session.SessionID}_NewMap_TotalItems", response.TotalRows);
            }
            else
            {
                CLMS.AppDev.Cache.CacheManager.Current.Add($"{Request.RequestContext.HttpContext.Session.SessionID}_NewMap_TotalItems", response.TotalRows);
            }
            if (response.TotalRows < datasourceRequest.StartRow + 1)
            {
                datasourceRequest.StartRow = 0;
            }
            var items  = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
            var _dtos  = items.Select(i => new MapPointDataset_MapPointDTO(i, true)).ToList();
            var points = new List <MapHelperPoint>();
            var lines  = new List <MapHelperLine>();

            foreach (var _dto in _dtos)
            {
                points.Add(new MapHelperPoint
                {
                    BoundObject = _dto,
                    Coordinates = new MapHelperCoordinates
                    {
                        Latitude  = _dto?.Latitude,
                        Longitude = _dto?.Longitude
                    }
                    , Tooltip = _dto?.Title

                    , Icon = _dto?.Icon
                });
            }
            var data = new MapHelper {
                Points = points, Lines = lines
            };

            response.Data = data.ToGeoJson();
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(response)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult InvestorForm_DomainFocusChoices_Datasource()
        {
            var postedData        = _LoadViewModel();
            var datasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var queryable         = Get_InvestorForm_DomainFocusChoices_DatasourceQueryable(datasourceRequest);
            var response          = new ListResponse
            {
                TotalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(),
            };

            //Total items count
            if (CLMS.AppDev.Cache.CacheManager.Current.HasKey($"{Request.RequestContext.HttpContext.Session.SessionID}_InvestorForm_DomainFocusChoices_TotalItems"))
            {
                CLMS.AppDev.Cache.CacheManager.Current.Set($"{Request.RequestContext.HttpContext.Session.SessionID}_InvestorForm_DomainFocusChoices_TotalItems", response.TotalRows);
            }
            else
            {
                CLMS.AppDev.Cache.CacheManager.Current.Add($"{Request.RequestContext.HttpContext.Session.SessionID}_InvestorForm_DomainFocusChoices_TotalItems", response.TotalRows);
            }
            if (response.TotalRows < datasourceRequest.StartRow + 1)
            {
                datasourceRequest.StartRow = 0;
            }
            if (datasourceRequest.GroupBy.Any())
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q, postedData);
                var items  = groups.GetAllItems();
                response.Data = items.Select(i => new
                {
                    _key = i
                }).ToList();
                response.Groups = groups;
//Fix for total items in GetGroupsClosed
                if (datasourceRequest.GroupBy.FirstOrDefault().GetGroupsClosed)
                {
                    response.TotalRows = DatasourceRetriever.GetTotalGroups(groups);
                }
            }
            else
            {
                var items = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
                response.Data = items.Select(i => new
                {
                    _key = i
                }).ToList();
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(response)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult OperationsList_List1DataSet_Datasource()
        {
            var postedData        = _LoadViewModel();
            var datasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var queryable         = Get_OperationsList_List1DataSet_DatasourceQueryable(datasourceRequest);
            var response          = new ListResponse
            {
                TotalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(),
            };

            //Total items count
            if (CLMS.AppDev.Cache.CacheManager.Current.HasKey($"{Request.RequestContext.HttpContext.Session.SessionID}_OperationsList_List1DataSet_TotalItems"))
            {
                CLMS.AppDev.Cache.CacheManager.Current.Set($"{Request.RequestContext.HttpContext.Session.SessionID}_OperationsList_List1DataSet_TotalItems", response.TotalRows);
            }
            else
            {
                CLMS.AppDev.Cache.CacheManager.Current.Add($"{Request.RequestContext.HttpContext.Session.SessionID}_OperationsList_List1DataSet_TotalItems", response.TotalRows);
            }
            if (response.TotalRows < datasourceRequest.StartRow + 1)
            {
                datasourceRequest.StartRow = 0;
            }
            var _dto = DynamicDtoInfo.CreateFromPropsArray(datasourceRequest.DtoProperties);
            var _convertionMethod = _dto.GetConvertionFunc <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>();

            if (datasourceRequest.GroupBy.Any())
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, postedData);
                var items  = groups.GetAllItems();
                response.Data   = items.ToList().Select(i => _convertionMethod(i)).ToList();
                response.Groups = groups;
//Fix for total items in GetGroupsClosed
                if (datasourceRequest.GroupBy.FirstOrDefault().GetGroupsClosed)
                {
                    response.TotalRows = DatasourceRetriever.GetTotalGroups(groups);
                }
            }
            else
            {
                var items = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
                response.Data = items.ToList().Select(i => _convertionMethod(i)).ToList();
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(response)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult TransactionListNoDT_DatasourceAggregators()
        {
            object aggregatorsResponse = null;
            var    postedData          = _LoadViewModel();
            var    datasourceRequest   = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var    queryable           = Get_TransactionListNoDT_DatasourceQueryable(datasourceRequest);

            queryable = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable);
            var formattings = new Dictionary <string, string>();

            formattings.Add("TransactionDateOccured", "dd/MM/yyyy");
            formattings.Add("TransactionValue", "#,0.00;'-'#,0.00;'0'");
            formattings.Add("FundedAmount", "#,0.00;'-'#,0.00;'0'");
            formattings.Add("ToBePaidAmount", "#,0.00;'-'#,0.00;'0'");
            formattings.Add("PaymentDate", "dd/MM/yyyy");
            formattings.Add("RestPaymentAmount", "#,0.00;'-'#,0.00;'0'");
            if (datasourceRequest.GroupBy.Any() /* && datasourceRequest.GroupBy.First().GetGroupsClosed*/)
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, postedData, true);
                GroupsHelper.FormatGroupedAggregators(groups, formattings);
                aggregatorsResponse = new ListResponse()
                {
                    Groups = groups
                };
            }
            else
            {
                var aggregatorsInfo = DeserializeAggregatorsRequest <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>(postedData["aggregatorsRequest"].ToString());
                var aggregators     = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);
                foreach (var a in aggregators)
                {
                    var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                    a.Calculate(queryable, formatting);
                }
                aggregatorsResponse = aggregators;
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(aggregatorsResponse)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
Example #8
0
        public JsonResult List_DatasourceAggregators()
        {
            object aggregatorsResponse = null;
            var    postedData          = _LoadViewModel();
            var    datasourceRequest   = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var    queryable           = Get_List_DatasourceQueryable(datasourceRequest);

            queryable = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable);
            var formattings = new Dictionary <string, string>();

            formattings.Add("OrderForecast_CreatedOn", "dd/MM/yyyy");
            formattings.Add("OrderForecast_StartDate", "dd/MM/yyyy");
            formattings.Add("OrderForecast_EndDate", "dd/MM/yyyy");
            formattings.Add("RecommendedOrderDate", "dd/MM/yyyy");
            formattings.Add("SalesForecastDate", "dd/MM/yyyy");
            if (datasourceRequest.GroupBy.Any() /* && datasourceRequest.GroupBy.First().GetGroupsClosed*/)
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, postedData, true);
                GroupsHelper.FormatGroupedAggregators(groups, formattings);
                aggregatorsResponse = new ListResponse()
                {
                    Groups = groups
                };
            }
            else
            {
                var aggregatorsInfo = DeserializeAggregatorsRequest <DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails>(postedData["aggregatorsRequest"].ToString());
                var aggregators     = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);
                foreach (var a in aggregators)
                {
                    var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                    a.Calculate(queryable, formatting);
                }
                aggregatorsResponse = aggregators;
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(aggregatorsResponse)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public JsonResult List_DatasourceAggregators()
        {
            object aggregatorsResponse = null;
            var    postedData          = _LoadViewModel();
            var    datasourceRequest   = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var    queryable           = Get_List_DatasourceQueryable(datasourceRequest);

            queryable = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable);
            var formattings = new Dictionary <string, string>();

            if (datasourceRequest.GroupBy.Any() /* && datasourceRequest.GroupBy.First().GetGroupsClosed*/)
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, postedData, true);
                GroupsHelper.FormatGroupedAggregators(groups, formattings);
                aggregatorsResponse = new ListResponse()
                {
                    Groups = groups
                };
            }
            else
            {
                var aggregatorsInfo = DeserializeAggregatorsRequest <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>(postedData["aggregatorsRequest"].ToString());
                var aggregators     = RuntimePredicateBuilder.BuildAggregatorPredicates(aggregatorsInfo);
                foreach (var a in aggregators)
                {
                    var formatting = formattings.ContainsKey(a.Column) ? formattings[a.Column] : null;
                    a.Calculate(queryable, formatting);
                }
                aggregatorsResponse = aggregators;
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(aggregatorsResponse)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        public string List_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation> > 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 = "List";
            }
            if (exportOptions.ColumnOptions == null)
            {
                exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions>
                {
                    new ExportHelper.ColumnOptions {
                        Column = "ParentControllerName", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Name", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "IsAvailableToAllAuthorizedUsers", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "IsAvailableToAnonymous", IsVisible = true
                    },
                };
            }
            var queryable   = Get_List_DatasourceQueryable(datasourceRequest);
            var totalRows   = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count();
            var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
            var dto         = items.Select(i => new List1DataSet_ApplicationOperationDTO(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.ParentControllerName),
                    Value          = record?.ParentControllerName,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("OperationsList", "RES_LIST_List_COLUMN_ParentControllerName")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Name),
                    Value          = record?.Name,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("OperationsList", "RES_LIST_List_COLUMN_Name")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.IsAvailableToAllAuthorizedUsers),
                    Value          = record?.IsAvailableToAllAuthorizedUsers,
                    ColumnDataType = "bool",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("OperationsList", "RES_LIST_List_COLUMN_IsAvailableToAllAuthorizedUsers")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.IsAvailableToAnonymous),
                    Value          = record?.IsAvailableToAnonymous,
                    ColumnDataType = "bool",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("OperationsList", "RES_LIST_List_COLUMN_IsAvailableToAnonymous")
                });
                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("OperationsList", content, fileName));
        }
        public string DeliveryNoteListNoDT_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote> > 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 = "DeliveryNoteListNoDT";
            }
            if (exportOptions.ColumnOptions == null)
            {
                exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions>
                {
                    new ExportHelper.ColumnOptions {
                        Column = "Transaction.Id", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "DeliveryNoteNumber", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Description", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "DateIssued", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Amount", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Transaction.Supplier.Company", IsVisible = true
                    },
                };
            }
            var queryable   = Get_DeliveryNoteListNoDT_DatasourceQueryable(datasourceRequest);
            var totalRows   = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count();
            var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
            var dto         = items.Select(i => new DeliveryNoteDataSet_DeliveryNoteDTO(i));
            var formattings = new Dictionary <string, string>();

            formattings.Add("DateIssued", "dd/MM/yyyy");
            formattings.Add("Amount", "#,0.00;'-'#,0.00;'0'");
            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     = "Transaction.Id",
                    Value          = record?.Transaction?.Id,
                    ColumnDataType = "int",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_Transaction.Id")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.DeliveryNoteNumber),
                    Value          = record?.DeliveryNoteNumber,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_DeliveryNoteNumber")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Description),
                    Value          = record?.Description,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_Description")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.DateIssued),
                    Value          = record?.DateIssued,
                    ColumnDataType = "DateTime",
                    Format         = "dd/MM/yyyy",
                    ExcelFormat    = @"dd/MM/yyyy",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_DateIssued")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Amount),
                    Value          = record?.Amount,
                    ColumnDataType = "decimal",
                    Format         = "#,0.00;'-'#,0.00;'0'",
                    ExcelFormat    = @"#,##0.00;-#,##0.00;#,##0.00",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_Amount")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = "Transaction.Supplier.Company",
                    Value          = record?.Transaction?.Supplier?.Company,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("AdminDeliveryNoteList", "RES_LIST_DeliveryNoteListNoDT_COLUMN_Transaction.Supplier.Company")
                });
                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("AdminDeliveryNoteList", content, fileName));
        }
        public JsonResult Chart11_Datasource()
        {
            var postedData        = _LoadViewModel();
            var datasourceRequest = DeserializeDatasourceRequest(postedData["datasourceRequest"].ToString());
            var queryable         = Get_Chart11_DatasourceQueryable(datasourceRequest);
            var response          = new ListResponse
            {
                TotalRows = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count(),
            };

            //Total items count
            if (CLMS.AppDev.Cache.CacheManager.Current.HasKey($"{Request.RequestContext.HttpContext.Session.SessionID}_Chart11_TotalItems"))
            {
                CLMS.AppDev.Cache.CacheManager.Current.Set($"{Request.RequestContext.HttpContext.Session.SessionID}_Chart11_TotalItems", response.TotalRows);
            }
            else
            {
                CLMS.AppDev.Cache.CacheManager.Current.Add($"{Request.RequestContext.HttpContext.Session.SessionID}_Chart11_TotalItems", response.TotalRows);
            }
            if (response.TotalRows < datasourceRequest.StartRow + 1)
            {
                datasourceRequest.StartRow = 0;
            }
            if (datasourceRequest.GroupBy.Any())
            {
                var groups = DatasourceRetriever.RetrieveGrouped(datasourceRequest, queryable, q => q.Id, postedData);
                IDictionary <string, string> groupLabels = new Dictionary <string, string>()
                {
                    { "isavailabletoallauthorizedusers", "Actions" }, { "id", "Actions" }
                };
                var data = new List <ChartHelper.ChartResult>();
                foreach (var group in groups.SubGroups)
                {
                    var result = new ChartHelper.ChartResult();
                    result.Label = group.KeyFormatted;
                    foreach (var aggr in group.Aggregates)
                    {
                        if (aggr.Column == "__Count")
                        {
                            continue;
                        }
                        result.Values.Add(aggr.Value);
                        if (groupLabels.ContainsKey(aggr.Column.ToLower()))
                        {
                            result.ValueLabels.Add(groupLabels[aggr.Column.ToLower()]);
                        }
                        else
                        {
                            result.ValueLabels.Add(aggr.Column);
                        }
                    }
                    data.Add(result);
                }
                response.Data = data;
//Fix for total items in GetGroupsClosed
                if (datasourceRequest.GroupBy.FirstOrDefault().GetGroupsClosed)
                {
                    response.TotalRows = DatasourceRetriever.GetTotalGroups(groups);
                }
            }
            else
            {
                var items     = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
                var _dtos     = items.Select(i => new ApplicationOperationDataSet_ApplicationOperationDTO(i, true)).ToList();
                var chartData = new List <ChartHelper.ChartResult>();
                foreach (var _dto in _dtos)
                {
                    chartData.Add(new ChartHelper.ChartResult(_dto, _dto?.IsAvailableToAllAuthorizedUsers, new List <object> {
                        _dto?.Id
                    }, new List <object> {
                        "Actions"
                    }, new List <object> {
                    }));
                }
                response.Data = chartData;
            }
            var __result = Json(new
            {
                Type = "DatasourceData", Data = Serialize(response)
            }, JsonRequestBehavior.AllowGet);

            __result.MaxJsonLength = int.MaxValue;
            return(__result);
        }
        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 = "Business", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "PercentageOfCreditNotes", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "AcceptedPolicyTerms", 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("PendingRegisteredSuppliersList", "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("PendingRegisteredSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Company")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Business),
                    Value          = record?.Business,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("PendingRegisteredSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_Business")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.PercentageOfCreditNotes),
                    Value          = record?.PercentageOfCreditNotes,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("PendingRegisteredSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_PercentageOfCreditNotes")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.AcceptedPolicyTerms),
                    Value          = record?.AcceptedPolicyTerms,
                    ColumnDataType = "bool",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("PendingRegisteredSuppliersList", "RES_LIST_SupplierListNoDT_COLUMN_AcceptedPolicyTerms")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.SupplierStatus),
                    Value          = record?.SupplierStatus,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("PendingRegisteredSuppliersList", "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("PendingRegisteredSuppliersList", content, fileName));
        }
Example #14
0
        public string OrderProposalList_ExportImplementation(DatasourceRequest datasourceRequest, ExportHelper.ExportOptions exportOptions, List <AggregatorInfo <DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails> > 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 = "OrderProposalList";
            }
            if (exportOptions.ColumnOptions == null)
            {
                exportOptions.ColumnOptions = new List <ExportHelper.ColumnOptions>
                {
                    new ExportHelper.ColumnOptions {
                        Column = "Item.SKU", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Item.Description", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Warehouse.Description", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "Quantity", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "RecommendedOrderDate", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "SalesForecastDate", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "SupplierCanDeliver", IsVisible = true
                    },
                    new ExportHelper.ColumnOptions {
                        Column = "SupplierMaxQuantity", IsVisible = true
                    },
                };
            }
            var queryable   = Get_OrderProposalList_DatasourceQueryable(datasourceRequest);
            var totalRows   = DatasourceRetriever.ApplyDynamicFilterToQueryable(datasourceRequest, queryable).Count();
            var items       = DatasourceRetriever.Retrieve(datasourceRequest, queryable);;
            var dto         = items.Select(i => new OrderProposalDataSet_OrderForecastDetailsDTO(i));
            var formattings = new Dictionary <string, string>();

            formattings.Add("RecommendedOrderDate", "dd/MM/yyyy");
            formattings.Add("SalesForecastDate", "dd/MM/yyyy");
            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     = "Item.SKU",
                    Value          = record?.Item?.SKU,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Item.SKU")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = "Item.Description",
                    Value          = record?.Item?.Description,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Item.Description")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = "Warehouse.Description",
                    Value          = record?.Warehouse?.Description,
                    ColumnDataType = "string",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Warehouse.Description")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.Quantity),
                    Value          = record?.Quantity,
                    ColumnDataType = "decimal",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_Quantity")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.RecommendedOrderDate),
                    Value          = record?.RecommendedOrderDate,
                    ColumnDataType = "DateTime",
                    Format         = "dd/MM/yyyy",
                    ExcelFormat    = @"dd/MM/yyyy",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_RecommendedOrderDate")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.SalesForecastDate),
                    Value          = record?.SalesForecastDate,
                    ColumnDataType = "DateTime",
                    Format         = "dd/MM/yyyy",
                    ExcelFormat    = @"dd/MM/yyyy",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SalesForecastDate")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.SupplierCanDeliver),
                    Value          = record?.SupplierCanDeliver,
                    ColumnDataType = "bool",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SupplierCanDeliver")
                });
                recordDTO.Columns.Add(new ExportHelper.ExportColumnDTO
                {
                    ColumnName     = nameof(record.SupplierMaxQuantity),
                    Value          = record?.SupplierMaxQuantity,
                    ColumnDataType = "decimal",
                    Format         = "",
                    ExcelFormat    = @"",
                    Caption        = BaseViewPage <object> .GetResourceValue("SupplierOrderForecast", "RES_LIST_OrderProposalList_COLUMN_SupplierMaxQuantity")
                });
                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("SupplierOrderForecast", content, fileName));
        }