46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using cn.sancainet.Resident.health.register.Entity.XiTong;
|
|
using cn.xinelu.MedicalCheckup.Client;
|
|
using Dapper;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace cn.sancainet.Resident.health.register.DAL
|
|
{
|
|
public class sysParm
|
|
{
|
|
public string setParm(string key,string value,string memo,string type)
|
|
{
|
|
sysConfigure config = new sysConfigure
|
|
{
|
|
Name = key,
|
|
Memo = memo,
|
|
Type = type,
|
|
Value = value,
|
|
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");
|
|
conn.Execute(sql, config);
|
|
return value;
|
|
}
|
|
else
|
|
{
|
|
sql = "update sys_configure_sc set Name=@Name , Type=@Type,Value=@Value,Memo=@Memo,px=@px where Name=@Name and Type=@Type";
|
|
conn.Execute(sql, config);
|
|
return value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|