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;
|
}
|
|
}
|
}
|