49 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using AIMSDAL;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using HelperDB;
 | |
| 
 | |
| namespace AIMSBLL
 | |
| {
 | |
|     public partial class BDrugs
 | |
|     { 
 | |
|         public static DataTable GetAllDrugsByCondition(string Condition)
 | |
|         {
 | |
|             string strSql = "SELECT top 20 d.*, d.DrugKind as TypeName,Stand,DosageUnit FROM Drugs d where d.IsValid=1 and (d.HelpCode like'%" + Condition.ToUpper() + "%' or d.Name like'%" + Condition + "%') Order By UseRate desc";
 | |
|             return DBHelper.GetDataTable(strSql);
 | |
|         }
 | |
| 
 | |
|         public static DataTable SelectIdName(string str)
 | |
|         {
 | |
|             string sql = string.Empty;
 | |
|             if (str == "")
 | |
|             {
 | |
|                 sql = string.Format("select Id,HelpCode,Name,Id code,Stand from Drugs where IsValid = 1");
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 sql = string.Format("SELECT Top 26 e.Id,e.Name,Id code, Stand FROM Drugs e WHERE (Lower(Name) like '%{0}%' OR  Lower(HelpCode) like '%{0}%') and IsValid = 1", str);
 | |
|             } 
 | |
|                 return DBHelper.GetDataTable(sql);
 | |
|         }
 | |
|         public static DataTable GetDrugsByIds(string ids)
 | |
|         {
 | |
|             if (ids != null && ids.Length > 0)
 | |
|             {
 | |
|                 string sql = string.Format("select * from  Drugs where IsValid=1 and Id in({0})  order by charindex(','+rtrim(cast(id as varchar(10)))+',',',{0},')", ids);//IsValid=1 and
 | |
|                 return DBHelper.GetDataTable(sql);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 string sql = string.Format("select * from  Drugs where 1<>1 ");
 | |
|                 return DBHelper.GetDataTable(sql);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|     }
 | |
| }
 |