Browse Source

加日志

master
yidi.wu 11 months ago
parent
commit
9bc287b067
  1. 47
      北京北汽/Controller/SCP_ASK_CONTROLLER.cs
  2. 15
      北京北汽/Controller/SCP_ASN_CONTROLLER.cs
  3. 10
      北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs
  4. 26
      北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs
  5. 4
      北京北汽/SCP/Properties/AssemblyInfo.cs
  6. 23
      北京北汽/Utils/LogHelper.cs

47
北京北汽/Controller/SCP_ASK_CONTROLLER.cs

@ -21,7 +21,6 @@ namespace CK.SCP.Controller
public static void Get_V_TB_ASK_List(V_TB_ASK p_entity, Action<ResultObject<IQueryable<V_TB_ASK>>> p_action)
{
ResultObject<IQueryable<V_TB_ASK>> _ret = new ResultObject<IQueryable<V_TB_ASK>>();
try
{
@ -121,6 +120,8 @@ 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_List", sb.ToString());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
@ -130,9 +131,8 @@ namespace CK.SCP.Controller
_ret.ErrorList.Add(ex);
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(*)", LogHelper.GetExceptionMessage(ex).Message);
}
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
@ -140,20 +140,19 @@ 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_List", ex.Message.ToString());
if (ex.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List", inner.Message.ToString());
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) {
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List", ex.InnerException.Message);
throw ex.InnerException;
}
}
@ -163,6 +162,9 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List", e.Message);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_List(Exception)", LogHelper.GetExceptionMessage(e).Message);
throw e;
}
}
@ -468,6 +470,9 @@ 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_ASN_View_List", sb.ToString());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
@ -477,9 +482,8 @@ namespace CK.SCP.Controller
_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);
}
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
@ -487,6 +491,8 @@ 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(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
@ -505,6 +511,9 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", e.Message);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASK_ASN_View_List(ScpException)", LogHelper.GetExceptionMessage(e).Message);
throw e;
}
@ -1643,36 +1652,33 @@ 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());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_V_TB_ASK_DETAIL_List(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_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);
}
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_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(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
@ -1682,11 +1688,12 @@ namespace CK.SCP.Controller
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List", e.Message);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List(Exception)", LogHelper.GetExceptionMessage(e).Message);
throw e;
}
}

15
北京北汽/Controller/SCP_ASN_CONTROLLER.cs

@ -124,18 +124,19 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List", sb.ToString());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
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(*)", LogHelper.GetExceptionMessage(ex).Message);
}
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
@ -143,6 +144,9 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
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(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
@ -162,6 +166,9 @@ namespace CK.SCP.Controller
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List(Exception)", LogHelper.GetExceptionMessage(e).Message);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_List", e.Message);
throw e;
}

10
北京北汽/Controller/SCP_BARCODE_CONTROLLER.cs

@ -609,6 +609,9 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", sb.ToString());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
@ -617,6 +620,8 @@ 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(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
@ -624,7 +629,8 @@ 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(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
@ -642,6 +648,8 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", e.Message);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule(Exception)", LogHelper.GetExceptionMessage(e).Message);
throw e;
}
return _ret;

26
北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs

@ -90,7 +90,7 @@ namespace CK.SCP.Controller
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", sb.ToString());
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_PRICE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
@ -98,14 +98,14 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", ex.ToString());
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_PRICE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", ex.ToString());
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_PRICE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
@ -123,7 +123,7 @@ namespace CK.SCP.Controller
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", e.Message);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_PRICE_List", e.Message);
throw e;
}
}
@ -131,7 +131,6 @@ namespace CK.SCP.Controller
public static void Get_TB_PRICE_List(bool p_flag, V_TB_PRICE p_entity, Action<ResultObject<IQueryable<V_TB_PRICE>>> p_action)
{
ResultObject<IQueryable<V_TB_PRICE>> _ret = new ResultObject<IQueryable<V_TB_PRICE>>();
try
{
@ -142,9 +141,6 @@ namespace CK.SCP.Controller
{
q = q.Where(p => p.Amt==0);
}
if (p_entity.UID!=0)
{
q = q.Where(p => p.UID==p_entity.UID);
@ -240,18 +236,19 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", sb.ToString());
if (dbEx.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List(DbEntityValidationException)", LogHelper.GetExceptionMessage(dbEx).Message);
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
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(*)", LogHelper.GetExceptionMessage(ex).Message);
}
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List(OptimisticConcurrencyException)", LogHelper.GetExceptionMessage(ex).Message);
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
@ -259,6 +256,8 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
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(ScpException)", LogHelper.GetExceptionMessage(ex).Message);
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
@ -281,6 +280,9 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List", e.Message);
if (e.InnerException != null)
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TB_PRICE_CONTROLLER), "Get_TB_PRICE_List(Exception)", LogHelper.GetExceptionMessage(e).Message);
throw e;
}
}

4
北京北汽/SCP/Properties/AssemblyInfo.cs

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// 可以指定所有值,也可以使用“修订号”和“内部版本号”的默认值,
// 方法是按如下所示使用 "*":
[assembly: AssemblyVersion("1.23.1222.1")]
[assembly: AssemblyFileVersion("1.23.1222.1")]
[assembly: AssemblyVersion("1.23.1225.1")]
[assembly: AssemblyFileVersion("1.23.1225.1")]

23
北京北汽/Utils/LogHelper.cs

@ -94,6 +94,29 @@ namespace CK.SCP.Utils
break;
}
}
public static void WriteSql(string path, string content)
{
try
{
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string fileName = $"{path}//{DateTime.Now:yyyyMMdd}.log";
using (var sw = new StreamWriter(fileName, true, Encoding.Unicode))
{
sw.WriteLine($"{DateTime.Now:HH:mm:ss fff}\t{content}");
sw.WriteLine($"-----------------------------------------{Environment.NewLine}");
}
}
catch (Exception ex)
{
string exMsg = ex.ToString();
//MessageBox.Show(ex.ToString());
}
}
public enum LogType
{
Debug,

Loading…
Cancel
Save