修复错误

This commit is contained in:
admin
2021-01-22 13:35:15 +08:00
parent e3e8a0ce67
commit eb296d39bc
2 changed files with 18 additions and 17 deletions

View File

@@ -32,13 +32,13 @@ namespace NX.ERP.U8
public IEnumerable<Customer> GetList(NX.ERP.Model.Request.Customer Params)
{
IList<string> where = new List<string>();
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 ");
}

View File

@@ -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<MediaTypeFormatter> formatters)
{
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
return result;
}
}
// public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> 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,