//EF_Places public DDDClass.CardPlaceDailyWorkPeriod Get_EF_Places(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_places"; string currentParam; DDDClass.CardPlaceDailyWorkPeriod cardPlaceDailyWorkPeriod = new DDDClass.CardPlaceDailyWorkPeriod(); DDDClass.PlaceRecord placeRecord = new DDDClass.PlaceRecord(); List<string> dailyWorkPeriodCountry = new List<string>(); List<string> dailyWorkPeriodRegion = new List<string>(); List<string> entryTime = new List<string>(); List<string> entryTypeDailyWorkPeriod = new List<string>(); List<string> vehicleOdometerValue = new List<string>(); currentParam = paramName + ".dailyWorkPeriodCountry"; dailyWorkPeriodCountry = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); currentParam = paramName + ".dailyWorkPeriodRegion"; dailyWorkPeriodRegion = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); currentParam = paramName + ".entryTime"; entryTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); currentParam = paramName + ".entryTypeDailyWorkPeriod"; entryTypeDailyWorkPeriod = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); currentParam = paramName + ".vehicleOdometerValue"; vehicleOdometerValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); if (dailyWorkPeriodCountry.Count == dailyWorkPeriodRegion.Count && entryTime.Count == entryTypeDailyWorkPeriod.Count) { for (int i = 0; i < dailyWorkPeriodCountry.Count; i++) { placeRecord = new DDDClass.PlaceRecord(); placeRecord.dailyWorkPeriodCountry = new DDDClass.NationNumeric(dailyWorkPeriodCountry[i]); placeRecord.dailyWorkPeriodRegion = new DDDClass.RegionNumeric(dailyWorkPeriodRegion[i]); placeRecord.entryTime = new DDDClass.TimeReal(entryTime[i]); placeRecord.entryTypeDailyWorkPeriod = new DDDClass.EntryTypeDailyWorkPeriod(entryTypeDailyWorkPeriod[i]); placeRecord.vehicleOdometerValue = new DDDClass.OdometerShort(vehicleOdometerValue[i]); cardPlaceDailyWorkPeriod.placeRecords.Add(placeRecord); } } return cardPlaceDailyWorkPeriod; }
public List<DDDClass.ActivityChangeInfo> DriversActivityChangeInfo(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString); List<string> DriversActivityChangeInfo_getted = new List<string>(); List<DDDClass.ActivityChangeInfo> DriversActivityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); string paramName = "ef_driver_activity_data.activityDailyRecords.activityChangeInfo"; DDDClass.ActivityChangeInfo activityChangeInfo; System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); // конвертация строки в массив байт byte[] _bytes; sqldbRecords.OpenConnection(); DriversActivityChangeInfo_getted = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); sqldbRecords.CloseConnection(); foreach (string activity in DriversActivityChangeInfo_getted) { if (activity != "It's parent array") { _bytes = encoding.GetBytes(activity); activityChangeInfo = new DDDClass.ActivityChangeInfo(_bytes); DriversActivityChangeInfo.Add(activityChangeInfo); } } return DriversActivityChangeInfo; }
public List<DDDClass.VuControlActivityRecord> Get_VehicleOverview_VuControlActivityData(int dataBlockId) { //Тут еще надо дополнить инфо о карточке проверяющего!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; byte[] _bytes; List<DDDClass.VuControlActivityRecord> vehicleOverview_VuControlActivityData = new List<DDDClass.VuControlActivityRecord>(); List<string> controlTime = new List<string>(); List<string> controlType = new List<string>(); List<string> downloadPeriodBeginTime = new List<string>(); List<string> downloadPeriodEndTime = new List<string>(); paramName = "vehicleOverview.vuControlActivityData.vuControlActivityRecords.controlTime"; controlTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuControlActivityData.vuControlActivityRecords.controlType"; controlType = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuControlActivityData.vuControlActivityRecords.downloadPeriodBeginTime"; downloadPeriodBeginTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuControlActivityData.vuControlActivityRecords.downloadPeriodEndTime"; downloadPeriodEndTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); DDDClass.VuControlActivityRecord vuControlActivityRecord = new DDDClass.VuControlActivityRecord(); if (controlTime.Count == controlType.Count && downloadPeriodEndTime.Count == downloadPeriodBeginTime.Count) { List<DDDClass.FullCardNumber> cardNumbers = new List<DDDClass.FullCardNumber>(); cardNumbers = GetCardFullNumber(dataBlockId, "vehicleOverview.vuControlActivityData.vuControlActivityRecords.controlCardNumber"); for (int i = 0; i < controlTime.Count; i++) { vuControlActivityRecord = new DDDClass.VuControlActivityRecord(); vuControlActivityRecord.controlTime = new DDDClass.TimeReal(Convert.ToUInt32(controlTime[i])); vuControlActivityRecord.downloadPeriodBeginTime = new DDDClass.TimeReal(Convert.ToUInt32(downloadPeriodBeginTime[i])); vuControlActivityRecord.downloadPeriodEndTime = new DDDClass.TimeReal(Convert.ToUInt32(downloadPeriodEndTime[i])); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); _bytes = enc.GetBytes(controlType[i]); vuControlActivityRecord.controlType = new DDDClass.ControlType(_bytes); vuControlActivityRecord.controlCardNumber = cardNumbers[i]; vehicleOverview_VuControlActivityData.Add(vuControlActivityRecord); } } return vehicleOverview_VuControlActivityData; }
private List<DDDClass.VehicleRegistrationIdentification> GetVehicleRegistrationIdentification(int dataBlockId, string paramName) { DDDClass.VehicleRegistrationIdentification vehicleRegistrationIdentification = new DDDClass.VehicleRegistrationIdentification(); List<DDDClass.VehicleRegistrationIdentification> vehicleRegistrationIdentificationList = new List<DDDClass.VehicleRegistrationIdentification>(); SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string currentParamName; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<string> vehicleRegistrationNumber = new List<string>(); List<string> vehicleRegistrationNation = new List<string>(); currentParamName = paramName + ".vehicleRegistrationNumber.vehicleRegNumber"; vehicleRegistrationNumber = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".vehicleRegistrationNation"; vehicleRegistrationNation = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (vehicleRegistrationNumber.Count == vehicleRegistrationNation.Count) { for (int i = 0; i < vehicleRegistrationNumber.Count; i++) { vehicleRegistrationIdentification = new DDDClass.VehicleRegistrationIdentification(); vehicleRegistrationIdentification.vehicleRegistrationNation = new DDDClass.NationNumeric(Convert.ToInt16(vehicleRegistrationNation[i])); _bytes = enc.GetBytes(vehicleRegistrationNumber[i]); vehicleRegistrationIdentification.vehicleRegistrationNumber.vehicleRegNumber = _bytes; vehicleRegistrationIdentificationList.Add(vehicleRegistrationIdentification); } } return vehicleRegistrationIdentificationList; }
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; }
//Это не вся информация. Есть еще, смотреть CardUnit.CardUnitClass - нет информации в картах для отладки. public List<DateTime> Get_StartEndPeriod(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_driver_activity_data.activityDailyRecords"; string currentParamName; List<DateTime> returnPeriod = new List<DateTime>(); List<string> activityRecordDate = new List<string>(); currentParamName = paramName + ".activityRecordDate"; activityRecordDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); DateTime date; if (activityRecordDate.Count > 0) { date = new DateTime(); date = new DDDClass.TimeReal(activityRecordDate[0]).getTimeRealDate(); returnPeriod.Add(date); date = new DDDClass.TimeReal(activityRecordDate[activityRecordDate.Count - 1]).getTimeRealDate(); returnPeriod.Add(date); } else { date = new DateTime(); returnPeriod.Add(date); date = new DateTime(); returnPeriod.Add(date); } return returnPeriod; }
private List<DDDClass.CardNumber> GetCardNumber(int dataBlockId, string paramName) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string currentParamName; List<DDDClass.CardNumber> cardNumberList = new List<DDDClass.CardNumber>(); DDDClass.CardNumber cardNumber = new DDDClass.CardNumber(); List<string> cardConsecutiveIndex = new List<string>(); List<string> cardRenewalIndex = new List<string>(); List<string> cardReplacementIndex = new List<string>(); List<string> driverIdentification = new List<string>(); List<string> ownerIdentification = new List<string>(); currentParamName = paramName + ".cardConsecutiveIndex"; cardConsecutiveIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardRenewalIndex"; cardRenewalIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardReplacementIndex"; cardReplacementIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".driverIdentification"; driverIdentification = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".ownerIdentification"; ownerIdentification = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (cardRenewalIndex.Count == ownerIdentification.Count && driverIdentification.Count == cardConsecutiveIndex.Count) { for (int i = 0; i < cardRenewalIndex.Count; i++) { cardNumber = new DDDClass.CardNumber(); cardNumber.cardConsecutiveIndex = new DDDClass.CardConsecutiveIndex(cardConsecutiveIndex[i]); cardNumber.cardRenewalIndex = new DDDClass.CardRenewalIndex(cardRenewalIndex[i]); cardNumber.cardReplacementIndex = new DDDClass.CardReplacementIndex(cardReplacementIndex[i]); cardNumber.driverIdentification = driverIdentification[i]; cardNumber.ownerIdentification = ownerIdentification[i]; cardNumberList.Add(cardNumber); } } return cardNumberList; }
public List<DDDClass.VuCardIWRecord> Get_VehicleActivities_VuCardIWData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleActivities.vuCardIWData.vuCardIWRecords"; string currentParamName; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; DDDClass.VuCardIWRecord vuCardIWRecord = new DDDClass.VuCardIWRecord(); List<DDDClass.VuCardIWRecord> vuCardIWData = new List<DDDClass.VuCardIWRecord>(); List<string> cardExpiryDate = new List<string>(); List<string> holderFirstNames = new List<string>(); List<string> holderSurname = new List<string>(); List<string> cardInsertionTime = new List<string>(); List<string> cardSlotNumber = new List<string>(); List<string> cardWithdrawalTime = new List<string>(); List<DDDClass.FullCardNumber> fullCardNumber = new List<DDDClass.FullCardNumber>(); List<string> manualInputFlag = new List<string>(); List<string> previousVehicleInfo_cardWithdrawalTime = new List<string>(); List<DDDClass.VehicleRegistrationIdentification> previousVehicleInfo_vehicleRegistrationIdentification = new List<DDDClass.VehicleRegistrationIdentification>(); List<string> vehicleOdometerValueAtInsertion = new List<string>(); List<string> vehicleOdometerValueAtWithdrawal = new List<string>(); currentParamName = paramName + ".cardExpiryDate"; cardExpiryDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderName.holderFirstNames.name"; holderFirstNames = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardHolderName.holderSurname.name"; holderSurname = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardInsertionTime"; cardInsertionTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardSlotNumber"; cardSlotNumber = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardWithdrawalTime"; cardWithdrawalTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".manualInputFlag"; manualInputFlag = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".previousVehicleInfo.cardWithdrawalTime"; previousVehicleInfo_cardWithdrawalTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".vehicleOdometerValueAtInsertion"; vehicleOdometerValueAtInsertion = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".vehicleOdometerValueAtWithdrawal"; vehicleOdometerValueAtWithdrawal = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); fullCardNumber = GetCardFullNumber(dataBlockId, paramName + ".fullCardNumber"); previousVehicleInfo_vehicleRegistrationIdentification = GetVehicleRegistrationIdentification(dataBlockId, paramName + ".previousVehicleInfo.vehicleRegistrationIdentification"); if (manualInputFlag.Count == cardSlotNumber.Count && cardExpiryDate.Count == fullCardNumber.Count && holderFirstNames.Count == holderSurname.Count) { for (int i = 0; i < holderFirstNames.Count; i++) { vuCardIWRecord = new DDDClass.VuCardIWRecord(); vuCardIWRecord.cardExpiryDate = new DDDClass.TimeReal(Convert.ToInt64(cardExpiryDate[i])); _bytes = enc.GetBytes(holderFirstNames[i]); vuCardIWRecord.cardHolderName.holderFirstNames.name = _bytes; _bytes = enc.GetBytes(holderSurname[i]); vuCardIWRecord.cardHolderName.holderSurname.name = _bytes; vuCardIWRecord.cardInsertionTime = new DDDClass.TimeReal(Convert.ToInt64(cardInsertionTime[i])); vuCardIWRecord.cardSlotNumber = new DDDClass.CardSlotNumber(Convert.ToByte(cardSlotNumber[i])); vuCardIWRecord.cardWithdrawalTime = new DDDClass.TimeReal(Convert.ToInt64(cardWithdrawalTime[i])); vuCardIWRecord.fullCardNumber = fullCardNumber[i]; if (manualInputFlag[i] == "true") vuCardIWRecord.manualInputFlag.manualInputFlag = true; else vuCardIWRecord.manualInputFlag.manualInputFlag = false; vuCardIWRecord.previousVehicleInfo.cardWithdrawalTime = new DDDClass.TimeReal(Convert.ToInt64(previousVehicleInfo_cardWithdrawalTime[i])); vuCardIWRecord.previousVehicleInfo.vehicleRegistrationIdentification = previousVehicleInfo_vehicleRegistrationIdentification[i]; vuCardIWRecord.vehicleOdometerValueAtInsertion.odometerShort = Convert.ToInt32(vehicleOdometerValueAtInsertion[i]); vuCardIWRecord.vehicleOdometerValueAtWithdrawal.odometerShort = Convert.ToInt32(vehicleOdometerValueAtWithdrawal[i]); vuCardIWData.Add(vuCardIWRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); return vuCardIWData; }
public List<DDDClass.VuPlaceDailyWorkPeriodRecord> Get_VehicleActivities_VuPlaceDailyWorkPeriodData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleActivities.vuPlaceDailyWorkPeriodData.vuPlaceDailyWorkPeriodRecords"; string currentParamName; List<DDDClass.VuPlaceDailyWorkPeriodRecord> vuPlaceDailyWorkPeriodData = new List<DDDClass.VuPlaceDailyWorkPeriodRecord>(); DDDClass.VuPlaceDailyWorkPeriodRecord vuPlaceDailyWorkPeriodRecord = new DDDClass.VuPlaceDailyWorkPeriodRecord(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<DDDClass.FullCardNumber> fullCardNumber = new List<DDDClass.FullCardNumber>(); List<string> dailyWorkPeriodCountry = new List<string>(); List<string> dailyWorkPeriodRegion = new List<string>(); List<string> entryTime = new List<string>(); List<string> entryTypeDailyWorkPeriod = new List<string>(); List<string> vehicleOdometerValue = new List<string>(); currentParamName = paramName + ".fullCardNumber"; fullCardNumber = GetCardFullNumber(dataBlockId, currentParamName); currentParamName = paramName + ".placeRecord.dailyWorkPeriodCountry"; dailyWorkPeriodCountry = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".placeRecord.dailyWorkPeriodRegion"; dailyWorkPeriodRegion = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".placeRecord.entryTime"; entryTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".placeRecord.entryTypeDailyWorkPeriod"; entryTypeDailyWorkPeriod = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".placeRecord.vehicleOdometerValue"; vehicleOdometerValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (dailyWorkPeriodCountry.Count == dailyWorkPeriodRegion.Count && entryTypeDailyWorkPeriod.Count == fullCardNumber.Count) { for (int i = 0; i < entryTime.Count; i++) { vuPlaceDailyWorkPeriodRecord = new DDDClass.VuPlaceDailyWorkPeriodRecord(); vuPlaceDailyWorkPeriodRecord.fullCardNumber = fullCardNumber[i]; vuPlaceDailyWorkPeriodRecord.placeRecord.dailyWorkPeriodCountry = new DDDClass.NationNumeric(Convert.ToInt16(dailyWorkPeriodCountry[i])); vuPlaceDailyWorkPeriodRecord.placeRecord.dailyWorkPeriodRegion = new DDDClass.RegionNumeric(Convert.ToByte(dailyWorkPeriodRegion[i])); vuPlaceDailyWorkPeriodRecord.placeRecord.entryTime = new DDDClass.TimeReal(Convert.ToInt64(entryTime[i])); vuPlaceDailyWorkPeriodRecord.placeRecord.entryTypeDailyWorkPeriod = new DDDClass.EntryTypeDailyWorkPeriod(Convert.ToByte(entryTypeDailyWorkPeriod[i])); vuPlaceDailyWorkPeriodRecord.placeRecord.vehicleOdometerValue.odometerShort = Convert.ToInt32(vehicleOdometerValue[i]); vuPlaceDailyWorkPeriodData.Add(vuPlaceDailyWorkPeriodRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); return vuPlaceDailyWorkPeriodData; }
public List<DDDClass.VuActivityDailyData> Get_VehicleActivities_VuActivityDailyData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleActivities.vuActivityDailyData"; string currentParamName; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; DDDClass.VuActivityDailyData activityChangeInfo = new DDDClass.VuActivityDailyData(); List<DDDClass.VuActivityDailyData> ActivityChangeInfoData = new List<DDDClass.VuActivityDailyData>(); List<string> activityChangeInfos = new List<string>(); List<string> noOfActivityChanges = new List<string>(); currentParamName = paramName + ".noOfActivityChanges"; noOfActivityChanges = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".activityChangeInfo"; activityChangeInfos = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); int allActivitiesNumbers = 0; foreach (string changeNumb in noOfActivityChanges) { allActivitiesNumbers += Convert.ToInt32(changeNumb); } if (allActivitiesNumbers != activityChangeInfos.Count) throw new Exception("Активности неправильно разобраны!"); int noOfActivityChangesInt; int number = 0; for (int i = 0; i < noOfActivityChanges.Count; i++) { noOfActivityChangesInt = Convert.ToInt32(noOfActivityChanges[i]); activityChangeInfo = new DDDClass.VuActivityDailyData(); activityChangeInfo.noOfActivityChanges = noOfActivityChangesInt; activityChangeInfo.activityChangeInfo = new List<DDDClass.ActivityChangeInfo>(); for (int j = 0; j < noOfActivityChangesInt; j++) { activityChangeInfo.activityChangeInfo.Add(new DDDClass.ActivityChangeInfo(activityChangeInfos[number])); number++; } /*Новое тестировать!!!!*/ if (activityChangeInfo.activityChangeInfo[activityChangeInfo.activityChangeInfo.Count - 1].time == 0) activityChangeInfo.activityChangeInfo.RemoveAt(activityChangeInfo.activityChangeInfo.Count - 1); activityChangeInfo.activityChangeInfo.Sort(ActivityChangeInfoDataComparison); /***********************/ ActivityChangeInfoData.Add(activityChangeInfo); } return ActivityChangeInfoData; }
private List<DDDClass.VuOverSpeedingEventRecord> Get_VehicleEventsAndFaults_VuOverSpeedingEventData(int dataBlockId, DateTime startPeriod, DateTime endPeriod) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; List<DDDClass.VuOverSpeedingEventRecord> vuOverSpeedingEvents = new List<DDDClass.VuOverSpeedingEventRecord>(); List<string> averageSpeedValue = new List<string>(); List<string> eventBeginTime = new List<string>(); List<string> eventEndTime = new List<string>(); List<string> eventRecordPurpose = new List<string>(); List<string> maxSpeedValue = new List<string>(); List<string> eventType = new List<string>(); List<DDDClass.FullCardNumber> cardNumberDriverSlotBegin = new List<DDDClass.FullCardNumber>(); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.averageSpeedValue"; averageSpeedValue = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.eventBeginTime"; eventBeginTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.eventEndTime"; eventEndTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.eventRecordPurpose"; eventRecordPurpose = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.eventType"; eventType = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.maxSpeedValue"; maxSpeedValue = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.cardNumberDriverSlotBegin"; cardNumberDriverSlotBegin = GetCardFullNumber(dataBlockId, paramName); DDDClass.VuOverSpeedingEventRecord eventRecord; if (averageSpeedValue.Count == maxSpeedValue.Count && cardNumberDriverSlotBegin.Count == eventRecordPurpose.Count) { List<DDDClass.FullCardNumber> cardNumbers = new List<DDDClass.FullCardNumber>(); cardNumbers = GetCardFullNumber(dataBlockId, "vehicleEventsAndFaults.vuOverSpeedingEventData.vuOverSpeedingEventRecords.cardNumberDriverSlotBegin"); List<int> Indexes = new List<int>(); Indexes = CheckDate(eventBeginTime, eventEndTime, startPeriod, endPeriod); foreach (int i in Indexes) { eventRecord = new DDDClass.VuOverSpeedingEventRecord(); eventRecord.averageSpeedValue.speed = Convert.ToInt16(averageSpeedValue[i]); eventRecord.eventBeginTime = new DDDClass.TimeReal(Convert.ToUInt32(eventBeginTime[i])); eventRecord.eventEndTime = new DDDClass.TimeReal(Convert.ToUInt32(eventEndTime[i])); eventRecord.eventRecordPurpose.eventFaultRecordPurpose = Convert.ToByte(eventRecordPurpose[i]); eventRecord.eventType.eventFaultType = Convert.ToByte(eventType[i]); eventRecord.maxSpeedValue.speed = Convert.ToInt16(maxSpeedValue[i]); eventRecord.cardNumberDriverSlotBegin = cardNumbers[i]; eventRecord.cardNumberDriverSlotBegin.cardIssuingMemberState = cardNumberDriverSlotBegin[i].cardIssuingMemberState; eventRecord.cardNumberDriverSlotBegin.cardNumber = cardNumberDriverSlotBegin[i].cardNumber; eventRecord.cardNumberDriverSlotBegin.cardType = cardNumberDriverSlotBegin[i].cardType; vuOverSpeedingEvents.Add(eventRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); vuOverSpeedingEvents.Sort(VuOverSpeedingEventDataComparison); return vuOverSpeedingEvents; }
public List<DDDClass.OdometerShort> Get_VehicleActivities_OdoMeterValueMidnight(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; DDDClass.OdometerShort odoMeterValueMidnight = new DDDClass.OdometerShort(); List<DDDClass.OdometerShort> odoMeterValueMidnightList = new List<DDDClass.OdometerShort>(); List<string> odoMeterValueMidnightStringList = new List<string>(); paramName = "vehicleActivities.odoMeterValueMidnight"; odoMeterValueMidnightStringList = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); for (int i = 0; i < odoMeterValueMidnightStringList.Count; i++) { odoMeterValueMidnight = new DDDClass.OdometerShort(); odoMeterValueMidnight.odometerShort = Convert.ToInt32(odoMeterValueMidnightStringList[i]); odoMeterValueMidnightList.Add(odoMeterValueMidnight); } return odoMeterValueMidnightList; }
//Vehicle_Activities public List<DDDClass.TimeReal> Get_VehicleActivities_DownloadedDayDate(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; DDDClass.TimeReal downloadedDayDate = new DDDClass.TimeReal(); List<DDDClass.TimeReal> downloadedDayDateList = new List<DDDClass.TimeReal>(); List<string> downloadedDayDateStringList = new List<string>(); paramName = "vehicleActivities.downloadedDayDate"; downloadedDayDateStringList = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); for (int i = 0; i < downloadedDayDateStringList.Count; i++) { downloadedDayDate = new DDDClass.TimeReal(Convert.ToInt64(downloadedDayDateStringList[i])); downloadedDayDateList.Add(downloadedDayDate); } return downloadedDayDateList; }
public List<DDDClass.VuCalibrationRecord> Get_VehicleTechnicalData_VuCalibrationData(int dataBlockId) { DDDClass.VuCalibrationRecord vuCalibrationRecord = new DDDClass.VuCalibrationRecord(); List<DDDClass.VuCalibrationRecord> VuCalibrationDataList = new List<DDDClass.VuCalibrationRecord>(); SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string currentParamName; string paramName = "vehicleTechnicalData.vuCalibrationData.vuCalibrationRecords"; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<string> authorisedSpeed = new List<string>(); List<string> calibrationPurpose = new List<string>(); List<string> kConstantOfRecordingEquipment = new List<string>(); List<string> lTyreCircumference = new List<string>(); List<string> newOdometerValue = new List<string>(); List<string> newTimeValue = new List<string>(); List<string> nextCalibrationDate = new List<string>(); List<string> oldOdometerValue = new List<string>(); List<string> oldTimeValue = new List<string>(); List<string> tyreSize = new List<string>(); List<string> vehicleIdentificationNumber = new List<string>(); List<DDDClass.VehicleRegistrationIdentification> vehicleRegistrationIdentification = new List<DDDClass.VehicleRegistrationIdentification>(); List<string> workshopAddress = new List<string>(); List<string> workshopCardExpiryDate = new List<string>(); List<DDDClass.FullCardNumber> workshopCardNumber = new List<DDDClass.FullCardNumber>(); List<string> workshopName = new List<string>(); List<string> wVehicleCharacteristicConstant = new List<string>(); currentParamName = paramName + ".authorisedSpeed"; authorisedSpeed = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".calibrationPurpose"; calibrationPurpose = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".kConstantOfRecordingEquipment"; kConstantOfRecordingEquipment = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".lTyreCircumference"; lTyreCircumference = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".newOdometerValue"; newOdometerValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".newTimeValue"; newTimeValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".nextCalibrationDate"; nextCalibrationDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".oldOdometerValue"; oldOdometerValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".oldTimeValue"; oldTimeValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".tyreSize"; tyreSize = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".vehicleIdentificationNumber"; vehicleIdentificationNumber = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); vehicleRegistrationIdentification = GetVehicleRegistrationIdentification(dataBlockId, paramName + ".vehicleRegistrationIdentification"); currentParamName = paramName + ".workshopAddress.address"; workshopAddress = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".workshopCardExpiryDate"; workshopCardExpiryDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); workshopCardNumber = GetCardFullNumber(dataBlockId, paramName + ".workshopCardNumber"); currentParamName = paramName + ".workshopName.name"; workshopName = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".wVehicleCharacteristicConstant"; wVehicleCharacteristicConstant = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (wVehicleCharacteristicConstant.Count == workshopAddress.Count && oldTimeValue.Count == kConstantOfRecordingEquipment.Count) { for (int i = 0; i < calibrationPurpose.Count; i++) { vuCalibrationRecord = new DDDClass.VuCalibrationRecord(); vuCalibrationRecord.authorisedSpeed.speed = Convert.ToInt16(authorisedSpeed[i]); vuCalibrationRecord.calibrationPurpose = new DDDClass.CalibrationPurpose(Convert.ToByte(calibrationPurpose[i])); vuCalibrationRecord.kConstantOfRecordingEquipment.kConstantOfRecordingEquipment = Convert.ToInt32(kConstantOfRecordingEquipment[i]); vuCalibrationRecord.lTyreCircumference.lTyreCircumference = Convert.ToInt32(lTyreCircumference[i]); vuCalibrationRecord.newOdometerValue.odometerShort = Convert.ToInt32(newOdometerValue[i]); vuCalibrationRecord.newTimeValue = new DDDClass.TimeReal(Convert.ToInt64(newTimeValue[i])); vuCalibrationRecord.nextCalibrationDate = new DDDClass.TimeReal(Convert.ToInt64(nextCalibrationDate[i])); vuCalibrationRecord.oldOdometerValue.odometerShort = Convert.ToInt32(oldOdometerValue[i]); vuCalibrationRecord.oldTimeValue = new DDDClass.TimeReal(Convert.ToInt64(oldTimeValue[i])); vuCalibrationRecord.tyreSize = new DDDClass.TyreSize(tyreSize[i]); vuCalibrationRecord.vehicleIdentificationNumber.vehicleIdentificationNumber = vehicleIdentificationNumber[i]; vuCalibrationRecord.vehicleRegistrationIdentification = vehicleRegistrationIdentification[i]; _bytes = enc.GetBytes(workshopAddress[i]); vuCalibrationRecord.workshopAddress.address = _bytes; vuCalibrationRecord.workshopCardExpiryDate = new DDDClass.TimeReal(Convert.ToInt64(workshopCardExpiryDate[i])); vuCalibrationRecord.workshopCardNumber = workshopCardNumber[i]; _bytes = enc.GetBytes(workshopName[i]); vuCalibrationRecord.workshopName.name = _bytes; vuCalibrationRecord.wVehicleCharacteristicConstant.wVehicleCharacteristicConstant = Convert.ToInt32(wVehicleCharacteristicConstant[i]); VuCalibrationDataList.Add(vuCalibrationRecord); } } return VuCalibrationDataList; }
//EF_Specific_Conditions public List<DDDClass.SpecificConditionRecord> Get_EF_Specific_Conditions(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_specific_conditions"; string currentParam; List<DDDClass.SpecificConditionRecord> specificConditionData = new List<DDDClass.SpecificConditionRecord>(); DDDClass.SpecificConditionRecord specificConditionRecord = new DDDClass.SpecificConditionRecord(); List<string> entryTime = new List<string>(); List<string> specificConditionType = new List<string>(); currentParam = paramName + ".entryTime"; entryTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); currentParam = paramName + ".specificConditionType"; specificConditionType = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParam); if (entryTime.Count == specificConditionType.Count) { for (int i = 0; i < entryTime.Count; i++) { specificConditionRecord = new DDDClass.SpecificConditionRecord(); specificConditionRecord.entryTime = new DDDClass.TimeReal(entryTime[i]); specificConditionRecord.specificConditionType = new DDDClass.SpecificConditionType(specificConditionType[i]); specificConditionData.Add(specificConditionRecord); } } else throw new Exception("Ошибка, извлечение из БД информации об особых состояниях неуспешно!"); return specificConditionData; }
public List<DDDClass.SpecificConditionRecord> Get_VehicleActivities_VuSpecificConditionData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleActivities.vuSpecificConditionData.noOfSpecificConditionRecords"; string currentParamName; List<DDDClass.SpecificConditionRecord> vuSpecificConditionData = new List<DDDClass.SpecificConditionRecord>(); DDDClass.SpecificConditionRecord vuSpecificConditionRecord = new DDDClass.SpecificConditionRecord(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<string> entryTime = new List<string>(); List<string> specificConditionType = new List<string>(); currentParamName = paramName + ".entryTime"; entryTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".specificConditionType"; specificConditionType = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (entryTime.Count == specificConditionType.Count) { for (int i = 0; i < entryTime.Count; i++) { vuSpecificConditionRecord = new DDDClass.SpecificConditionRecord(); vuSpecificConditionRecord.entryTime = new DDDClass.TimeReal(Convert.ToInt64(entryTime[i])); vuSpecificConditionRecord.specificConditionType = new DDDClass.SpecificConditionType(Convert.ToInt16(specificConditionType[i])); vuSpecificConditionData.Add(vuSpecificConditionRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); return vuSpecificConditionData; }
public List<DDDClass.CardVehicleRecord> Get_EF_Vehicles_Used(List<int> dataBlockIds, DateTime startPeriod, DateTime endPeriod) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "ef_vehicles_used"; string curentParam; int dataBlockId = dataBlockIds[0]; List<DDDClass.CardVehicleRecord> ef_cardVehicle_used = new List<DDDClass.CardVehicleRecord>(); List<string> vehicleOdometerBegin = new List<string>(); List<string> vehicleOdometerEnd = new List<string>(); List<string> vehicleFirstUse = new List<string>(); List<string> vehicleLastUse = new List<string>(); List<string> vehicleRegistrationNation = new List<string>(); List<string> vehicleRegNumber = new List<string>(); curentParam = paramName + ".vehicleOdometerBegin"; vehicleOdometerBegin = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); curentParam = paramName + ".vehicleOdometerEnd"; vehicleOdometerEnd = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); curentParam = paramName + ".vehicleFirstUse"; vehicleFirstUse = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); curentParam = paramName + ".vehicleLastUse"; vehicleLastUse = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); curentParam = paramName + ".vehicleRegistration.vehicleRegistrationNation"; vehicleRegistrationNation = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); curentParam = paramName + ".vehicleRegistration.vehicleRegistrationNumber.vehicleRegNumber"; vehicleRegNumber = sqldbRecords.Get_AllParamsArray(dataBlockId, curentParam); DDDClass.CardVehicleRecord cardVehiclesUsed; byte[] _bytes; List<int> Indexes = new List<int>(); Indexes = CheckDate(vehicleFirstUse, vehicleLastUse, startPeriod, endPeriod); if (vehicleOdometerBegin.Count == vehicleOdometerEnd.Count && vehicleLastUse.Count == vehicleRegNumber.Count) { foreach (int i in Indexes) { cardVehiclesUsed = new DDDClass.CardVehicleRecord(); cardVehiclesUsed.vehicleFirstUse = new DDDClass.TimeReal(Convert.ToUInt32(vehicleFirstUse[i])); cardVehiclesUsed.vehicleLastUse = new DDDClass.TimeReal(Convert.ToUInt32(vehicleLastUse[i])); cardVehiclesUsed.vehicleOdometerBegin = new DDDClass.OdometerShort(); cardVehiclesUsed.vehicleOdometerEnd = new DDDClass.OdometerShort(); cardVehiclesUsed.vehicleOdometerBegin.odometerShort = Convert.ToInt32(vehicleOdometerBegin[i]); cardVehiclesUsed.vehicleOdometerEnd.odometerShort = Convert.ToInt32(vehicleOdometerEnd[i]); cardVehiclesUsed.vehicleRegistration = new DDDClass.VehicleRegistrationIdentification(); cardVehiclesUsed.vehicleRegistration.vehicleRegistrationNation.nationNumeric = short.Parse(vehicleRegistrationNation[i]); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); _bytes = enc.GetBytes(vehicleRegNumber[i]); cardVehiclesUsed.vehicleRegistration.vehicleRegistrationNumber.vehicleRegNumber = _bytes; ef_cardVehicle_used.Add(cardVehiclesUsed); } } else throw new Exception("Нельзя извлечь информацию об использовании ТС"); return ef_cardVehicle_used; }
public List<DDDClass.VuDetailedSpeedBlock> Get_VehicleDetailedSpeed_VuDetailedSpeedData(int dataBlockId, DateTime startPeriod, DateTime endPeriod) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleDetailedSpeed.vuDetailedSpeedBlocks"; string currentParamName; List<DDDClass.VuDetailedSpeedBlock> vuDetailedSpeedData = new List<DDDClass.VuDetailedSpeedBlock>(); DDDClass.VuDetailedSpeedBlock vuDetailedSpeedBlock = new DDDClass.VuDetailedSpeedBlock(); List<string> speedBlockBeginDate = new List<string>(); List<string> speedsPerSecond = new List<string>(); currentParamName = paramName + ".speedBlockBeginDate"; speedBlockBeginDate = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".speedsPerSecond"; speedsPerSecond = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); int speedIndex = 0; if (speedBlockBeginDate.Count == (speedsPerSecond.Count / 60) && speedBlockBeginDate.Count!=0) { List<int> Indexes = new List<int>(); Indexes = CheckDate(speedBlockBeginDate, speedBlockBeginDate, startPeriod, endPeriod); foreach (int i in Indexes) { vuDetailedSpeedBlock = new DDDClass.VuDetailedSpeedBlock(); vuDetailedSpeedBlock.speedBlockBeginDate = new DDDClass.TimeReal(Convert.ToInt64(speedBlockBeginDate[i])); for (int j = 0; j < 60; j++) { vuDetailedSpeedBlock.speedsPerSecond[j] = new DDDClass.Speed(); vuDetailedSpeedBlock.speedsPerSecond[j].speed = Convert.ToInt16(speedsPerSecond[speedIndex]); speedIndex++; } vuDetailedSpeedData.Add(vuDetailedSpeedBlock); } } else throw new Exception("Ошибка, извлечение скорости ТС прошло с ошибками!"); return vuDetailedSpeedData; }
//------------------------------------------- private List<DDDClass.FullCardNumber> GetCardFullNumber(int dataBlockId, string paramName) { DDDClass.FullCardNumber fullCardNumber = new DDDClass.FullCardNumber(); List<DDDClass.FullCardNumber> fullCardNumberList = new List<DDDClass.FullCardNumber>(); SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string currentParamName; List<string> cardIssuingMemberState = new List<string>(); List<string> cardType = new List<string>(); List<string> cardConsecutiveIndex = new List<string>(); List<string> cardRenewalIndex = new List<string>(); List<string> cardReplacementIndex = new List<string>(); List<string> driverIdentification = new List<string>(); List<string> ownerIdentification = new List<string>(); currentParamName = paramName + ".cardIssuingMemberState"; cardIssuingMemberState = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardType"; cardType = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber.cardConsecutiveIndex"; cardConsecutiveIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber.cardRenewalIndex"; cardRenewalIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber.cardReplacementIndex"; cardReplacementIndex = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber.driverIdentification"; driverIdentification = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumber.ownerIdentification"; ownerIdentification = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (cardRenewalIndex.Count == ownerIdentification.Count && cardType.Count == cardIssuingMemberState.Count) { for (int i = 0; i < cardRenewalIndex.Count; i++) { fullCardNumber = new DDDClass.FullCardNumber(); fullCardNumber.cardIssuingMemberState = new DDDClass.NationNumeric(Convert.ToInt16(cardIssuingMemberState[i])); fullCardNumber.cardType = new DDDClass.EquipmentType(Convert.ToByte(cardType[i])); fullCardNumber.cardNumber.cardConsecutiveIndex = new DDDClass.CardConsecutiveIndex(cardConsecutiveIndex[i]); fullCardNumber.cardNumber.cardRenewalIndex = new DDDClass.CardRenewalIndex(cardRenewalIndex[i]); fullCardNumber.cardNumber.cardReplacementIndex = new DDDClass.CardReplacementIndex(cardReplacementIndex[i]); fullCardNumber.cardNumber.driverIdentification = driverIdentification[i]; fullCardNumber.cardNumber.ownerIdentification = ownerIdentification[i]; fullCardNumberList.Add(fullCardNumber); } } return fullCardNumberList; }
public List<DDDClass.VuFaultRecord> Get_VehicleEventsAndFaults_VuFaultData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleEventsAndFaults.vuFaultData.vuFaultRecords"; string currentParamName; List<DDDClass.VuFaultRecord> VuFaultData = new List<DDDClass.VuFaultRecord>(); DDDClass.VuFaultRecord vuFaultRecord = new DDDClass.VuFaultRecord(); List<DDDClass.FullCardNumber> cardNumberCodriverSlotBegin = new List<DDDClass.FullCardNumber>(); List<DDDClass.FullCardNumber> cardNumberCodriverSlotEnd = new List<DDDClass.FullCardNumber>(); List<DDDClass.FullCardNumber> cardNumberDriverSlotBegin = new List<DDDClass.FullCardNumber>(); List<DDDClass.FullCardNumber> cardNumberDriverSlotEnd = new List<DDDClass.FullCardNumber>(); List<string> faultBeginTime = new List<string>(); List<string> faultEndTime = new List<string>(); List<string> faultRecordPurpose = new List<string>(); List<string> faultType = new List<string>(); currentParamName = paramName + ".cardNumberCodriverSlotBegin"; cardNumberCodriverSlotBegin = GetCardFullNumber(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumberCodriverSlotEnd"; cardNumberCodriverSlotEnd = GetCardFullNumber(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumberDriverSlotBegin"; cardNumberDriverSlotBegin = GetCardFullNumber(dataBlockId, currentParamName); currentParamName = paramName + ".cardNumberDriverSlotEnd"; cardNumberDriverSlotEnd = GetCardFullNumber(dataBlockId, currentParamName); currentParamName = paramName + ".faultBeginTime"; faultBeginTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultEndTime"; faultEndTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultRecordPurpose"; faultRecordPurpose = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultType"; faultType = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (faultEndTime.Count == faultType.Count && cardNumberCodriverSlotBegin.Count == faultBeginTime.Count) { for (int i = 0; i < faultEndTime.Count; i++) { vuFaultRecord = new DDDClass.VuFaultRecord(); vuFaultRecord.cardNumberCodriverSlotBegin.cardIssuingMemberState = cardNumberCodriverSlotBegin[i].cardIssuingMemberState; vuFaultRecord.cardNumberCodriverSlotBegin.cardNumber = cardNumberCodriverSlotBegin[i].cardNumber; vuFaultRecord.cardNumberCodriverSlotBegin.cardType = cardNumberCodriverSlotBegin[i].cardType; vuFaultRecord.cardNumberCodriverSlotEnd.cardIssuingMemberState = cardNumberCodriverSlotEnd[i].cardIssuingMemberState; vuFaultRecord.cardNumberCodriverSlotEnd.cardNumber = cardNumberCodriverSlotEnd[i].cardNumber; vuFaultRecord.cardNumberCodriverSlotEnd.cardType = cardNumberCodriverSlotEnd[i].cardType; vuFaultRecord.cardNumberDriverSlotBegin.cardIssuingMemberState = cardNumberDriverSlotBegin[i].cardIssuingMemberState; vuFaultRecord.cardNumberDriverSlotBegin.cardNumber = cardNumberDriverSlotBegin[i].cardNumber; vuFaultRecord.cardNumberDriverSlotBegin.cardType = cardNumberDriverSlotBegin[i].cardType; vuFaultRecord.cardNumberDriverSlotEnd.cardIssuingMemberState = cardNumberDriverSlotEnd[i].cardIssuingMemberState; vuFaultRecord.cardNumberDriverSlotEnd.cardNumber = cardNumberDriverSlotEnd[i].cardNumber; vuFaultRecord.cardNumberDriverSlotEnd.cardType = cardNumberDriverSlotEnd[i].cardType; vuFaultRecord.faultBeginTime = new DDDClass.TimeReal(Convert.ToInt64(faultBeginTime[i])); vuFaultRecord.faultEndTime = new DDDClass.TimeReal(Convert.ToInt64(faultEndTime[i])); vuFaultRecord.faultRecordPurpose = new DDDClass.EventFaultRecordPurpose(Convert.ToByte(faultRecordPurpose[i])); vuFaultRecord.faultType = new DDDClass.EventFaultType(Convert.ToByte(faultType[i])); VuFaultData.Add(vuFaultRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); return VuFaultData; }
private List<DDDClass.ExtendedSerialNumber> GetExtendedSerialNumber(int dataBlockId, string paramName) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); DDDClass.ExtendedSerialNumber extendedSerialNumber = new DDDClass.ExtendedSerialNumber(); List<DDDClass.ExtendedSerialNumber> extendedSerialNumberList = new List<DDDClass.ExtendedSerialNumber>(); string currentParamName; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<string> manufacturerCode = new List<string>(); List<string> monthYear = new List<string>(); List<string> serialNumber = new List<string>(); List<string> type = new List<string>(); currentParamName = paramName + ".manufacturerCode"; manufacturerCode = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".monthYear"; monthYear = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".serialNumber"; serialNumber = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".type"; type = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); if (manufacturerCode.Count == monthYear.Count && type.Count == serialNumber.Count) { for (int i = 0; i < manufacturerCode.Count; i++) { extendedSerialNumber = new DDDClass.ExtendedSerialNumber(); extendedSerialNumber.manufacturerCode = new DDDClass.ManufacturerCode(Convert.ToInt16(manufacturerCode[i])); extendedSerialNumber.monthYear = monthYear[i]; extendedSerialNumber.serialNumber = Convert.ToUInt32(serialNumber[i]); extendedSerialNumber.type = Convert.ToByte(type[i]); extendedSerialNumberList.Add(extendedSerialNumber); } } return extendedSerialNumberList; }
public List<DDDClass.VuTimeAdjustmentRecord> Get_VehicleEventsAndFaults_VuTimeAdjustmentData(int dataBlockId) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName = "vehicleEventsAndFaults.vuTimeAdjustmentData.vuTimeAdjustmentRecords"; string currentParamName; List<DDDClass.VuTimeAdjustmentRecord> vuTimeAdjustmentData = new List<DDDClass.VuTimeAdjustmentRecord>(); DDDClass.VuTimeAdjustmentRecord vuTimeAdjustmentRecord = new DDDClass.VuTimeAdjustmentRecord(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); byte[] _bytes; List<string> newTimeValue = new List<string>(); List<string> oldTimeValue = new List<string>(); List<string> workshopAddress = new List<string>(); List<DDDClass.FullCardNumber> workshopCardNumber = new List<DDDClass.FullCardNumber>(); List<string> workshopName = new List<string>(); currentParamName = paramName + ".newTimeValue"; newTimeValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".oldTimeValue"; oldTimeValue = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".workshopAddress.address"; workshopAddress = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".workshopName.name"; workshopName = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".workshopCardNumber"; workshopCardNumber = GetCardFullNumber(dataBlockId, currentParamName); if (newTimeValue.Count == oldTimeValue.Count && workshopName.Count == workshopCardNumber.Count) { for (int i = 0; i < newTimeValue.Count; i++) { vuTimeAdjustmentRecord = new DDDClass.VuTimeAdjustmentRecord(); vuTimeAdjustmentRecord.workshopCardNumber.cardIssuingMemberState = workshopCardNumber[i].cardIssuingMemberState; vuTimeAdjustmentRecord.workshopCardNumber.cardNumber = workshopCardNumber[i].cardNumber; vuTimeAdjustmentRecord.workshopCardNumber.cardType = workshopCardNumber[i].cardType; vuTimeAdjustmentRecord.newTimeValue = new DDDClass.TimeReal(Convert.ToInt64(newTimeValue[i])); vuTimeAdjustmentRecord.oldTimeValue = new DDDClass.TimeReal(Convert.ToInt64(oldTimeValue[i])); _bytes = enc.GetBytes(workshopAddress[i]); vuTimeAdjustmentRecord.workshopAddress.address = _bytes; _bytes = enc.GetBytes(workshopName[i]); vuTimeAdjustmentRecord.workshopName.name = _bytes; vuTimeAdjustmentData.Add(vuTimeAdjustmentRecord); } } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); return vuTimeAdjustmentData; }
//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; }
public List<DDDClass.VuCompanyLocksRecord> Get_VehicleOverview_VuCompanyLocksData(int dataBlockId, DateTime startPeriod, DateTime endPeriod) { //Тут еще надо дополнить инфо о карточке Компании!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); string paramName; byte[] _bytes; System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); List<DDDClass.VuCompanyLocksRecord> vehicleOverview_VuCompanyLocksRecord = new List<DDDClass.VuCompanyLocksRecord>(); DDDClass.VuCompanyLocksRecord vuCompanyLocksRecord = new DDDClass.VuCompanyLocksRecord(); List<string> lockInTime = new List<string>(); List<string> lockOutTime = new List<string>(); List<string> companyName = new List<string>(); List<string> companyAddress = new List<string>(); paramName = "vehicleOverview.vuCompanyLocksData.vuCompanyLocksRecords.lockInTime"; lockInTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuCompanyLocksData.vuCompanyLocksRecords.lockOutTime"; lockOutTime = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuCompanyLocksData.vuCompanyLocksRecords.companyName.name"; companyName = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); paramName = "vehicleOverview.vuCompanyLocksData.vuCompanyLocksRecords.companyAddress.address"; companyAddress = sqldbRecords.Get_AllParamsArray(dataBlockId, paramName); if (lockInTime.Count == lockOutTime.Count && companyName.Count == companyAddress.Count) { List<DDDClass.FullCardNumber> cardNumbers = new List<DDDClass.FullCardNumber>(); cardNumbers = GetCardFullNumber(dataBlockId, "vehicleOverview.vuCompanyLocksData.vuCompanyLocksRecords.companyCardNumber"); List<int> Indexes = new List<int>(); Indexes = CheckDate(lockInTime, lockOutTime, startPeriod, endPeriod); foreach (int i in Indexes) { vuCompanyLocksRecord = new DDDClass.VuCompanyLocksRecord(); vuCompanyLocksRecord.lockInTime = new DDDClass.TimeReal(Convert.ToUInt32(lockInTime[i])); vuCompanyLocksRecord.lockOutTime = new DDDClass.TimeReal(Convert.ToUInt32(lockOutTime[i])); _bytes = enc.GetBytes(companyName[i]); vuCompanyLocksRecord.companyName.name = _bytes; _bytes = enc.GetBytes(companyAddress[i]); vuCompanyLocksRecord.companyAddress.address = _bytes; vuCompanyLocksRecord.companyCardNumber = cardNumbers[i]; vehicleOverview_VuCompanyLocksRecord.Add(vuCompanyLocksRecord); } } return vehicleOverview_VuCompanyLocksRecord; }
public List<DDDClass.CardFaultRecord> Get_EF_Faults_Data(int dataBlockId, DateTime startPeriod, DateTime endPeriod) { SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION()); List<DDDClass.CardFaultRecord> cardFaultData = new List<DDDClass.CardFaultRecord>(); DDDClass.CardFaultRecord cardFaultRecord = new DDDClass.CardFaultRecord(); string paramName = "ef_faults_data"; string currentParamName; List<string> faultBeginTime = new List<string>(); List<string> faultEndTime = new List<string>(); List<string> faultType = new List<string>(); List<DDDClass.VehicleRegistrationIdentification> faultVehicleRegistration = new List<DDDClass.VehicleRegistrationIdentification>(); currentParamName = paramName + ".faultBeginTime"; faultBeginTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultEndTime"; faultEndTime = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultType"; faultType = sqldbRecords.Get_AllParamsArray(dataBlockId, currentParamName); currentParamName = paramName + ".faultVehicleRegistration"; faultVehicleRegistration = GetVehicleRegistrationIdentification(dataBlockId, currentParamName); List<int> existingEventsIndexes = new List<int>(); if (faultBeginTime.Count == faultEndTime.Count && faultType.Count == faultVehicleRegistration.Count) { for (int i = 0; i < faultBeginTime.Count; i++) if (faultBeginTime[i] != "0" || faultEndTime[i] != "0") existingEventsIndexes.Add(i); } else throw new Exception("Ошибка, не могу извлечь информацию из базы"); List<int> Indexes = new List<int>(); Indexes = CheckDate(faultBeginTime, faultEndTime, startPeriod, endPeriod); foreach (int i in existingEventsIndexes) { if (Indexes.Contains(i)) { cardFaultRecord = new DDDClass.CardFaultRecord(); cardFaultRecord.faultBeginTime = new DDDClass.TimeReal(faultBeginTime[i]); cardFaultRecord.faultEndTime = new DDDClass.TimeReal(faultEndTime[i]); cardFaultRecord.faultType = new DDDClass.EventFaultType(Convert.ToByte(faultType[i])); cardFaultRecord.faultVehicleRegistration = new DDDClass.VehicleRegistrationIdentification(); cardFaultRecord.faultVehicleRegistration.vehicleRegistrationNation = faultVehicleRegistration[i].vehicleRegistrationNation; cardFaultRecord.faultVehicleRegistration.vehicleRegistrationNumber = faultVehicleRegistration[i].vehicleRegistrationNumber; cardFaultData.Add(cardFaultRecord); } } return cardFaultData; }
private List<PLFRecord> Get_Records(int dataBlockId, DateTime startPeriod, DateTime endPeriod, PLFRecord sensorsInstalled, Hashtable allParamIds, SQLDB_Records sqldbRecords) { List<PLFRecord> records = new List<PLFRecord>(); PLFRecord plfRecord = new PLFRecord(); string paramName = "Records"; string currentParamName; #region "Variables" List<string> ADDITIONAL_SENSORS = new List<string>(); List<string> ALTITUDE = new List<string>(); List<string> DISTANCE_COUNTER = new List<string>(); List<string> ENGINE_RPM = new List<string>(); List<string> FUEL_CONSUMPTION = new List<string>(); List<string> FUEL_COUNTER = new List<string>(); List<string> FUEL_VOLUME1 = new List<string>(); List<string> FUEL_VOLUME2 = new List<string>(); List<string> LATITUDE = new List<string>(); List<string> LONGITUDE = new List<string>(); List<string> MAIN_STATES = new List<string>(); List<string> RESERVED_3 = new List<string>(); List<string> RESERVED_4 = new List<string>(); List<string> RESERVED_5 = new List<string>(); List<string> SPEED = new List<string>(); List<string> SYSTEM_TIME = new List<string>(); List<string> TEMPERATURE1 = new List<string>(); List<string> TEMPERATURE2 = new List<string>(); List<string> VOLTAGE = new List<string>(); List<string> WEIGHT1 = new List<string>(); List<string> WEIGHT2 = new List<string>(); List<string> WEIGHT3 = new List<string>(); List<string> WEIGHT4 = new List<string>(); List<string> WEIGHT5 = new List<string>(); #endregion #region "Load From DataBase" if (sensorsInstalled.ADDITIONAL_SENSORS == sensorsInstalled.YesString) { currentParamName = paramName + ".ADDITIONAL_SENSORS"; ADDITIONAL_SENSORS = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["ADDITIONAL_SENSORS"]); GetedPlfRecords += ADDITIONAL_SENSORS.Count; } if (sensorsInstalled.ALTITUDE == sensorsInstalled.YesString) { currentParamName = paramName + ".ALTITUDE"; ALTITUDE = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["ALTITUDE"]); GetedPlfRecords += ALTITUDE.Count; } if (sensorsInstalled.DISTANCE_COUNTER == sensorsInstalled.YesString) { currentParamName = paramName + ".DISTANCE_COUNTER"; DISTANCE_COUNTER = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["DISTANCE_COUNTER"]); GetedPlfRecords += DISTANCE_COUNTER.Count; } if (sensorsInstalled.ENGINE_RPM == sensorsInstalled.YesString) { currentParamName = paramName + ".ENGINE_RPM"; ENGINE_RPM = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["ENGINE_RPM"]); GetedPlfRecords += ENGINE_RPM.Count; } if (sensorsInstalled.FUEL_CONSUMPTION == sensorsInstalled.YesString) { currentParamName = paramName + ".FUEL_CONSUMPTION"; FUEL_CONSUMPTION = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["FUEL_CONSUMPTION"]); GetedPlfRecords += FUEL_CONSUMPTION.Count; } if (sensorsInstalled.FUEL_COUNTER == sensorsInstalled.YesString) { currentParamName = paramName + ".FUEL_COUNTER"; FUEL_COUNTER = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["FUEL_COUNTER"]); GetedPlfRecords += FUEL_COUNTER.Count; } if (sensorsInstalled.FUEL_VOLUME1 == sensorsInstalled.YesString) { currentParamName = paramName + ".FUEL_VOLUME1"; FUEL_VOLUME1 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["FUEL_VOLUME1"]); GetedPlfRecords += FUEL_VOLUME1.Count; } if (sensorsInstalled.FUEL_VOLUME2 == sensorsInstalled.YesString) { currentParamName = paramName + ".FUEL_VOLUME2"; FUEL_VOLUME2 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["FUEL_VOLUME2"]); GetedPlfRecords += FUEL_VOLUME2.Count; } if (sensorsInstalled.LATITUDE == sensorsInstalled.YesString) { currentParamName = paramName + ".LATITUDE"; LATITUDE = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["LATITUDE"]); GetedPlfRecords += LATITUDE.Count; } if (sensorsInstalled.LONGITUDE == sensorsInstalled.YesString) { currentParamName = paramName + ".LONGITUDE"; LONGITUDE = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["LONGITUDE"]); GetedPlfRecords += LONGITUDE.Count; } if (sensorsInstalled.MAIN_STATES == sensorsInstalled.YesString) { currentParamName = paramName + ".MAIN_STATES"; MAIN_STATES = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["MAIN_STATES"]); GetedPlfRecords += MAIN_STATES.Count; } if (sensorsInstalled.RESERVED_3 == sensorsInstalled.YesString) { currentParamName = paramName + ".RESERVED_3"; RESERVED_3 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["RESERVED_3"]); GetedPlfRecords += RESERVED_3.Count; } if (sensorsInstalled.RESERVED_4 == sensorsInstalled.YesString) { currentParamName = paramName + ".RESERVED_4"; RESERVED_4 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["RESERVED_4"]); GetedPlfRecords += RESERVED_4.Count; } if (sensorsInstalled.RESERVED_5 == sensorsInstalled.YesString) { currentParamName = paramName + ".RESERVED_5"; RESERVED_5 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["RESERVED_5"]); GetedPlfRecords += RESERVED_5.Count; } if (sensorsInstalled.SPEED == sensorsInstalled.YesString) { currentParamName = paramName + ".SPEED"; SPEED = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["SPEED"]); GetedPlfRecords += SPEED.Count; } if (sensorsInstalled.SYSTEM_TIME.systemTime == sensorsInstalled.YesString) { currentParamName = paramName + ".SYSTEM_TIME"; SYSTEM_TIME = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["SYSTEM_TIME"]); GetedPlfRecords += SYSTEM_TIME.Count; } if (sensorsInstalled.TEMPERATURE1 == sensorsInstalled.YesString) { currentParamName = paramName + ".TEMPERATURE1"; TEMPERATURE1 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["TEMPERATURE1"]); GetedPlfRecords += TEMPERATURE1.Count; } if (sensorsInstalled.TEMPERATURE2 == sensorsInstalled.YesString) { currentParamName = paramName + ".TEMPERATURE2"; TEMPERATURE2 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["TEMPERATURE2"]); GetedPlfRecords += TEMPERATURE2.Count; } if (sensorsInstalled.VOLTAGE == sensorsInstalled.YesString) { currentParamName = paramName + ".VOLTAGE"; VOLTAGE = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["VOLTAGE"]); GetedPlfRecords += VOLTAGE.Count; } if (sensorsInstalled.WEIGHT1 == sensorsInstalled.YesString) { currentParamName = paramName + ".WEIGHT1"; WEIGHT1 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["WEIGHT1"]); GetedPlfRecords += WEIGHT1.Count; } if (sensorsInstalled.WEIGHT2 == sensorsInstalled.YesString) { currentParamName = paramName + ".WEIGHT2"; WEIGHT2 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["WEIGHT2"]); GetedPlfRecords += WEIGHT2.Count; } if (sensorsInstalled.WEIGHT3 == sensorsInstalled.YesString) { currentParamName = paramName + ".WEIGHT3"; WEIGHT3 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["WEIGHT3"]); GetedPlfRecords += WEIGHT3.Count; } if (sensorsInstalled.WEIGHT4 == sensorsInstalled.YesString) { currentParamName = paramName + ".WEIGHT4"; WEIGHT4 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["WEIGHT4"]); GetedPlfRecords += WEIGHT4.Count; } if (sensorsInstalled.WEIGHT5 == sensorsInstalled.YesString) { currentParamName = paramName + ".WEIGHT5"; WEIGHT5 = sqldbRecords.Get_AllParamsArray(dataBlockId, (int)allParamIds["WEIGHT5"]); GetedPlfRecords += WEIGHT5.Count; } #endregion if (SYSTEM_TIME.Count == 0) { return records; throw new Exception("Файл содержит ошибки либо неправильно разобран"); } List<int> Indexes = new List<int>(); Indexes = CheckDate(SYSTEM_TIME, SYSTEM_TIME, startPeriod, endPeriod); foreach(int i in Indexes) { plfRecord = new PLFRecord(); #region "List Initialization" if (ADDITIONAL_SENSORS.Count != 0) plfRecord.ADDITIONAL_SENSORS = ADDITIONAL_SENSORS[i]; if (ALTITUDE.Count != 0) plfRecord.ALTITUDE = ALTITUDE[i]; if (DISTANCE_COUNTER.Count != 0) plfRecord.DISTANCE_COUNTER = DISTANCE_COUNTER[i]; if (ENGINE_RPM.Count != 0) plfRecord.ENGINE_RPM = ENGINE_RPM[i]; if (FUEL_CONSUMPTION.Count != 0) plfRecord.FUEL_CONSUMPTION = FUEL_CONSUMPTION[i]; if (FUEL_COUNTER.Count != 0) plfRecord.FUEL_COUNTER = FUEL_COUNTER[i]; if (FUEL_VOLUME1.Count != 0) plfRecord.FUEL_VOLUME1 = FUEL_VOLUME1[i]; if (FUEL_VOLUME2.Count != 0) plfRecord.FUEL_VOLUME2 = FUEL_VOLUME2[i]; if (LATITUDE.Count != 0) plfRecord.LATITUDE = LATITUDE[i]; if (LONGITUDE.Count != 0) plfRecord.LONGITUDE = LONGITUDE[i]; if (MAIN_STATES.Count != 0) plfRecord.MAIN_STATES = MAIN_STATES[i]; if (RESERVED_3.Count != 0) plfRecord.RESERVED_3 = RESERVED_3[i]; if (RESERVED_4.Count != 0) plfRecord.RESERVED_4 = RESERVED_4[i]; if (RESERVED_5.Count != 0) plfRecord.RESERVED_5 = RESERVED_5[i]; if (SPEED.Count != 0) plfRecord.SPEED = SPEED[i]; if (SYSTEM_TIME.Count != 0) plfRecord.SYSTEM_TIME = new PLFSystemTime(SYSTEM_TIME[i]); if (TEMPERATURE1.Count != 0) plfRecord.TEMPERATURE1 = TEMPERATURE1[i]; if (TEMPERATURE2.Count != 0) plfRecord.TEMPERATURE2 = TEMPERATURE2[i]; if (VOLTAGE.Count != 0) plfRecord.VOLTAGE = VOLTAGE[i]; if (WEIGHT1.Count != 0) plfRecord.WEIGHT1 = WEIGHT1[i]; if (WEIGHT2.Count != 0) plfRecord.WEIGHT2 = WEIGHT2[i]; if (WEIGHT3.Count != 0) plfRecord.WEIGHT3 = WEIGHT3[i]; if (WEIGHT4.Count != 0) plfRecord.WEIGHT4 = WEIGHT4[i]; if (WEIGHT5.Count != 0) plfRecord.WEIGHT5 = WEIGHT5[i]; #endregion records.Add(plfRecord); } return records; }