private int Get_EF_Driver_Events_Data_Comparison(DDDClass.CardEventRecord x, DDDClass.CardEventRecord y) { if (x == null) { if (y == null) { return 0; } else { return -1; } } else { if (y == null) { return 1; } else { int retval = x.eventBeginTime.timereal.CompareTo(y.eventBeginTime.timereal); return retval; } } }
private List<DDDClass.CardDriverActivity> Get_EF_Driver_Activity_Data_byWeeks_weeksCalculation(DDDClass.CardDriverActivity driverActivity) { DDDClass.CardActivityDailyRecord oneActivity = new DDDClass.CardActivityDailyRecord(); List<DDDClass.CardActivityDailyRecord> activities = new List<DDDClass.CardActivityDailyRecord>(); DDDClass.CardDriverActivity weekActivityList = new DDDClass.CardDriverActivity(); List<DDDClass.CardDriverActivity> weeksList = new List<DDDClass.CardDriverActivity>(); if (driverActivity.activityDailyRecords.Count <= 0) return weeksList; //система такая. Если предудыщий день больше настроящего, то новая неделя /* DayOfWeek currentDay = new DayOfWeek(); DayOfWeek previosDayOfWeek = new DayOfWeek(); previosDayOfWeek = driverActivity.activityDailyRecords[0].activityRecordDate.getTimeRealDate().DayOfWeek; //currentDay = driverActivity.activityDailyRecords[0].activityRecordDate.getTimeRealDate().DayOfWeek; weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[0]); driverActivity.activityDailyRecords.RemoveAt(0); bool nextweek = false; foreach (DDDClass.CardActivityDailyRecord record in driverActivity.activityDailyRecords) { currentDay = record.activityRecordDate.getTimeRealDate().DayOfWeek; if (previosDayOfWeek >= currentDay) { nextweek = true; } previosDayOfWeek = currentDay; if (nextweek == true) { weeksList.Add(weekActivityList); weekActivityList = new DDDClass.CardDriverActivity(); nextweek = false; } weekActivityList.activityDailyRecords.Add(record); } */ /////////////////////test///] for (int i = 0; i < driverActivity.activityDailyRecords.Count;) { weekActivityList = new DDDClass.CardDriverActivity(); try { if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Monday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Tuesday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Wednesday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Thursday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Friday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Saturday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } if (driverActivity.activityDailyRecords[i].activityRecordDate.getTimeRealDate().DayOfWeek == DayOfWeek.Sunday) { weekActivityList.activityDailyRecords.Add(driverActivity.activityDailyRecords[i]); i++; } } catch { } weeksList.Add(weekActivityList); } /////////////////////////// return weeksList; }
//comparison Functions! private int Get_EF_Driver_Activity_Data_Comparison(DDDClass.ActivityChangeInfo x, DDDClass.ActivityChangeInfo y) { if (x == null) { if (y == null) { return 0; } else { return -1; } } else { if (y == null) { return 1; } else { int retval = x.time.CompareTo(y.time); return retval; } } }
//----------------list comparison functions private int VuOverSpeedingEventDataComparison(DDDClass.VuOverSpeedingEventRecord x, DDDClass.VuOverSpeedingEventRecord y) { if (x == null) { if (y == null) { return 0; } else { return -1; } } else { if (y == null) { return 1; } else { int retval = x.eventBeginTime.timereal.CompareTo(y.eventBeginTime.timereal); return retval; } } }