wzp
2021-07-28 864986e4cad03f6b9bba9a7e65379db496b62a6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
 
namespace MonitorAlarm
{
    public class DataHander
    {
        readonly Database db = DatabaseFactory.CreateDatabase("DefaultDB");
 
        private static DataHander _instance = null;
        public static DataHander Instance
        {
            get
            {
                if (DataHander._instance == null)
                {
                    DataHander._instance = new DataHander();
                }
                return _instance;
            }
        }
        private DataHander() { }
 
 
 
        /// <summary>
        /// 获取统计
        /// </summary>
        /// <returns></returns>
        public string GetCount()
        {
            string sql = @"select count(1) as count from sms_mt_cm_wait where (down_time<getdate() and datediff(mi,down_time,getdate())>=30)";
 
            DataSet ds = db.ExecuteDataSet(System.Data.CommandType.Text, sql);
            DataTable dt = ds.Tables[0];
            string count = "";
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                     count = dr["count"].ToString();
                }
            }
            return count;
        }
 
    }
}