private void btnPrintFine_Click(object sender, EventArgs e) { Driver driver = DriverData.GetDriverByLicenseID(txtBoxOffenderDLN.Text); string price = txtBoxPrice.Text; if ("".Equals(price)) { price = "платена"; } if (driver == null) { MessageBox.Show("Моля, първо изберете глоба."); return; } string documentData = @" №: " + txtBoxFineId.Text + @" РЕПУБЛИКА БЪЛГАРИЯ / REPUBLIC OF BULGARIA МИНИСТЕРСТРО НА ВЪТРЕШНИТЕ РАБОТИ/ MINISTRY OF INTERIOR ГЛОБА С " + GetTypeName(cbType.SelectedIndex) + @"/ TRAFFIC TICKET Днес/Today " + txtBoxDate.Text + @" подписаният/undersigned " + txtBoxPoliceman.Text + @" На длъжност/ official post полицай в " + txtBoxPlace.Text + @" установих, че/ascertain the fact that " + driver.FirstName + " " + driver.MiddleName + " " + driver.LastName + @" Шофьорска книжка/Driving License №:" + txtBoxOffenderDLN.Text + @" Постоянен адрес/permanent address " + txtBoxAddress.Text + @" е извършил нарушение/commit a violation " + txtBoxReason.Text + @" поради което на основание чл. 186, налагам глоба/and upon article 186 set a fine " + price + @" лева/BG leva СЪСТАВИТЕЛ/COMPLIER: " + txtBoxPoliceman.Text + @" ПОДПИС/SIGNITURE: "; saveFile(documentData, "Глобата не може да се разпечата."); }
public static void TryStuff(int aFieldId) { CommonData dataField = null; switch (aFieldId) { case (0): dataField = new GPSData(); dataField.CommonStuff = "abcd"; (dataField as GPSData).GPSStuff = "bcde"; break; case (1): dataField = new DigitalData(); dataField.CommonStuff = "abcd"; (dataField as DigitalData).DigitalStuff = "cdef"; break; case (2): dataField = new DriverData(); dataField.CommonStuff = "abcd"; (dataField as DriverData).DriverStuff = "defg"; break; default: break; } }
private void SaveReportJson() { // TODO needs a more restricted output (full internal state contains useless information). var session = m_parser.SessionInfo; var countDrivers = m_parser.CountDrivers; var drivers = m_parser.Drivers; var events = m_parser.EventList.Events; JsonEntry json = new JsonEntry(); json.SessionInfo = session.Session.ToString("g"); json.Track = session.EventTrack.ToString("g"); json.Laps = session.TotalLaps; DriverData[] jsonDrivers = new DriverData[countDrivers]; for (int i = 0; i < countDrivers; ++i) { jsonDrivers[i] = m_parser.Drivers[i]; } json.Drivers = jsonDrivers; string[] jsonDriversTag = new string[countDrivers]; json.DriverTag = jsonDriversTag; string filename = DateTime.Now.ToString("ddMMyy_HHmmss") + "_report.json"; var jsonText = Newtonsoft.Json.JsonConvert.SerializeObject(json, Newtonsoft.Json.Formatting.Indented); File.WriteAllText(filename, jsonText); }
public void LoadForm(User user) { this.user = user; SetUserStatus(user.Role_); SetStatusToAllControls(true); ShowUserInfo(DriverData.GetDriverByLicenseID(user.DrivingLicenseNumber)); }
protected void btnSubmit_Click(object sender, EventArgs e) { //string fullName = txtName.Text; string username = txtUserName.Text; string phone = txtPhoneNumber.Text; string stateID = drpRegState.SelectedValue; string regNum = txtRegNumber.Text; string pass = txtPass.Text; //MessageBox.Show(stateID + " " + regNum); bool isFound = username.Contains("@uco.edu"); if (!isFound) { username += "@uco.edu"; } /*string info = "[{"+ * "\"LicensePlateState_ID\":" + stateID + "," + * "\"EMail\":" + username + "," + * "\"Password\":" + pass + "," + * "\"MobileNum\":" + phone + "," + * "\"LicensePlate\":" + regNum + "," + * //"\"Name\":" + fullName + * "}]";*/ //Response.Write(info); Bridge.DriverData dd = new DriverData(); dd.fullName = txtUserName.Text; dd.mobileNumber = txtPhoneNumber.Text; dd.password = txtPass.Text; dd.licensePlateNum = regNum; dd.licensePlateState = stateID; //dd.licensePlateNum = ""; //dd.licensePlateState = "Oklahoma"; dd.eMailAddress = txtUserName.Text; dd.Id = Facade.Login_GetID(dd.fullName, dd.password); // returning boolean to check is update successful bool r = Facade.UpdateDriverProfile(dd); if (r) { Response.Redirect("loginPage.aspx"); } else { string msg = "Something went wrong. Please try again."; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append("alert('"); sb.Append(msg); sb.Append("')};"); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } }
protected override bool ValidateDynamic() { bool isSerialValid = (FineData.GetFineBySerialNumber(_fine.SerialNumber) == null); setErrMessage("Съществува глоба със сериен номер: " + _fine.SerialNumber + ".", isSerialValid); bool isDriverValid = (DriverData.GetDriverByLicenseID(_fine.DrivingLicenseNumber) != null); setErrMessage("Не съществува шофьор с номер на книжка: " + _fine.DrivingLicenseNumber + ".", isDriverValid); return(isDriverValid && isSerialValid); }
protected override bool ValidateDynamic() { bool isValid = true; isValid &= (DriverData.GetDriverByLicenseID(_driver.DrivingLicenseNumber) == null); setErrMessage("Съществува шофьор с шофьорска книжка номер: " + _driver.DrivingLicenseNumber + ".", isValid); isValid &= (DriverData.GetDriverByIdNumber(_driver.IdNumber) == null); setErrMessage("Съществува шофьор с ЕГН: " + _driver.IdNumber + ".", isValid); return(isValid); }
public IActionResult RequestUberMe(AuthToken info) { try { var client = new RestClient("https://api.uber.com/v1/partners/me"); var request = new RestRequest(Method.GET); DriverResponse dadosMotoristaRetorno = null; request.AddHeader("Authorization", string.Format("Bearer {0}", info.access_token)); request.AddHeader("Accept-Language", "en_US"); request.AddHeader("Content-Type", "application/json"); IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { DriverData dadosDoUber = JsonConvert.DeserializeObject <DriverData>(response.Content); dadosMotoristaRetorno = new DriverResponse() { tokenDoMotorista = info.access_token, NomeMotorista = dadosDoUber.first_name, EmailMotorista = dadosDoUber.email, UrlFotoMotorista = dadosDoUber.picture }; } else { //mock this information, until the liberation of uber's scope dadosMotoristaRetorno = new DriverResponse() { tokenDoMotorista = "8LvWuRAq2511gmr8EMkovekFNa2848lyMaQevIto", NomeMotorista = "Agostinho Carrara", EmailMotorista = "*****@*****.**", UrlFotoMotorista = null }; } return(View("Playlist")); //return Json(new { StatusCode = HttpStatusCode.OK, RiderProfile = dadosMotoristaRetorno }); } catch (WebException ex) { var response = ex.Response as HttpWebResponse; if (response != null) { return(Json(new { StatusCode = (int)response.StatusCode, ex.Message })); } else { return(Json(new { StatusCode = string.Empty, ex.Message })); } } }
public void EditDriverDataTest() { DriverData newData = new DriverData(12, 15, 25, 8); _insuranceRepo.EditDriverData(00001, newData); DriverData actual = _insuranceRepo.GetOneDriversData(00001); Assert.AreEqual(newData.SpeedingFrequency, actual.SpeedingFrequency); Assert.AreEqual(newData.TimesRollingThroughStopSign, actual.TimesRollingThroughStopSign); }
private void LoadPeripheralsInfo() { int pos = -1; PrinterSettings settings = new PrinterSettings(); string printerName = settings.PrinterName; string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}'", printerName.Replace("\\", "\\\\")); ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); ManagementObjectCollection coll = searcher.Get(); try { foreach (ManagementObject printer in coll) { IsPrinterConnected = !printer["WorkOffline"].ToString().ToLowerInvariant().Equals("true"); ManagementObjectSearcher sr = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PrinterDrive"); } DriversMonitor DrvMonitor = DriversMonitor.Instance; DriverData drd = DrvMonitor.GetPrinterDriverInfoA(); PrinterDriver = drd.driver_file_version; PrinterModel = settings.PrinterName; if (drd.mnf_name != null) { PrinterProducer = drd.mnf_name; } else { if (drd.device_name != null) { pos = drd.device_name.IndexOf("Microsoft"); if (pos != -1) { PrinterProducer = "Microsoft"; } } if ((pos == -1) && (PrinterModel != null)) { pos = PrinterModel.IndexOf(' '); if (pos != -1) { PrinterProducer = PrinterModel.Substring(0, pos); } } } } catch { IsPrinterConnected = false; } }
public void GetAverageDataTest() { Driver newDriver = new Driver(00003, "John Smith-Jones", new DriverData(3, 3, 1, 1)); Driver driver = new Driver(00002, "Eric Jones", new DriverData(5, 0, 1, 2)); _insuranceRepo.AddDriverToDict(newDriver); _insuranceRepo.AddDriverToDict(driver); List <DriverData> dataList = _insuranceRepo.GetDriverData(); DriverData averageData = _insuranceRepo.GetAverageData(dataList); Assert.AreEqual(6, averageData.SpeedingFrequency); }
public void Apply() { var firstByte = 0x0047141F; var lastByte = 0x00478F18; // Open file and write using (var executableConnection = new ExecutableConnection(_executableFilePath)) { // Create byte array of NOPs var nopInstructions = new byte[lastByte + 1 - firstByte]; for (var i = 0; i < nopInstructions.Length; i++) { nopInstructions[i] = 0x90; } // Write byte array of NOPs executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte), nopInstructions); // Get the data-laden instructions var teamInstructions = TeamData.GetInstructions(); var personnelInstructions = PersonnelData.GetInstructions(); var driverInstructions = DriverData.GetInstructions(); // Write instructions var writePosition = InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte); executableConnection.WriteByteArray(writePosition, teamInstructions); writePosition += teamInstructions.Length; executableConnection.WriteByteArray(writePosition, personnelInstructions); writePosition += personnelInstructions.Length; executableConnection.WriteByteArray(writePosition, driverInstructions); // Apply track changes firstByte = 0x005031C6; lastByte = 0x00503EE5; // Create byte array of NOPs var nopTrackInstructions = new byte[lastByte + 1 - firstByte]; for (var i = 0; i < nopTrackInstructions.Length; i++) { nopTrackInstructions[i] = 0x90; } // Write byte array of NOPs executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte), nopTrackInstructions); // Get the data-laden instructions var trackInstructions = TrackData.GetInstructions(); writePosition = InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte); executableConnection.WriteByteArray(writePosition, trackInstructions); } }
private void btnDell_Click(object sender, EventArgs e) { try { DriverData.DeleteDriver(txtBoxLicenseId.Text); MessageBox.Show("Шофьор с документ №:'" + txtBoxLicenseId.Text + "' е изтрит успешно."); ClearAllControls(); ReloadMainForm(); } catch (Exception exc) { MessageBox.Show("Грешка при изтриването на шофьор." + exc.Message); } }
private void ShowAverage() { List <DriverData> driverData = _insuranceRepo.GetDriverData(); DriverData average = _insuranceRepo.GetAverageData(driverData); Driver averageDriver = new Driver(999999, "average", average); Console.WriteLine($"On average our drivers are {averageDriver.DriverClass}.\n" + $"Average percentage of time speeding: {average.SpeedingFrequency}%\n" + $"Average percentage of time spent out of lane: {average.OutOfLaneFrequency}%\n" + $"Average percentage of time spent following too closely: {average.FollowingTooCloselyFrequency}%\n" + $"Average number of times rolling through stop signs: {average.TimesRollingThroughStopSign}\n" + $"Press any key to continue..."); Console.ReadKey(); }
public void UpdateDriver() { Console.Write("Enter the current ID of the driver to update: "); int oldID = int.Parse(Console.ReadLine()); Console.WriteLine("Would you like to update: \n" + "1. The full driver entry\n" + "2. Just the data for a specific driver"); string userInput = Console.ReadLine(); switch (userInput) { case "1": Console.Write("Enter the new Driver ID: "); int newID = int.Parse(Console.ReadLine()); Console.Write("Enter the new Driver Name: "); string newName = Console.ReadLine(); Console.Write("Enter the percentage of time speeding as a whole number: "); int timeSpeeding = int.Parse(Console.ReadLine()); Console.Write("Enter the percentage of time spent out of lane: "); int timeOutOfLane = int.Parse(Console.ReadLine()); Console.Write("Enter the percentage of time following too closely: "); int timeClose = int.Parse(Console.ReadLine()); Console.Write("Enter the number of times rolling through stop signs: "); int rollingStop = int.Parse(Console.ReadLine()); Driver newDriver = new Driver(newID, newName, new DriverData(timeSpeeding, timeOutOfLane, timeClose, rollingStop)); _insuranceRepo.EditDriver(oldID, newDriver); break; case "2": Console.Write("Enter the percentage of time speeding as a whole number: "); int newSpeeding = int.Parse(Console.ReadLine()); Console.Write("Enter the percentage of time spent out of lane: "); int newOutOfLane = int.Parse(Console.ReadLine()); Console.Write("Enter the percentage of time following too closely: "); int newClose = int.Parse(Console.ReadLine()); Console.Write("Enter the number of times rolling through stop signs: "); int newRollingStop = int.Parse(Console.ReadLine()); DriverData newData = new DriverData(newSpeeding, newOutOfLane, newClose, newRollingStop); break; default: Console.WriteLine("Please enter 1 or 2"); break; } Console.WriteLine("Driver updated\n" + "Press any key to continue..."); Console.ReadKey(); }
public void DDRepo_CalculateDriverPremiumPartThree_ShouldReturnCorrectValue() { //Arrange DDRepo _ddRepo = new DDRepo(); DriverData driver = new DriverData(); driver.RollSS = 10; //Act decimal actual = _ddRepo.CalculateDriverPremiumPartThree(driver); decimal expected = 10m; //Assert Assert.AreEqual(expected, actual); }
public void DDRepo_CalculateDriverPremiumPartFour_ShouldReturnCorrectValue() { //Arrange DDRepo _ddRepo = new DDRepo(); DriverData driver = new DriverData(); driver.Tailgate = 90; //Act decimal actual = _ddRepo.CalculateDriverPremiumPartFour(driver); decimal expected = 50m; //Assert Assert.AreEqual(expected, actual); }
public void AddDriverTooList_ShouldBeCorrect() { InsuranceRepository _driverData = new InsuranceRepository(); DriverData driver = new DriverData(); DriverData driverTwo = new DriverData(); _driverData.AddDriverToList(driver); _driverData.AddDriverToList(driverTwo); int actual = _driverData.GetDriverData().Count; int expected = 2; Assert.AreEqual(expected, actual); }
//Update Driver Data in database public void Update(DriverData Driverdata) { //Create Connection MySqlConnection con = DatabaseConfig.GetConnection(); //try to connect to database try { //Build MySQLcommand MySqlCommand cmd = new MySqlCommand("UPDATE `chauffeurs` SET " + "`voornaam`=FirstName,`tussenvoegsel`=Insertion,`achternaam`=LastName,`soortrijbewijs`=KindLicense,`nationaliteit_rijbewijs`=LicenseNationalitie," + "`werkdagen`=BusinessDays,`inlognaam`=Username,`wachtwoord`=Password WHERE ID", con); //Create Parameters cmd.Parameters.AddWithValue("ID", Driverdata.ID); cmd.Parameters.AddWithValue("FirstName", Driverdata.FirstName); cmd.Parameters.AddWithValue("Insertion", Driverdata.Insertion); cmd.Parameters.AddWithValue("LastName", Driverdata.LastName); cmd.Parameters.AddWithValue("KindLicense", Driverdata.KindLicense); cmd.Parameters.AddWithValue("LicenseNationalitie", Driverdata.LicenseNationalitie); cmd.Parameters.AddWithValue("BusinessDays", Driverdata.BusinessDays); cmd.Parameters.AddWithValue("Username", Driverdata.Username); cmd.Parameters.AddWithValue("Password", Driverdata.Password); //Execute and get Effectedrows int RowsEffected = cmd.ExecuteNonQuery(); //Check if insertion wass succesfull if (RowsEffected == 0) { Debug.WriteLine("Update was NOT Succesfull"); } else { Debug.WriteLine("Uodate was Succesfull"); } } catch (Exception e) { //Write down the exception Debug.WriteLine(e); } finally { //Close Connection con.Clone(); } }
public override bool Equals(object obj) { if ((obj != null) && (obj is DriverData)) { DriverData temp = (DriverData)obj; if (temp.driver != null && temp.device != null && temp.instanceID != null) { return(temp.driver.Equals(this.driver) && temp.device.Equals(this.device) && temp.instanceID.Equals(this.instanceID)); } } return(false); }
protected override bool ValidateDynamic() { bool isRegValid = (VehicleData.GetVehicleByRegNumber(_vehicle.RegistryNumber) == null); setErrMessage("Съществува МПС с регистрационен номер: " + _vehicle.RegistryNumber + ".", isRegValid); bool isFrameValid = (VehicleData.GetVehicleByFrameNumber(_vehicle.FrameNumber) == null); setErrMessage("Съществува МПС с номер на рамата: " + _vehicle.FrameNumber + ".", isFrameValid); bool isEngValid = (VehicleData.GetVehicleByEngineNumber(_vehicle.EngineNumber) == null); setErrMessage("Съществува МПС с номер на двигателя: " + _vehicle.EngineNumber + ".", isEngValid); bool isDriverValid = (DriverData.GetDriverByLicenseID(_vehicle.DrivingLicenseNumber) != null); setErrMessage("Не съществува шофьор с номер на книжка: " + _vehicle.DrivingLicenseNumber + ".", isDriverValid); return(isRegValid && isFrameValid && isEngValid && isDriverValid); }
public void TestUpdateDriver() { int uid; uid = Facade.Login_GetID("*****@*****.**", "1dda81"); if (uid > 0) { DriverData d = Facade.GetDriverFull(uid); d.mobileNumber = "888-yaygirl"; d.password = "******"; d.licensePlateNum = "17-A856"; d.licensePlateState = "Oklahoma"; Facade.UpdateDriverProfile(d); } }
public void DDRepo_TotalPremiumCost_ShouldReturnCorrectValue() { //Arrange DDRepo _ddRepo = new DDRepo(); DriverData driver = new DriverData(); driver.OverSL = 10; driver.Swerve = 10; driver.RollSS = 5; driver.Tailgate = 90; //Act decimal actual = _ddRepo.TotalPremiumCost(driver); decimal expected = 90m; //Assert Assert.AreEqual(expected, actual); }
// For double-file manual rolling starts. Will only work when the cars are all nicely settled on the grid - preferably // when the game thinks the race has just started public override Tuple <GridSide, Dictionary <int, GridSide> > getGridSide(Object currentStateObj) { RaceRoomShared latestRawData = ((CrewChiefV4.RaceRoom.R3ESharedMemoryReader.R3EStructWrapper)currentStateObj).data; DriverData playerData = getDriverData(latestRawData, latestRawData.VehicleInfo.SlotId); float playerRotation = latestRawData.CarOrientation.Yaw; if (playerRotation < 0) { playerRotation = (float)(2 * Math.PI) + playerRotation; } playerRotation = (float)(2 * Math.PI) - playerRotation; float playerXPosition = playerData.Position.X; float playerZPosition = playerData.Position.Z; int playerStartingPosition = latestRawData.Position; int numCars = latestRawData.NumCars; return(getGridSideInternal(latestRawData, playerRotation, playerXPosition, playerZPosition, playerStartingPosition, numCars)); }
public void OnCheckpointReached(CarDriver driver) { foreach (DriverData data in this.drivers) { if (data.driver == driver) { data.checkpointsReached++; // update leader if (data != leader && data.checkpointsReached > leader.checkpointsReached) { leader = data; // emote leader leader.driver.characterController.selectedCharacter.emotions.SetEmotion(EmotionController.EmotionType.Happy); } return; } } }
public void DriverInsurance_ShouldBeCorrect() { InsuranceRepository driverInfo = new InsuranceRepository(); DriverData driver = new DriverData(); DriverData driverTwo = new DriverData(); driver.OverTheLimit = 100; driverTwo.OverTheLimit = 101; decimal actual = driverInfo.DriverInsruance(driver); decimal actualTwo = driverInfo.DriverInsruance(driverTwo); decimal expected = 200.00m; decimal expectedTwo = 200.00m; Assert.AreEqual(expected, actual); Assert.AreEqual(expectedTwo, actualTwo); }
private void btnUpdate_Click(object sender, EventArgs e) { try { Driver driver = createDriver(); DriverValidator validator = new DriverValidator(driver, cbRole.SelectedIndex); if (!validator.ValidateStatic()) { MessageBox.Show(DriverValidator.errText, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } User user = CreateUser(); DriverData.UpdateDriver(driver.DrivingLicenseNumber, driver.Country, driver.City, driver.Address, driver.DrivingPointsLeft, driver.DrivingCategories, user.Role_, driver.PictureLocation); MessageBox.Show("Актуализацията е успешна."); ReloadMainForm(); } catch (Exception exc) { MessageBox.Show("Грешка при актуализация. " + exc.Message); } }
private void btnAddDriver_Click(object sender, EventArgs e) { try { Driver driver = createDriver(); DriverValidator validator = new DriverValidator(driver, cbRole.SelectedIndex); if (!validator.Validate()) { MessageBox.Show(DriverValidator.errText, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DriverData.addDriver(driver); UserData.CreateUsernameAndPassword(CreateUser()); ReloadMainForm(); MessageBox.Show("Добавен шофьор: " + driver.FirstName + " " + driver.LastName + "."); } catch (Exception exc) { MessageBox.Show("Грешка при добавяне на шофьор." + exc.Message); } }
//Delete a Driver from the database public void Delete(DriverData Driverdata) { //Create Connection MySqlConnection con = DatabaseConfig.GetConnection(); //try to connect to database try { //Build MySQLcommand MySqlCommand cmd = new MySqlCommand("DELETE FROM `chauffeurs` WHERE ID", con); //Cretae Parameters cmd.Parameters.AddWithValue("ID", Driverdata.ID); //Execute and get Effectedrows int RowsEffected = cmd.ExecuteNonQuery(); //Check if insertion wass succesfull if (RowsEffected == 0) { Debug.WriteLine("Delete was NOT Succesfull"); } else { Debug.WriteLine("Delete was Succesfull"); } } catch (Exception e) { //Write down the exception Debug.WriteLine(e); } finally { //Close Connection con.Clone(); } }
private void btnPrintVehicle_Click(object sender, EventArgs e) { Driver driver = DriverData.GetDriverByLicenseID(txtBoxOwnerDLN.Text); if (driver == null) { MessageBox.Show("Моля, първо изберете МПС."); return; } string documentData = @" РЕПУБЛИКА БЪЛГАРИЯ МИНИСТЕРСТВО НА ВЪТРЕШНИТЕ РАБОТИ REPUBLIC OF BULGARIA MINISTRY OF INTERIOR СВИДЕТЕЛСТВО ЗА РЕГИСТРАЦИЯ НА МОТОРНО ПРЕВОЗНО СРЕДСТВО ---ДАННИ ЗА МПС--- А. Регистрационен №: " + txtBoxRegNumber.Text + @" E. Рама №: " + txtBoxFrameNumber.Text + @" Двигател №: " + txtBoxEngineNumber.Text + @" D. Марка: " + txtBoxBrand.Text + @" Модел: " + txtBoxModel.Text + @" Вид: " + txtBoxType.Text + @" F. Брой места: " + txtBoxSeats.Text + @" Общо тегло: " + txtBoxWeight.Text + @" B. Дата на регистрация: " + txtBoxRegDate.Text + @" ---ДАННИ ЗА СОБСТВЕНИК--- С. Собственик: " + driver.FirstName + " " + driver.LastName + @" ЕГН: " + driver.IdNumber + @" Aдрес: " + driver.City + ", " + driver.Address; saveFile(documentData, "Данните не могат да се разпечатат."); }
private OpponentData createOpponentData(DriverData participantStruct, String driverName, Boolean loadDriverName) { if (loadDriverName && CrewChief.enableDriverNames) { speechRecogniser.addNewOpponentName(driverName); } OpponentData opponentData = new OpponentData(); opponentData.DriverRawName = driverName; opponentData.Position = participantStruct.place; opponentData.UnFilteredPosition = opponentData.Position; opponentData.CompletedLaps = participantStruct.completed_laps; opponentData.CurrentSectorNumber = participantStruct.track_sector; opponentData.WorldPosition = new float[] { participantStruct.position.X, participantStruct.position.Z }; opponentData.DistanceRoundTrack = participantStruct.lap_distance; opponentData.CarClass = CarData.getCarClassForRaceRoomId(participantStruct.driver_info.class_id); opponentData.CurrentTyres = mapToTyreType(participantStruct.tire_type); Console.WriteLine("New driver " + driverName + " is using car class " + opponentData.CarClass.carClassEnum + " (class ID " + participantStruct.driver_info.class_id + ")"); return opponentData; }
private DriverData[] getPopulatedDriverDataArray(DriverData[] raw) { List<DriverData> populated = new List<DriverData>(); foreach (DriverData rawData in raw) { if (rawData.place > 0) { populated.Add(rawData); } } if (populated.Count == 0) { populated.Add(raw[0]); } return populated.ToArray(); }