/// <summary> /// /// </summary> /// <returns></returns> internal List<Business.SystemLog> GetData() { List<Business.SystemLog> result = new List<Business.SystemLog>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.TickLogTableAdapter adap = new DSTableAdapters.TickLogTableAdapter(); DS.TickLogDataTable tbTickLog = new DS.TickLogDataTable(); try { tbTickLog = adap.GetData(); if (tbTickLog != null) { int count = tbTickLog.Count; for (int i = 0; i < count; i++) { Business.SystemLog newSystemLog = new Business.SystemLog(); newSystemLog.ID = tbTickLog[i].TickLogID; newSystemLog.LogContent = tbTickLog[i].LogContent; newSystemLog.LogDay = tbTickLog[i].Day; newSystemLog.InvestorCode = tbTickLog[i].InvestorCode; newSystemLog.Comment = tbTickLog[i].Comment; newSystemLog.IPAddress = tbTickLog[i].IPAddress; newSystemLog.TypeID = tbTickLog[i].LogTypeID; result.Add(newSystemLog); } } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return result; }
/// <summary> /// /// </summary> /// <param name="tb"></param> /// <returns></returns> private List<Business.SystemLog> MapSystemLog(DS.SystemLogDataTable tb) { if (tb == null || tb.Rows.Count == 0) { return null; } List<Business.SystemLog> systemLogList = new List<Business.SystemLog>(); int count = tb.Rows.Count; for (int i = 0; i < count; i++) { Business.SystemLog systemLog = new Business.SystemLog(); systemLog.ID = tb[i].SystemLogID; systemLog.TypeID = tb[i].LogTypeID; systemLog.Comment = tb[i].Comment; systemLog.LogContent = tb[i].LogContent; systemLog.LogDay = tb[i].Day; systemLog.IPAddress = tb[i].IPAddress; systemLog.InvestorCode = tb[i].InvestorCode; systemLogList.Add(systemLog); } return systemLogList; }