예제 #1
0
        public void Logger(string position, string target, string type, object message)
        {
            using (var context = Db.Context().UseSharedConnection(true))
            {
                var user = FormsAuth.GetUserData();
                context.Insert("sys_log")
                .Column("UserCode", user.UserCode)
                .Column("UserName", user.UserName)
                .Column("Position", position)
                .Column("Target", target)
                .Column("Type", type)
                .Column("Message", JsonConvert.SerializeObject(message.ToString().Replace("'", "&")))
                .Column("Date", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))
                .Execute();
//                string sql = string.Empty;
//                sql = string.Format(@"insert into [Zephyr.Sys].[dbo].[sys_log](UserCode,UserName,Position,Target,Type,Message,Date)
//                values('{0}','{1}','{2}','{3}','{4}','{5}',getdate())",user.UserCode,user.UserName,position,target,type,message);
//                int i = 0;
//                i = context.Insert(sql).Execute();
            }
        }