修复错误
This commit is contained in:
@@ -32,13 +32,13 @@ namespace NX.ERP.U8
|
|||||||
public IEnumerable<Customer> GetList(NX.ERP.Model.Request.Customer Params)
|
public IEnumerable<Customer> GetList(NX.ERP.Model.Request.Customer Params)
|
||||||
{
|
{
|
||||||
IList<string> where = new List<string>();
|
IList<string> where = new List<string>();
|
||||||
if (string.IsNullOrEmpty(Params.CustomerCode))
|
if (!string.IsNullOrEmpty(Params.CustomerCode))
|
||||||
{
|
{
|
||||||
where.Add(" cCusCode like @CustomerCode ");
|
where.Add(" cCusCode like @CustomerCode ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Params.CustomerName))
|
if (!string.IsNullOrEmpty(Params.CustomerName))
|
||||||
{
|
{
|
||||||
where.Add(" cCusName like @CustomerName ");
|
where.Add(" cCusName like @CustomerName ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,25 +17,26 @@ using System.Web.Http.Filters;
|
|||||||
namespace NX.ERP.WebAPi
|
namespace NX.ERP.WebAPi
|
||||||
{
|
{
|
||||||
|
|
||||||
public class JsonContentNegotiator : IContentNegotiator
|
//public class JsonContentNegotiator : IContentNegotiator
|
||||||
{
|
//{
|
||||||
private readonly JsonMediaTypeFormatter _jsonFormatter;
|
// private readonly JsonMediaTypeFormatter _jsonFormatter;
|
||||||
|
|
||||||
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
|
// public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
|
||||||
{
|
// {
|
||||||
_jsonFormatter = formatter;
|
// _jsonFormatter = formatter;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
|
// public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
|
||||||
{
|
// {
|
||||||
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
|
// var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
public static class WebApiConfig
|
public static class WebApiConfig
|
||||||
{
|
{
|
||||||
public static void Register(HttpConfiguration config)
|
public static void Register(HttpConfiguration config)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
NX.ERP.U8.U8LoginContext.Instance.AccID = System.Configuration.ConfigurationManager.AppSettings["AccId"];
|
NX.ERP.U8.U8LoginContext.Instance.AccID = System.Configuration.ConfigurationManager.AppSettings["AccId"];
|
||||||
NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
||||||
@@ -43,12 +44,12 @@ namespace NX.ERP.WebAPi
|
|||||||
NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"];
|
NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"];
|
||||||
NX.ERP.U8.U8LoginContext.Instance.Server= System.Configuration.ConfigurationManager.AppSettings["Server"];
|
NX.ERP.U8.U8LoginContext.Instance.Server= System.Configuration.ConfigurationManager.AppSettings["Server"];
|
||||||
|
|
||||||
|
|
||||||
//System.Web.Http.Filters.IExceptionFilter
|
//System.Web.Http.Filters.IExceptionFilter
|
||||||
config.Filters.Add(new ExceptionFilter());
|
config.Filters.Add(new ExceptionFilter());
|
||||||
config.Filters.Add(new ApiResultAttribute());
|
config.Filters.Add(new ApiResultAttribute());
|
||||||
Console.WriteLine(config.Filters.Count);
|
Console.WriteLine(config.Filters.Count);
|
||||||
// Web API 配置和服务
|
config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings
|
||||||
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings
|
|
||||||
{
|
{
|
||||||
//忽略循环引用,如果设置为Error,则遇到循环引用的时候报错
|
//忽略循环引用,如果设置为Error,则遇到循环引用的时候报错
|
||||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
||||||
|
|||||||
Reference in New Issue
Block a user