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/MvcShipping/DAL/WMS/WMSPriceDAL.cs

97 lines
2.9 KiB
C#

2 years ago
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using DSWeb.MvcShipping.Models.WMS;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.CommMng.Models;
using System.Web;
using System.Data.Common;
using DSWeb.TruckMng.Comm.Cookie;
using WebSqlHelper;
using HcUtility.Core;
using DSWeb.Areas.CommMng.Models;
using System.Data.SqlClient;
using DSWeb.EntityDA;
using DSWeb.Models;
namespace DSWeb.MvcShipping.DAL.WMS
{
public partial class WMSDAL
{
#region 仓储费率信息列表
static public List<WMSPricemb> GetPriceList(string strCondition, string sort)
{ //库存信息
var strSql = new StringBuilder();
strSql.Append(" SELECT GID,CUSTOMERNAME,PRICEDATE,PRICE_PAY,PRICE_RECV,remark ");
strSql.Append(" FROM [wmsPrice] ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition.Replace("~", ""));
}
else
{
//strSql.Append(" where ISDELETE=0 ");
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by CUSTOMERNAME,PRICE_PAY ");
}
return SetPriceData(strSql);
}
static public WMSPricemb GetPriceData ( string condition )
{
var _t = "";
var list = GetPriceList(condition, _t);
if (list.Count > 0)
return list[0];
return new WMSPricemb();
}
private static List<WMSPricemb> SetPriceData ( StringBuilder strSql )
{
var headList = new List<WMSPricemb>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
WMSPricemb data = new WMSPricemb();
#region Set DB data to Object
data.GID = Convert.ToString(reader["GID"]);
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
data.PRICEDATE = Convert.ToString(reader["PRICEDATE"]);
data.PRICE_PAY = Convert.ToString(reader["PRICE_PAY"]);
data.PRICE_RECV = Convert.ToString(reader["PRICE_RECV"]);
data.remark = Convert.ToString(reader["remark"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 参照部分
#endregion
}
}