using System.Data;
using System.Data.SqlClient;
using System.Web;
using Common;

namespace LogisticsSystem.Control.Helper
{
    public static class LogHelper
    {
        public static void Log(string log)
        {
            var sql = "insert into SysLog(userid,remark)  values(@userid,@remark)";
            var userid = string.Empty;
            if ((string) HttpContext.Current.Session["Userid"] != "" && HttpContext.Current.Session["Userid"] != null)
            {
                userid = (string) HttpContext.Current.Session["Userid"];
            }
            else
            {
                log = "有人试图没有登陆,执行程序操作:"+log;
            }
           SqlHelper.ExecSql(sql, new SqlParameter("@userid",userid ),new SqlParameter( "@remark",log));
        }
    }
}