1、单位数据清理合并功能;
2、单位新增编辑功能调整,补充英文名称等; 3、建筑企业单位资质字典;
This commit is contained in:
+104
-20
@@ -28,7 +28,7 @@ namespace BLL
|
||||
private static SqlCommand BuildIntCommand(string storedProcName, IDataParameter[] parameters)
|
||||
{
|
||||
SqlCommand command = BuildQueryCommand(storedProcName, parameters);
|
||||
|
||||
|
||||
command.Parameters.Add(new SqlParameter("ReturnValue",
|
||||
SqlDbType.Int,
|
||||
4, /* Size */
|
||||
@@ -71,7 +71,7 @@ namespace BLL
|
||||
finally
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -222,7 +222,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -332,7 +332,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = BuildQueryCommand(storedProcName, parameters);
|
||||
command.CommandTimeout = 0;
|
||||
@@ -344,6 +344,86 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程【无返回值】
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
public static void ExecuteNonQueryStoredProcedure(string procedureName, SqlParameter[] parameters = null)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 打开连接
|
||||
connection.Open();
|
||||
using (SqlCommand command = new SqlCommand(procedureName, connection))
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
if (parameters != null)
|
||||
{
|
||||
command.Parameters.AddRange(parameters);
|
||||
}
|
||||
// 执行存储过程
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,例如记录日志等
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
connection.Close(); // Ensures the connection is closed even if an exception occurs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行存储过程【返回int结果值】
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
public static int ExecuteProcedure(string procedureName, SqlParameter[] parameters = null)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 打开连接
|
||||
connection.Open();
|
||||
using (SqlCommand command = new SqlCommand(procedureName, connection))
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
if (parameters != null)
|
||||
{
|
||||
command.Parameters.AddRange(parameters);
|
||||
}
|
||||
command.Parameters["@returnVal"].Direction = ParameterDirection.Output;
|
||||
// 执行存储过程
|
||||
command.ExecuteNonQuery();
|
||||
// 获取返回值,如果存储过程有返回值参数,可以从参数中获取,例如:
|
||||
return (int)command.Parameters["returnVal"].Value;
|
||||
// 如果存储过程没有返回输出参数,而是通过其他方式(如SELECT语句)返回一个整数值,则需要修改为以下方式:
|
||||
//SqlCommand cmd = new SqlCommand("SELECT @RETURN_VALUE", connection); // 这里@RETURN_VALUE是你在存储过程中设置的变量名,例如SET @RETURN_VALUE = 1;
|
||||
//return (int)cmd.ExecuteScalar(); // 使用ExecuteScalar获取单个值结果
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理异常,例如记录日志等
|
||||
Console.WriteLine("An error occurred: " + ex.Message);
|
||||
return 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
connection.Close(); // Ensures the connection is closed even if an exception occurs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字符串
|
||||
/// </summary>
|
||||
@@ -355,7 +435,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -379,7 +459,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -405,7 +485,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(sql, Connection)
|
||||
{
|
||||
@@ -413,6 +493,10 @@ namespace BLL
|
||||
CommandType = CommandType.Text
|
||||
};
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -436,7 +520,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlDataAdapter sqlDA = new SqlDataAdapter
|
||||
{
|
||||
@@ -467,7 +551,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlDataAdapter sqlDA = new SqlDataAdapter
|
||||
{
|
||||
@@ -494,7 +578,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -525,7 +609,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -554,7 +638,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(strSql, Connection)
|
||||
{
|
||||
@@ -751,7 +835,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="pur_name">存储过程名称</param>
|
||||
/// <param name="parmList">存储过程的{参数--值}的集合</param>
|
||||
public static void RunProcedure(string pur_name, Hashtable parmList, ref int returnValue)
|
||||
public static void RunProcedure(string pur_name, Hashtable parmList, ref int returnValue)
|
||||
{
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
@@ -823,7 +907,7 @@ namespace BLL
|
||||
SqlTransaction trans = null;
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
cmd.Connection.Open();
|
||||
trans = cmd.Connection.BeginTransaction();
|
||||
cmd.Transaction = trans;
|
||||
@@ -862,7 +946,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -902,7 +986,7 @@ namespace BLL
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand(storedProcName, Connection)
|
||||
{
|
||||
@@ -978,7 +1062,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="storedProcName"></param>
|
||||
/// <returns></returns>
|
||||
public static int RunProcGetHsseKq(string ProjectId,DateTime startTime,DateTime endTime,string UnitId)
|
||||
public static int RunProcGetHsseKq(string ProjectId, DateTime startTime, DateTime endTime, string UnitId)
|
||||
{
|
||||
string str = "";
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
|
||||
Reference in New Issue
Block a user