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.
DS7/DSWeb/Areas/TruckMng/DAL/MsKfBzWx/MsKfBzWxDAL.cs

70 lines
2.0 KiB
C#

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