2021-01-05 11:11:28 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using Dapper;
|
|
|
|
|
|
using NX.ERP.Model;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NX.ERP.U8
|
|
|
|
|
|
{
|
|
|
|
|
|
public class CustomerDAL
|
|
|
|
|
|
{
|
2021-01-20 16:31:45 +08:00
|
|
|
|
public IEnumerable<Customer> GetList(string strWhere = "", object Param = null)
|
2021-01-05 11:11:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
|
|
|
|
|
{
|
|
|
|
|
|
var sql = @" select
|
2021-01-20 16:31:45 +08:00
|
|
|
|
cCusCode AS CustomerCode,
|
|
|
|
|
|
cCusName AS CustomerName,
|
2021-01-05 11:11:28 +08:00
|
|
|
|
cCusPostCode AS PostalCode,
|
|
|
|
|
|
cCusAddress AS Address,
|
|
|
|
|
|
cCusPerson AS Contract,cCusPhone AS ContractPhone from Customer ";
|
2021-01-11 09:07:29 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(strWhere))
|
|
|
|
|
|
{
|
2021-01-20 16:31:45 +08:00
|
|
|
|
sql += $" where {strWhere} ";
|
2021-01-11 09:07:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
return conn.Query<Customer>(sql, Param);
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-01-20 16:31:45 +08:00
|
|
|
|
|
|
|
|
|
|
public IEnumerable<Customer> GetList(NX.ERP.Model.Request.Customer Params)
|
|
|
|
|
|
{
|
|
|
|
|
|
IList<string> where = new List<string>();
|
|
|
|
|
|
if (string.IsNullOrEmpty(Params.CustomerCode))
|
|
|
|
|
|
{
|
|
|
|
|
|
where.Add(" cCusCode like @CustomerCode ");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(Params.CustomerName))
|
|
|
|
|
|
{
|
|
|
|
|
|
where.Add(" cCusName like @CustomerName ");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return this.GetList(string.Join(" and ", where.ToArray()), new
|
|
|
|
|
|
{
|
|
|
|
|
|
CustomerCode = $"%{Params.CustomerCode}%",
|
|
|
|
|
|
CustomerName = $"%{Params.CustomerName}%"
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-05 11:11:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|