Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();



            listBox1.ItemsSource = types;

            //попытка чтения без рекурсии
            if (SettingsReader.TryRead(out settings))
            {
            }
            else
            {
                SettingsView settings = new SettingsView();
                settings.ShowDialog();
                if (settings.DialogResult != true)
                {
                    MessageBox.Show("Нет строки подключения, завершение программы");
                    System.Windows.Application.Current.Shutdown();
                }
            }

            //_connectionString = System.Configuration.ConfigurationManager.
            //    ConnectionStrings["connectionString"].ConnectionString;
            _connectionString = SettingsReader.ResourcesConnectionString;


            cpuRepository = new CpuRepository(_connectionString);
            gpuRepository = new GpuRepository(_connectionString);
            informationSupportRepository = new InformationSupportRepository(_connectionString);
            monitorRepository            = new MonitorRepository(_connectionString);
            softwareRepository           = new SoftwareRepository(_connectionString);
        }
Exemple #2
0
        public UnitOfWork(ApplicationDbContext context)
        {
            _context       = context;
            ProductDetails = new ReservationDetailsRepository(_context);
            Products       = new ProductRepository(_context);

            ProductCategories = new ProductCategoryRepository(_context);

            Services = new ServiceRepository(_context);

            ServiceCategories = new ServiceCategoryRepository(_context);

            Departments = new DepartmentRepository(_context);

            Menus = new MenuRepository(_context);

            SubMenus = new SubMenuRepository(_context);

            OurTeams = new OurTeamRepository(_context);

            Designations = new DesignationRepository(_context);

            Faq = new FaqRepository(_context);

            Client = new ClientRepository(_context);

            Blogs = new BlogRepository(_context);

            ContactUs = new ContactUsRepository(_context);

            Companies = new CompanyRepository(_context);

            Banner = new BannerRepository(_context);

            ChooseUs = new WhyChooseUsRepository(_context);

            ClientProducts = new ClientProductRepository(_context);

            AboutUs = new AboutUsRepository(_context);

            HostingPlan = new HostingPlanRepository(_context);

            CustomerReview = new CustomerReviewRepository(_context);

            Career = new CareerRepository(_context);

            Job = new JobRepository(_context);

            Softwares = new SoftwareRepository(_context);

            SoftwareCategories = new SoftwareCategoriesRepository(_context);

            Features = new FeaturesRepository(_context);

            BlogComment = new BlogCommentRepository(_context);

            QueryHelper = new QueryHelper();
        }
 private void LoadRep()
 {
     cpuRepository = new CpuRepository(_connectionString);
     gpuRepository = new GpuRepository(_connectionString);
     informationSupportRepository = new InformationSupportRepository(_connectionString);
     monitorRepository            = new MonitorRepository(_connectionString);
     softwareRepository           = new SoftwareRepository(_connectionString);
     storageRepository            = new StorageDeviceRepository(_connectionString);
 }
Exemple #4
0
 public UnitOfWork(CogShareContext context)
 {
     _context          = context;
     Docs              = new DocumentationRepository(_context);
     ExternalProjects  = new ExternalProjectRepository(_context);
     Hardware          = new HardwareRepository(_context);
     PersonalProjects  = new PersonalProjectRepository(_context);
     SoftwareLibraries = new SoftwareLibraryRepository(_context);
     Software          = new SoftwareRepository(_context);
     CogShareUsers     = new CogShareUserRepository(_context);
 }
        private async Task <IActionResult> GetSoftwareById(GetSoftwareByIdRequest getSoftwareRequest)
        {
            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "Software")
                          .Options;


            // Run the test against one instance of the context
            using (var context = new Context(options))
            {
                var repository = new SoftwareRepository(context, AutomapperSingleton.Mapper);
                var service    = new SoftwareService(repository, AutomapperSingleton.Mapper);
                var controller = new SoftwareController(service);

                Mock <HttpRequest> mockGetRequest = MockHttpRequest.CreateMockQuery(getSoftwareRequest.Id);
                return(await controller.GetSoftwareByIdAsync(mockGetRequest.Object, _logger)); //as GridController;
            }
        }
Exemple #6
0
 public SoftwareBusiness(IUnitOfWork _unitOfWork)
 {
     unitOfWork = _unitOfWork;
     repository = new SoftwareRepository(unitOfWork);
 }
Exemple #7
0
        internal void scan(Intune_API oAPI)
        {
            try
            {
                var lIDs = oAPI.getRZIDs();
                //File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\dbg.txt"), new string[] { "Repository-Items:" + SoftwareRepository.Count.ToString() });

#if DEBUG
                System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZDebug.txt"), new string[] { DateTime.Now.ToString() + ";S0;" + "RZItems detected: ", lIDs.Count.ToString() });
#endif
#if DEBUG
                System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZDebug.txt"), new string[] { DateTime.Now.ToString() + ";S0;" + "Repository Items: ", SoftwareRepository.Count().ToString() });
#endif

                foreach (Intune_API.GraphRZ RZSW in lIDs)
                {
                    try
                    {
                        if (SoftwareRepository.Count(t => t.SWId == RZSW.RZID) == 0)
                        {
                            //File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\dbg.txt"), new string[] { "not match, IconId:" + SQLRZ.RZID.ToString() });

                            var oSW = SoftwareRepository.FirstOrDefault(t => t.ShortName == RZSW.Shortname);

                            if (oSW != null)
                            {
                                AddSoftware oNew = new AddSoftware()
                                {
                                    ProductName    = oSW.ProductName,
                                    ProductVersion = oSW.ProductVersion,
                                    Manufacturer   = oSW.Manufacturer,
                                    ShortName      = oSW.ShortName,
                                    Description    = oSW.Description,
                                    SWId           = oSW.SWId,
                                    IconHash       = oSW.IconHash,
                                    MSIProductID   = RZSW.Version
                                };

                                //if (RZSW.Bootstrap)
                                //    oNew.Author = "BootstrapTrue";
                                //else
                                //    oNew.Author = "BootstrapFalse";

#if DEBUG
                                System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZDebug.txt"), new string[] { DateTime.Now.ToString() + ";S1;" + "New SWVersion: ", oNew.ProductName, oNew.ProductVersion, oNew.MSIProductID });
#endif
                                NewSoftwareVersions.Add(oNew);
                            }
                        }
                        else
                        {
                            try
                            {
                                var oSW = SoftwareRepository.FirstOrDefault(t => t.SWId == RZSW.RZID);
                                if (oSW != null)
                                {
                                    try
                                    {
                                        AddSoftware oExisting = new AddSoftware()
                                        {
                                            ProductName    = oSW.ProductName,
                                            ProductVersion = oSW.ProductVersion,
                                            Manufacturer   = oSW.Manufacturer,
                                            ShortName      = oSW.ShortName,
                                            Description    = oSW.Description,
                                            IconHash       = oSW.IconHash,
                                            SWId           = oSW.SWId
                                        };

                                        //if (RZSW.Bootstrap)
                                        //    oExisting.Author = "BootstrapTrue";
                                        //else
                                        //    oExisting.Author = "BootstrapFalse";

#if DEBUG
                                        System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZDebug.txt"), new string[] { DateTime.Now.ToString() + ";S2;" + "Installed SWVersion: ", oExisting.ProductName, oExisting.ProductVersion });
#endif
                                        InstalledSoftware.Add(oExisting);
                                    }
                                    catch { }
                                }
                            }
                            catch { }
                        }
                    }
                    catch (Exception ex)
                    {
                        System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZError.txt"), new string[] { DateTime.Now.ToString() + ";F1814E1" + ex.Message });
                    }
                }

                //Cleanup SW where new Version already exists
                foreach (var oSW in InstalledSoftware)
                {
                    NewSoftwareVersions.RemoveAll(t => t.ShortName == oSW.ShortName);
                }
            }
            catch (Exception ex)
            {
                System.IO.File.AppendAllLines(Environment.ExpandEnvironmentVariables("%TEMP%\\RZError.txt"), new string[] { DateTime.Now.ToString() + ";F1845E1" + ex.Message });
            }
            OnUpdScanCompleted(this, new EventArgs());
            OnSWScanCompleted(this, new EventArgs());
        }
Exemple #8
0
 public SoftwareController(SoftwareRepository software)
 {
     Software = software;
 }
Exemple #9
0
        public EFUnitOfWork(ApplicationContext db, Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.Identity.IdentityOptions> optionAccessor, Microsoft.AspNetCore.Identity.IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <Microsoft.AspNetCore.Identity.IUserValidator <ApplicationUser> > userValidators, IEnumerable <Microsoft.AspNetCore.Identity.IPasswordValidator <ApplicationUser> > passwordValidators, Microsoft.AspNetCore.Identity.ILookupNormalizer keyNormalizer, Microsoft.AspNetCore.Identity.IdentityErrorDescriber errors, IServiceProvider servises, Microsoft.Extensions.Logging.ILogger <Microsoft.AspNetCore.Identity.UserManager <ApplicationUser> > logger, IEnumerable <Microsoft.AspNetCore.Identity.IRoleValidator <ApplicationRole> > roleValidators, Microsoft.Extensions.Logging.ILogger <Microsoft.AspNetCore.Identity.RoleManager <ApplicationRole> > roleLogger)
        {
            this.db = db;

            #region User repositories

            ApplicationUsers      = new ApplicationUserManager(new UserStore <ApplicationUser>(db), optionAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, servises, logger);
            Roles                 = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db), roleValidators, keyNormalizer, errors, roleLogger);
            UserProfiles          = new UserProfileRepository(db);
            Comments              = new CommentRepository(db);
            ComputerAssemblyRates = new ComputerAssemblyRateRepository(db);

            #endregion

            #region Infrastructure repositories

            ComputerAssemblies = new ComputerAssemblyRepository(db);
            Manufacturers      = new ManufacturerRepository(db);
            Softwares          = new SoftwareRepository(db);
            Developers         = new DeveloperRepository(db);
            Publishers         = new PublisherRepository(db);
            Countries          = new CountryRepository(db);

            #endregion

            #region Specification repositories

            CPUSockets                       = new CPUSocketRepository(db);
            GPUs                             = new GPURepository(db);
            GraphicMemoryTypes               = new GraphicMemoryTypeRepository(db);
            MotherBoardFormFactors           = new MotherBoardFormFactorRepository(db);
            MotherBoardNorthBridges          = new MotherBoardNorthBridgeRepository(db);
            OuterMemoryFormFactors           = new OuterMemoryFormFactorRepository(db);
            OuterMemoryInterfaces            = new OuterMemoryInterfaceRepository(db);
            PowerSupplyCPUInterfaces         = new PowerSupplyCPUInterfaceRepository(db);
            PowerSupplyMotherBoardInterfaces = new PowerSupplyMotherBoardInterfaceRepository(db);
            RAMTypes                         = new RAMTypeRepository(db);
            RequirementTypes                 = new RequirementTypeRepository(db);
            VideoCardInterfaces              = new VideoCardInterfaceRepository(db);
            #endregion

            #region Joins repositories

            ComputerAssemblyHDDs                = new ComputerAssemblyHDDRepository(db);
            ComputerAssemblyRAMs                = new ComputerAssemblyRAMRepository(db);
            ComputerAssemblySSDs                = new ComputerAssemblySSDRepository(db);
            ComputerAssemblyVideoCards          = new ComputerAssemblyVideoCardRepository(db);
            MotherBoardOuterMemorySlots         = new MotherBoardOuterMemorySlotRepository(db);
            MotherBoardRAMSlots                 = new MotherBoardRAMSlotRepository(db);
            MotherBoardPowerSupplySlots         = new MotherBoardPowerSupplySlotRepository(db);
            MotherBoardVideoCardSlots           = new MotherBoardVideoCardSlotRepository(db);
            PCCaseMotherBoardFormFactors        = new PCCaseMotherBoardFormFactorRepository(db);
            PCCaseOuterMemoryFormFactors        = new PCCaseOuterMemoryFormFactorRepository(db);
            PowerSupplyPowerSupplyCPUInterfaces = new PowerSupplyPowerSupplyCPUInterfaceRepository(db);
            SoftwareCPURequirements             = new SoftwareCPURequirementRepository(db);
            SoftwareVideoCardRequirements       = new SoftwareVideoCardRequirementRepository(db);
            #endregion

            #region Hardware Repositories

            CPUs          = new CPURepository(db);
            HDDs          = new HDDRepository(db);
            MotherBoards  = new MotherBoardRepository(db);
            PCCases       = new PCCaseRepository(db);
            PowerSupplies = new PowerSupplyRepository(db);
            RAMs          = new RAMRepository(db);
            SSDs          = new SSDRepository(db);
            VideoCards    = new VideoCardRepository(db);

            #endregion
        }