Exemple #1
0
        /////Statistics//////////////////////
        /// <summary>
        /// Получает проценты информации в карточке относительно дней в году
        /// </summary>
        /// <param name="date">Дата(год)</param>
        /// <param name="datablockId">ID файла, для которого нужно подсчитать</param>
        /// <returns>double - проценты</returns>
        public double Statistics_GetYearStatistics(DateTime date, int datablockId)//Проверить функции
        {
            SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION());

            double stat         = 0;
            int    minutesInDay = 1440;
            int    dayInYear    = GetDaysInAYear(date.Year);

            PLFUnitClass plfUnitClassTemp   = new PLFUnitClass();
            PLFRecord    sensorsInstalled   = new PLFRecord();
            Hashtable    allSensorsParamIds = new Hashtable();

            sensorsInstalled.SYSTEM_TIME.systemTime = "Y";
            allSensorsParamIds = Get_AllParamsSensorsId(sensorsInstalled);
            //plfUnitClassTemp.Records = Get_Records(datablockId, sensorsInstalled, allSensorsParamIds);

            int dayInMonth = DateTime.DaysInMonth(date.Year, 12);

            plfUnitClassTemp.Records = Get_Records(datablockId, new DateTime(date.Year, 1, 1), new DateTime(date.Year, 12, dayInMonth), sensorsInstalled, allSensorsParamIds, sqldbRecords);

            plfUnitClassTemp.TIME_STEP = Get_TIME_STEP(datablockId);
            if (plfUnitClassTemp.TIME_STEP == " ")
            {
                return(0);
            }
            double temp = plfUnitClassTemp.Get_AllWorkingTime().TotalMinutes;

            stat = (plfUnitClassTemp.Get_AllWorkingTime().TotalMinutes / (minutesInDay * dayInYear)) * 100;
            return(stat);
        }
Exemple #2
0
        /// <summary>
        /// Получает проценты информации в карточке относительно минут в дне
        /// </summary>
        /// <param name="date">дата(год, месяц, день)</param>
        /// <param name="datablockId">ID файла, для которого нужно подсчитать</param>
        /// <returns>double - проценты</returns>
        public double Statistics_GetDayStatistics(DateTime date, int datablockId)//Проверить функции activities.GetTotalTime() - писалась давно, может не точно подсчитывать!
        {
            SQLDB_Records sqldbRecords = new SQLDB_Records(connectionString, sqlDB.GETMYSQLCONNECTION());
            double        stat         = 0;
            int           minutesInDay = 1440;

            PLFUnitClass plfUnitClassTemp   = new PLFUnitClass();
            PLFRecord    sensorsInstalled   = new PLFRecord();
            Hashtable    allSensorsParamIds = new Hashtable();

            sensorsInstalled.SYSTEM_TIME.systemTime = "Y";
            allSensorsParamIds         = Get_AllParamsSensorsId(sensorsInstalled);
            plfUnitClassTemp.Records   = Get_Records(datablockId, date.Date, date, sensorsInstalled, allSensorsParamIds, sqldbRecords);
            plfUnitClassTemp.TIME_STEP = Get_TIME_STEP(datablockId);
            if (plfUnitClassTemp.TIME_STEP == " ")
            {
                return(0);
            }
            stat = (plfUnitClassTemp.Get_AllWorkingTime().TotalMinutes / minutesInDay) * 100;
            return(stat);
        }