From eb296d39bc7131f8acf8648b1ca715e86b755180 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 22 Jan 2021 13:35:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Base/CustomerDAL.cs | 4 ++-- NX.ERP.WebAPi/App_Start/WebApiConfig.cs | 31 +++++++++++++------------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/NX.ERP.U8/Base/CustomerDAL.cs b/NX.ERP.U8/Base/CustomerDAL.cs index e379163..a35c5ae 100644 --- a/NX.ERP.U8/Base/CustomerDAL.cs +++ b/NX.ERP.U8/Base/CustomerDAL.cs @@ -32,13 +32,13 @@ namespace NX.ERP.U8 public IEnumerable GetList(NX.ERP.Model.Request.Customer Params) { IList where = new List(); - if (string.IsNullOrEmpty(Params.CustomerCode)) + if (!string.IsNullOrEmpty(Params.CustomerCode)) { where.Add(" cCusCode like @CustomerCode "); } - if (string.IsNullOrEmpty(Params.CustomerName)) + if (!string.IsNullOrEmpty(Params.CustomerName)) { where.Add(" cCusName like @CustomerName "); } diff --git a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs index 5c2aaff..e47b881 100644 --- a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs +++ b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs @@ -17,25 +17,26 @@ using System.Web.Http.Filters; namespace NX.ERP.WebAPi { - public class JsonContentNegotiator : IContentNegotiator - { - private readonly JsonMediaTypeFormatter _jsonFormatter; + //public class JsonContentNegotiator : IContentNegotiator + //{ + // private readonly JsonMediaTypeFormatter _jsonFormatter; - public JsonContentNegotiator(JsonMediaTypeFormatter formatter) - { - _jsonFormatter = formatter; - } + // public JsonContentNegotiator(JsonMediaTypeFormatter formatter) + // { + // _jsonFormatter = formatter; + // } - public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) - { - var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); - return result; - } - } + // public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) + // { + // var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); + // return result; + // } + //} public static class WebApiConfig { public static void Register(HttpConfiguration config) { + NX.ERP.U8.U8LoginContext.Instance.AccID = System.Configuration.ConfigurationManager.AppSettings["AccId"]; 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.Server= System.Configuration.ConfigurationManager.AppSettings["Server"]; + //System.Web.Http.Filters.IExceptionFilter config.Filters.Add(new ExceptionFilter()); config.Filters.Add(new ApiResultAttribute()); Console.WriteLine(config.Filters.Count); - // Web API 配置和服务 - GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings + config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings { //忽略循环引用,如果设置为Error,则遇到循环引用的时候报错 ReferenceLoopHandling = ReferenceLoopHandling.Ignore,