public string PostDriverDetails(DriverDetails dtls) { try { if (!cabODbContext.Driver.Any(r => r.PhoneNo == dtls.PhoneNo && r.IsDeleted == false)) { var user = new Driver { Name = dtls.Name, PhoneNo = dtls.PhoneNo, UserName = dtls.UserName, Password = dtls.Password, IsDeleted = dtls.IsDeleted }; cabODbContext.Driver.Add(user); cabODbContext.SaveChanges(); return("Posted"); } else { throw new Exception(); } } catch (Exception ex) { throw ex; } }
public DriverDetails GetDriverDetailsById(long id) { DriverDetails details = null; details = _driverRepository.GetDriverDetailsById(id); return(details); }
internal List <DriverDetails> GetDriver(string attributeName, string attributeValue) { List <List <Dictionary <String, string> > > persistentCarrier = new List <List <Dictionary <String, string> > >(); string query = "Select * from mlo.driver where " + attributeName + " = '" + attributeValue + "';"; DriverDetails driver = null; List <DriverDetails> drivers = new List <DriverDetails>(); try { persistentCarrier = DBUtility.ExecuteQuery(query); SBMapper map = new SBMapper(); List <PropertyMap> listPropertyMap = PropertyMapper.MapDriverDetails(); map.MapperCollection = listPropertyMap; foreach (Dictionary <string, string> eachCarrier in persistentCarrier[0]) { driver = new DriverDetails(); string json = new DTOMapper().Mapper(eachCarrier, driver, map); //Console.WriteLine("Destination = " + (json)); driver = JsonConvert.DeserializeObject <DriverDetails>(json); drivers.Add(driver); } } catch (Exception ex) { throw ex; } return(drivers); }
public void Configure(DriverDetails driverDetails) { client = new OpenRGBClient(name: "RGB Sync Studio", autoconnect: true, timeout: 1000); var deviceCount = client.GetControllerCount(); var devices = client.GetAllControllerData(); for (int devId = 0; devId < devices.Length; devId++) { ORGBControlDevice slsDevice = new ORGBControlDevice(); slsDevice.id = devId; slsDevice.Driver = this; slsDevice.Name = devices[devId].Name; slsDevice.DeviceType = DeviceTypeConverter.GetType(devices[devId].Type); slsDevice.Has2DSupport = false; slsDevice.ProductImage = (Bitmap)Image.FromStream(orgbImage); List <ControlDevice.LedUnit> deviceLeds = new List <ControlDevice.LedUnit>(); int i = 0; foreach (Led orgbLed in devices[devId].Leds) { ControlDevice.LedUnit slsLed = new ControlDevice.LedUnit(); slsLed.LEDName = orgbLed.Name; deviceLeds.Add(slsLed); } slsDevice.LEDs = deviceLeds.ToArray(); DeviceAdded?.Invoke(slsDevice, new Events.DeviceChangeEventArgs(slsDevice)); } }
public string UpdateDriverDetails(int id, DriverDetails chng) { try { if (!cabODbContext.Driver.Any(r => r.PhoneNo == chng.PhoneNo && r.IsDeleted == false)) { var update = cabODbContext.Driver.Where(x => x.Id == id).SingleOrDefault(); update.Name = chng.Name; update.PhoneNo = chng.PhoneNo; update.UserName = chng.UserName; update.Password = chng.Password; cabODbContext.SaveChanges(); return("Updated"); } else { throw new Exception(); } } catch (Exception ex) { throw ex; } }
public IActionResult Put(int id, [FromBody] DriverDetails edit) { try { if (id != null && edit != null) { var r = adddriver.UpdateDriverDetails(id, edit); if (r == "Updated") { return(Ok(true)); } else { return(Ok(false)); } } else { return(Ok(false)); } } catch (Exception ex) { return(BadRequest()); } }
internal object GetLoginDetails(string userId, string loginType) { LoginInfo loginInfo = null; switch (loginType.ToLower()) { case "wholesaler": case "retailer": case "distributor": List <LoginInfo> users = GetUser("id", userId); loginInfo = users.Count != 0 ? users[0] : null; break; case "collector": List <LoginInfo> collectors = GetCollector("id", userId); loginInfo = collectors.Count != 0 ? collectors[0] : null; break; case "loader": List <LoginInfo> loaders = GetLoader("id", userId); loginInfo = loaders.Count != 0 ? loaders[0] : null; break; case "driver": List <DriverDetails> drivers = GetDriver("id", userId); DriverDetails dd = drivers.Count != 0 ? drivers[0] : null; return(dd); default: break; } return(loginInfo); }
public IActionResult Post([FromBody] DriverDetails add) { try { if (add != null) { var r = adddriver.PostDriverDetails(add); if (r == "Posted") { return(Ok(true)); } else { return(Ok(false)); } } else { return(Ok(false)); } } catch (Exception ex) { return(BadRequest()); } }
public ActionResult GetDriverDetailsById(long id) { try { if (id <= 0) { return(BadRequest(new ApiBadRequestResponse())); } else { bool isExist = _service.CheckIsDriverDetailsExist(id); if (isExist == false) { return(StatusCode(StatusCodes.Status404NotFound, new ApiResponse(404, Constants.recordNotFound))); } DriverDetails details = _service.GetDriverDetailsById(id); if (details != null) { return(Ok(new ApiOkResponse(details))); } else { return(StatusCode(StatusCodes.Status500InternalServerError, new ApiResponse(500, null))); } } } catch (Exception ex) { ex.ToString(); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiResponse(500, null))); } }
public Ride CreateRide(Money price, int driverId, DriverDetails driverDetails, Address startPoint, Address destination) { var startRoute = _routeService.CreateRoute(startPoint); var destinationRoute = _routeService.CreateRoute(destination, startRoute); return(new Ride(price, driverId, driverDetails, startRoute, destinationRoute)); }
public void Configure(DriverDetails driverDetails) { MadLedDriverDetails specificDriverDetails = driverDetails as MadLedDriverDetails; //if (specificDriverDetails == null) //{ // throw new ArgumentException(); //} for (int i = 1; i < 10; i++) { Debug.WriteLine("testing COM" + i + ":"); try { var serialDriver = new MadLedSerialDriver("COM" + i); if (serialDriver.Ping() < TimeSpan.FromSeconds(1)) { Debug.WriteLine("adding COM" + i + ":"); serialDrivers.Add(serialDriver); } } catch { } } Debug.WriteLine("init done"); }
public void Configure(DriverDetails driverDetails) { //configXaml.SetLEDCounts = SetLedCounts; IT8297Config config = new IT8297Config(); DeviceSetup(); }
public Ride(Money price, int driverId, DriverDetails driverDetails, params Route[] routes) { Price = price; DriverId = driverId; DriverDetails = driverDetails; Routes = routes; Status = RideStatus.WaitingForDriver; }
// Weirdly encoded and not really relevant for the user //public string ReleaseNotes; public static DriverDetails CreateFromVersion(string version_in) { DriverDetails d = new DriverDetails(); d.Version = new System.Version(version_in); return(d); }
public async Task <DriverDetails> GetDriverDetails(int cabId) { var details = wait _busDepoRepository.GetDriverDetails(cabID); DriverDetails driverDetails = MapDriverDetails(details); return(driverDetails); }
public void Configure(DriverDetails driverDetails) { var drivers = GetDevices(); foreach (ControlDevice controlDevice in drivers) { DeviceAdded?.Invoke(this, new Events.DeviceChangeEventArgs(controlDevice)); } }
public void Configure(DriverDetails driverDetails) { ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; // timer = new Timer(TimerCallback, null, 0, 150); Setup(); }
public void Configure(DriverDetails driverDetails) { config = new MadLedDevice.MadLedConfig(); config.PinConfigs = new MadLedDevice.PinConfig[8]; var connected = SimpleLed.SLSManager.GetSupportedDevices(SupportedDevices); foreach (USBDevice supportedDevice in connected) { InterestedUSBChange(supportedDevice.VID, supportedDevice.HID.Value, true); } }
public void Configure(DriverDetails driverDetails) { IT8297Config config = new IT8297Config(); //todo read from config leds1 = new ControlDevice.LedUnit[config.Fan1LedCount]; leds2 = new ControlDevice.LedUnit[config.Fan2LedCount]; for (int i = 0; i < leds1.Length; i++) { leds1[i] = new ControlDevice.LedUnit { Color = new LEDColor(0, 0, 0), Data = new ControlDevice.LEDData { LEDNumber = i }, LEDName = "ARGB 1 LED " + (i + 1) }; } for (int i = 0; i < leds2.Length; i++) { leds2[i] = new ControlDevice.LedUnit { Color = new LEDColor(0, 0, 0), Data = new ControlDevice.LEDData { LEDNumber = i }, LEDName = "ARGB 2 LED " + (i + 1) }; } vrmLeds[0] = new ControlDevice.LedUnit { Data = new ControlDevice.LEDData { LEDNumber = 0 }, LEDName = "VRM Block" }; pciLeds[0] = new ControlDevice.LedUnit { Data = new ControlDevice.LEDData { LEDNumber = 0 }, LEDName = "PCI Area" }; }
public async Task <IActionResult> AddDriver(DriverDetails driver) { if (ModelState.IsValid) { var callbackUrl = Url.Action("RegisterDriver", "Account", new { teamId = company.Team.ID, email = driver.Email, firstName = driver.FirstName }, "https"); await userService.GenerateDriverRegistrationRequestAsync(driver, company, callbackUrl); return(RedirectToAction("Index")); } return(View(company.Team)); }
public async Task GenerateDriverRegistrationRequestAsync(DriverDetails driver, Company company, string callbackUrl) { await _emailSender.SendEmailAsync(driver.Email, "You were invited to register", $"You were invited as a driver, please register: <a href='{callbackUrl}'>link</a>"); DriverRegistrationRequest request = new DriverRegistrationRequest(); request.TeamID = company.Team.ID; request.DriverEmail = driver.Email; _context.DriverRegistrationRequests.Add(request); await _context.SaveChangesAsync(); }
public void Configure(DriverDetails driverDetails) { int[,] mappy = new int[22, 6]; int startx = 0; int starty = 0; int x = 0; int y = 0; for (int i = 0; i < 122; i++) { Debug.WriteLine($"{x},{y}={i}"); mappy[x, y] = i; y--; x++; if (y < 0) { starty++; if (starty > 5) { starty = 5; startx++; } x = startx; y = starty; } } int ct = 0; for (int yy = 0; yy < 6; yy++) { for (int xx = 0; xx < 22; xx++) { RemapKeyboard[ct] = mappy[xx, yy]; } } Timer tmr = new Timer(2000); tmr.AutoReset = true; tmr.Elapsed += (sender, args) => { if (DeviceAdded != null) { tmr.Stop(); GetDevices(); } }; tmr.Start(); }
public void Configure(DriverDetails driverDetails) { _sdk = (IAuraSdk2) new AuraSdk(); _sdk.SwitchMode(); _collection = _sdk.Enumerate(0); var drivers = GetDevices(); foreach (ControlDevice controlDevice in drivers) { DeviceAdded?.Invoke(this, new Events.DeviceChangeEventArgs(controlDevice)); } }
public bool CheckIsDriverDetailsExist(long id) { bool flag = true; DriverDetails details = null; details = _driverRepository.GetDriverDetailsById(id); if (details != null && details.id == 0) { flag = false; } return(flag); }
// Token: 0x06000003 RID: 3 RVA: 0x0000215E File Offset: 0x0000035E public void Configure(DriverDetails driverDetails) { ControlDevice rainbowWaveDevice = new ControlDevice { Name = "Rainbow Wave", Driver = this, ProductImage = (Bitmap)System.Drawing.Image.FromStream(imageStream), LEDs = this.leds, DeviceType = DeviceTypes.Effect }; DeviceAdded?.Invoke(rainbowWaveDevice, new Events.DeviceChangeEventArgs(rainbowWaveDevice)); }
public bool CheckIsDriverDetailsExist(string xmlContent) { bool flag = false; DriverDetails details = null; details = _driverRepository.GetDriverDetails(xmlContent); if (details != null && details.id > 0) { flag = true; } return(flag); }
public AvailableDriverFound(int driverId, int customerId, CustomerDetails customerDetails, DriverDetails driverDetails, Address startPoint, Address destinationPoint) { DriverId = driverId; CustomerId = customerId; CustomerDetails = customerDetails; DriverDetails = driverDetails; StartPoint = startPoint; DestinationPoint = destinationPoint; }
public ActionResult UpdateDriverDetails(DriverDetails model) { long id = 0; ModelStateDictionary ModelState = new ModelStateDictionary(); DriverValidationHelper.ValidateDriverInput(ref ModelState, ref model); if (model.id == 0) { ModelState.AddModelError(nameof(DriverDetails.id), Constants.idValidationMessage); } if (ModelState.IsValid) { try { string xmlString = XmlHelper.ConvertObjectToXML(model); XElement xElement = XElement.Parse(xmlString); bool isExist = _service.CheckIsDriverDetailsExist(xmlString); if (isExist == true) { return(StatusCode(StatusCodes.Status409Conflict, new ApiResponse(404, Constants.recordExist))); } else { id = _service.AddOrUpdateDriverDetails(xElement.ToString()); if (id > 0) { return(Ok(new ApiOkResponse(id, Constants.recordSaved))); } else { return(StatusCode(StatusCodes.Status500InternalServerError, new ApiResponse(500, null))); } } } catch (Exception ex) { ex.ToString(); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiResponse(500, null))); } } else { return(BadRequest(new ApiBadRequestResponse(ModelState))); } }
public void Configure(DriverDetails driverDetails) { if (driverDetails != null) { homePath = driverDetails.HomeFolder; } scanTimer = new Timer(); scanTimer.Interval = 10000; scanTimer.Elapsed += ScanTimerOnElapsed; scanTimer.Enabled = true; Scan(); }
public PrintDeviceDriver(DriverDetails other) { Name = other.Name; Architecture = other.Architecture; Version = other.Version; InfPath = other.InfPath; Driver = other.DriverFile; ConfigurationFile = other.ConfigurationFile; HelpFile = other.HelpFile; DataFile = other.DataFile; PrintProcessor = other.PrintProcessor; Monitor = other.Monitor; Provider = other.Provider; DriverDate = other.DriverDate; }