68 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Reflection;
 | |
| using System.Text;
 | |
| 
 | |
| namespace AIMSDAL
 | |
| {
 | |
|     internal partial class DAnaesthesiaMethod
 | |
|     { 
 | |
|         public static AnaesthesiaMethod GetModel(int Id)
 | |
|         {
 | |
|             AnaesthesiaMethod AnaesthesiaMethodObj = new 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 static 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());
 | |
|         }
 | |
|     }
 | |
| }
 |