98 lines
4.1 KiB
C#
98 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
namespace DataDictionary.DAL
|
|
{
|
|
public class AnaesthesiaMethodDB
|
|
{
|
|
public void Add(Model.AnaesthesiaMethod AnaesthesiaMethodObj)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("insert into [AnaesthesiaMethod](");
|
|
strSql.Append("Name,HelpCode,ParentId,UseRate,IsValid,OperatorNo,OperatorName,OperateDate");
|
|
strSql.Append(")");
|
|
strSql.Append(" values (");
|
|
strSql.Append("'"+AnaesthesiaMethodObj.Name+"',");
|
|
strSql.Append("'"+AnaesthesiaMethodObj.HelpCode+"',");
|
|
strSql.Append(""+AnaesthesiaMethodObj.ParentId+",");
|
|
strSql.Append(""+AnaesthesiaMethodObj.UseRate+",");
|
|
strSql.Append(""+AnaesthesiaMethodObj.IsValid+",");
|
|
strSql.Append("'"+AnaesthesiaMethodObj.OperatorNo+"',");
|
|
strSql.Append("'"+AnaesthesiaMethodObj.OperatorName+"',");
|
|
strSql.Append("'"+AnaesthesiaMethodObj.OperateDate+"'");
|
|
strSql.Append(")");
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public void Update(Model.AnaesthesiaMethod AnaesthesiaMethodObj)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("update AnaesthesiaMethod set ");
|
|
strSql.Append("Name='"+AnaesthesiaMethodObj.Name+"',");
|
|
strSql.Append("HelpCode='"+AnaesthesiaMethodObj.HelpCode+"',");
|
|
strSql.Append("ParentId="+AnaesthesiaMethodObj.ParentId+",");
|
|
strSql.Append("UseRate="+AnaesthesiaMethodObj.UseRate+",");
|
|
strSql.Append("IsValid="+AnaesthesiaMethodObj.IsValid+",");
|
|
strSql.Append("OperatorNo='"+AnaesthesiaMethodObj.OperatorNo+"',");
|
|
strSql.Append("OperatorName='"+AnaesthesiaMethodObj.OperatorName+"',");
|
|
strSql.Append("OperateDate='"+AnaesthesiaMethodObj.OperateDate+"'");
|
|
strSql.Append(" where Id="+AnaesthesiaMethodObj.Id+" ");
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public Model.AnaesthesiaMethod GetModel(int Id)
|
|
{
|
|
Model.AnaesthesiaMethod AnaesthesiaMethodObj = new Model.AnaesthesiaMethod();
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select ");
|
|
strSql.Append("Id,Name,HelpCode,ParentId,UseRate,IsValid,OperatorNo,OperatorName,OperateDate ");
|
|
strSql.Append(" from AnaesthesiaMethod ");
|
|
strSql.Append(" where Id="+Id+"" );
|
|
DataSet ds = HelperDB.DbHelperSQL.GetDataSet(strSql.ToString());
|
|
if(ds.Tables[0].Rows.Count>0)
|
|
{
|
|
if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
|
|
{
|
|
AnaesthesiaMethodObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
|
}
|
|
AnaesthesiaMethodObj.Name = ds.Tables[0].Rows[0]["Name"].ToString();
|
|
AnaesthesiaMethodObj.HelpCode = ds.Tables[0].Rows[0]["HelpCode"].ToString();
|
|
if(ds.Tables[0].Rows[0]["ParentId"].ToString()!="")
|
|
{
|
|
AnaesthesiaMethodObj.ParentId = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
|
|
}
|
|
if(ds.Tables[0].Rows[0]["UseRate"].ToString()!="")
|
|
{
|
|
AnaesthesiaMethodObj.UseRate = int.Parse(ds.Tables[0].Rows[0]["UseRate"].ToString());
|
|
}
|
|
if(ds.Tables[0].Rows[0]["IsValid"].ToString()!="")
|
|
{
|
|
AnaesthesiaMethodObj.IsValid = int.Parse(ds.Tables[0].Rows[0]["IsValid"].ToString());
|
|
}
|
|
AnaesthesiaMethodObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
|
|
AnaesthesiaMethodObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
|
|
if(ds.Tables[0].Rows[0]["OperateDate"].ToString()!="")
|
|
{
|
|
AnaesthesiaMethodObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
|
|
}
|
|
}
|
|
return AnaesthesiaMethodObj;
|
|
}
|
|
|
|
public DataTable GetDataTable(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select [Id],[Name],[HelpCode],[ParentId],[UseRate],CASE IsValid WHEN 1 THEN '有效' WHEN 0 THEN '无效' END AS IsValid");
|
|
strSql.Append(" FROM AnaesthesiaMethod ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
}
|
|
}
|