/// <summary> /// 新增日志 /// </summary> /// <param name="request"></param> /// <returns></returns> public bool AddLog(AddLog request) { using (var db = DbFactory.Open()) { var info = new LogInfo(); info.UserName = request.UserName; info.tm = DateTime.Now; info.adcd = !string.IsNullOrEmpty(request.adcd)? request.adcd:adcd; info.Operation = request.Operation; info.RealName = GetUserByIdOrUserName(new GetUserByIdOrUserName() { UserName = request.UserName }).RealName; info.OperationType = request.OperationType; if (request.Id != null) { info.Id = request.Id.Value; return(db.Update(info) == 1); } else { return(db.Insert(info) == 1); } } }
/// <summary> /// 添加日志 /// </summary> /// <param name="status">状态 AddLog.Status</param> /// <param name="str">内容</param> private string InsertLog(string str, Enum status) // AddLog.Status.Fail { AddLog log = new AddLog(log_richtxt, status, str); this.Text = log.log; return(log.log); }
public void DoAddText(string msg) { if (lstLog.InvokeRequired) { AddLog del = new AddLog(AddText); lstLog.Invoke(del, msg); } else { clinetLog += msg; lstLog.Items.Add(msg); } }
public FtpHelper(AddLog addLog) { _server = ConfigurationManager.AppSettings["FtpServer"]; _username = ConfigurationManager.AppSettings["FtpUser"]; _password = ConfigurationManager.AppSettings["FtpPassword"]; _9HitPatch = ConfigurationManager.AppSettings["Ftp9HitPatch"]; _lolbotPatch = ConfigurationManager.AppSettings["FtpLolbotPatch"]; _sshFolderBase = ConfigurationManager.AppSettings["SSHFolderBase"]; _lolbotFolderBase = ConfigurationManager.AppSettings["LolbotFolderBase"]; _numberVPS = int.TryParse(ConfigurationManager.AppSettings["NumberVPS"], out var number) ? number : 1; _numberVPS2 = int.TryParse(ConfigurationManager.AppSettings["NumberVPS2"], out number) ? number : 1; _event = addLog; }
public object AdAgencyLog([FromBody] AddLog addLog) { _contextFirebaseEntities.tbl_AdAgencyLog.Add(new tbl_AdAgencyLog() { AddUrl = addLog.LogUrl, ServiecName = addLog.ServiecName, TimeStamp = DateTime.Now }); _contextFirebaseEntities.SaveChanges(); return(Ok(new { result = "Success" })); }
private void BtnAlarm_Click(object sender, EventArgs e) { if (objFrmAlarm == null) { objFrmAlarm = new FrmAlarm(); //第四步:绑定委托 myAddLog = objFrmAlarm.AddLog; } else { objFrmAlarm.InitialDGV(Convert.ToInt32(new IniConfigHelper().ReadIniData("历史报警显示条数", "Count", "", CommonMethods.FilePath))); objFrmAlarm.BringToFront(); } objFrmAlarm.Show(); }
public bool Post(AddLog request) { return(SysManager.AddLog(request)); }
void ReceiveLogEvent(AddLog msg) { ReceiveLog(msg.logmsg); }
/// <summary> /// the constructor. /// </summary> private ModelCommunication() { ///getting a tcpClient instance. client = TcpClientChannel.GetInstance(); //if not already connected then connect. if (!TcpClientChannel.connected) { try { //connecting to the server and setting the connected boolean to true. TcpClientChannel.Connect(8000); connected = true; } catch (Exception) { //connection failed. connected = false; } } //If we connected we will continue if (TcpClientChannel.connected) { try { Task t = new Task(() => { //Receiving messages. while (true) { MessageToClient message; //getting all things that relate to the message. try { message = client.recieveMessage(); } catch (Exception) { connected = false; return; } int id = message.TypeMessage; string content = message.Content; bool allClients = message.AllClients; //Check to who transfer the message if (id == (int)SendClientEnum.AddLog) { AddLog?.Invoke(this, content); } if (id == (int)SendClientEnum.RemoveHandler) { RemoveHandler?.Invoke(allClients, content); } if (id == (int)SendClientEnum.GetConfig) { GetConfig?.Invoke(this, content); } if (id == (int)SendClientEnum.GetLogs) { GetLogs?.Invoke(this, content); } } }); t.Start(); } catch (Exception) { connected = false; } } }
private void CallLogEvent(string message) { AddLog?.Invoke(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ", " + message); }
public void Log(string text) { AddLog f = Logint; Invoke(f, text); }