初始化CRICS

This commit is contained in:
2025-12-11 09:17:16 +08:00
commit 83247ec0a2
2735 changed files with 787765 additions and 0 deletions

61
Common/AppUtils.cs Normal file
View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
public sealed class AppUtils
{
/// <summary>
/// 获取数据库连接字符串
/// </summary>
/// <returns></returns>
private static string GetConnectingString()
{
var databaseSettings = ConfigurationManager.GetSection("databaseSettings") as NameValueCollection;
return databaseSettings["connectionString"];
}
/// <summary>
/// 重置回路当天开启时长
/// </summary>
public static void ResetHostModalTime()
{
Task.Factory.StartNew(() =>
{
using (IDbConnection connection = new SqlConnection(GetConnectingString()))
{
using (IDbCommand command = connection.CreateCommand())
{
connection.Open();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "UpdateHostModalRecords";
command.ExecuteNonQuery();
}
}
});
}
/// <summary>
/// 统计回路能耗
/// </summary>
public static void StatisticHostModalEnergy()
{
using (IDbConnection connection = new SqlConnection(GetConnectingString()))
{
using (IDbCommand command = connection.CreateCommand())
{
connection.Open();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "QueryRoomTypeModal_Power";
command.ExecuteNonQuery();
}
}
}
}
}