You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Mobile/DAL/DBLog.cs

46 lines
1.4 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
using System.Configuration;
namespace DSWeb.Areas.Mobile.DAL
{
public class DBLog
{
public static void Log ( string info1 = "", string info2 = "", string info3 = "" )
{
var AllowDBLog = ConfigurationManager.AppSettings["AllowDBLog"];
if (AllowDBLog==null)
{
return;
}
else
{
if (AllowDBLog.ToString()=="0")
{
return;
}
else
{
info1 = info1 == null ? "" : info1;
info2 = info2 == null ? "" : info2;
info3 = info3 == null ? "" : info3;
string sql = "insert into WeChatHandle (gid,info1,info2,info3) values ('" + Guid.NewGuid() + "','" + change(info1) + "','" + change(info2) + "','" + change(info3) + "')";
Database db = DatabaseFactory.CreateDatabase();
db.ExecuteNonQuery(CommandType.Text, sql);
}
}
}
private static string change (string str ) {
string rst = str.Replace(",", "$");
rst = rst.Replace("'", "*");
rst = rst.Replace("\"", "#");
return rst;
}
}
}