diff --git a/北京北汽/Controller/SCP_ASK_CONTROLLER.cs b/北京北汽/Controller/SCP_ASK_CONTROLLER.cs index 77b31d5..8d82e88 100644 --- a/北京北汽/Controller/SCP_ASK_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_ASK_CONTROLLER.cs @@ -131,7 +131,7 @@ namespace CK.SCP.Controller LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List", ex.Message.ToString()); if (ex.InnerException != null) { - LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List", ex.InnerException.Message.ToString()); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List(*)", LogHelper.GetExceptionMessage(ex).Message); } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } @@ -476,6 +476,10 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List(*)", LogHelper.GetExceptionMessage(ex).Message); + } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) @@ -1639,6 +1643,7 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(dbEx); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); } catch (OptimisticConcurrencyException ex)//并发冲突异常 @@ -1647,6 +1652,12 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List", ex.ToString()); + + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List(*)", LogHelper.GetExceptionMessage(ex).Message); + } + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) diff --git a/北京北汽/Controller/SCP_ASN_CONTROLLER.cs b/北京北汽/Controller/SCP_ASN_CONTROLLER.cs index d7a1f60..506d84c 100644 --- a/北京北汽/Controller/SCP_ASN_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_ASN_CONTROLLER.cs @@ -134,7 +134,7 @@ namespace CK.SCP.Controller LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List", ex.Message); if (ex.InnerException != null) { - LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List", ex.InnerException.Message); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List(*)", LogHelper.GetExceptionMessage(ex).Message); } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } @@ -2011,6 +2011,10 @@ namespace CK.SCP.Controller _ret.Result = false; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_DETAIL", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASN_DETAIL(*)", LogHelper.GetExceptionMessage(ex).Message); + } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) diff --git a/北京北汽/Controller/SCP_BARCODE_CONTROLLER _SYJB.cs b/北京北汽/Controller/SCP_BARCODE_CONTROLLER _SYJB.cs index 00f33d6..aa31033 100644 --- a/北京北汽/Controller/SCP_BARCODE_CONTROLLER _SYJB.cs +++ b/北京北汽/Controller/SCP_BARCODE_CONTROLLER _SYJB.cs @@ -136,6 +136,10 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBarcodeList", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBarcodeList(*)", LogHelper.GetExceptionMessage(ex).Message); + } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) @@ -292,6 +296,10 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule(*)", LogHelper.GetExceptionMessage(ex).Message); + } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) diff --git a/北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs b/北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs index bcd8c08..1c4326a 100644 --- a/北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs @@ -316,6 +316,11 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List(*)", LogHelper.GetExceptionMessage(ex).Message); + } + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) diff --git a/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs b/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs index f458646..8c5f8a2 100644 --- a/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs @@ -1354,6 +1354,11 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List", ex.ToString()); + if (ex.InnerException != null) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_RECIVECE_CONTROLLER), "Get_V_TB_ARRIVE_List(*)", LogHelper.GetExceptionMessage(ex).Message); + } + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } catch (ScpException ex) diff --git a/北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs b/北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs index 5bbad8a..49f7939 100644 --- a/北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs @@ -250,7 +250,7 @@ namespace CK.SCP.Controller LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", ex.Message.ToString()); if (ex.InnerException != null) { - LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", ex.InnerException.Message.ToString()); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List(*)", LogHelper.GetExceptionMessage(ex).Message); } throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); } diff --git a/北京北汽/SCP/Business/PageBase.cs b/北京北汽/SCP/Business/PageBase.cs index 548a8a6..3d7846d 100644 --- a/北京北汽/SCP/Business/PageBase.cs +++ b/北京北汽/SCP/Business/PageBase.cs @@ -32,6 +32,7 @@ using SCP.Common; using System.Drawing.Imaging; using System.Drawing; using System.Net.NetworkInformation; +using System.Text.RegularExpressions; namespace SCP { @@ -584,7 +585,7 @@ namespace SCP } DateTime now = DateTime.Now; online.User = user; - online.IPAdddress = Request.UserHostAddress; + online.IPAdddress = GetExternalIpAddress();//Request.UserHostAddress; online.LoginTime = now; online.UpdateTime = now; @@ -2047,6 +2048,33 @@ namespace SCP } } return partCodeList; - } + } + + public string GetExternalIpAddress() + { + try + { + WebClient client = new WebClient + { + Encoding = System.Text.Encoding.UTF8 + }; + string responseIpHtml = client.DownloadString("http://ip.chinaz.com/");//站长之家 //https://api.ipify.org + string regMatch = @"
([\s\S]+?)<\/dd>"; + Match mc = Regex.Match(responseIpHtml, regMatch, RegexOptions.Singleline); + if (mc.Success && mc.Groups.Count > 1) + { + responseIpHtml = mc.Groups[1].Value; + return responseIpHtml; + } + else + { + return Request.UserHostAddress; + } + } + catch (Exception) + { + return Request.UserHostAddress; + } + } } } \ No newline at end of file diff --git a/北京北汽/SCP/Properties/AssemblyInfo.cs b/北京北汽/SCP/Properties/AssemblyInfo.cs index 4b6f073..fdb9d15 100644 --- a/北京北汽/SCP/Properties/AssemblyInfo.cs +++ b/北京北汽/SCP/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // 可以指定所有值,也可以使用“修订号”和“内部版本号”的默认值, // 方法是按如下所示使用 "*": -[assembly: AssemblyVersion("1.23.1023.1")] -[assembly: AssemblyFileVersion("1.23.1023.1")] +[assembly: AssemblyVersion("1.23.1222.1")] +[assembly: AssemblyFileVersion("1.23.1222.1")] diff --git a/北京北汽/Utils/LogHelper.cs b/北京北汽/Utils/LogHelper.cs index e8578e5..0d3cb63 100644 --- a/北京北汽/Utils/LogHelper.cs +++ b/北京北汽/Utils/LogHelper.cs @@ -102,6 +102,12 @@ namespace CK.SCP.Utils } + public static Exception GetExceptionMessage(this Exception ex) + { + if (ex.InnerException == null) return ex; + return ex.InnerException.GetExceptionMessage(); + } + }