2023-09-26

This commit is contained in:
2023-09-26 15:20:47 +08:00
parent 1c28e4069e
commit d5d459bf1c
77 changed files with 10228 additions and 3160 deletions
+31
View File
@@ -74,6 +74,37 @@ namespace BLL
}
}
/// <summary>
/// 添加操作日志
/// </summary>
/// <param name="userId"></param>
/// <param name="opLog"></param>
public static void AddLog(string userId, string opLog)
{
//SetOvertime(userId);
Model.SGGLDB db = Funs.DB;
Model.Sys_Log log = new Model.Sys_Log
{
LogId = SQLHelper.GetNewID(typeof(Model.Sys_Log)),
HostName = Dns.GetHostName()
};
IPAddress[] ips = Dns.GetHostAddresses(log.HostName);
if (ips.Length > 0)
{
foreach (IPAddress ip in ips)
{
if (ip.ToString().IndexOf('.') != -1)
{
log.Ip = ip.ToString();
}
}
}
log.OperationTime = DateTime.Now;
log.OperationLog = opLog;
log.UserId = userId;
db.Sys_Log.InsertOnSubmit(log);
db.SubmitChanges();
}
/// <summary>
/// 根据项目Id删除所有相关日志信息
/// </summary>
+42
View File
@@ -8,8 +8,10 @@
public static class SysConstSetService
{
private static string _CNCECPath;
private static string _CncecEsbPath;
private static string _CNCECToken;
private static string _CNCECTokenExTime;
private static string _ClientId;
public static string CNCECPath
{
@@ -31,6 +33,46 @@
_CNCECPath = value;
}
}
public static string CncecEsbPath
{
get
{
var sysSet5 = (from x in Funs.DB.Sys_Const where x.ConstText == "集团ESB地址" select x).ToList().FirstOrDefault();
if (sysSet5 != null)
{
_CncecEsbPath = sysSet5.ConstValue;
}
else
{
_CncecEsbPath = "";
}
return _CncecEsbPath;
}
set
{
_CncecEsbPath = value;
}
}
public static string ClientId
{
get
{
var sysSet5 = (from x in Funs.DB.Sys_Const where x.ConstText == "ClientId" select x).ToList().FirstOrDefault();
if (sysSet5 != null)
{
_ClientId = sysSet5.ConstValue;
}
else
{
_ClientId = "";
}
return _ClientId;
}
set
{
_ClientId = value;
}
}
public static string CNCECToken
{
get
+143
View File
@@ -0,0 +1,143 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SysHttplogService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.Sys_HttpLog> GetSys_HttpLogByModle(Model.Sys_HttpLog table)
{
var q = from x in db.Sys_HttpLog
where
(string.IsNullOrEmpty(table.HttpLogId) || x.HttpLogId.Contains(table.HttpLogId)) &&
(string.IsNullOrEmpty(table.UserName) || x.UserName.Contains(table.UserName)) &&
(string.IsNullOrEmpty(table.HttpUrl) || x.HttpUrl.Contains(table.HttpUrl)) &&
(string.IsNullOrEmpty(table.LogTxt) || x.LogTxt.Contains(table.LogTxt)) &&
(string.IsNullOrEmpty(table.MeThod) || x.MeThod.Contains(table.MeThod)) //&&
// (!table.LogTime.HasValue || (x.LogTime.HasValue && x.LogTime.Value.Date == table.LogTime.Value.Date))
select x
;
if (table.LogTime.HasValue)
{
q=q.Where(x=> x.LogTime.Value.Date.CompareTo(table.LogTime.Value.Date) == 0);
}
return q.OrderByDescending(x=>x.LogTime ).ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.Sys_HttpLog table, Grid Grid1)
{
var q = GetSys_HttpLogByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
q= q.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.HttpLogId,
x.LogTime,
x.UserName,
x.HttpUrl,
x.LogTxt,
x.MeThod,
};
}
#endregion
public static Model.Sys_HttpLog GetSys_HttpLogById(string HttpLogId)
{
return db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == HttpLogId);
}
public static void AddSys_HttpLog(Model.Sys_HttpLog newtable)
{
Model.Sys_HttpLog table = new Model.Sys_HttpLog
{
HttpLogId = newtable.HttpLogId,
LogTime = newtable.LogTime,
UserName = newtable.UserName,
HttpUrl = newtable.HttpUrl,
LogTxt = newtable.LogTxt,
MeThod = newtable.MeThod,
};
db.Sys_HttpLog.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSys_HttpLog(List<Model.Sys_HttpLog> newtables)
{
db.Sys_HttpLog.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSys_HttpLog(Model.Sys_HttpLog newtable)
{
Model.Sys_HttpLog table = db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == newtable.HttpLogId);
if (table != null)
{
table.HttpLogId = newtable.HttpLogId;
table.LogTime = newtable.LogTime;
table.UserName = newtable.UserName;
table.HttpUrl = newtable.HttpUrl;
table.LogTxt = newtable.LogTxt;
table.MeThod = newtable.MeThod;
db.SubmitChanges();
}
}
public static void DeleteSys_HttpLogById(string HttpLogId)
{
Model.Sys_HttpLog table = db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == HttpLogId);
if (table != null)
{
db.Sys_HttpLog.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSys_HttpLog()
{
if (db.Sys_HttpLog != null)
{
db.Sys_HttpLog.DeleteAllOnSubmit(db.Sys_HttpLog);
db.SubmitChanges();
}
}
}
}