public static void ToEntity(DT.StateLog source, StateLog target) { if ((source != null) && (target != null)) { target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = source.State; target.UserId = source.UserId; } }
public Guid AddStateLog(DT.StateLog dto) { using (var db = CreateContext()) { var entity = Convert.ToEntity(dto); db.StateLogs.InsertOnSubmit(entity); db.SubmitChanges(); return(entity.StateLogId); } }
public static StateLog ToEntity(DT.StateLog source) { if (source == null) { return(null); } var entity = new StateLog(); ToEntity(source, entity); return(entity); }
public void UpdateStateLog(DT.StateLog dto) { using (var db = CreateContext()) { var entity = db.StateLogs.FirstOrDefault(x => x.StateLogId == dto.Id); if (entity == null) { db.StateLogs.InsertOnSubmit(Convert.ToEntity(dto)); } else { Convert.ToEntity(dto, entity); } db.SubmitChanges(); } }