/// <summary> /// /// </summary> /// <returns></returns> internal List<Business.InvestorLog> GetAllInvestorLog() { List<Business.InvestorLog> Result = new List<Business.InvestorLog>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InvestorLogTableAdapter adap = new DSTableAdapters.InvestorLogTableAdapter(); DS.InvestorLogDataTable tbInvestorLog = new DS.InvestorLogDataTable(); try { conn.Open(); adap.Connection = conn; tbInvestorLog = adap.GetData(); if (tbInvestorLog != null) { int count = tbInvestorLog.Count; for (int i = 0; i < count; i++) { Business.InvestorLog newInvestorLog = new Business.InvestorLog(); newInvestorLog.InvestorLogID = tbInvestorLog[i].InvestorLogID; newInvestorLog.InvestorInstance.InvestorID = tbInvestorLog[i].InvestorID; newInvestorLog.IP = tbInvestorLog[i].IP; newInvestorLog.Message = tbInvestorLog[i].Message; newInvestorLog.Status = tbInvestorLog[i].Status; newInvestorLog.Time = tbInvestorLog[i].Time; Result.Add(newInvestorLog); } } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <param name="InvestorLogID"></param> /// <returns></returns> internal Business.InvestorLog GetInvestorLogByID(int InvestorLogID) { Business.InvestorLog Result = new Business.InvestorLog(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InvestorLogTableAdapter adap = new DSTableAdapters.InvestorLogTableAdapter(); DS.InvestorLogDataTable tbInvestorLog = new DS.InvestorLogDataTable(); try { conn.Open(); adap.Connection = conn; tbInvestorLog = adap.GetInvestorLogByID(InvestorLogID); if (tbInvestorLog != null) { Result.InvestorLogID = tbInvestorLog[0].InvestorLogID; Result.InvestorInstance.InvestorID = tbInvestorLog[0].InvestorID; Result.IP = tbInvestorLog[0].IP; Result.Message = tbInvestorLog[0].Message; Result.Status = tbInvestorLog[0].Status; Result.Time = tbInvestorLog[0].Time; } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }