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
{
///
/// 获取系统参数
///
/// 参数KEY
/// 默认值
/// 备注信息
/// 参数类型
/// 参数值
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(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;
}
}
}
}
}