51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Dapper;
|
|
using MySql.Data.MySqlClient;
|
|
using cn.sancainet.Resident.health.register.Entity.XiTong;
|
|
using cn.xinelu.MedicalCheckup.Client;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace cn.sancainet.Resident.health.register.Utils
|
|
{
|
|
public class sysParms
|
|
{
|
|
/// <summary>
|
|
/// 获取系统参数
|
|
/// </summary>
|
|
/// <param name="key">参数KEY</param>
|
|
/// <param name="defaultValue">默认值</param>
|
|
/// <param name="Memo">备注信息</param>
|
|
/// <param name="type">参数类型</param>
|
|
/// <returns>参数值</returns>
|
|
internal static string getPram(string key,string defaultValue,string Memo,string type)
|
|
{
|
|
sysConfigure config = new sysConfigure {
|
|
Name = key,
|
|
Memo = Memo,
|
|
Type = type,
|
|
Value = defaultValue,
|
|
px = 0
|
|
};
|
|
using (SqlConnection conn = new SqlConnection(MainWindow.ConnMain))
|
|
{
|
|
string sql = "select * from sys_configure_sc where Name=@Name and Type=@Type";
|
|
sysConfigure sysparm = conn.Query<sysConfigure>(sql, config).FirstOrDefault();
|
|
if(sysparm==null)
|
|
{
|
|
sql = "insert into sys_configure_sc(ID,Name,Value,Type,Memo,px) values(@ID,@Name,@Value,@Type,@Memo,@px)";
|
|
config.ID = Guid.NewGuid().ToString("N");
|
|
var aa = conn.Execute(sql, config);
|
|
return defaultValue;
|
|
}
|
|
else
|
|
{
|
|
return sysparm.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|