Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lockname"></param>
        /// <param name="starttime"></param>
        /// <param name="endtime"></param>
        /// <param name="username"></param>
        /// <returns></returns>
        public string TotalDataAnalysis(string lockname, string starttime, string endtime)
        {
            string        msg = string.Empty;
            RecordGolable obj = DataAnalysis.GetInstance().totalAnalysis(out msg, EventClass.GetInstance()._gloabledataTable, lockname, starttime, endtime);

            if (msg != "Success")
            {
                return(msg);
            }
            else
            {
                string json = JsonConvert.SerializeObject(obj._analysisData);
                return(json);
            }
        }
Exemple #2
0
        /// <summary>
        /// 数据分析接口
        /// </summary>
        /// <param name="lockname"></param>
        /// <param name="starttime"></param>
        /// <param name="endtime"></param>
        /// <param name="username"></param>
        /// <returns></returns>
        public string StatisticalAnalysis(string lockname, string starttime, string endtime, string username)
        {
            string        msg = string.Empty;
            RecordGolable obj = DataAnalysis.GetInstance().StatisticalAnalysis(out msg, EventClass.GetInstance()._gloabledataTable, lockname, starttime, endtime, username);

            if (msg != "Success")
            {
                return(msg);
            }
            else
            {
                string json = JsonConvert.SerializeObject(obj._monthlydisplaysList);
                return(json);
            }
        }
Exemple #3
0
        /// <summary>
        /// 报警对象数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="counts"></param>
        /// <returns></returns>
        public string GetWarningObject(string page, string counts)
        {
            RecordGolable goableData             = new RecordGolable();
            List <WarningRecordDetails> tempList = new List <WarningRecordDetails>();

            goableData = RedvelopRecord.GetInstance().ReadDataToMemory("warning");
            int iPage   = Int32.Parse(page);
            int iCounts = Int32.Parse(counts);

            try
            {
                int totalcounts = goableData._warningRecordList.Count;
                int totalpages  = 0;

                if (totalcounts % Int32.Parse(counts) > 0)
                {
                    totalpages = totalcounts / Int32.Parse(counts) + 1;
                }
                else
                {
                    totalpages = totalcounts / Int32.Parse(counts);
                }
                if (Int32.Parse(page) > totalpages)
                {
                    //MessageBox.Show("当前输入页数大于总页数", "系统提示");
                    return("[]");
                }

                for (int i = 0; i < iCounts; i++)
                {
                    if (((iPage - 1) * iCounts + i) == totalcounts)
                    {
                        break;
                    }
                    if (goableData._warningRecordList[(iPage - 1) * iCounts + i]._warningdatetime != "")
                    {
                        tempList.Add(goableData._warningRecordList[(iPage - 1) * iCounts + i]);
                    }
                    else
                    {
                        break;
                    }
                    RecordLog.GetInstance().WriteLog(Level.Info, string.Format("报警分页返回数据完成,page:[{0}],count:[{1}]", iPage, (iPage - 1) * iCounts + i + 1));
                }

                object obj = new
                {
                    totalcounts = totalcounts,
                    pagedata    = tempList
                };

                string json = JsonConvert.SerializeObject(obj);
                //string json = JsonConvert.SerializeObject(goableData._recordlogsdatadetailsList);
                return(json);
            }
            catch (Exception ex)
            {
                RecordLog.GetInstance().WriteLog(Level.Info, "分页时异常:" + ex.Message);
                return("");
            }
        }
Exemple #4
0
        /// <summary>
        /// 导入数据分页展示
        /// </summary>
        /// <param name="page"></param>
        /// <param name="counts"></param>
        /// <returns></returns>
        public string GetRecordImportEcxel(string page, string counts)
        {
            RecordGolable goableData = new RecordGolable();
            List <RecordLogsDataDetails> tempList = new List <RecordLogsDataDetails>();

            Task ta = Task.Factory.StartNew(delegate { goableData._recordlogsdatadetailsList = RedvelopRecord.GetInstance().ReadDataTableToMemory(EventClass.GetInstance().tb); });

            Task.WaitAny(ta);
            int iPage   = Int32.Parse(page);
            int iCounts = Int32.Parse(counts);

            try
            {
                int totalcounts = goableData._recordlogsdatadetailsList.Count;
                int totalpages  = 0;

                if (totalcounts % Int32.Parse(counts) > 0)
                {
                    totalpages = totalcounts / Int32.Parse(counts) + 1;
                }
                else
                {
                    totalpages = totalcounts / Int32.Parse(counts);
                }
                if (Int32.Parse(page) > totalpages)
                {
                    //MessageBox.Show("当前输入页数大于总页数", "系统提示");
                    return("[]");
                }

                for (int i = 0; i < iCounts; i++)
                {
                    if (((iPage - 1) * iCounts + i) == totalcounts)
                    {
                        break;
                    }
                    if (goableData._recordlogsdatadetailsList[(iPage - 1) * iCounts + i].openlocktime != "")
                    {
                        tempList.Add(goableData._recordlogsdatadetailsList[(iPage - 1) * iCounts + i]);
                    }
                    else
                    {
                        break;
                    }
                    //RecordLog.GetInstance().WriteLog(Level.Info, string.Format("查询分页返回数据完成,page:[{0}],count:[{1}]", iPage, (iPage - 1) * iCounts + i + 1));
                }

                object obj = new
                {
                    totalcounts = totalcounts,
                    pagedata    = tempList
                };

                string json = JsonConvert.SerializeObject(obj);
                //string json = JsonConvert.SerializeObject(goableData._recordlogsdatadetailsList);
                return(json);
            }
            catch (Exception ex)
            {
                RecordLog.GetInstance().WriteLog(Level.Info, "分页时异常:" + ex.Message);
                return("");
            }
        }