You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
using System;
|
|
using PEIS.Utils;
|
|
|
|
namespace PEIS.Entity
|
|
{
|
|
public class Log : ObjectData
|
|
{
|
|
public override String TableName => "Log";
|
|
|
|
public DateTime Time { get; set; }
|
|
public String Operator { get; set; }
|
|
public String Content { get; set; }
|
|
|
|
/// <summary>
|
|
/// 1=增加(CREATE)、2=更新(UPDATE)、3=删除(DELETE)、4=错误(ERROR)
|
|
/// </summary>
|
|
public String Type { get; set; }
|
|
|
|
public Log()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 日志
|
|
/// </summary>
|
|
/// <param name="content">内容</param>
|
|
/// <param name="type">1=增加(CREATE)、2=更新(UPDATE)、3=删除(DELETE)、4=错误(ERROR)</param>
|
|
public Log(string content, string type)
|
|
{
|
|
switch (type)
|
|
{
|
|
case "1":
|
|
type = "CREATE";
|
|
break;
|
|
|
|
case "2":
|
|
type = "UPDATE";
|
|
break;
|
|
|
|
case "3":
|
|
type = "DELETE";
|
|
break;
|
|
|
|
case "4":
|
|
type = "ERROR";
|
|
break;
|
|
}
|
|
if (content.Length > 1024)
|
|
{
|
|
content = content.Substring(0, 1024);
|
|
}
|
|
Time = DateTime.Now;
|
|
Operator = $@"{Global.currentUser?.Code}-{Global.currentUser?.Name}";
|
|
Content = content;
|
|
Type = type;
|
|
}
|
|
}
|
|
} |