public IIoCContainer CreateContainer()
        {
            IIoCContainer container = new IoCContainer();

            using (var sr = new StreamReader(new FileStream(_jsonConfigFile, FileMode.Open)))
            {
                var configuration = JsonConvert.DeserializeObject <IoCConfiguration>(sr.ReadToEnd());
                foreach (var serializedConfig in configuration.DiConfigs)
                {
                    var config = new DiConfig
                    {
                        InterfaceType      = GetType(serializedConfig.InterfaceType),
                        ImplementationType = GetType(serializedConfig.ImplementationType),
                        Type = serializedConfig.Type
                    };
                    container.AddConfig(config);
                }

                foreach (var serializedConfig in configuration.DiConfigsWithArguments)
                {
                    var config = new DiConfigWithArguments
                    {
                        InterfaceType      = GetType(serializedConfig.InterfaceType),
                        ImplementationType = GetType(serializedConfig.ImplementationType),
                        Type = serializedConfig.Type,
                        PrimitiveArgumentList = serializedConfig.PrimitiveArgumentList.ToList()
                    };
                    container.AddConfig(config);
                }
            }

            return(container);
        }
Example #2
0
        public IList <ContractReportSection5ReportModel> GetSectionReport5Models(ContractFilterModel model)
        {
            var contractService = DiConfig.Resolve <IContractService>();
            var contractModels  = contractService.Report5Filter(model);

            return(contractModels);
        }
Example #3
0
        public CustomerList()
        {
            InitializeComponent();

            _organizationService = DiConfig.Resolve <IOrganizationService>();

            _worker.DoWork             += WorkerOnDoWork;
            _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted;

            // Create de Command.
            var changedIndex = new RoutedUICommand("ChangedIndex", "ChangedIndex", typeof(CustomerList));

            // Assing the command to PagingControl Command.
            GridPaging1.ChangedIndexCommand = changedIndex;

            // Binding Command
            var binding = new CommandBinding
            {
                Command = changedIndex
            };

            // Binding Handler to executed.
            binding.Executed += OnChangeIndexCommandHandler;

            CommandBindings.Add(binding);

            _worker.RunWorkerAsync();
        }
Example #4
0
        public void ConfigureServices(IServiceCollection services)
        {
            var appSettings = new AppSettings();

            Configuration.Bind(appSettings);

            services.AddSingleton(appSettings);

            services.AddDbContext <DataContext>(options => options.UseSqlite(DataContext.ConnectionString));

            services.AddControllers()
            .AddNewtonsoftJson();

            services.AddSpaStaticFiles(configuration => { configuration.RootPath = "wwwroot"; });

            services.AddHttpContextAccessor();

            services.AddCors(options =>
            {
                options.AddPolicy("Dev",
                                  builder =>
                {
                    builder.AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowAnyOrigin();
                });
            });

            services.AddHttpClient();

            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options => { options.SlidingExpiration = true; });

            services.AddAuthorization();

            services.AddIdentity <IdentityUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail         = false;
                options.Password.RequiredLength         = 10;
                options.Password.RequireUppercase       = false;
                options.Password.RequireLowercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequiredUniqueChars    = 5;
            })
            .AddEntityFrameworkStores <DataContext>()
            .AddDefaultTokenProviders();

            services.ConfigureApplicationCookie(options =>
            {
                options.Events.OnRedirectToLogin = context =>
                {
                    context.Response.StatusCode = StatusCodes.Status401Unauthorized;
                    return(Task.CompletedTask);
                };
                options.Cookie.Name = "SID";
            });

            DiConfig.Config(services);
            Service.DiConfig.Config(services);
        }
Example #5
0
        public CustomerForm(int id)
        {
            _organizationService = DiConfig.Resolve <IOrganizationService>();

            var organization = _organizationService.GetById(id);

            CustomerModel = new OrganizationUIViewModel
            {
                Id            = organization.Id,
                AccountNumber = organization.AccountNumber,
                Okohx         = organization.Okohx,
                Name          = organization.Name,
                Inn           = organization.Inn,
                BankName1     = organization.BankName1,
                Mfo1          = organization.Mfo1,
                BankName2     = organization.BankName2,
                Mfo2          = organization.Mfo2,
                BankName3     = organization.BankName3,
                Mfo3          = organization.Mfo3,
                PhoneNumbers  = organization.PhoneNumbers,
                Position      = organization.Position,
                Chief         = organization.Chief,
                KS            = organization.KS,
                LS            = organization.LS,
                Foundation    = organization.Foundation,
                Postcode      = organization.Postcode,
                TypeOwnership = organization.TypeOwnership,
                LegalAddress  = organization.LegalAddress
            };

            InitializeComponent();
        }
        public void GetOrders(string status)
        {
            using (var scope = DiConfig.GetContainer().BeginLifetimeScope())
            {
                var orderService = scope.Resolve <IOrderService>();

                var orderStatus = OrderStatus.Empty;

                if (!string.IsNullOrEmpty(status))
                {
                    orderStatus = OrderStatus.ParseDisplayName(status);
                    if (orderStatus == OrderStatus.Empty)
                    {
                        orderStatus = OrderStatus.Parse(status);
                    }

                    if (orderStatus == OrderStatus.Empty)
                    {
                        Console.WriteLine("Provided status is incorrect.");
                        return;
                    }
                }

                var orders = orderService.GetOrdersAsync(orderStatus).Result.Orders;

                ConsoleTable.From(orders.Select(o => new { o.Id, o.OrderDate, o.Status })).Write();
            }
        }
        public void UpdateStock(string merchantProductNo, int?stock)
        {
            if (string.IsNullOrEmpty(merchantProductNo))
            {
                Console.WriteLine("Cannot update: merchantProductNo is required");
                return;
            }
            if (stock == null)
            {
                Console.WriteLine("Cannot update: stock value is required");
                return;
            }
            if (stock < 0)
            {
                Console.WriteLine("Cannot update: stock cannot be negative number");
                return;
            }

            using (var scope = DiConfig.GetContainer().BeginLifetimeScope())
            {
                var productService = scope.Resolve <IProductService>();

                var isSuccess
                    = productService.UpdateStockAsync(merchantProductNo, stock.Value).Result == ResultStatus.Success;

                Console.WriteLine(isSuccess
                    ? $"Stock for {merchantProductNo} updated to {stock}."
                    : $"Cannot update stock for {merchantProductNo}");
            }
        }
Example #8
0
        private void _addService(Type interfaceType, Type implementationType, DiType diType,
                                 IReadOnlyCollection <object> args = null)
        {
            if (!interfaceType.IsAssignableFrom(implementationType))
            {
                throw new Exception($"The type {implementationType.Name} is not subclass of {interfaceType.Name}");
            }

            if (_typeIsRegistered(implementationType))
            {
                throw new Exception("The type " + implementationType.Name + " is already registered.");
            }

            DiConfig config;

            if (args == null || args.Count == 0)
            {
                config = new DiConfig();
            }
            else
            {
                config = new DiConfigWithArguments {
                    PrimitiveArgumentList = args.ToList()
                };
            }

            config.ImplementationType = implementationType;
            config.InterfaceType      = interfaceType;
            config.Type = diType;

            _configs.Add(config);
        }
Example #9
0
        public ContractList()
        {
            _contractService = DiConfig.Resolve <IContractService>();

            InitializeComponent();

            // Create de Command.
            var changedIndex = new RoutedUICommand("ChangedIndex", "ChangedIndex", typeof(ExportControl));

            // Assing the command to PagingControl Command.
            GridPaging1.ChangedIndexCommand = changedIndex;

            // Binding Command
            var binding = new CommandBinding
            {
                Command = changedIndex
            };

            // Binding Handler to executed.
            binding.Executed += OnChangeIndexCommandHandler;

            CommandBindings.Add(binding);

            ExecuteQuery();
        }
        /// <inheritdoc />
        public override void OnInitialize(TestRunExecutionContext context)
        {
            var builder = new ContainerBuilder();

            DiConfig.Setup(builder, testingMode: true);
            container = builder.Build();
            ServiceProviderFactory = new AutofacServiceProviderFactory(container);
        }
Example #11
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     DiConfig.Register();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Example #12
0
        public static string DoExportReport4(ContractFilterModel model)
        {
            try
            {
                var contractService = DiConfig.Resolve <IContractService>();
                var contractModels  = contractService.Report4Filter(model);
                var file            = new MemoryStream(Resources.template4);
                var wb          = new XLWorkbook(file);
                var ws          = wb.Worksheets.Worksheet(1);
                var filePath    = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "xlsx"));
                var topRowIndex = 9;

                //rows
                ws.Range(topRowIndex + 1, 1, contractModels.Count + topRowIndex, 10)
                .InsertRowsAbove(contractModels.Count, true);

                ws.Cell(5, 8).Value = DateTime.Now;
                ws.Cell(5, 8).Style.DateFormat.Format = "dd/MM/yyyy";

                for (var i = 0; i < contractModels.Count; i++)
                {
                    ws.Cell(topRowIndex + i, 1).Value = i + 1;
                    ws.Cell(topRowIndex + i, 2).Value = contractModels[i].Client;
                    ws.Cell(topRowIndex + i, 3).Value = contractModels[i].Object;
                    ws.Cell(topRowIndex + i, 4).SetValue(contractModels[i].Number);

                    ws.Cell(topRowIndex + i, 5).Value = contractModels[i].Col27;
                    ws.Cell(topRowIndex + i, 5).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 6).Value = contractModels[i].Col28;
                    ws.Cell(topRowIndex + i, 6).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 7).Value = contractModels[i].Col31;
                    ws.Cell(topRowIndex + i, 7).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 8).Value = contractModels[i].Date;
                    ws.Cell(topRowIndex + i, 8).Style.DateFormat.Format = "dd/MM/yyyy";

                    ws.Cell(topRowIndex + i, 9).Value = contractModels[i].Amount;
                    ws.Cell(topRowIndex + i, 9).Style.NumberFormat.Format = "#,##0.00";

                    ws.Cell(topRowIndex + i, 10).Value = contractModels[i].Paid;
                    ws.Cell(topRowIndex + i, 10).Style.NumberFormat.Format = "#,##0.00";
                }

                FitToColumns(ws, contractModels.Count);

                //save
                wb.SaveAs(filePath);

                return(filePath);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #13
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     DiConfig.RegisterDependency();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Example #14
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            DiConfig.RegisterTypesForMvc(typeof(MvcApplication).Assembly);
        }
Example #15
0
        private object Resolve(Type tDependency)
        {
            if (RecursionStack.Contains(tDependency))
            {
                throw new StackOverflowException("Infinite recursion detected");
            }
            RecursionStack.Push(tDependency);

            if (!DiConfig.dDepImpl.Any())
            {
                return(null);
            }

            // resolving
            object result = null;

            if (typeof(IEnumerable).IsAssignableFrom(tDependency))
            {
                Type argumentType     = tDependency.GetGenericArguments()[0];
                var  implementations  = new List <Implementation>(DiConfig.GetImplementationsForDependency(argumentType));
                var  createdArguments = (object[])Activator.CreateInstance(argumentType.MakeArrayType(), new object[] { implementations.Count });
                for (var i = 0; i < implementations.Count; i++)
                {
                    createdArguments[i] = HandleSingletonCase(implementations[i]);
                }
                result = createdArguments;
            }
            else
            {
                var implementations = new List <Implementation>();
                if (tDependency.IsGenericType && DiConfig.dDepImpl.ContainsKey(tDependency.GetGenericTypeDefinition()))
                {
                    implementations = new List <Implementation>(DiConfig.GetImplementationsForDependency(tDependency.GetGenericTypeDefinition()));
                }
                else
                {
                    if (DiConfig.dDepImpl.ContainsKey(tDependency))
                    {
                        implementations = new List <Implementation>(DiConfig.GetImplementationsForDependency(tDependency));
                    }
                }

                if (implementations.Any())
                {
                    result = HandleSingletonCase(implementations[0]);
                }
                else
                {
                    result = CreateUsingConstructor(tDependency);
                }
            }

            RecursionStack.Pop();

            return(result);
        }
Example #16
0
        public CustomerForm()
        {
            _organizationService = DiConfig.Resolve <IOrganizationService>();

            CustomerModel = new OrganizationUIViewModel();

            InitializeComponent();

            CustomerModel.Validate();
        }
Example #17
0
        public CategoryControl()
        {
            _categoryService = DiConfig.Resolve <ICategoryService>();

            InitializeComponent();

            UCCategoryGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick;
            UCCategoryForm.ButtonSaveClick     += Button_Save;
            UCCategoryForm.ButtonDeleteClick   += Button_Delete;
        }
        public ClientControl()
        {
            _clientService = DiConfig.Resolve <IClientService>();

            InitializeComponent();

            UCClientGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick;
            UCClientForm.ButtonSaveClick     += Button_Save;
            UCClientForm.ButtonDeleteClick   += Button_Delete;
        }
Example #19
0
        /// <summary>
        /// Common scraping function
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="log"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private static async Task ScrapeAsync(Expression <Func <Cluster, bool> > expression, ILogger log, ExecutionContext context)
        {
            var serviceProvider     = DiConfig.GetServiceProvider(context.FunctionAppDirectory);
            var scraper             = serviceProvider.GetService <IAtlasScraper>();
            var clusterSnapshotRepo = serviceProvider.GetService <ClusterSnapshotRepository>();

            var clusterSnapshot = await scraper.ScrapeAsync(expression);

            await clusterSnapshotRepo.CreateItemAsync(clusterSnapshot);
        }
Example #20
0
        public FolderControl()
        {
            _folderService = DiConfig.Resolve <IFolderService>();

            InitializeComponent();

            UCFolderGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick;
            UCFolderForm.ButtonSaveClick     += Button_Save;
            UCFolderForm.ButtonDeleteClick   += Button_Delete;
        }
        public ProductControl()
        {
            _productService = DiConfig.Resolve <IProductService>();

            InitializeComponent();

            UCProductGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick;
            UCProductForm.ButtonSaveClick     += Button_Save;
            UCProductForm.ButtonDeleteClick   += Button_Delete;
        }
        public EmployeeControl()
        {
            _employeeService = DiConfig.Resolve <IEmployeeService>();

            InitializeComponent();

            UCEmployeeGrid.DataGridDoubleClick += DataGrid_MouseDoubleClick;
            UCEmployeeForm.ButtonSaveClick     += Button_Save;
            UCEmployeeForm.ButtonDeleteClick   += Button_Delete;
        }
Example #23
0
        private object CreateUsingConstructor(Type type)
        {
            object result = null;

            if (type.ContainsGenericParameters)
            {
                var genericArguments = type.GetGenericArguments();
                var genericParams    = genericArguments.Select(dependency =>
                {
                    var implementations = DiConfig.GetImplementationsForDependency(dependency.BaseType)?.ToArray();
                    if (implementations == null)
                    {
                        return(dependency.BaseType);
                    }
                    else
                    {
                        return(implementations.First().Type);
                    }
                }).ToArray();

                type = type.MakeGenericType(genericParams);
            }

            var constructorsInfo = type.GetConstructors();

            foreach (var constructorInfo in constructorsInfo)
            {
                var parameters = new List <object>();

                try
                {
                    var paramsInfo = constructorInfo.GetParameters();
                    foreach (var paramInfo in paramsInfo)
                    {
                        parameters.Add(Resolve(paramInfo.ParameterType));
                    }

                    result = Activator.CreateInstance(type, parameters.ToArray());
                    if (result != null)
                    {
                        return(result);
                    }
                }
                catch (StackOverflowException e) // for handling recursion
                {
                    throw e;
                }
                catch
                {
                    // do nothing
                }
            }

            return(result);
        }
Example #24
0
        public static string ContractExport(int contractId)
        {
            var contractService     = DiConfig.Resolve <IContractService>();
            var organizationService = DiConfig.Resolve <IOrganizationService>();
            var workPaymentService  = DiConfig.Resolve <IContractWorkPaymentService>();
            var workTypeService     = DiConfig.Resolve <IWorkTypeService>();
            var actInvoiceService   = DiConfig.Resolve <IActInvoiceService>();
            var categoryService     = DiConfig.Resolve <ICategoryService>();
            var branchService       = DiConfig.Resolve <IBranchService>();
            var contractModel       = contractService.GetById(contractId);
            var actInvoiceModel     = actInvoiceService.Get(a => a.ContractId == contractId);
            var organizationModel   = organizationService.GetById(contractModel.OrganizationId.GetValueOrDefault());
            var workTypes           = workPaymentService.GetAll(a => a.ContractId == contractId);
            var categoryModel       = categoryService.GetById(contractModel.CategoryId ?? 0);
            var branchModel         = branchService.GetById(contractModel.BranchId ?? 0);
            var resourceKey         = String.Format("contract_template{0}_{1}", (int)branchModel.Code, (int)categoryModel.Code);
            var resource            = Resources.ResourceManager.GetObject(resourceKey);

            MemoryStream file = null;

            if (resource is byte[])
            {
                file = new MemoryStream((byte[])resource);
            }
            else
            {
                throw new InvalidCastException("The specified resource is not a binary resource.");
            }

            var filePath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), "docx"));

            using (var document = DocX.Load(file)) {
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_NUMBER, contractModel.ContractNumber ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.OBJECT_NAME, contractModel.ObjectName ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_NAME, organizationModel.Name ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_DATE, contractModel.ContractDate.GetValueOrDefault(DateTime.Now).ToShortDateString(), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_TOTAL_PRICE, contractModel.ContractAmount.GetValueOrDefault(0).ToString("N"), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_TOTAL_PRICE_STR, contractModel.ContractAmount.GetValueOrDefault(0).Speach(), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_ACCOUNT_NUMBER, organizationModel.AccountNumber ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_ADDRESS, organizationModel.LegalAddress ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_INN, organizationModel.Inn ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_MFO1, organizationModel.Mfo1 ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_OKOHX, organizationModel.Okohx ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ORGANIZATION_PHONE_NUMBER, organizationModel.PhoneNumbers ?? "", false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TYPE, String.Join(",", workTypes.Select(s => workTypeService.GetById(s.WorkTypeId.GetValueOrDefault(0)).Descrption)), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TOTAL_AMOUNT, workTypes.Sum(s => s.Amount.GetValueOrDefault(0)).ToString("N"), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.CONTRACT_WORK_TOTAL_AMOUNT_STR, workTypes.Sum(s => s.Amount).GetValueOrDefault(0).Speach(), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ACTINVOICE_DATE, DateTime.Now.ToShortDateString(), false, RegexOptions.IgnoreCase);
                document.ReplaceText(ExportConfig.KEYS.ACTINVOICE_NUMBER, actInvoiceModel.Number ?? "", false, RegexOptions.IgnoreCase);

                document.SaveAs(filePath);
            }

            return(filePath);
        }
Example #25
0
        public CategoryFormControl()
        {
            _categoryService = DiConfig.Resolve <ICategoryService>();
            _folderService   = DiConfig.Resolve <IFolderService>();

            InitializeComponent();

            ComboBoxFolder.ItemsSource       = _folderService.GetAll();
            ComboBoxFolder.DisplayMemberPath = "Name";
            ComboBoxFolder.SelectedValuePath = "Id";
        }
        public ProductFormControl()
        {
            _productService  = DiConfig.Resolve <IProductService>();
            _categoryService = DiConfig.Resolve <ICategoryService>();

            InitializeComponent();

            ComboBoxCategory.ItemsSource       = _categoryService.GetAll();
            ComboBoxCategory.DisplayMemberPath = "Name";
            ComboBoxCategory.SelectedValuePath = "Id";
        }
Example #27
0
        public NakladnoyList()
        {
            _contractService = DiConfig.Resolve <IContractService>();

            InitializeComponent();

            _worker.WorkerReportsProgress = true;
            _worker.DoWork             += WorkerOnDoWork;
            _worker.ProgressChanged    += WorkerOnProgressChanged;
            _worker.RunWorkerCompleted += WorkerOnRunWorkerCompleted;
        }
Example #28
0
        public ClientFormControl()
        {
            _clientService     = DiConfig.Resolve <IClientService>();
            _clientTypeService = DiConfig.Resolve <IClientTypeService>();

            InitializeComponent();

            ComboBoxClientType.ItemsSource       = _clientTypeService.GetAll();
            ComboBoxClientType.DisplayMemberPath = "Name";
            ComboBoxClientType.SelectedValuePath = "Id";
        }
Example #29
0
        public void TestMethod1()
        {
            var config = new DiConfig();

            config.AddFabricGenerator <Dog>();

            var provider = new DiProvider(config);
            var pet      = provider.Inject <Pet>();

            Assert.AreEqual(typeof(Dog), pet.GetType());
        }
        public void GetTopProducts()
        {
            using (var scope = DiConfig.GetContainer().BeginLifetimeScope())
            {
                var productService = scope.Resolve <IProductService>();

                var products = productService.Get5TopProductsAsync().Result.Products;

                ConsoleTable.From(products.Select(p => new
                                                  { p.Product.Name, p.Product.MerchantProductNo, p.Product.Ean, p.TotalQuantity })).Write();
            }
        }