//增加操作日志 public HttpResponseMessage Post_Log([FromBody] string value) { string userid = UtilFunction.GetCookie("uid"); string username = UtilFunction.GetCookie("uname"); string roleid = UtilFunction.GetCookie("roleid"); string rolename = Convert.ToString(SqlHelpers.ExecuteScalar("select rolename from angel_sys_role where id = '" + roleid + "'")); string logposition = value.Split('"')[5]; string operationtype = value.Split('"')[9]; try { int count = Convert.ToInt32(SqlHelpers.ExecuteScalar("SELECT COUNT(*) FROM angel_sys_operationlog")); int ID = 0; if (count == 0) { ID = 1; } else { ID = Convert.ToInt32(SqlHelpers.ExecuteScalar("SELECT MAX(ID) FROM angel_sys_operationlog")) + 1; } string sql = "INSERT INTO angel_sys_operationlog VALUES (" + ID + ", '" + userid + "', '" + username + "', '" + roleid + "','" + rolename + "','" + logposition + "','" + operationtype + "','" + value.ToString() + "','" + username + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')"; SqlHelpers.ExecuteNonQuery(sql); StringBuilder result = new StringBuilder(); result.Append("{"); string code = "\"code\":{{\"id\":{0},\"msg\":\"{1}\"}}"; code = string.Format(code, 1, "成功"); result.Append(code); result.Append("}"); return(GetJSONMessage(result.ToString())); } catch (Exception er) { return(GetJSONMessage("")); } }
/// <summary> /// 获取总条数 /// </summary> public object counttotal() { string sql = " select count(*) from angel_sys_loginlog"; return(SqlHelpers.ExecuteScalar(sql)); }
public object ExecuteScalar(string sql) { return(SqlHelpers.ExecuteScalar(sql)); }