public string Get_ID_DEVICE(int dataBlockId) { string ID_Device; SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ID_DEVICE"; ID_Device = sqldbRecords.Get_ParamValue(dataBlockId, paramName); return ID_Device; }
public DateTime Get_END_PERIOD(int dataBlockId) { string gettedVaL; SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "END_PERIOD"; gettedVaL = sqldbRecords.Get_ParamValue(dataBlockId, paramName); return new PLFSystemTime(gettedVaL).GetSystemTime(); }
public CardUnit.CardUnitClass GetAllCardUnitClass_parsingDataBlock(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string fileName = ""; PARSER.DDDParser dddParser = new PARSER.DDDParser(); fileName = sqldbRecords.Get_ParamValue(dataBlockId, "DataBlock_FileName"); byte[] blockDataBlob = sqlDB.GetDataBlock(dataBlockId); blockDataBlob = UnZipBytes(blockDataBlob);//АнЗипим файл! dddParser.ParseFile(blockDataBlob, fileName); return dddParser.cardUnitClass; }
public DDDClass.EquipmentType Get_EF_Application_Identification_CardType(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_application_identification.cardType"; string currentParamName; DDDClass.EquipmentType equipmentType; string cardType; currentParamName = paramName; cardType = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); equipmentType = new DDDClass.EquipmentType(cardType); return equipmentType; }
public string Get_VEHICLE(int dataBlockId) { string vehicle; SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "VEHICLE"; vehicle = sqldbRecords.Get_ParamValue(dataBlockId, paramName); return vehicle; }
public DDDClass.DriverCardHolderIdentification Get_EF_Identification_DriverCardHolderIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); DDDClass.DriverCardHolderIdentification driverCardHolderIdentification = new DDDClass.DriverCardHolderIdentification(); string paramName = "ef_identification.driverCardHolderIdentification"; string currentParamName; string cardHolderBirthDate_day; string cardHolderBirthDate_month; string cardHolderBirthDate_year; string holderFirstNames; string holderSurname; string cardHolderPreferredLanguage; currentParamName = paramName + ".cardHolderBirthDate.day"; cardHolderBirthDate_day = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderBirthDate.month"; cardHolderBirthDate_month = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderBirthDate.year"; cardHolderBirthDate_year = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderName.holderFirstNames.name"; holderFirstNames = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderName.holderSurname.name"; holderSurname = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderPreferredLanguage"; cardHolderPreferredLanguage = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); driverCardHolderIdentification.cardHolderBirthDate.Set_Day(cardHolderBirthDate_day); driverCardHolderIdentification.cardHolderBirthDate.Set_Month(cardHolderBirthDate_month); driverCardHolderIdentification.cardHolderBirthDate.Set_Year(cardHolderBirthDate_year); driverCardHolderIdentification.cardHolderName.holderFirstNames.setName(holderFirstNames); driverCardHolderIdentification.cardHolderName.holderSurname.setName(holderSurname); driverCardHolderIdentification.cardHolderPreferredLanguage = new DDDClass.Language(cardHolderPreferredLanguage); return driverCardHolderIdentification; }
public DDDClass.CompanyCardApplicationIdentification Get_EF_Application_Identification_CompanyCardApplicationIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_application_identification.companyCardApplicationIdentification"; string currentParamName; DDDClass.CompanyCardApplicationIdentification companyCardApplicationIdentification = new DDDClass.CompanyCardApplicationIdentification(); string cardStructureVersion; string noOfCompanyActivityRecords; string typeOfTachographCardId; currentParamName = paramName + ".cardStructureVersion"; cardStructureVersion = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfCompanyActivityRecords"; noOfCompanyActivityRecords = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".typeOfTachographCardId"; typeOfTachographCardId = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); companyCardApplicationIdentification.cardStructureVersion = new DDDClass.CardStructureVersion(cardStructureVersion); companyCardApplicationIdentification.noOfCompanyActivityRecords = new DDDClass.NoOfCompanyActivityRecords(noOfCompanyActivityRecords); companyCardApplicationIdentification.typeOfTachographCardId = new DDDClass.EquipmentType(typeOfTachographCardId); return companyCardApplicationIdentification; }
//EF_ICC public CardUnit.EF_ICC Get_EF_ICC(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_icc"; string currentParamName; CardUnit.EF_ICC ef_icc = new CardUnit.EF_ICC(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; string cardApprovalNumber; List<DDDClass.ExtendedSerialNumber> cardExtendedSerialNumber = new List<DDDClass.ExtendedSerialNumber>(); string cardPersonaliserID; string clockStop; string embedderIcAssemblerId; string icIdentifier; currentParamName = paramName + ".cardApprovalNumber"; cardApprovalNumber = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardExtendedSerialNumber"; cardExtendedSerialNumber = GetExtendedSerialNumber(dataBlockId, currentParamName); currentParamName = paramName + ".cardPersonaliserID"; cardPersonaliserID = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".clockStop"; clockStop = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".embedderIcAssemblerId"; embedderIcAssemblerId = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".icIdentifier"; icIdentifier = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); ef_icc.cardIccIdentification.cardApprovalNumber = new DDDClass.CardApprovalNumber(cardApprovalNumber); if (cardExtendedSerialNumber.Count > 0) ef_icc.cardIccIdentification.cardExtendedSerialNumber = cardExtendedSerialNumber[0]; ef_icc.cardIccIdentification.cardPersonaliserID = Convert.ToByte(cardPersonaliserID); ef_icc.cardIccIdentification.clockStop = Convert.ToByte(clockStop); _bytes = enc.GetBytes(embedderIcAssemblerId); ef_icc.cardIccIdentification.embedderIcAssemblerId = _bytes; _bytes = enc.GetBytes(icIdentifier); ef_icc.cardIccIdentification.icIdentifier = _bytes; return ef_icc; }
//EF_Driving_Licence_Info public CardUnit.EF_Driving_Licence_Info Get_EF_Driving_Licence_Info(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); CardUnit.EF_Driving_Licence_Info efDrivingLicenceInfo = new CardUnit.EF_Driving_Licence_Info(); string paramName = "ef_driving_licence_info"; string currentParamName; string drivingLicenceIssuingAuthority; string drivingLicenceIssuingNation; string drivingLicenceNumber; try { currentParamName = paramName + ".drivingLicenceIssuingAuthority.name"; drivingLicenceIssuingAuthority = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".drivingLicenceIssuingNation"; drivingLicenceIssuingNation = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".drivingLicenceNumber"; drivingLicenceNumber = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); efDrivingLicenceInfo.cardDrivingLicenceInformation.drivingLicenceIssuingAuthority = new DDDClass.Name(0, drivingLicenceIssuingAuthority); efDrivingLicenceInfo.cardDrivingLicenceInformation.drivingLicenceIssuingNation = new DDDClass.NationNumeric(drivingLicenceIssuingNation); efDrivingLicenceInfo.cardDrivingLicenceInformation.drivingLicenceNumber = drivingLicenceNumber; } catch (Exception ex) { Console.WriteLine("Ошибка: " + ex.Message); return efDrivingLicenceInfo; } return efDrivingLicenceInfo; }
//EF_Driver_Activity_Data public DDDClass.CardDriverActivity Get_EF_Driver_Activity_Data(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_driver_activity_data"; string currentParamName; DDDClass.CardDriverActivity driverActivityData = new DDDClass.CardDriverActivity(); DDDClass.CardActivityDailyRecord cardActivityDailyRecord = new DDDClass.CardActivityDailyRecord(); string activityPointerNewestRecord; string activityPointerOldestDayRecord; currentParamName = paramName + ".activityPointerNewestRecord"; activityPointerNewestRecord = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); if (activityPointerNewestRecord == " ") throw new Exception("Такой информации не существует..."); currentParamName = paramName + ".activityPointerOldestDayRecord"; activityPointerOldestDayRecord = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); driverActivityData.activityPointerNewestRecord = Convert.ToInt32(activityPointerNewestRecord); driverActivityData.activityPointerOldestDayRecord = Convert.ToInt32(activityPointerOldestDayRecord); List<string> activityChangeInfo = new List<string>(); List<string> activityDailyPresenceCounter = new List<string>(); List<string> activityDayDistance = new List<string>(); List<string> activityPreviousRecordLength = new List<string>(); List<string> activityRecordDate = new List<string>(); List<string> activityRecordLength = new List<string>(); paramName += ".activityDailyRecords"; currentParamName = paramName + ".activityChangeInfo"; activityChangeInfo = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityDailyPresenceCounter"; activityDailyPresenceCounter = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityDayDistance"; activityDayDistance = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityPreviousRecordLength"; activityPreviousRecordLength = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityRecordDate"; activityRecordDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityRecordLength"; activityRecordLength = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); int allActivitiesNumbers = 0; int tempActivity; List<int> activityChangesCount = new List<int>(); foreach (string changeNumb in activityRecordLength) { tempActivity = (Convert.ToInt32(changeNumb) - 12); if (tempActivity != 0) tempActivity = tempActivity / 2; allActivitiesNumbers += tempActivity; activityChangesCount.Add(tempActivity); } if (allActivitiesNumbers != activityChangeInfo.Count) throw new Exception("Активности неправильно разобраны!"); int noOfActivityChangesInt; List<DDDClass.ActivityChangeInfo> dayActivityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); int number = 0; if (activityDailyPresenceCounter.Count == activityRecordDate.Count) { number = 0; for (int i = 0; i < activityRecordDate.Count; i++) { cardActivityDailyRecord = new DDDClass.CardActivityDailyRecord(); cardActivityDailyRecord.activityDailyPresenceCounter = new DDDClass.DailyPresenceCounter(activityDailyPresenceCounter[i]); cardActivityDailyRecord.activityDayDistance = new DDDClass.Distance(activityDayDistance[i]); cardActivityDailyRecord.activityPreviousRecordLength = new DDDClass.CardActivityLengthRange(activityPreviousRecordLength[i]); cardActivityDailyRecord.activityRecordDate = new DDDClass.TimeReal(activityRecordDate[i]); cardActivityDailyRecord.activityRecordLength = new DDDClass.CardActivityLengthRange(activityRecordLength[i]); noOfActivityChangesInt = cardActivityDailyRecord.activityRecordLength.cardActivityLengthRange; dayActivityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); for (int j = 0; j < activityChangesCount[i]; j++) { dayActivityChangeInfo.Add(new DDDClass.ActivityChangeInfo(activityChangeInfo[number])); number++; } cardActivityDailyRecord.activityChangeInfo = dayActivityChangeInfo; driverActivityData.activityDailyRecords.Add(cardActivityDailyRecord); } } else throw new Exception("Ошибка в загрузке активностей водителя"); return driverActivityData; }
/// <summary> /// Получить имя загруженного файла /// </summary> /// <param name="dataBlockId">ID блока данных</param> /// <returns></returns> public string GetDataBlock_FileName(int dataBlockId) { SQLDB_Records sqlDB_rec = new SQLDB_Records(connectionString, sqlDb.GETMYSQLCONNECTION()); string dataBlockFilename; try { int dataBlockFilenameParamID = sqlDb.getParamId("DataBlock_FileName"); dataBlockFilename = sqlDB_rec.Get_ParamValue(dataBlockId, dataBlockFilenameParamID); } catch { return "Имя недоступно"; } return dataBlockFilename; }
/// <summary> /// Получить количество байт загруженного файла /// </summary> /// <param name="dataBlockId">ID блока данных</param> /// <returns>количество байт в файле</returns> public string GetDataBlock_BytesCount(int dataBlockId) { SQLDB_Records sqlDB_rec = new SQLDB_Records(connectionString, sqlDb.GETMYSQLCONNECTION()); string dataBlockRecordsCount; try { int dataBlockRecordsCountParamID = sqlDb.getParamId("DataBlock_BytesCount"); dataBlockRecordsCount = sqlDB_rec.Get_ParamValue(dataBlockId, dataBlockRecordsCountParamID); } catch { return "Значение недоступно"; } return dataBlockRecordsCount; }
/// <summary> /// Парсить блок данных /// </summary> /// <param name="generateXML">генерировать ли XML файл</param> /// <param name="output">путь, куда XML сохранять</param> /// <param name="userId">ID пользователя, от имени которого вызывается этот метод</param> /// <returns>разобранный обьект</returns> public object ParseRecords(bool generateXML, string output, int userId) { Exception noOrg = new Exception("No organization entered"); Exception CardVehicleError = new Exception("Ошибка в базе данных. Нет связи Карта - ТС!"); if (organizationID == 0) throw noOrg; if (DATA_BLOCK_ID == -1) throw (new Exception("Can't find this Data Block")); else { //SQLDB sqlDB = new SQLDB(connectionString); SQLDB_Records sqlDB_rec = new SQLDB_Records(connectionString, sqlDb.GETMYSQLCONNECTION()); ReflectObjectToTableClass reflectedItemsList; Type type = null; object myParseObject = new object(); PARSER.DDDParser dddParser = new DDDParser(); string fileName = ""; try { fileName = sqlDB_rec.Get_ParamValue(DATA_BLOCK_ID, "DataBlock_FileName"); byte[] blockDataBlob = sqlDb.GetDataBlock(DATA_BLOCK_ID); blockDataBlob = UnZipBytes(blockDataBlob);//АнЗипим файл! dddParser.ParseFile(blockDataBlob, fileName); int cardType = dddParser.GetCardType(); currentCardType = cardType; //test //OpenConnection(); //OpenTransaction(); // if (cardType == 0)// 0 - card(driver) { int cardId; if (dddParser.cardUnitClass.ef_identification.driverCardHolderIdentification != null) { string drName = dddParser.cardUnitClass.ef_identification.driverCardHolderIdentification.cardHolderName.ToString(); string drNumber = dddParser.cardUnitClass.ef_identification.cardIdentification.cardNumber.ToString(); //sqlDB.OpenConnection(); cardId = cardsTable.GetCardId(drName, drNumber, cardsTable.driversCardTypeId); if (cardId <= 0) { int grId = cardsTable.GetAllGroupIds(organizationID, 0)[0]; UserFromTable userData = new UserFromTable(); userData.name = ""; userData.pass = ""; int newUserId = usersTable.AddNewUser(userData, usersTable.DriverUserTypeId, 1, organizationID, userId); string[] arr=drName.Split(' '); usersTable.AddUserInfoValue(newUserId, DataBaseReference.UserInfo_Name, arr[0]); usersTable.AddUserInfoValue(newUserId, DataBaseReference.UserInfo_Surname, arr[1]); cardId = cardsTable.CreateNewCard(drName, drNumber, cardsTable.driversCardTypeId, organizationID, newUserId, "Init DataBlockId = " + DATA_BLOCK_ID, userId, grId); } sqlDb.SetDataBlock_CardId(DATA_BLOCK_ID, cardId); //sqlDB.CloseConnection(); } else { //sqlDB.OpenConnection(); sqlDb.SetDataBlockState(DATA_BLOCK_ID, 4); //sqlDB.CloseConnection(); throw new Exception("Поддерживаются только водительские карты и информация с бортового устройства."); } type = dddParser.cardUnitClass.GetType(); myParseObject = dddParser.cardUnitClass; } else if (cardType == 1)//vehicle { ///////////////////////// int vehicleId; if (dddParser.vehicleUnitClass.vehicleOverview.vehicleRegistrationIdentification != null) { int cardId; string vehRegNumber = dddParser.vehicleUnitClass.vehicleOverview.vehicleRegistrationIdentification.vehicleRegistrationNumber.ToString(); string vin = dddParser.vehicleUnitClass.vehicleOverview.vehicleIdentificationNumber.ToString(); cardId = cardsTable.GetCardId(vehRegNumber, vin, cardsTable.vehicleCardTypeId); vehicleId = vehiclesTables.GetVehicleId_byVinRegNumbers(vin, vehRegNumber); if ((vehicleId <= 0 && cardId > 0) || (vehicleId > 0 && cardId <= 0)) throw CardVehicleError; if (cardId <= 0) { string marka = ""; DateTime BLOCKED = dddParser.vehicleUnitClass.vehicleOverview.vuDownloadablePeriod.maxDownloadableTime.getTimeRealDate(); int grId = cardsTable.GetAllGroupIds(organizationID,0)[0]; cardId = cardsTable.CreateNewCard(vehRegNumber, vin, cardsTable.vehicleCardTypeId, organizationID, userId, "Init DataBlockId = " + DATA_BLOCK_ID, userId, grId); //vehiclesTables.OpenConnection(); vehicleId = vehiclesTables.AddNewVehicle(vehRegNumber, marka, vin, 0, 1, cardId, BLOCKED, 1); //vehiclesTables.CloseConnection(); // SetAllVehiclesIDS(vehicleId); } sqlDb.SetDataBlock_CardId(DATA_BLOCK_ID, cardId); } ///////////////////////// type = dddParser.vehicleUnitClass.GetType(); myParseObject = dddParser.vehicleUnitClass; } else if (cardType == 2)//plf { //////////////////////устанавливаем PLF карту нужного водителя. Незнаю почему именно здесь, но так получилось. int plfDriversCardType = sqlDB_rec.Get_DataBlockCardType(DATA_BLOCK_ID); sqlDb.SetDataBlock_CardId(DATA_BLOCK_ID, plfDriversCardType); // sqlDB.OpenConnection(); int cardTypeParamId = sqlDb.AddParam("cardType", 0, 255); //sqlDB.OpenConnection(); sqlDb.DeleteDataRecord(DATA_BLOCK_ID, cardTypeParamId); // sqlDB.CloseConnection(); ////////////////////// type = dddParser.plfUnitClass.GetType(); myParseObject = dddParser.plfUnitClass; } else if (cardType == -1) throw new Exception("Информация непригодна для разбора(не опознан тип карты"); //sqlDB.OpenConnection(); SetParseBDate(sqlDb); //sqlDB.CloseConnection(); List<ReflectObjectToTableClass> allRecordsToAdd = new List<ReflectObjectToTableClass>(); foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { reflectedItemsList = new ReflectObjectToTableClass(); string fieldName = pi.Name; object field2 = pi.GetValue(myParseObject, null); if (field2 != null) { reflectedItemsList.ReflectObjectToTable(fieldName, field2);//Не удалять! allRecordsToAdd.Add(AddRecords(reflectedItemsList));//не удалять } } foreach (ReflectObjectToTableClass recordList in allRecordsToAdd) { dataRecord.AddDataArray(recordList.reflectedItemsList); } //sqlDB.OpenConnection(); SetParseEDate(sqlDb); sqlDb.SetDataBlockState(DATA_BLOCK_ID, 2); int dataBlockParseRecords = sqlDb.SetDataBlockParseRecords(DATA_BLOCK_ID); Console.WriteLine("\n\r" + dataBlockParseRecords.ToString() + " records added"); //XML GENERATING if (generateXML) dddParser.GenerateXmlFile(output); // //Добавляем лог для каждого типа блока данных свой. string logNote; HistoryTable historyTable = new HistoryTable(connectionString, CurrentLanguage, sqlDb); if (currentCardType == 0)//driver { string drName = dddParser.cardUnitClass.ef_identification.driverCardHolderIdentification.cardHolderName.ToString(); string drNumber = dddParser.cardUnitClass.ef_identification.cardIdentification.cardNumber.ToString(); logNote = "Driver: " + drName + "(" + drNumber + ")" + ", records number: " + dataBlockParseRecords.ToString(); historyTable.AddHistoryRecord("fn_data_block", "DATA_BLOCK_ID", DATA_BLOCK_ID, userId, historyTable.DDDDriversDataBlockLoaded, logNote, sqlDb); } if (currentCardType == 1)//vehicle { string logVehRegNumber = dddParser.vehicleUnitClass.vehicleOverview.vehicleRegistrationIdentification.vehicleRegistrationNumber.ToString(); string logVin = dddParser.vehicleUnitClass.vehicleOverview.vehicleIdentificationNumber.ToString(); logNote = "Vehicle: " + logVehRegNumber + "(" + logVin + ")" + ", records number: " + dataBlockParseRecords.ToString(); historyTable.AddHistoryRecord("fn_data_block", "DATA_BLOCK_ID", DATA_BLOCK_ID, userId, historyTable.DDDVehiclesDataBlockLoaded, logNote, sqlDb); } if (currentCardType == 2)//plf { string vehPlfIdent = dddParser.plfUnitClass.VEHICLE; string plfDeviceId = dddParser.plfUnitClass.ID_DEVICE; string period = dddParser.plfUnitClass.START_PERIOD.GetSystemTime().ToShortDateString() + " - " + dddParser.plfUnitClass.END_PERIOD.GetSystemTime().ToShortDateString(); logNote = "PLF File: " + vehPlfIdent + "(" + plfDeviceId + ")" + ", period: " + period + ", records number: " + dataBlockParseRecords.ToString(); historyTable.AddHistoryRecord("fn_data_block", "DATA_BLOCK_ID", DATA_BLOCK_ID, userId, historyTable.PLFDataBlockLoaded, logNote, sqlDb); } // //sqlDb.CommitConnection(); //sqlDb.CloseConnection(); } catch (Exception ex) { //sqlDb.RollbackConnection(); //sqlDb.CloseConnection(); throw ex; } finally { } return myParseObject; } }
public PLFRecord Get_InstalledSensors(int dataBlockId) { //SQLDB sqldb = new SQLDB(connectionString); SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); PLFRecord sensorsInstalled = new PLFRecord(); string paramName = "installedSensors"; string currentParamName; #region "Variables" bool ADDITIONAL_SENSORS; bool ALTITUDE; bool DISTANCE_COUNTER; bool ENGINE_RPM; bool FUEL_CONSUMPTION; bool FUEL_COUNTER; bool FUEL_VOLUME1; bool FUEL_VOLUME2; bool LATITUDE; bool LONGITUDE; bool MAIN_STATES; bool RESERVED_3; bool RESERVED_4; bool RESERVED_5; bool SPEED; bool SYSTEM_TIME; bool TEMPERATURE1; bool TEMPERATURE2; bool VOLTAGE; bool WEIGHT1; bool WEIGHT2; bool WEIGHT3; bool WEIGHT4; bool WEIGHT5; #endregion #region "Load From DataBase" currentParamName = paramName + ".ADDITIONAL_SENSORS"; ADDITIONAL_SENSORS = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".ALTITUDE"; ALTITUDE = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".DISTANCE_COUNTER"; DISTANCE_COUNTER = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".ENGINE_RPM"; ENGINE_RPM = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".FUEL_CONSUMPTION"; FUEL_CONSUMPTION = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".FUEL_COUNTER"; FUEL_COUNTER = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".FUEL_VOLUME1"; FUEL_VOLUME1 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".FUEL_VOLUME2"; FUEL_VOLUME2 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".FUEL_VOLUME2"; FUEL_VOLUME2 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".LATITUDE"; LATITUDE = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".LONGITUDE"; LONGITUDE = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".MAIN_STATES"; MAIN_STATES = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".RESERVED_3"; RESERVED_3 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".RESERVED_4"; RESERVED_4 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".RESERVED_5"; RESERVED_5 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".SPEED"; SPEED = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".SYSTEM_TIME"; SYSTEM_TIME = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".TEMPERATURE1"; TEMPERATURE1 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".TEMPERATURE2"; TEMPERATURE2 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".VOLTAGE"; VOLTAGE = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".WEIGHT1"; WEIGHT1 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".WEIGHT2"; WEIGHT2 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".WEIGHT3"; WEIGHT3 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".WEIGHT4"; WEIGHT4 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); currentParamName = paramName + ".WEIGHT5"; WEIGHT5 = If_Y_retTrue(sqldbRecords.Get_ParamValue(dataBlockId, currentParamName)); #endregion #region "List Initialization" //Тут еще имеется пространство для оптимизации if (ADDITIONAL_SENSORS) sensorsInstalled.ADDITIONAL_SENSORS = "Y"; if (ALTITUDE) sensorsInstalled.ALTITUDE = "Y"; if (DISTANCE_COUNTER) sensorsInstalled.DISTANCE_COUNTER = "Y"; if (ENGINE_RPM) sensorsInstalled.ENGINE_RPM = "Y"; if (FUEL_CONSUMPTION) sensorsInstalled.FUEL_CONSUMPTION = "Y"; if (FUEL_COUNTER) sensorsInstalled.FUEL_COUNTER = "Y"; if (FUEL_VOLUME1) sensorsInstalled.FUEL_VOLUME1 = "Y"; if (FUEL_VOLUME2) sensorsInstalled.FUEL_VOLUME2 = "Y"; if (LATITUDE) sensorsInstalled.LATITUDE = "Y"; if (LONGITUDE) sensorsInstalled.LONGITUDE = "Y"; if (MAIN_STATES) sensorsInstalled.MAIN_STATES = "Y"; if (RESERVED_3) sensorsInstalled.RESERVED_3 = "Y"; if (RESERVED_4) sensorsInstalled.RESERVED_4 = "Y"; if (RESERVED_5) sensorsInstalled.RESERVED_5 = "Y"; if (SPEED) sensorsInstalled.SPEED = "Y"; if (SYSTEM_TIME) sensorsInstalled.SYSTEM_TIME.systemTime = "Y"; if (TEMPERATURE1) sensorsInstalled.TEMPERATURE1 = "Y"; if (TEMPERATURE2) sensorsInstalled.TEMPERATURE2 = "Y"; if (VOLTAGE) sensorsInstalled.VOLTAGE = "Y"; if (WEIGHT1) sensorsInstalled.WEIGHT1 = "Y"; if (WEIGHT2) sensorsInstalled.WEIGHT2 = "Y"; if (WEIGHT3) sensorsInstalled.WEIGHT3 = "Y"; if (WEIGHT4) sensorsInstalled.WEIGHT4 = "Y"; if (WEIGHT5) sensorsInstalled.WEIGHT5 = "Y"; #endregion return sensorsInstalled; }
//EF_Control_Activity_Data public DDDClass.CardControlActivityDataRecord Get_EF_Control_Activity_Data(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_control_activity_data"; string currentParam; DDDClass.CardControlActivityDataRecord cardControlActivityDataRecord = new DDDClass.CardControlActivityDataRecord(); List<DDDClass.FullCardNumber> controlCardNumber = new List<DDDClass.FullCardNumber>(); string controlDownloadPeriodBegin; string controlDownloadPeriodEnd; string controlTime; string controlType; List<DDDClass.VehicleRegistrationIdentification> controlVehicleRegistration = new List<DDDClass.VehicleRegistrationIdentification>(); currentParam = paramName + ".controlCardNumber"; controlCardNumber = GetCardFullNumber(dataBlockId, currentParam); currentParam = paramName + ".controlVehicleRegistration"; controlVehicleRegistration = GetVehicleRegistrationIdentification(dataBlockId, currentParam); currentParam = paramName + ".controlDownloadPeriodBegin"; controlDownloadPeriodBegin = sqldbRecords.Get_ParamValue(dataBlockId, currentParam); currentParam = paramName + ".controlDownloadPeriodEnd"; controlDownloadPeriodEnd = sqldbRecords.Get_ParamValue(dataBlockId, currentParam); currentParam = paramName + ".controlTime"; controlTime = sqldbRecords.Get_ParamValue(dataBlockId, currentParam); currentParam = paramName + ".controlType"; controlType = sqldbRecords.Get_ParamValue(dataBlockId, currentParam); if (controlCardNumber.Count != 0 && controlVehicleRegistration.Count != 0) { cardControlActivityDataRecord.controlCardNumber = controlCardNumber[0]; cardControlActivityDataRecord.controlVehicleRegistration = controlVehicleRegistration[0]; } else { cardControlActivityDataRecord.controlCardNumber = new DDDClass.FullCardNumber(); cardControlActivityDataRecord.controlVehicleRegistration = new DDDClass.VehicleRegistrationIdentification(); } cardControlActivityDataRecord.controlDownloadPeriodBegin = new DDDClass.TimeReal(controlDownloadPeriodBegin); cardControlActivityDataRecord.controlDownloadPeriodEnd = new DDDClass.TimeReal(controlDownloadPeriodEnd); cardControlActivityDataRecord.controlTime = new DDDClass.TimeReal(controlTime); cardControlActivityDataRecord.controlType = new DDDClass.ControlType(controlType); return cardControlActivityDataRecord; }
//EF_Current_Usage public DDDClass.CardCurrentUse Get_EF_Current_Usage(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_current_usage"; string currentParam; DDDClass.CardCurrentUse cardCurrentUse = new DDDClass.CardCurrentUse(); string sessionOpenTime; List<DDDClass.VehicleRegistrationIdentification> sessionOpenVehicle = new List<DDDClass.VehicleRegistrationIdentification>(); currentParam = paramName + ".sessionOpenTime"; sessionOpenTime = sqldbRecords.Get_ParamValue(dataBlockId, currentParam); currentParam = paramName + ".sessionOpenVehicle"; sessionOpenVehicle = GetVehicleRegistrationIdentification(dataBlockId, currentParam); if (sessionOpenVehicle.Count != 0) cardCurrentUse.sessionOpenVehicle = sessionOpenVehicle[0]; else cardCurrentUse.sessionOpenVehicle = new DDDClass.VehicleRegistrationIdentification(); cardCurrentUse.sessionOpenTime = new DDDClass.TimeReal(sessionOpenTime); return cardCurrentUse; }
public DDDClass.VuIdentification Get_VehicleTechnicalData_VuIdentification(int dataBlockId) { DDDClass.VuIdentification vuIdentification = new DDDClass.VuIdentification(); SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleTechnicalData.vuIdentification"; string currentParamName; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; currentParamName = paramName + ".vuApprovalNumber"; string vuApprovalNumber = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".vuManufacturerAddress.address"; string vuManufacturerAddress = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".vuManufacturerName.name"; string vuManufacturerName = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".vuManufacturingDate"; string vuManufacturingDate = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".vuPartNumber"; string vuPartNumber = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); List<DDDClass.ExtendedSerialNumber> vuSerialNumber = new List<DDDClass.ExtendedSerialNumber>(); vuSerialNumber = GetExtendedSerialNumber(dataBlockId, paramName + ".vuSerialNumber"); currentParamName = paramName + ".vuSoftwareIdentification.vuSoftInstallationDate"; string vuSoftInstallationDate = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".vuSoftwareIdentification.vuSoftwareVersion"; string vuSoftwareVersion = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); if (vuSerialNumber.Count > 1) throw new Exception("Ошибка в VehicleTechnicalData! Несколько записей вместо одной!"); if (vuSerialNumber.Count == 0) throw new Exception("Нет данных!"); vuIdentification.vuApprovalNumber.vuApprovalNumber = vuApprovalNumber; _bytes = enc.GetBytes(vuManufacturerAddress); vuIdentification.vuManufacturerAddress.address = _bytes; _bytes = enc.GetBytes(vuManufacturerName); vuIdentification.vuManufacturerName.name = _bytes; vuIdentification.vuManufacturingDate.timereal = Convert.ToInt64(vuManufacturingDate); vuIdentification.vuPartNumber = new DDDClass.VuPartNumber(vuPartNumber); vuIdentification.vuSerialNumber.manufacturerCode = vuSerialNumber[0].manufacturerCode; vuIdentification.vuSerialNumber.monthYear = vuSerialNumber[0].monthYear; vuIdentification.vuSerialNumber.serialNumber = vuSerialNumber[0].serialNumber; vuIdentification.vuSerialNumber.type = vuSerialNumber[0].type; vuIdentification.vuSoftwareIdentification.vuSoftInstallationDate = new DDDClass.VuSoftInstallationDate(Convert.ToInt64(vuSoftInstallationDate)); vuIdentification.vuSoftwareIdentification.vuSoftwareVersion.vuSoftwareVersion = vuSoftwareVersion; return vuIdentification; }
public DDDClass.CardDriverActivity Get_EF_Driver_Activity_Data(int dataBlockId, DateTime startPeriod, DateTime endPeriod) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_driver_activity_data"; string currentParamName; DDDClass.CardDriverActivity driverActivityData = new DDDClass.CardDriverActivity(); DDDClass.CardActivityDailyRecord cardActivityDailyRecord = new DDDClass.CardActivityDailyRecord(); string activityPointerNewestRecord; string activityPointerOldestDayRecord; currentParamName = paramName + ".activityPointerNewestRecord"; activityPointerNewestRecord = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".activityPointerOldestDayRecord"; activityPointerOldestDayRecord = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); driverActivityData.activityPointerNewestRecord = Convert.ToInt32(activityPointerNewestRecord); driverActivityData.activityPointerOldestDayRecord = Convert.ToInt32(activityPointerOldestDayRecord); List<string> activityChangeInfo = new List<string>(); List<string> activityDailyPresenceCounter = new List<string>(); List<string> activityDayDistance = new List<string>(); List<string> activityPreviousRecordLength = new List<string>(); List<string> activityRecordDate = new List<string>(); List<string> activityRecordLength = new List<string>(); paramName += ".activityDailyRecords"; currentParamName = paramName + ".activityChangeInfo"; activityChangeInfo = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityDailyPresenceCounter"; activityDailyPresenceCounter = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityDayDistance"; activityDayDistance = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityPreviousRecordLength"; activityPreviousRecordLength = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityRecordDate"; activityRecordDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityRecordLength"; activityRecordLength = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); int allActivitiesNumbers = 0; int tempActivity; List<int> activityChangesCount = new List<int>(); foreach (string changeNumb in activityRecordLength) { tempActivity = (Convert.ToInt32(changeNumb) - 12); if (tempActivity != 0) tempActivity = tempActivity / 2; allActivitiesNumbers += tempActivity; activityChangesCount.Add(tempActivity); } if (allActivitiesNumbers != activityChangeInfo.Count) throw new Exception("Активности неправильно разобраны!"); List<List<string>> ActivityChangeInfoSorted = GetActivityInfosStartsFromIndex(activityChangeInfo, activityChangesCount); int noOfActivityChangesInt; List<DDDClass.ActivityChangeInfo> dayActivityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); if (activityDailyPresenceCounter.Count == activityRecordDate.Count) { List<int> Indexes = new List<int>(); Indexes = CheckDate(activityRecordDate, activityRecordDate, startPeriod, endPeriod); foreach(int i in Indexes) { cardActivityDailyRecord = new DDDClass.CardActivityDailyRecord(); cardActivityDailyRecord.activityDailyPresenceCounter = new DDDClass.DailyPresenceCounter(activityDailyPresenceCounter[i]); cardActivityDailyRecord.activityDayDistance = new DDDClass.Distance(activityDayDistance[i]); cardActivityDailyRecord.activityPreviousRecordLength = new DDDClass.CardActivityLengthRange(activityPreviousRecordLength[i]); cardActivityDailyRecord.activityRecordDate = new DDDClass.TimeReal(activityRecordDate[i]); cardActivityDailyRecord.activityRecordLength = new DDDClass.CardActivityLengthRange(activityRecordLength[i]); dayActivityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); for (int j = 0; j < ActivityChangeInfoSorted[i].Count; j++) { dayActivityChangeInfo.Add(new DDDClass.ActivityChangeInfo(ActivityChangeInfoSorted[i][j])); } dayActivityChangeInfo.Sort(Get_EF_Driver_Activity_Data_Comparison); cardActivityDailyRecord.activityChangeInfo = dayActivityChangeInfo; driverActivityData.activityDailyRecords.Add(cardActivityDailyRecord); } } else throw new Exception("Ошибка в загрузке активностей водителя"); return driverActivityData; }
public DDDClass.VuOverSpeedingControlData Get_VehicleEventsAndFaults_VuOverSpeedingControlData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleEventsAndFaults.vuOverSpeedingControlData"; string currentParamName; DDDClass.VuOverSpeedingControlData vuOverSpeedingControlData = new DDDClass.VuOverSpeedingControlData(); string firstOverspeedSince; string lastOverspeedControlTime; string numberOfOverspeedSince; currentParamName = paramName + ".firstOverspeedSince"; firstOverspeedSince = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".lastOverspeedControlTime"; lastOverspeedControlTime = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".numberOfOverspeedSince"; numberOfOverspeedSince = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); vuOverSpeedingControlData.firstOverspeedSince = new DDDClass.TimeReal(Convert.ToInt64(firstOverspeedSince)); vuOverSpeedingControlData.lastOverspeedControlTime = new DDDClass.TimeReal(Convert.ToInt64(lastOverspeedControlTime)); vuOverSpeedingControlData.numberOfOverspeedSince = new DDDClass.OverspeedNumber(Convert.ToByte(numberOfOverspeedSince)); return vuOverSpeedingControlData; }
public DDDClass.VuDownloadablePeriod Get_VehicleOverview_VuDownloadablePeriod(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; DDDClass.VuDownloadablePeriod vuDownloadablePeriod = new DDDClass.VuDownloadablePeriod(); paramName = "vehicleOverview.vuDownloadablePeriod.minDownloadableTime"; string minDownloadableTime = sqldbRecords.Get_ParamValue(dataBlockId, paramName); paramName = "vehicleOverview.vuDownloadablePeriod.maxDownloadableTime"; string maxDownloadableTime = sqldbRecords.Get_ParamValue(dataBlockId, paramName); vuDownloadablePeriod.minDownloadableTime = new DDDClass.TimeReal(Convert.ToUInt32(minDownloadableTime)); vuDownloadablePeriod.maxDownloadableTime = new DDDClass.TimeReal(Convert.ToUInt32(maxDownloadableTime)); return vuDownloadablePeriod; }
public DDDClass.VuDownloadActivityData Get_VehicleOverview_VuDownloadActivityData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; DDDClass.VuDownloadActivityData vuDownloadActivityData = new DDDClass.VuDownloadActivityData(); paramName = "vehicleOverview.vuDownloadActivityData.companyOrWorkshopName.name"; string companyOrWorkshopName = sqldbRecords.Get_ParamValue(dataBlockId, paramName); paramName = "vehicleOverview.vuDownloadActivityData.downloadingTime"; string downloadingTime = sqldbRecords.Get_ParamValue(dataBlockId, paramName); DDDClass.FullCardNumber cardNumber = new DDDClass.FullCardNumber(); cardNumber = GetCardFullNumber(dataBlockId, "vehicleOverview.vuDownloadActivityData.fullCardNumber")[0]; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes = enc.GetBytes(companyOrWorkshopName); vuDownloadActivityData.companyOrWorkshopName.name = _bytes; vuDownloadActivityData.downloadingTime = new DDDClass.TimeReal(Convert.ToUInt32(downloadingTime)); vuDownloadActivityData.fullCardNumber = cardNumber; return vuDownloadActivityData; }
//EF_IC public CardUnit.EF_IC Get_EF_IC(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_ic"; string currentParamName; CardUnit.EF_IC ef_ic = new CardUnit.EF_IC(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; string icManufacturingReferences; string icSerialNumber; currentParamName = paramName + ".icManufacturingReferences"; icManufacturingReferences = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".icSerialNumber"; icSerialNumber = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); ef_ic.cardChipIdentification.Set_icSerialNumber(icSerialNumber); ef_ic.cardChipIdentification.Set_icManufacturingReferences(icManufacturingReferences); return ef_ic; }
//Vehicle_Technical_data public DDDClass.SensorPaired Get_VehicleTechnicalData_SensorPaired(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); DDDClass.SensorPaired sensorPaired = new DDDClass.SensorPaired(); string paramName; paramName = "vehicleTechnicalData.sensorPaired.sensorApprovalNumber"; string sensorApprovalNumber = sqldbRecords.Get_ParamValue(dataBlockId, paramName); paramName = "vehicleTechnicalData.sensorPaired.sensorPairingDateFirst"; string sensorPairingDateFirst = sqldbRecords.Get_ParamValue(dataBlockId, paramName); List<DDDClass.ExtendedSerialNumber> sensorSerialNumber = new List<DDDClass.ExtendedSerialNumber>(); sensorSerialNumber = GetExtendedSerialNumber(dataBlockId, "vehicleTechnicalData.sensorPaired.sensorSerialNumber"); if (sensorSerialNumber.Count > 1) throw new Exception("Ошибка в VehicleTechnicalData! Несколько записей!"); if (sensorSerialNumber.Count == 0) throw new Exception("Нет данных!"); sensorPaired.sensorApprovalNumber = new DDDClass.SensorApprovalNumber(sensorApprovalNumber); sensorPaired.sensorPairingDateFirst = new DDDClass.SensorPairingDate(Convert.ToInt64(sensorPairingDateFirst)); sensorPaired.sensorSerialNumber.manufacturerCode = sensorSerialNumber[0].manufacturerCode; sensorPaired.sensorSerialNumber.monthYear = sensorSerialNumber[0].monthYear; sensorPaired.sensorSerialNumber.serialNumber = sensorSerialNumber[0].serialNumber; sensorPaired.sensorSerialNumber.type = sensorSerialNumber[0].type; return sensorPaired; }
public DDDClass.CardIdentification Get_EF_Identification_CardIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_identification.cardIdentification"; string currentParamName; DDDClass.CardIdentification cardIdentification = new DDDClass.CardIdentification(); string cardExpiryDate; string cardIssueDate; string cardIssuingAuthorityName; string cardIssuingMemberState; string cardValidityBegin; DDDClass.CardNumber cardNumber = new DDDClass.CardNumber(); currentParamName = paramName + ".cardExpiryDate"; cardExpiryDate = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardIssueDate"; cardIssueDate = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardIssuingAuthorityName.name"; cardIssuingAuthorityName = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardIssuingMemberState"; cardIssuingMemberState = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardValidityBegin"; cardValidityBegin = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber"; cardNumber = GetCardNumber(dataBlockId, currentParamName)[0];//Зайти внутрь попалить cardIdentification.cardExpiryDate = new DDDClass.TimeReal(Convert.ToInt64(cardExpiryDate)); cardIdentification.cardIssueDate = new DDDClass.TimeReal(Convert.ToInt64(cardIssueDate)); cardIdentification.cardIssuingAuthorityName.setName(cardIssuingAuthorityName); cardIdentification.cardIssuingMemberState = new DDDClass.NationNumeric(Convert.ToByte(cardIssuingMemberState)); cardIdentification.cardValidityBegin = new DDDClass.TimeReal(cardValidityBegin); cardIdentification.cardNumber = cardNumber; return cardIdentification; }
public DDDClass.WorkshopCardApplicationIdentification Get_EF_Application_Identification_WorkshopCardApplicationIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_application_identification.workshopCardApplicationIdentification"; string currentParamName; DDDClass.WorkshopCardApplicationIdentification worksShopCardApplicationIdentification = new DDDClass.WorkshopCardApplicationIdentification(); string activityStructureLength; string cardStructureVersion; string noOfCalibrationRecords; string noOfCardPlaceRecords; string noOfCardVehicleRecords; string noOfEventsPerType; string noOfFaultsPerType; string typeOfTachographCardId; currentParamName = paramName + ".activityStructureLength"; activityStructureLength = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardStructureVersion"; cardStructureVersion = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfCalibrationRecords"; noOfCalibrationRecords = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfCardPlaceRecords"; noOfCardPlaceRecords = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfCardVehicleRecords"; noOfCardVehicleRecords = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfEventsPerType"; noOfEventsPerType = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".noOfFaultsPerType"; noOfFaultsPerType = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".typeOfTachographCardId"; typeOfTachographCardId = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); worksShopCardApplicationIdentification.activityStructureLength = new DDDClass.CardActivityLengthRange(activityStructureLength); worksShopCardApplicationIdentification.cardStructureVersion = new DDDClass.CardStructureVersion(cardStructureVersion); worksShopCardApplicationIdentification.noOfCalibrationRecords = new DDDClass.NoOfCalibrationRecords(noOfCalibrationRecords); worksShopCardApplicationIdentification.noOfCardPlaceRecords = new DDDClass.NoOfCardPlaceRecords(noOfCardPlaceRecords); worksShopCardApplicationIdentification.noOfCardVehicleRecords = new DDDClass.NoOfCardVehicleRecords(noOfCardVehicleRecords); worksShopCardApplicationIdentification.noOfEventsPerType = new DDDClass.NoOfEventsPerType(noOfEventsPerType); worksShopCardApplicationIdentification.noOfFaultsPerType = new DDDClass.NoOfFaultsPerType(noOfFaultsPerType); worksShopCardApplicationIdentification.typeOfTachographCardId = new DDDClass.EquipmentType(typeOfTachographCardId); return worksShopCardApplicationIdentification; }
public DDDClass.ControlCardHolderIdentification Get_EF_Identification_ControlCardHolderIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); DDDClass.ControlCardHolderIdentification controlCardHolderIdentification = new DDDClass.ControlCardHolderIdentification(); string paramName = "ef_identification.controlCardHolderIdentification"; string currentParamName; string holderFirstNames; string holderSurname; string cardHolderPreferredLanguage; string controlBodyAddress; string controlBodyName; currentParamName = paramName + ".cardHolderName.holderFirstNames.name"; holderFirstNames = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderName.holderSurname.name"; holderSurname = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderPreferredLanguage"; cardHolderPreferredLanguage = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".controlBodyAddress.address"; controlBodyAddress = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".controlBodyName.name"; controlBodyName = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); controlCardHolderIdentification.cardHolderName.holderFirstNames = new DDDClass.Name(0, holderFirstNames); controlCardHolderIdentification.cardHolderName.holderSurname = new DDDClass.Name(0, holderSurname); controlCardHolderIdentification.cardHolderPreferredLanguage = new DDDClass.Language(cardHolderPreferredLanguage); controlCardHolderIdentification.controlBodyAddress = new DDDClass.Address(0, controlBodyAddress); controlCardHolderIdentification.controlBodyName = new DDDClass.Name(0, controlBodyName); return controlCardHolderIdentification; }
//EF_Card_Download public CardUnit.EF_Card_Download Get_EF_Card_Download(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); CardUnit.EF_Card_Download efCardDownload = new CardUnit.EF_Card_Download(); string paramName = "ef_card_download"; string currentParamName; try { DDDClass.EquipmentType cardType = Get_EF_Identification_CardType(dataBlockId); string lastCardDownload; string noOfCalibrationsSinceDownload; efCardDownload.cardType = cardType.equipmentType; switch (cardType.equipmentType) { case 1://driver card currentParamName = paramName + ".lastCardDownload"; lastCardDownload = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); efCardDownload.lastCardDownload = new DDDClass.LastCardDownload(Convert.ToInt64(lastCardDownload)); efCardDownload.cardType = cardType.equipmentType; break; case 2://workshop card currentParamName = paramName + ".noOfCalibrationsSinceDownload"; noOfCalibrationsSinceDownload = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); efCardDownload.noOfCalibrationsSinceDownload = new DDDClass.NoOfCalibrationsSinceDownload(noOfCalibrationsSinceDownload); efCardDownload.cardType = cardType.equipmentType; break; default: efCardDownload.cardType = cardType.equipmentType; break; } return efCardDownload; } catch (Exception) { return efCardDownload; } }
public DDDClass.WorkshopCardHolderIdentification Get_EF_Identification_WorkshopCardHolderIdentification(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); DDDClass.WorkshopCardHolderIdentification workshopCardHolderIdentification = new DDDClass.WorkshopCardHolderIdentification(); string paramName = "ef_identification.workshopCardHolderIdentification"; string currentParamName; string holderFirstNames; string holderSurname; string cardHolderPreferredLanguage; string workshopAddress; string workshopName; currentParamName = paramName + ".holderFirstNames"; holderFirstNames = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".holderSurname"; holderSurname = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderPreferredLanguage"; cardHolderPreferredLanguage = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".workshopAddress.address"; workshopAddress = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); currentParamName = paramName + ".workshopName.name"; workshopName = sqldbRecords.Get_ParamValue(dataBlockId, currentParamName); workshopCardHolderIdentification.cardHolderName.holderFirstNames.setName(holderFirstNames); workshopCardHolderIdentification.cardHolderName.holderSurname.setName(holderSurname); workshopCardHolderIdentification.cardHolderPreferredLanguage = new DDDClass.Language(cardHolderPreferredLanguage); workshopCardHolderIdentification.workshopAddress.SetAddress(workshopAddress); workshopCardHolderIdentification.workshopName.setName(workshopName); return workshopCardHolderIdentification; }
public string Get_TIME_STEP(int dataBlockId) { string TIME_STEP; SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "TIME_STEP"; TIME_STEP = sqldbRecords.Get_ParamValue(dataBlockId, paramName); return TIME_STEP; }