You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9 KiB
C#

using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.Areas.TruckMng.DAL.MsWlInsureLtd
{
public partial class MsWlInsureLtdDAL
{
#region Inquery DataList
static public List<Models.MsWlInsureLtd.MsWlInsureLtd> GetDataList(string strCondition)
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append("Code,Name");
strSql.Append(" from tMsWlInsureLtd ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
return SetData(strSql);
}
static public Models.MsWlInsureLtd.MsWlInsureLtd GetData(string condition)
{
var list = GetDataList(condition);
if (list.Count > 0)
return list[0];
return new Models.MsWlInsureLtd.MsWlInsureLtd();
}
private static List<Models.MsWlInsureLtd.MsWlInsureLtd> SetData(StringBuilder strSql)
{
var headList = new List<Models.MsWlInsureLtd.MsWlInsureLtd>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
Models.MsWlInsureLtd.MsWlInsureLtd data = new Models.MsWlInsureLtd.MsWlInsureLtd();
#region Set DB data to Object
data.Code = Convert.ToString(reader["Code"]);
data.Name = Convert.ToString(reader["Name"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 参照部分
#endregion
}
}