コード例 #1
0
        static void PrintDriverMetadata(DriverUpdate driverUpdate)
        {
            var driverMetadataList = driverUpdate.GetDriverMetadata();

            if (driverMetadataList != null)
            {
                foreach (var driverMetadata in driverMetadataList)
                {
                    Console.ForegroundColor = ConsoleColor.DarkCyan;
                    Console.WriteLine("    Driver metadata:");
                    Console.ResetColor();
                    Console.WriteLine("        HardwareId : {0}", driverMetadata.HardwareID);
                    Console.WriteLine("        Date       : {0}", driverMetadata.Versioning.Date);
                    Console.WriteLine("        Version    : {0}", driverMetadata.Versioning.VersionString);
                    Console.WriteLine("        Class      : {0}", driverMetadata.Class);

                    if (driverMetadata.FeatureScores.Count > 0)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("        Feature score:");
                        Console.ResetColor();
                        foreach (var featureScore in driverMetadata.FeatureScores)
                        {
                            Console.WriteLine("            Operating System : {0}", featureScore.OperatingSystem);
                            Console.WriteLine("            Score       : {0}", featureScore.Score);
                        }
                    }

                    if (driverMetadata.TargetComputerHardwareId.Count > 0)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("        Target computer hardware id:");
                        Console.ResetColor();
                        foreach (var targetComputerHwId in driverMetadata.TargetComputerHardwareId)
                        {
                            Console.WriteLine("            {0}", targetComputerHwId);
                        }
                    }

                    if (driverMetadata.DistributionComputerHardwareId.Count > 0)
                    {
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("        Distribution computer hardware id:");
                        Console.ResetColor();
                        foreach (var distributionComputerHardwareId in driverMetadata.DistributionComputerHardwareId)
                        {
                            Console.WriteLine("            {0}", distributionComputerHardwareId);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public async Task <IActionResult> Update([FromBody] DriverUpdate model)
        {
            try
            {
                var result = await _driverService.Update(model);

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #3
0
        public async Task <IActionResult> Update(DriverUpdate model)
        {
            if (model.MobileNumber.StartsWith('0'))
            {
                model.MobileNumber = "962" + model.MobileNumber.Substring(1);
            }
            else
            {
                model.MobileNumber = "962" + model.MobileNumber;
            }

            Driver driver = await _db.Drivers.FirstOrDefaultAsync(x => x.Id == model.Id);

            long userId = _principalService.GetUserId();

            if (!string.IsNullOrEmpty(model.DriverFullName))
            {
                driver.DriverFullName = model.DriverFullName;
            }

            if (!string.IsNullOrEmpty(model.MobileNumber))
            {
                driver.MobileNumber = model.MobileNumber;
            }

            if (!string.IsNullOrEmpty(model.Address))
            {
                driver.Address = model.Address;
            }
            if (!string.IsNullOrEmpty(model.DrivingLisenceNumber))
            {
                driver.DrivingLisenceNumber = model.DrivingLisenceNumber;
            }
            if (model.Status.HasValue)
            {
                driver.Status = (DriverStatus)model.Status;
            }
            driver.UpdatedAt = DateTime.Now;
            driver.UpdatedBy = userId;
            var result = await _db.SaveChangesAsync();

            await UpdateUser(driver.UserId, model.Username, model.Email, model.Password);

            if (result == 1)
            {
                return(new OkObjectResult(1));
            }
            throw new Exception("حصل خطأ");
        }
コード例 #4
0
 /// <summary>
 /// Create a driver match result for a device
 /// </summary>
 /// <param name="driver">The driver that matched a device hardware id</param>
 public DriverMatchResult(DriverUpdate driver)
 {
     Driver = driver;
 }