public static string Adress(string userip) { string useradress; DataTable dt; using (CDBAccess cn1 = new CDBAccess(System.Configuration.ConfigurationManager.AppSettings["OledbConStrConfig"])) { using (dt = cn1.ExecQuery("select Loc1 from IpRegion where IntIp=dbo.IP2Int(?)", new OleDbParameter[] { new OleDbParameter("@p", userip) })) { if (dt.Rows.Count > 0) { useradress = dt.Rows[0][0].ToString(); } else { useradress = "未知区域"; } } } return(useradress); }
public static void operationlog(string username, string useraction, string useridpic, string usertype, string user_ip) { using (CDBAccess cn1 = new CDBAccess(System.Configuration.ConfigurationManager.AppSettings["OledbConStrLog"])) { //记录用户登录日志 // string username = dt.Rows[0]["user_id"].ToString(); //string useraction = "用户登录"; //string useridpic = dt.Rows[0]["ad_pic"].ToString(); //string usertype = "True"; //string userip = "122.0.66.184"; string address = Adress(user_ip); Dictionary <string, string> dc1 = new Dictionary <string, string>(); dc1.Add("userid", username); dc1.Add("user_action", useraction); dc1.Add("user_type", usertype); dc1.Add("user_adpic", useridpic); dc1.Add("user_ip", user_ip); dc1.Add("user_area", address); dc1.Add("user_datetime", DateTime.Now.ToString()); cn1.ExecSQL("insert into _user_action_log(user_id,user_action,user_type,user_adpic,user_ip,user_area,user_datetime) values(?,?,?,?,?,?,?)", cn1.sqlparameter_append(dc1)); } }
public virtual void afterSave(CDBAccess cda) { }
public virtual void beforSave(CDBAccess cda) { }