private static bool CheckAuthLogin( DbConnection conn, string userId, out int success, out DateTime?currentTime, out DateTime?loginTime, out DateTime?hangUpTime ) { success = 0; currentTime = null; loginTime = null; hangUpTime = null; bool retVal = false; const string strQuery = "SELECT SUCCESS, SYSDATE, LOGINTIME, HANGUPTIME FROM ASPIRIN.AUTHLOGIN " + "WHERE USERID = :UserId AND RECID = (SELECT MAX(RECID) FROM ASPIRIN.AUTHLOGIN WHERE USERID = :UserId)"; using (DbCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = strQuery; DaoHelper.AddInputParameter(cmd, "UserId", userId); using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { success = Convert.ToInt32(reader[0]); currentTime = reader[1] as DateTime?; loginTime = reader[2] as DateTime?; hangUpTime = reader[3] as DateTime?; retVal = true; } } } return(retVal); }
private static void AddInputParameter(DbCommand cmd, string name, object value) { DaoHelper.AddInputParameter(cmd, name, value); }