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.

81 lines
2.5 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Stone.WinBiz.BasicData;
using Stone.Entity;
using System.Windows.Forms;
using Stone.Common;
using System.Data;
namespace Stone.WinBiz.JISData
{
public class F_JIS_Log : F_Base
{
public F_JIS_Log()
{
this.type = "JISLog";
this.name = "排序数据_操作日志";
this.entity = new Entity_t_JIS_Log();
this.strOrder = "[ID] desc";
}
public override void GetView(DataGridView dgv)
{
dgv.DataSource = dsMain.Tables[0];
dgv.Columns["ID"].Visible = false; //隐藏ID列
dgv.Columns["FileType"].HeaderText = "类型";
dgv.Columns["FileName"].HeaderText = "文件名/用户名";
dgv.Columns["StartTime"].HeaderText = "开始时间"; dgv.Columns["StartTime"].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
dgv.Columns["EndTime"].HeaderText = "结束时间"; dgv.Columns["EndTime"].DefaultCellStyle.Format = "HH:mm:ss";
dgv.Columns["ProcessState"].HeaderText = "状态";
dgv.Columns["Memo"].HeaderText = "备注";
MyGridViewStyle.GetGridViewState(dgv, "基础资料" + type);
MyGridViewStyle.SetDataGridMenuCommon(dgv);
}
public static string WriteLogsStart(string Type)
{
try
{
Entity_t_JIS_Log t_JIS_Log = new Entity_t_JIS_Log();
DataRow drLog = t_JIS_Log.Table.NewRow();
drLog["FileType"] = Type;
drLog["FileName"] = User.UserInfo.UserName;
drLog["StartTime"] = DateTime.Now;
drLog = t_JIS_Log.Add(drLog);
return drLog["ID"].ToString();
}
catch
{
}
return "0";
}
public static void WriteLogsEnd(string LogID, bool ProcessState, string Memo)
{
try
{
Entity_t_JIS_Log t_JIS_Log = new Entity_t_JIS_Log();
DataTable dtLog = t_JIS_Log.GetData($"[ID]={LogID}").Tables[0];
if (dtLog.Rows.Count > 0)
{
dtLog.Rows[0]["ProcessState"] = ProcessState ? "Success" : "Failed";
dtLog.Rows[0]["EndTime"] = DateTime.Now;
dtLog.Rows[0]["Memo"] = Memo;
t_JIS_Log.Edit(dtLog.Rows[0]);
}
}
catch
{
}
}
}
}