public ActionResult HardwareSettings()
        {
            var dto   = HardwareSettingsService.GetSettings();
            var model = new HardwareSettingsViewModel();

            model.InjectFrom(dto);

            // Get the drives and drive information
            var drives = HardwareService.GetDrives().ToList();
            var nics   = HardwareService.GetAllNics();

            model.Drives = new List <DriveSettingsViewModel>();

            foreach (var d in drives)
            {
                var driveModel = new DriveSettingsViewModel();
                driveModel.InjectFrom(d);
                model.Drives.Add(driveModel);
            }

            model.NicDict = new Dictionary <string, int>();
            foreach (var nic in nics)
            {
                model.NicDict.Add(nic.Key, nic.Value);
            }

            // TODO: Add view
            return(View(model));
        }
示例#2
0
 public AccountingController()
 {
     _accService      = new AccountingService();
     _customerService = new CustomerService();
     _hardwareService = new HardwareService();
     _softwareService = new SoftwareService();
 }
示例#3
0
        public ActionResult HardwareSettings()
        {
            var dto   = HardwareSettingsService.GetSettings();
            var model = Mapper.Map <HardwareSettingsViewModel>(dto);

            // Get the drives and drive information
            var drives = HardwareService.GetDrives().ToList();
            var nics   = HardwareService.GetAllNics();

            model.Drives = new List <DriveSettingsViewModel>();

            foreach (var d in drives)
            {
                var driveModel = new DriveSettingsViewModel();
                driveModel.InjectFrom(d);
                model.Drives.Add(driveModel);
            }

            model.NetworkMonitoring.NicDict = new Dictionary <string, int>();
            var ddlNics = new List <string>();

            foreach (var nic in nics)
            {
                model.NetworkMonitoring.NicDict.Add(nic.Key, nic.Value);
                ddlNics.Add(nic.Key);
            }
            model.NetworkMonitoring.Nics = new SelectList(model.NetworkMonitoring.NicDict, "Value", "Key", 1);

            return(View(model));
        }
示例#4
0
 public SupportController()
 {
     _supportService  = new SupportService();
     _hardwareService = new HardwareService();
     _productService  = new ProductService();
     _customerService = new CustomerService();
 }
        public PartialViewResult PV_HardwareList(T_HARDWARE_COND Cond)
        {
            List <T_HARDWARE> rtn = new HardwareService().GetHardwareList(Cond);

            ViewBag.list = rtn;
            ViewBag.Cond = Cond;
            return(PartialView2());
        }
        public override Task StartAsync(CancellationToken cancellationToken)
        {
            var hardwareList = HardwareService.GetHardwareInfo();

            AddHardwareToDb(hardwareList);

            return(base.StartAsync(cancellationToken));
        }
示例#7
0
 private void GetCPUTemperature()
 {
     do
     {
         WaitMilliseconds(1000);
         var cpuReadings = HardwareService.GetCPUInfo();
         UpdateTextBox(OutputBox2, string.Join(",", cpuReadings));
     } while (_isLCDReadingRunning);
 }
        public JsonResult HardwareSave(T_HARDWARE Param)
        {
            Param.INSERT_CODE = SessionHelper.LoginInfo.MEMBER.MEMBER_CODE;
            RTN_SAVE_DATA rtn = new HardwareService().HardwareSave(Param);

            return(new JsonResult()
            {
                Data = rtn
            });
        }
示例#9
0
 public HardwareController()
 {
     _hardwareService = new HardwareService();
     _productService = new ProductService();
     _customerService = new CustomerService();
     _ptypes = new ProblemType();
     _tsh = new TroubleShooting();
     
     
 }
示例#10
0
        private async Task <IActionResult> GetHardwareById(GetHardwareByIdRequest getHardwareRequest)
        {
            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "Hardware")
                          .Options;


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

                Mock <HttpRequest> mockGetRequest = MockHttpRequest.CreateMockQuery(getHardwareRequest.Id);
                return(await controller.GetHardwareByIdAsync(mockGetRequest.Object, _logger)); //as GridController;
            }
        }
示例#11
0
        public IrrigationProgram(int id, string name, DateTime start, int duration, int solenoidId, HardwareService hw, DataService data)
        {
            Id         = id;
            Name       = name;
            Start      = start;
            Duration   = duration;
            SolenoidId = solenoidId;

            hardwareService  = hw;
            dataService      = data;
            DataSolenoid     = dataService.Solenoids.AsQueryable <Solenoid>().Where(s => s.Id == solenoidId).First <Solenoid>();
            HardwareSolenoid = hardwareService.Solenoids.AsQueryable <ISolenoid>().Where(s => s.Id == solenoidId).First <ISolenoid>();

            HardwarePumpSolenoid                           = hardwareService.PumpSolenoid;
            DataPumpSolenoid                               = dataService.Solenoids
                                              RequiresPump = DataSolenoid.RequiresPump;


            Data.IrrigationProgram program = new Data.IrrigationProgram()
            {
                Name         = Name,
                Start        = Start,
                Duration     = Duration,
                DeviceId     = data.device.Id,
                SolenoidName = DataSolenoid.Name,
                SolenoidId   = DataSolenoid.Id,
                RequiresPump = DataSolenoid.RequiresPump
            };
            dataService.dataServer.PutIrrigationProgram(program);

            //start irrigating
            HardwareSolenoid.On();
            DataSolenoid.Value = 1;
            dataService.dataServer.PutSolenoid(DataSolenoid);

            if (RequiresPump)
            {
                hardwareService.PumpSolenoid.On();
            }

            //report to the server
            DataSolenoid.Value = 1;
            dataService.dataServer.PutSolenoid(DataSolenoid);
        }
示例#12
0
 public static SerialPortAddress[] GetSerialPorts()
 {
     return(HardwareService.GetSerialPorts());
 }