using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Configuration; using MyShippingWeb.Classes; 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 == "" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : info3; string sql = "insert into WeChatHandle (gid,info1,info2,info3) values ('" + Guid.NewGuid() + "','" + change(info1) + "','" + change(info2) + "','" + change(info3) + "')"; SQLHelperDS.ExcuteSQL(sql); } } } private static string change (string str ) { string rst = str.Replace(",", "$"); rst = rst.Replace("'", "*"); rst = rst.Replace("\"", "#"); return rst; } } }