/// <summary>
        /// </summary>
        /// <param name="day"></param>
        /// <param name="failureTypes">
        /// 0 for unexpected shutdown,
        /// 1 for short non-responding,
        /// 2 for hardware failures,
        /// 3 for connection problems
        /// </param>
        /// <param name="deviceId"></param>
        /// <param name="times"></param>
        /// <param name="devices"></param>
        /// <returns></returns>
        ///

        public static List <string> FindDevicesFailedBeforeDate(FailureTypes failure, Device device, DateTime date)
        {
            var problematicDevices = new HashSet <int>();

            //var failureType = new IEnumerable<int>(device.Id.AsEnumerable);

            for (int i = 0; i < failure.Types.Length; i++)
            {
                if (FailureTypes.IsFailureSerious(failure.Types[i]) == 1 &&
                    DateTime.Earlier(date.Times[i], date.Day, date.Month, date.Year) == 1)
                {
                    problematicDevices.Add(device.Id[i]);
                }
            }

            var result = new List <string>();

            foreach (var oneDevice in device.Id)
            {
                if (problematicDevices.Contains(oneDevice))
                {
                    result.Add(device.Name[oneDevice] as string);
                }
            }

            return(result);
        }
        public static List <string> FindDevicesFailedBeforeDateObsolete(
            int day,
            int month,
            int year,
            int[] failureTypes,
            int[] deviceId,
            object[][] times,
            List <Dictionary <string, object> > devices)
        {
            var failure = new FailureTypes(failureTypes);
            var device  = new Device(deviceId);
            var date    = new DateTime(day, month, year, times);

            foreach (var oneDevice in devices)
            {
                device.Name.Add(oneDevice["Name"]);
            }

            var result = FindDevicesFailedBeforeDate(failure, device, date);

            return(result);
        }
示例#3
0
 public Failure(FailureTypes failure, int DeveciID, DateTime date)
 {
     FailureType = failure;
     DeviceId    = DeveciID;
     Date        = date;
 }
示例#4
0
 public Failure(FailureTypes failure, int device, DateTime date)
 {
     this.failure = (FailureTypes)failure;
     this.device  = device;
     this.date    = date;
 }