using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Text; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.Areas.Dispatch.Models; namespace DSWeb.Dispatch.DAL { public class MsChFeeDAL { #region 查询费用数据 public static List GetShouldGetDataList(string shortName, string BSNO) { var strSql = new StringBuilder(); strSql.AppendLine("SELECT FEENAME,UNIT,TAXUNITPRICE UNITPRICE,QUANTITY,AMOUNT,CURRENCY,EXCHANGERATE"); strSql.AppendLine("FROM CH_FEE"); strSql.AppendLine($"WHERE FEETYPE=1 AND FEESTATUS IN (0,8,9) AND CUSTOMERNAME='{shortName}' AND BSNO='{BSNO}'"); strSql.AppendLine(" ORDER BY SORT,LINENUM "); return SetData(strSql); } private static List SetData(StringBuilder strSql) { var bodyList = new List(); Database db = DatabaseFactory.CreateDatabase(); using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) { while (reader.Read()) { ChFeeModel data = new ChFeeModel(); #region Set DB data to Object data.FeeName = Convert.ToString(reader["FeeName"]); data.Unit = Convert.ToString(reader["Unit"]); data.UnitPrice = Convert.ToString(reader["UnitPrice"]); data.Quantity = Convert.ToString(reader["Quantity"]); data.Amount = Convert.ToString(reader["Amount"]); data.Currency = Convert.ToString(reader["Currency"]); data.ExChangerate = Convert.ToString(reader["ExChangerate"]); #endregion bodyList.Add(data); } reader.Close(); } return bodyList; } #endregion } }