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 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 SetData(StringBuilder strSql) { var headList = new List(); 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 } }