Exemplo n.º 1
0
        public static void LogHistory(int userId, string userName, AdvHistoryType type, string advURL, string clientIP)
        {
            var sql =
                "INSERT INTO dbo.AcnClub_LogAdv VALUES (@userid, @username, @typeCode, @advURL, @clientIP, getdate());";

            using (var con = SQLConn.GetConnection())
            {
                var com = new SqlCommand(sql, con);
                com.Parameters.Add(new SqlParameter("@userid", userId));
                com.Parameters.Add(new SqlParameter("@username", userName));
                com.Parameters.Add(new SqlParameter("@typeCode", (int)type));
                com.Parameters.Add(new SqlParameter("@advURL", advURL == string.Empty ? (object)DBNull.Value : advURL));
                com.Parameters.Add(new SqlParameter("@clientIP",
                                                    clientIP == string.Empty ? (object)DBNull.Value : clientIP));

                con.Open();
                com.ExecuteNonQuery();
                //con.Close();
            }
        }
Exemplo n.º 2
0
        public static void LogHistory(int userId, string userName, AdvHistoryType type, string advURL, string clientIP)
        {
            var sql =
                "INSERT INTO dbo.AcnClub_LogAdv VALUES (@userid, @username, @typeCode, @advURL, @clientIP, getdate());";

            using (var con = SQLConn.GetConnection())
            {
                var com = new SqlCommand(sql, con);
                com.Parameters.Add(new SqlParameter("@userid", userId));
                com.Parameters.Add(new SqlParameter("@username", userName));
                com.Parameters.Add(new SqlParameter("@typeCode", (int) type));
                com.Parameters.Add(new SqlParameter("@advURL", advURL == string.Empty ? (object) DBNull.Value : advURL));
                com.Parameters.Add(new SqlParameter("@clientIP",
                    clientIP == string.Empty ? (object) DBNull.Value : clientIP));

                con.Open();
                com.ExecuteNonQuery();
                //con.Close();
            }
        }