109 lines
4.4 KiB
C#
109 lines
4.4 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using AIMSModel;
|
|
using AIMSObjectQuery;
|
|
using System.Text;
|
|
|
|
namespace AIMSDAL
|
|
{
|
|
internal partial class DOperation
|
|
{
|
|
public static bool IsExit(string Name)
|
|
{
|
|
|
|
string strSql = "select * from Operation where name ='" + Name + "'";
|
|
|
|
DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql);
|
|
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
public static void Add(Operation OperationObj)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into [Operation](");
|
|
strSql.Append("IcdCode,Name,HelpCode,UseRate,IsValid,OperatorNo,OperatorName,OperateDate");
|
|
strSql.Append(")");
|
|
strSql.Append(" values (");
|
|
strSql.Append("'" + OperationObj.IcdCode + "',");
|
|
strSql.Append("'" + OperationObj.Name + "',");
|
|
strSql.Append("'" + OperationObj.HelpCode + "',");
|
|
strSql.Append("" + OperationObj.UseRate + ",");
|
|
strSql.Append("" + OperationObj.IsValid + ",");
|
|
strSql.Append("'" + OperationObj.OperatorNo + "',");
|
|
strSql.Append("'" + OperationObj.OperatorName + "',");
|
|
strSql.Append("'" + OperationObj.OperateDate + "'");
|
|
strSql.Append(")");
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public static Operation GetModel(int Id)
|
|
{
|
|
Operation OperationObj = new Operation();
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select ");
|
|
strSql.Append("Id,IcdCode,Name,HelpCode,UseRate,IsValid,OperatorNo,OperatorName,OperateDate ");
|
|
strSql.Append(" from Operation ");
|
|
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() != "")
|
|
{
|
|
OperationObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
|
}
|
|
OperationObj.IcdCode = ds.Tables[0].Rows[0]["IcdCode"].ToString();
|
|
OperationObj.Name = ds.Tables[0].Rows[0]["Name"].ToString();
|
|
OperationObj.HelpCode = ds.Tables[0].Rows[0]["HelpCode"].ToString();
|
|
if (ds.Tables[0].Rows[0]["UseRate"].ToString() != "")
|
|
{
|
|
OperationObj.UseRate = int.Parse(ds.Tables[0].Rows[0]["UseRate"].ToString());
|
|
}
|
|
if (ds.Tables[0].Rows[0]["IsValid"].ToString() != "")
|
|
{
|
|
OperationObj.IsValid = int.Parse(ds.Tables[0].Rows[0]["IsValid"].ToString());
|
|
}
|
|
OperationObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
|
|
OperationObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
|
|
if (ds.Tables[0].Rows[0]["OperateDate"].ToString() != "")
|
|
{
|
|
OperationObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
|
|
}
|
|
}
|
|
return OperationObj;
|
|
}
|
|
|
|
public static DataTable GetDataTable(string HelpCode)
|
|
{
|
|
string strSql = "";
|
|
if (HelpCode == "")
|
|
{
|
|
strSql = "SELECT TOP 75 d.Id, d.IcdCode, d.Name FROM Operation d WHERE d.IsValid=1 order by UseRate desc";
|
|
}
|
|
else
|
|
{
|
|
strSql = "SELECT d.Id, d.IcdCode, d.Name FROM Operation d WHERE d.IsValid=1 AND (d.IcdCode LIKE '%" + HelpCode + "%' OR d.Name LIKE '%" + HelpCode + "%' OR d.HelpCode LIKE '%" + HelpCode + "%') order by UseRate desc";
|
|
}
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
|
|
|
|
public static DataTable GetDataTable()
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select [Id], IcdCode,[Name],HelpCode,CASE IsValid WHEN 1 THEN '有效' WHEN 0 THEN '无效' END AS IsValid");
|
|
strSql.Append(" FROM Operation ");
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
}
|
|
}
|