/// <summary>
 /// 
 /// </summary>
 /// <param name="begin"></param>
 /// <param name="end"></param>
 /// <param name="typeID"></param>
 /// <param name="code"></param>
 /// <returns></returns>
 internal List<Business.SystemLog> GetByCodeAndTime(DateTime begin, DateTime end, int typeID, string code)
 {
     SqlConnection connection = new SqlConnection(DBConnection.DBConnection.Connection);
     DS.SystemLogDataTable tb = null;
     try
     {
         DSTableAdapters.SystemLogTableAdapter adap = new DSTableAdapters.SystemLogTableAdapter();
         adap.Connection = connection;
         tb = adap.GetByCodeAndTime(begin, typeID, end, code);
     }
     catch (Exception ex)
     { }
     finally
     {
         connection.Dispose();
     }
     return this.MapSystemLog(tb);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <param name="ipAddress"></param>
        /// <param name="typeID"></param>
        /// <returns></returns>
        internal List<Business.SystemLog> GetByIPAddressAndType(DateTime begin, DateTime end, string ipAddress, int typeID)
        {
            SqlConnection connection = new SqlConnection(DBConnection.DBConnection.Connection);
            DS.SystemLogDataTable tb = null;
            DSTableAdapters.SystemLogTableAdapter adap = new DSTableAdapters.SystemLogTableAdapter();

            try
            {
                connection.Open();
                adap.Connection = connection;
                tb = adap.GetByIPAddressAndType(ipAddress.Trim(), typeID, begin, end);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                adap.Connection.Close();
                connection.Close();
            }

            return this.MapSystemLog(tb);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="systemLog"></param>
        /// <returns></returns>
        internal bool InsertLog(Business.SystemLog systemLog)
        {
            SqlConnection connection = new SqlConnection(DBConnection.DBConnection.Connection);
            int rowAffect=0;
            try
            {
                DSTableAdapters.SystemLogTableAdapter adap = new DSTableAdapters.SystemLogTableAdapter();
                adap.Connection = connection;
                connection.Open();
                rowAffect = adap.Insert(systemLog.TypeID, systemLog.LogContent, systemLog.LogDay, systemLog.Comment, systemLog.IPAddress, systemLog.InvestorCode); ;

            }
            catch (Exception ex)
            {

            }
            finally
            {
                connection.Close();
                connection.Dispose();
            }
            if (rowAffect == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }