Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, OEM oEM)
        {
            if (id != oEM.OEMNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(oEM);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OEMExists(oEM.OEMNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(oEM));
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            SystemInfo.GetOSInfo();
            OEM.GetOEMInfo();
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(OEM oEM)
        {
            if (ModelState.IsValid)
            {
                _context.Add(oEM);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(oEM));
        }
        public override string ToString()
        {
            if (Valid)
            {
                try
                {
                    StringBuilder output = new StringBuilder();

                    output.AppendLine($"HAL build info: {HalBuildVersion?.ToString()}, {HalBuildInfo}");
                    output.AppendLine();
                    output.AppendLine($"Image build @ { ImageBuildDate } { ImageCompilerInfo } v{ ImageCompilerVersion.ToString() }");
                    output.AppendLine();
                    output.AppendLine($"OEM Product codes (vendor, model, SKU): {OEM.ToString()}, {Model.ToString()}, {SKU.ToString()}");
                    output.AppendLine();
                    output.AppendLine("Serial Numbers (module, system):");
                    output.AppendLine("  " + ModuleSerialNumber);
                    output.AppendLine("  " + SystemSerialNumber);
                    output.AppendLine();
                    output.AppendLine($"Solution Build Info: {SolutionBuildVersion?.ToString()}, {SolutionBuildInfo}");

                    output.AppendLine();
                    output.AppendLine("AppDomains:");
                    foreach (IAppDomainInfo adi in AppDomains)
                    {
                        output.AppendLine($"  {adi.Name}, id={adi.ID}");
                    }

                    output.AppendLine();
                    output.AppendLine("Assemblies:");
                    foreach (IAssemblyInfo ai in Assemblies)
                    {
                        output.AppendLine($"  {ai.Name}, {ai.Version}");
                    }

                    output.AppendLine();
                    output.AppendLine("Native Assemblies:");
                    foreach (CLRCapabilities.NativeAssemblyProperties assembly in NativeAssemblies)
                    {
                        output.AppendLine($"  {assembly.Name} v{assembly.Version}, checksum 0x{assembly.Checksum.ToString("X8")}");
                    }

                    return(output.ToString());
                }
                catch { };
            }

            return("DeviceInfo is not valid!");
        }
Ejemplo n.º 5
0
        private static void CreateData(UnitOfWork unitOfWork)
        {
            unitOfWork.BeginTransaction();

            // languages
            unitOfWork.LanguageRepository.Add(new Language()
            {
                Id = 1, Title = "English"
            });
            unitOfWork.LanguageRepository.Add(new Language()
            {
                Id = 2, Title = "Russian"
            });

            // countries
            unitOfWork.CountryRepository.Add(new Country()
            {
                Id = 1, LangId = 1, CountryName = "Italy"
            });
            unitOfWork.CountryRepository.Add(new Country()
            {
                Id = 2, LangId = 2, CountryName = "Италия"
            });
            unitOfWork.CountryRepository.Add(new Country()
            {
                Id = 3, LangId = 1, CountryName = "USA"
            });
            unitOfWork.CountryRepository.Add(new Country()
            {
                Id = 4, LangId = 2, CountryName = "США"
            });

            // machine types
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 1, MachineTypes = MachineTypeEnum.Excavator, LangId = 1, Text = "Crawler Excavator"
            });
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 2, MachineTypes = MachineTypeEnum.Excavator, LangId = 2, Text = "Гусеничный экскаватор"
            });
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 3, MachineTypes = MachineTypeEnum.Bulldozer, LangId = 1, Text = "Bulldozer"
            });
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 4, MachineTypes = MachineTypeEnum.Bulldozer, LangId = 2, Text = "Бульдозер"
            });
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 5, MachineTypes = MachineTypeEnum.PassengerVehicle, LangId = 1, Text = "Passenger Vehicle"
            });
            unitOfWork.MachineTypeRepository.Add(new MachineType()
            {
                Id = 6, MachineTypes = MachineTypeEnum.PassengerVehicle, LangId = 2, Text = "Легковой Автомобиль"
            });


            // brands
            unitOfWork.BrandRepository.Add(new Brand()
            {
                Id = 1, BrandName = "KOMATSU"
            });
            unitOfWork.BrandRepository.Add(new Brand()
            {
                Id = 2, BrandName = "CATERPILLAR"
            });

            // models
            unitOfWork.ModelRepository.Add(new Model()
            {
                Id = 1, BrandId = 1, MachineTypeId = MachineTypeEnum.Excavator, ModelName = "PC400LC-7"
            });
            unitOfWork.ModelRepository.Add(new Model()
            {
                Id = 2, BrandId = 1, MachineTypeId = MachineTypeEnum.Excavator, ModelName = "PC300LC-3"
            });
            unitOfWork.ModelRepository.Add(new Model()
            {
                Id = 3, BrandId = 1, MachineTypeId = MachineTypeEnum.Bulldozer, ModelName = "D355A-3"
            });
            unitOfWork.ModelRepository.Add(new Model()
            {
                Id = 4, BrandId = 2, MachineTypeId = MachineTypeEnum.Bulldozer, ModelName = "CAT320"
            });

            // category
            unitOfWork.CategoryRepository.Add(new Category()
            {
                Id = 1, LangId = 1, CategoryName = "Undercarriage"
            });
            unitOfWork.CategoryRepository.Add(new Category()
            {
                Id = 2, LangId = 2, CategoryName = "Ходовая часть"
            });
            unitOfWork.CategoryRepository.Add(new Category()
            {
                Id = 3, LangId = 1, CategoryName = "Crawler belt"
            });
            unitOfWork.CategoryRepository.Add(new Category()
            {
                Id = 4, LangId = 2, CategoryName = "Гусеницы"
            });


            // item1
            Item item = unitOfWork.ItemRepository.Create();

            item.Id             = 1;
            item.ModelId        = 1;
            item.CategoryId     = 1;
            item.Article        = "208-30-00431";
            item.CountryId      = 1;
            item.IsAvailable    = true;
            item.ManufacturerId = 1;

            unitOfWork.ItemRepository.Add(item);

            OEM oem = new OEM()
            {
                OEMCode = "208-30-00201", ItemId = 1
            };

            item.OEMList.Add(oem);

            unitOfWork.OemRepository.Add(oem);

            // description
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 1, ItemId = 1, LangId = 1, Text = "Carrier Roller"
            });
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 2, ItemId = 1, LangId = 2, Text = "Поддерживающий каток"
            });


            // item2
            Item item2 = unitOfWork.ItemRepository.Create();

            item2.Id             = 2;
            item2.ModelId        = 1;
            item2.CategoryId     = 1;
            item2.Article        = "AD441-1108R-LD-E";
            item2.CountryId      = 1;
            item2.IsAvailable    = true;
            item2.ManufacturerId = 1;

            oem = new OEM()
            {
                OEMCode = "8A0505465", ItemId = 2
            };

            item2.OEMList.Add(oem);

            unitOfWork.OemRepository.Add(oem);

            unitOfWork.ItemRepository.Add(item2);

            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 3, ItemId = 2, LangId = 1, Text = "Front Idler"
            });
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 4, ItemId = 2, LangId = 2, Text = "Передний ленивец"
            });

            // item3
            Item item3 = unitOfWork.ItemRepository.Create();

            item3.Id             = 3;
            item3.ModelId        = 1;
            item3.CategoryId     = 1;
            item3.Article        = "AU230009S-0L00";
            item3.CountryId      = 1;
            item3.IsAvailable    = true;
            item3.ManufacturerId = 1;

            oem = new OEM()
            {
                OEMCode = "8A0505548", ItemId = 3
            };

            item3.OEMList.Add(oem);

            unitOfWork.OemRepository.Add(oem);

            unitOfWork.ItemRepository.Add(item3);

            unitOfWork.ItemRepository.Add(item3);
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 5, ItemId = 3, LangId = 1, Text = "Crawler belt(type of ckvk)(2 fjjgks)"
            });
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 6, ItemId = 3, LangId = 2, Text = "Гусеницы (смазыв.типа)(2 сцепных звена)"
            });

            // item4
            Item item4 = unitOfWork.ItemRepository.Create();

            item4.Id             = 4;
            item4.ModelId        = 1;
            item4.CategoryId     = 1;
            item4.Article        = "AU230009S-0L00";
            item4.CountryId      = 1;
            item4.IsAvailable    = true;
            item4.ManufacturerId = 1;

            oem = new OEM()
            {
                OEMCode = "8A0505548", ItemId = 4
            };

            item4.OEMList.Add(oem);

            unitOfWork.OemRepository.Add(oem);

            unitOfWork.ItemRepository.Add(item4);

            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 7, ItemId = 4, LangId = 1, Text = "Crawler belt 45L 3G 800 мм"
            });
            unitOfWork.DescriptionRepository.Add(new DescriptionText()
            {
                Id = 8, ItemId = 4, LangId = 2, Text = "Гусеница в сборе 45L 3G 800 мм"
            });

            // item5
            Item item5 = unitOfWork.ItemRepository.Create();

            item5.Id             = 5;
            item5.ModelId        = 1;
            item5.CategoryId     = 1;
            item5.Article        = "AD441-1955R-LD-UE";
            item5.CountryId      = 1;
            item5.IsAvailable    = true;
            item5.ManufacturerId = 1;

            oem = new OEM()
            {
                OEMCode = "8A0807424A01C", ItemId = 5
            };

            item5.OEMList.Add(oem);

            unitOfWork.OemRepository.Add(oem);

            unitOfWork.ItemRepository.Add(item5);



            // currencies
            unitOfWork.CurrencyRepository.Add(new Currency()
            {
                Id = 1, CurrencyDesignation = "USD"
            });
            unitOfWork.CurrencyRepository.Add(new Currency()
            {
                Id = 2, CurrencyDesignation = "RUB"
            });

            // prices
            unitOfWork.ItemPriceRepository.Add(new ItemPriceReg()
            {
                Period = DateTime.Now, CurrencyId = 2, ItemId = 1, Value = (decimal)5950.00
            });
            unitOfWork.ItemPriceRepository.Add(new ItemPriceReg()
            {
                Period = DateTime.Now, CurrencyId = 2, ItemId = 2, Value = (decimal)53950.00
            });
            unitOfWork.ItemPriceRepository.Add(new ItemPriceReg()
            {
                Period = DateTime.Now, CurrencyId = 2, ItemId = 3, Value = (decimal)5420.00
            });

            unitOfWork.CommitTransaction();
        }
Ejemplo n.º 6
0
        public async Task Init()
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + "Data/";

            try
            {
                string[][] Brands = ReadCSV(path + "BRANDS.csv");
                for (int i = 0; i < Brands.Length; i++)
                {
                    Brand newBrand = new Brand
                    {
                        Name        = Brands[i][0],
                        Description = Brands[i][1],
                        PictureUrl  = Brands[i][2]
                    };
                    await _context.Brand.AddAsync(newBrand);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured:" + ex.Message);
            }

            try
            {
                string[][] Manufacturers = ReadCSV(path + "MANUFACTURERS.csv");
                for (int i = 0; i < Manufacturers.Length; i++)
                {
                    Manufacturer newManu = new Manufacturer
                    {
                        Name        = Manufacturers[i][0],
                        Description = Manufacturers[i][1]
                    };
                    await _context.Manufacturer.AddAsync(newManu);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured:" + ex.Message);
            }

            try
            {
                string[][] Cars = ReadCSV(path + "CARS.csv");
                for (int i = 0; i < Cars.Length; i++)
                {
                    Brand fkBrand = await _context.Brand.FirstOrDefaultAsync(e => e.Name.Equals(Cars[i][0]));

                    Car newCar = new Car
                    {
                        BrandFK     = fkBrand.Key,
                        Name        = Cars[i][1],
                        Description = Cars[i][2],
                        Started     = Convert.ToInt32(Cars[i][3]),
                        Finished    = Convert.ToInt32(Cars[i][4]),
                        Weight      = Convert.ToInt32(Cars[i][5])
                    };
                    await _context.Car.AddAsync(newCar);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured:" + ex.Message);
            }

            try
            {
                string[][] OEM = ReadCSV(path + "OEM.csv");
                for (int i = 0; i < OEM.Length; i++)
                {
                    OEM newOEM = new OEM
                    {
                        OEMNumber   = OEM[i][0],
                        Name        = OEM[i][1],
                        Description = OEM[i][2],
                        Weight      = Convert.ToDouble(OEM[i][3])
                    };
                    await _context.OEM.AddAsync(newOEM);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured:" + ex.Message);
            }

            try
            {
                string[][] Spares = ReadCSV(path + "SPARES.csv");
                for (int i = 0; i < Spares.Length; i++)
                {
                    Manufacturer man = await _context.Manufacturer.FirstOrDefaultAsync(e => e.Name.Equals(Spares[i][1]));

                    OEM oem = await _context.OEM.FirstOrDefaultAsync(e => e.OEMNumber.Equals(Spares[i][0]));

                    SparePart newSpare = new SparePart
                    {
                        OEMKey          = oem.OEMNumber,
                        ManufacturerKey = man.Key,
                        Name            = Spares[i][2],
                        Description     = Spares[i][3],
                        Price           = Convert.ToDouble(Spares[i][4]),
                        Weight          = Convert.ToDouble(Spares[i][5]),
                        Available       = Convert.ToInt32(Spares[i][6])
                    };
                    await _context.ReplacementPart.AddAsync(newSpare);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured:" + ex.Message);
            }
        }
Ejemplo n.º 7
0
        public override string ToString()
        {
            if (m_fValid)
            {
                try
                {
                    StringBuilder output = new StringBuilder();

                    output.AppendLine(String.Format("HAL build info: {0}, {1}", HalBuildVersion?.ToString(), HalBuildInfo?.TrimEnd('\0')));
                    output.AppendLine(String.Format("OEM Product codes (vendor, model, SKU): {0}, {1}, {2}", OEM.ToString(), Model.ToString(), SKU.ToString()));
                    output.AppendLine("Serial Numbers (module, system):");
                    output.AppendLine("  " + ModuleSerialNumber?.TrimEnd('\0'));
                    output.AppendLine("  " + SystemSerialNumber?.TrimEnd('\0'));
                    output.AppendLine(String.Format("Solution Build Info: {0}, {1}", SolutionBuildVersion?.ToString(), SolutionBuildInfo?.TrimEnd('\0')));

                    output.AppendLine("AppDomains:");
                    foreach (IAppDomainInfo adi in AppDomains)
                    {
                        output.AppendLine(String.Format("  {0}, id={1}", adi.Name, adi.ID));
                    }

                    output.AppendLine("Assemblies:");
                    foreach (IAssemblyInfo ai in Assemblies)
                    {
                        output.AppendLine(String.Format("  {0}, {1}", ai.Name, ai.Version));
                    }

                    return(output.ToString());
                }
                catch { };
            }

            return("DeviceInfo is not valid!");
        }
Ejemplo n.º 8
0
        private bool SaveToDataBaseProcess(IEnumerable <ImportDataRowModel> importCollection)
        {
            List <ImportDataRowModel> col = importCollection.ToList();

            UnitOfWork unitOfWork = new UnitOfWork();

            //проверим существование всех Brand и добавим если нету
            var brands = col.Select(s => s.Brand).Distinct().ToList();

            var brandsInDb = unitOfWork.BrandRepository.GetAllBrands().ToList();

            bool isNewAdded = false;

            int i = 0;

            foreach (string brandName in brands)
            {
                if (brandsInDb.FirstOrDefault(s => s.BrandName == brandName) == null)
                {
                    i--;
                    var newBrand = new Brand();
                    newBrand.BrandName = brandName;
                    newBrand.Id        = i;
                    unitOfWork.BrandRepository.Add(newBrand);

                    isNewAdded = true;
                }
            }

            if (isNewAdded)
            {
                try
                {
                    unitOfWork.BeginTransaction();
                    unitOfWork.CommitTransaction();
                    brandsInDb = unitOfWork.BrandRepository.GetAllBrands().ToList();
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Не удалось сохранить новые бренды: " + exc.Message);
                    return(false);
                }
            }

            //проверим существование всех моделей если нет то добавим
            var models = col.Select(s => new { s.Brand, s.SubModel }).Distinct().ToList();

            var modelInDb = unitOfWork.ModelRepository.GetAllModelsWithInclude().ToList();

            isNewAdded = false;

            i = 0;

            foreach (var model in models)
            {
                if (modelInDb.FirstOrDefault(s => s.ModelName == model.SubModel && s.Brand.BrandName == model.Brand) == null)
                {
                    i--;
                    var newModel = new HEPDataModel.Model();
                    newModel.Id            = i;
                    newModel.ModelName     = model.SubModel;
                    newModel.Brand         = brandsInDb.FirstOrDefault(q => q.BrandName == model.Brand);
                    newModel.BrandId       = newModel.Brand.Id;
                    newModel.MachineTypeId = SelectedMachineType.MachineTypes;
                    unitOfWork.ModelRepository.Add(newModel);

                    isNewAdded = true;
                }
            }

            if (isNewAdded)
            {
                try
                {
                    unitOfWork.BeginTransaction();
                    unitOfWork.CommitTransaction();
                    modelInDb = unitOfWork.ModelRepository.GetAllModelsWithInclude().ToList();
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Не удалось сохранить новые модели: " + exc.Message);
                    return(false);
                }
            }

            //проверим существование всех производителей если нет то добавим
            var manufs = col.Select(s => s.Manufacturer).Distinct().ToList();

            var manufInDb = unitOfWork.ManufacturerRepository.GetQuery().ToList();

            isNewAdded = false;

            i = 0;

            foreach (var manuf in manufs)
            {
                if (manufInDb.FirstOrDefault(s => s.ManufacturerName == manuf) == null)
                {
                    var newManuf = new HEPDataModel.Manufacturer();
                    newManuf.Id = i;
                    newManuf.ManufacturerName = manuf;
                    unitOfWork.ManufacturerRepository.Add(newManuf);

                    isNewAdded = true;
                }
            }

            if (isNewAdded)
            {
                try
                {
                    unitOfWork.BeginTransaction();
                    unitOfWork.CommitTransaction();
                    manufInDb = unitOfWork.ManufacturerRepository.GetQuery().ToList();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message);
                    return(false);
                }
            }

            //добавляем Item

            var itemsInDb = unitOfWork.ItemRepository.GetQuery().Select(s => s.Article).Distinct().ToList();

            unitOfWork = new UnitOfWork(true);

            i = 0;

            int continueCount = 0;

            foreach (ImportDataRowModel row in col)
            {
                i--;

                if (itemsInDb.FirstOrDefault(s => s == row.Article) != null)
                {
                    continueCount++;
                    continue;
                }

                Item newItem = new Item();
                newItem.Id         = i;
                newItem.Article    = row.Article;
                newItem.CostBase   = row.PriceBase;
                newItem.CostNative = row.PriceNative;

                // + 22/06/2014
                newItem.CategoryId = 1;
                newItem.CountryId  = 1;
                // - 22/06/2014

                DescriptionText descriptionText = new DescriptionText()
                {
                    ItemId = i, Item = newItem, LangId = 1, Text = row.Description
                };
                unitOfWork.DescriptionRepository.Add(descriptionText);
                newItem.DescriptionTextList.Add(descriptionText);

                newItem.IsAvailable = row.Quantity;

                Manufacturer manufacturer = manufInDb.FirstOrDefault(s => s.ManufacturerName == row.Manufacturer);
                if (manufacturer != null)
                {
                    newItem.ManufacturerId = manufacturer.Id;
                    //newItem.Manufacturer = manufacturer;
                }

                HEPDataModel.Model model = modelInDb.FirstOrDefault(s => s.ModelName == row.SubModel && s.Brand.BrandName == row.Brand);
                if (model != null)
                {
                    //newItem.Model = model;
                    newItem.ModelId = model.Id;
                }

                foreach (string oem in row.OEMList)
                {
                    OEM newOEM = new OEM();
                    newOEM.Item    = newItem;
                    newOEM.ItemId  = newItem.Id;
                    newOEM.OEMCode = oem;
                    unitOfWork.OemRepository.Add(newOEM);
                    newItem.OEMList.Add(newOEM);
                }

                unitOfWork.ItemRepository.Add(newItem);
            }


            try
            {
                unitOfWork.BeginTransaction();
                unitOfWork.CommitTransaction();
                MessageBox.Show("Items импортированы: " + (-i - continueCount).ToString() + " пропущено: " + continueCount.ToString());
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                var baseboardInfo = OEM.GetBaseBoardInfo();

                if (baseboardInfo != null)
                {
                    baseboard.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "BaseBoardId",
                            Value = baseboardInfo.BaseBoardId
                        },
                        new ListItems {
                            Item  = "Manufacturer",
                            Value = baseboardInfo.Manufacturer
                        },
                        new ListItems
                        {
                            Item  = "Model",
                            Value = baseboardInfo.Model
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = baseboardInfo.Name
                        }
                    };
                }

                var cpuInfo = OEM.GetCPUInfo();

                if (cpuInfo != null)
                {
                    cpu.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "CPUId",
                            Value = cpuInfo.CPUId
                        },
                        new ListItems {
                            Item  = "Manufacturer",
                            Value = cpuInfo.Manufacturer
                        },
                        new ListItems
                        {
                            Item  = "Family",
                            Value = cpuInfo.Family.ToString()
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = cpuInfo.Name
                        }
                    };
                }

                var gpuInfo = OEM.GetGPUInfo();

                if (gpuInfo != null)
                {
                    gpu.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "AdapterDACType",
                            Value = gpuInfo.AdapterDACType
                        },
                        new ListItems {
                            Item  = "VideoProcessor",
                            Value = gpuInfo.VideoProcessor
                        },
                        new ListItems
                        {
                            Item  = "Ram",
                            Value = gpuInfo.Ram.ToString()
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = gpuInfo.Name
                        }
                    };
                }

                var hardDriveInfo = OEM.GetPrimaryHardDiskInfo();

                if (hardDriveInfo != null)
                {
                    hardDrive.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "HardDiskId",
                            Value = hardDriveInfo.HardDiskId
                        },
                        new ListItems {
                            Item  = "Manufacturer",
                            Value = hardDriveInfo.Manufacturer
                        },
                        new ListItems
                        {
                            Item  = "Size",
                            Value = hardDriveInfo.Size.ToString()
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = hardDriveInfo.Name
                        }
                    };
                }

                var memoryInfo = OEM.GetMemoryInfo();

                if (memoryInfo != null)
                {
                    memory.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "Model",
                            Value = memoryInfo.Model
                        },
                        new ListItems {
                            Item  = "Manufacturer",
                            Value = memoryInfo.Manufacturer
                        },
                        new ListItems
                        {
                            Item  = "Size",
                            Value = memoryInfo.Size.ToString()
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = memoryInfo.Name
                        }
                    };
                }

                var monitorInfo = OEM.GetMonitorInfo();

                if (monitorInfo != null)
                {
                    monitor.ItemsSource = new List <ListItems>
                    {
                        new ListItems {
                            Item  = "MonitorType",
                            Value = monitorInfo.MonitorType
                        },
                        new ListItems {
                            Item  = "ScreenInchSize",
                            Value = monitorInfo.ScreenInchSize.ToString()
                        },
                        new ListItems
                        {
                            Item  = "Size",
                            Value = monitorInfo.ScreenHeight + "x" + monitorInfo.ScreenWidth
                        },
                        new ListItems
                        {
                            Item  = "Name",
                            Value = monitorInfo.Name
                        }
                    };
                }


                var osInfo = SystemInfo.GetOSInfo();

                system.ItemsSource = new List <ListItems>
                {
                    new ListItems {
                        Item  = "Operating Info",
                        Value = osInfo.OSName + osInfo.MajorMinorVersion.Major.ToString()
                    },
                    new ListItems {
                        Item  = "Build",
                        Value = osInfo.Build.ToString()
                    },
                    new ListItems {
                        Item  = "ServicePack",
                        Value = osInfo.ServicePack
                    },
                    new ListItems {
                        Item  = "Bit",
                        Value = osInfo.OSBit.ToString()
                    }
                };

                var driveList = OEM.GetDriveInfo();

                drives.ItemsSource = new List <ListItems>
                {
                    new ListItems {
                        Item  = "Letter",
                        Value = driveList[0].Letter
                    },
                    new ListItems {
                        Item  = "Size",
                        Value = driveList[0].TotalSize.ToSize(CommonHelpers.SizeUnits.GB) + " GB"
                    },
                    new ListItems {
                        Item  = "Usage",
                        Value = driveList[0].Usage.ToSize(CommonHelpers.SizeUnits.GB) + " GB" + " - %" + driveList[0].UsagePercent.ToString().Substring(0, 3)
                    },
                    new ListItems {
                        Item  = "AvailableSpace",
                        Value = driveList[0].AvailableSpace.ToSize(CommonHelpers.SizeUnits.GB) + " GB" + " - %" + driveList[0].AvailableSpacePercent.ToString().Substring(0, 3)
                    }
                };

                var biosInfo = OEM.GetBiosInfo();

                bios.ItemsSource = new List <ListItems>
                {
                    new ListItems {
                        Item  = "BIOSVersion",
                        Value = biosInfo.Version
                    },
                    new ListItems {
                        Item  = "BuildNumber",
                        Value = biosInfo.BuildNumber
                    },
                    new ListItems {
                        Item  = "CurrentLanguage",
                        Value = biosInfo.CurrentLanguage
                    },
                    new ListItems {
                        Item  = "Manufacturer",
                        Value = biosInfo.Manufacturer
                    }
                };
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.ToString());
                throw;
            }
        }
        public override string ToString()
        {
            if (Valid)
            {
                try
                {
                    StringBuilder output = new StringBuilder();

                    output.AppendLine($"HAL build info: {HalBuildInfo}");
                    output.AppendLine($"  Target:   {TargetName?.ToString()}");
                    output.AppendLine($"  Platform: {Platform?.ToString()}");
                    output.AppendLine();
                    output.AppendLine($"Firmware build Info:");
                    output.AppendLine($"  Date:        {ImageBuildDate ?? "unknown"}");
                    output.AppendLine($"  Type:        {VendorInfo ?? "unknown"}");
                    output.AppendLine($"  CLR Version: {SolutionBuildVersion}");
                    output.AppendLine($"  Compiler:    {ImageCompilerInfo ?? "unknown"} v{ImageCompilerVersion?.ToString()}");
                    output.AppendLine();
                    output.AppendLine($"OEM Product codes (vendor, model, SKU): {OEM.ToString()}, {Model.ToString()}, {SKU.ToString()}");
                    output.AppendLine();
                    output.AppendLine("Serial Numbers (module, system):");
                    output.AppendLine("  " + ModuleSerialNumber);
                    output.AppendLine("  " + SystemSerialNumber);
                    output.AppendLine();
                    output.AppendLine("Target capabilities:");
                    output.AppendLine("  Has nanoBooter: " + (Dbg.HasNanoBooter? "YES" : "NO"));
                    if (Dbg.TargetInfo != null &&
                        Dbg.HasNanoBooter)
                    {
                        output.AppendLine($"  nanoBooter: v{Dbg.TargetInfo.BooterVersion}");
                    }
                    output.AppendLine("  IFU capable: " + (Dbg.IsIFUCapable ? "YES" : "NO"));
                    output.AppendLine("  Has proprietary bootloader: " + (Dbg.HasProprietaryBooter ? "YES" : "NO"));

                    output.AppendLine();
                    output.AppendLine("AppDomains:");
                    foreach (IAppDomainInfo adi in AppDomains)
                    {
                        output.AppendLine($"  {adi.Name}, id={adi.ID}");
                    }

                    output.AppendLine();
                    output.AppendLine("Assemblies:");
                    foreach (IAssemblyInfo ai in Assemblies)
                    {
                        output.AppendLine($"  {ai.Name}, {ai.Version}");
                    }

                    output.AppendLine();
                    output.AppendLine("Native Assemblies:");
                    foreach (CLRCapabilities.NativeAssemblyProperties assembly in NativeAssemblies)
                    {
                        output.AppendLine($"  {assembly.Name} v{assembly.Version}, checksum 0x{assembly.Checksum.ToString("X8")}");
                    }

                    return(output.ToString());
                }
                catch
                {
                    // catch everything, doesn't matter
                }
            }

            return("DeviceInfo is not valid!");
        }