本文整理汇总了C#中LogType.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# LogType.GetHashCode方法的具体用法?C# LogType.GetHashCode怎么用?C# LogType.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogType
的用法示例。
在下文中一共展示了LogType.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteToDbAndFile
public static void WriteToDbAndFile(dynamic ex, LogType type, string orgId = null, string IatiIdentifier = null, string message = null)
{
try
{
if (message == null) message = ex.Message;
Log log = new Log();
log.DateTime = DateTime.Now;
log.OrgId = orgId;
log.IatiIdentifier = IatiIdentifier;
log.Message = message;
log.LogType = type.GetHashCode();
using (TextWriter writer = new StringWriter())
{
try
{
new JsonSerializer().Serialize(new JsonTextWriter(writer), ex);
log.ExceptionObj = writer.ToString();
}
catch { }
}
new AimsDbIatiDAL().InsertLog(log);
}
catch { }
finally
{
Write(type + " " + message);
}
}
示例2: QueryOperLog
public PagedList<Log> QueryOperLog(PageView view, string qtext, string optype, LogType logtype)
{
string where = "";
if (logtype != LogType.None)
{
where += " and LogType=" + logtype.GetHashCode();
}
if (!string.IsNullOrEmpty(optype))
{
where += " and OperateCode='" + optype + "'";
}
if (!string.IsNullOrEmpty(qtext))
{
where += " and [Content] like '%" + qtext + "%'";
}
StoredProcedure sp = StoredProcedures.SP_PAGESELECT(where, view.PageSize, view.PageIndex
, "[Logs]", "[Id],[Content],[OperateCode],[LogType],[OperateUID],[OperateName],[IPAddress],[OperateTime]", "[Id]",
"Order By Id DESC");
var pl = new PagedList<Log>();
pl.DataList = new List<Log>();
using (IDataReader dr = base.SPExecuteDataReader(sp))
{
while (dr.Read())
{
Log log = new Log();
log.Id = dr.GetInt32(0);
log.Content = dr.IsDBNull(1) ? "" : dr.GetString(1);
log.OperateCode = dr.GetString(2);
log.LogType = dr.GetByte(3);
log.OperateUID = dr.GetString(4);
log.OperateName = dr.GetString(5);
log.IPAddress = dr.GetString(6);
log.OperateTime = dr.GetDateTime(7);
log.IsNew = false;
pl.DataList.Add(log);
}
}
if (view.PageIndex == 0)
{
pl.Total = Convert.ToInt32(sp.GetParameterValue(sp.ParamsCount - 1));
}
pl.PageIndex = view.PageIndex;
return pl;
}
示例3: Log
/// <summary>
/// 记录操作日志
/// </summary>
/// <param name="opType">操作类型</param>
/// <param name="content">日志内容</param>
/// <param name="logtype">日志类型</param>
public void Log(string opType, string content, LogType logtype)
{
Log log = new Log();
log.LogType = Convert.ToByte(logtype.GetHashCode());
log.Content = content;
log.IPAddress = MyContext.UserIP;
log.OperateName = MyContext.CurrentUser.FullName;
log.OperateTime = DateTime.Now;
log.OperateCode = opType;
log.OperateUID = MyContext.Identity;
Log(log);
}