DS7/DSWeb/Areas/Import/DAL/RptProfit/CargoinfoDAL.cs

72 lines
2.0 KiB
C#

using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using DSWeb.Areas.Import.Models.RptProfit;
using HcUtility.Comm;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.Areas.Import.DAL.RptProfit
{
public partial class RptProfitDAL
{
#region 主表
static public List<RptProfitmb> GetDataList(string strCondition)
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append("gid,customername,bsno,feename,amount,enterdate,feetype");
strSql.Append(" from ch_fee ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
return SetData(strSql);
}
private static List<RptProfitmb> SetData(StringBuilder strSql)
{
var headList = new List<RptProfitmb>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
RptProfitmb data = new RptProfitmb();
#region Set DB data to Object
data.gid = Convert.ToString(reader["gid"]);
data.CustomerName = Convert.ToString(reader["Code"]);
data.FeeName = Convert.ToString(reader["Name"]);
data.Bsno = Convert.ToString(reader["Bsno"]);
data.Amount = Convert.ToString(reader["Amount"]);
data.EnterDate = Convert.ToString(reader["EnterDate"]);
data.FeeType = Convert.ToString(reader["FeeType"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 参照部分
#endregion
}
}