public async Task LogToDB(LogDTO log) { var response = await _httpService.Post <LogDTO>($"{url}/LogToDB", log); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } }
public void Send() { var logDTO = new LogDTO() { Message = "Unity speaks too!" }; _client.Send("Log", logDTO); }
public LogDTOTest() { DateTime currentTime = DateTime.Now; _logDTO = new LogDTO() { StartDate = currentTime, EndDate = currentTime.AddHours(4), Reason = "Testing the Reason", SpecialInstructions = "Testing the Special Instructions", CreatedByUserID = "mickey.mouse" }; }
public HttpResponseMessage Get(int Id) { LogDTO selectedTitle = service.getLog(Id); if (selectedTitle == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Id + sysLanguage.CompanyTitlesControllerStrings.id_title)); } return(Request.CreateResponse(HttpStatusCode.OK, selectedTitle)); }
public void WarnMethodTest() { LogDTO mock = new LogDTO() { Module = "LoggerServiceTest", Function = "MethodTest", Message = "Test message" }; _sut.Warn(mock); _mockLogger.Received(1).Warn(Arg.Is <string>(s => s.Contains(mock.Module) && s.Contains(mock.Function) && s.Contains(mock.Message) && s.Contains("127.0.0.1"))); }
public ActionResult <LogDTO> Post([FromBody] LogDTO value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Log log = mapper.Map <Log>(value); return(Ok(mapper.Map <LogDTO>(service.Save(log)))); }
public LogDTO PostLog(LogDTO log) { if (log is EventLogDTO) { return(logService.AddEventLog(log as EventLogDTO)); } else { return(logService.AddExceptionLog(log as ExceptionLogDTO)); } }
protected static void Log(string pageName, string level, string message) { LogDAO logDAO = new LogDAO(); LogDTO dto = new LogDTO(); dto.System = "LDAP"; dto.Page = pageName; dto.Level = level; dto.Message = message; logDAO.Add(dto); }
/* * private Log ToLog(DataRow row) * { * Log log = new Log(); * log.Id = (long)row["Id"]; * log.Message = (string)row["Message"]; * log.UserId = (long)row["UserId"]; * log.CreateDateTime = (DateTime)row["CreateDateTime"]; * return log; * } * * public Log GetById(long id) * { * DataTable dt = SqlHelper.ExecuteQuery("select * from T_Logs where Id=@Id", * new SqlParameter("@Id",id)); * if(dt.Rows.Count<=0) * { * return null; * } * else if(dt.Rows.Count>1) * { * throw new ApplicationException("找到多个id重复的数据"); * } * else * { * DataRow row = dt.Rows[0]; * return ToLog(row); * } * } * * public IEnumerable<Log> GetAll() * { * DataTable dt = SqlHelper.ExecuteQuery("select * from T_Logs"); * List<Log> list = new List<Log>(); * foreach(DataRow row in dt.Rows) * { * Log log = ToLog(row); * list.Add(log);//list.Add(ToLog(row)); * } * return list; * }*/ private LogDTO ToLogDTO(DataRow row) { LogDTO log = new LogDTO(); log.Id = (long)row["Id"]; log.Message = (string)row["Message"]; log.UserName = (string)row["UserName"]; log.CreateDateTime = (DateTime)row["CreateDateTime"]; log.UserPhoneNum = (string)row["PhoneNum"]; return(log); }
/// <inheritdoc /> public async Task <IList <LogDTO> > GetPerItem(int id) { if (await items.AllAsync(s => s.Id != id)) { throw new ArgumentException(); } return(await itemLogs.AsNoTracking().Include(s => s.Item) .Where(s => s.Item.Id == id) .Select(s => LogDTO.FromItemLog(s)) .ToListAsync()); }
public IHttpActionResult GetLog(int id) { LogDTO log = _logService.GetLogById(id); if (log == null) { return(NotFound()); } return(Ok(log)); }
/// <summary> /// Convierte el DTO en BM. /// </summary> /// <param name="log"></param> /// <returns></returns> private LogBM ConvertIntoBusinessModel(LogDTO log) { LogBM result = new LogBM(); result.Id = log.id; result.LogLevel = log.logLevel.ToString(); result.Action = log.action; result.Description = log.description; result.Entity = log.entity; result.Created = log.created; return result; }
public void RegistrarLog(string msg, int pro_id) { var dto = new LogDTO(); if (pro_id > 0) { dto.PRO_ID = pro_id; } dto.LOG_DESCRICAO = msg; dto.LOG_DATA = DateTime.Now; dao.Save(dto); }
private void createLog(int logType, long amount, string details, string cardNoTo) { /* * LogTypeID * 1-Withdraw * 2-Transfer * 3-Check balance * 4-Change PIN */ LogDTO newLog = new LogDTO(10000, atmIDLocal, logType, cardinfor.cardNo, DateTime.Now, amount, details, cardNoTo); bool checkCreateLog = logBUL.WriteLog(newLog); }
public void ToLogDTo(string username, string message, LogTypeHelper logTypeHelper) { LogDTO logDTO = new LogDTO(); logDTO.UserName = username; logDTO.Type = logTypeHelper.Value; logDTO.Message = message; logDTO.IPAddress = ""; logDTO.CreationDate = DateTime.Now; _logService.Add(logDTO); }
private LogDTO ToDto(LogEntity entity) { LogDTO dto = new LogDTO { Id = entity.Id, MessageId = entity.MessageId, Contents = entity.Contents, UpdateTime = entity.UpdateTime }; return(dto); }
private LogDTO Resolve(List <String> item) { LogDTO result = new LogDTO(); result.id = int.Parse(item[0]); result.logLevel = (LogDTO.Level) int.Parse(item[1]); result.action = item[2]; result.description = item[3]; result.entity = item[4]; result.created = DateTime.Parse(item[5]); return(result); }
/// <inheritdoc /> public async Task <IList <LogDTO> > GetByUser(int id) { if (await currencyLogs.AllAsync(s => s.ShopUser.Id != id)) { throw new ArgumentException(); } return(await currencyLogs.Include(s => s.ShopUser) .Where(s => s.ShopUser.Id == id) .OrderBy(s => s.Time) .Select(s => LogDTO.FromCurrencyLog(s)).ToListAsync()); }
public void Post([FromBody] LogDTO log) { if (log.Level == "Error") { Exception ex = new ApplicationException(log.Message + ". " + log.StackTrace); _logger.LogError(ex); } if (log.Level == "Trace") { _logger.LogTrace(log.Message); } }
public LogDTO ToDTO(LogEntity entity) { LogDTO dto = new LogDTO(); dto.UserId = entity.UserId; dto.LogName = entity.LogName; dto.CreateTime = entity.CreateTime; dto.Description = entity.Description; dto.Id = entity.Id; dto.LogCode = entity.LogCode; return(dto); }
public IHttpActionResult DeleteLog(int id) { LogDTO log = _logService.GetById(id); if (log == null) { return(NotFound()); } _logService.Delete(id); return(Ok(log)); }
public HttpResponseMessage Put(LogDTO LogDTO) { LogDTO dto = service.updateLog(LogDTO); if (dto != null) { return(Request.CreateResponse(HttpStatusCode.OK, dto)); } else { return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title)); } }
public async Task <LogDTO> AddLog(LogDTO logDTO) { Log log = new Log { Action = logDTO.Action, UserId = logDTO.UserId }; await db.Logs.AddAsync(log); await db.SaveChangesAsync(); return(logDTO); }
public async Task <ResultModel <LogDTO> > GetLogInfo(int id) { try { LogDTO result = await _logService.GetLogInfoAsync(id); return(ResultModel <LogDTO> .Success(result, "查询成功")); } catch (InvalidOperationException ex) { return(ResultModel <LogDTO> .Fail(ex.Message)); } }
//IMapper mapper = new Mapper(new MapperConfiguration(cfg => cfg.CreateMap<LogDTO, Log>())); public void AddLog(LogDTO dto) { try { Log log = new Log(dto); logs.Insert(log); } catch (Exception ex) { string msg = ex.Message.ToString(); throw; } }
public void Insert(LogDTO log) { Log logResult = new Log() { Id = log.Id, Ip = log.Ip, BrowserName = log.BrowserName, PageName = log.PageName, Parameters = log.Parameters }; _repository.Insert(logResult); }
public async Task <IActionResult> Create([Bind("Id,LogDate,TimeSpent,LogDescription,JobTaskId,DoneById")] LogDTO logDTO) { if (ModelState.IsValid) { await _logManager.CreateAsync(logDTO); return(RedirectToAction(nameof(Index))); } ViewData["JobTaskId"] = new SelectList(_context.JobTasks, "Id", "TaskName", logDTO.JobTaskId); ViewData["DoneById"] = new SelectList(_context.Users, "Id", "UserName", logDTO.DoneById); return(View(logDTO)); }
public LogDTO newLog(LogDTO log) { if (!uow.GetRepository <Log>().GetAll().Any(z => z.Id == log.Id)) { var adedLog = MapperFactory.CurrentMapper.Map <Log>(log); adedLog = uow.GetRepository <Log>().Add(adedLog); uow.SaveChanges(); return(MapperFactory.CurrentMapper.Map <LogDTO>(adedLog)); } else { return(null); } }
static void Main(string[] args) { Console.WriteLine("Começando"); Console.ReadLine(); var cond = ""; while (cond != "y") { var apiClient = new ServiceClient("http://ec2-18-228-156-207.sa-east-1.compute.amazonaws.com:8080"); //var apiClient = new ServiceClient("http://localhost:8080"); //Criar levantamento e deserializar var levantamento = new LevantamentoDTO("BR 020", "Teste de levantamento"); var result = apiClient.CreateLevantamento(levantamento).Result; var text = result.Content.ReadAsStringAsync().Result; var serialized = JsonConvert.DeserializeObject <ApiResultModel <LevantamentoDTO> >(text); //CriarLogs Console.WriteLine("Criado: " + serialized.Data.Id); var trecho = File.ReadAllLines("DF_020.csv"); var anterior = new LogDTO(); for (int i = trecho.Length - 1; i > trecho.Length - 1 - 120; i -= 3) { var split = trecho[i].Split(";"); var log = new LogDTO(Convert.ToDecimal(split[0]), Convert.ToDecimal(split[1]), Convert.ToDecimal(split[3]), (int)Convert.ToDecimal(split[2])); apiClient.CreateLog(serialized.Data.Id, log); anterior = log; Console.WriteLine("Criado: " + i); Thread.Sleep(1000); } //var anterior = new LogDTO(); //for (int i = 0; i < 30; i++) //{ // Thread.Sleep(1000); // Console.WriteLine("Criado: " + i); // var log = new LogDTO(anterior.Speed, anterior.Long, anterior.Lat); // apiClient.CreateLog(serialized.Data.Id, log); // anterior = log; //} //Concluir Thread.Sleep(1000); var resultConcluded = apiClient.ConcludeLevantamento(serialized.Data.Id).Result; Console.WriteLine("Concluido!!"); Console.WriteLine("Deseja sair?"); cond = Console.ReadLine(); } }
public async Task AddLog(LogDTO logDTO) { if (logDTO == null) { throw new BusinessLogicException("Требуется лог", ""); } Log log = new Log() { Event_date = logDTO.Event_date, Exception = logDTO.Exception, Method_name = logDTO.Method_name }; await _logRepository.AddLog(log); }