Esempio n. 1
0
        public static void QueryTransferStatistic()
        {
            Models.Maintain db   = new Models.Maintain();
            DateTime        now  = DateTime.Now;
            DateTime        from = new DateTime(
                year: now.Year,
                month: now.Month,
                day: now.Day,
                hour: 9,
                minute: 0,
                second: 0
                );
            DateTime to = new DateTime(
                year: now.Year,
                month: now.Month,
                day: now.Day,
                hour: now.Hour,
                minute: 0,
                second: 0
                );
            List <Models.DK_E_INFO> dic = DAL.TransferDataService.ListErrorData(db, from, to);

            Models.TransferStatisticRecord records = new Models.TransferStatisticRecord(dic);
            foreach (KeyValuePair <DateTime, bool> data in records.datas)
            {
                Console.WriteLine(data.Key.ToString() + "\t" + (data.Value ? "Yes" : "No"));
            }
        }
Esempio n. 2
0
        //GET: transfer/statistic
        /// <summary>
        /// 获取数据转储统计信息,这里时间为年月日,直接在表中取当天9时-第二天8时之间的所有数据。只能查询一天的数据。
        /// @param date:YYYY-MM-DD
        /// </summary>
        /// <returns></returns>
        public ActionResult statistic()
        {
            DateTime from;
            int      id = 0;

            try
            {
                from = DateTime.Parse(Request.Params.Get("date"));
                id   = int.Parse(Request.Params.Get("isubcenter"));
            }
            catch (Exception e)
            {
                return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet));
            }
            Models.QueryResult     result   = new Models.QueryResult();
            Models.Maintain        db       = new Models.Maintain();
            List <Models.Station>  stations = DAL.StationService.ListStationBySubcenterId(id);
            List <Models.M_status> datas    = DAL.TransferDataService.ListMonitorData(db, from, 1); //仅查一天的数据

            foreach (Models.Station station in stations)
            {
                Models.M_status data = datas.FirstOrDefault(i => i.STCD == station.stationId);
                Models.TransferStatisticRecord record = new Models.TransferStatisticRecord(station, data);
                result.records.Add(record);
            }
            JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

            jsSerializer.MaxJsonLength = Int32.MaxValue;
            string json = jsSerializer.Serialize(result);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }