//public string ConvertXMLToDataSet() //{ // //string xmlFile = System.Web.HttpContext.Current.Request.Form["xmlFile"]; // string xmlFile = "TabPageChoose.xml"; // DataSet ds = proxy.ConvertXMLToDataSet(xmlFile); //路径怎么破 // DataTable dt = ds.Tables[0]; // int totalRecord = 0; // string json = DataConverterHelper.ToJson(dt, totalRecord); // return json; //} public void SaveRequestRecord() { string moduleno = System.Web.HttpContext.Current.Request.Form["moduleno"]; string url = System.Web.HttpContext.Current.Request.Form["url"]; RequestRecordEntity record = new RequestRecordEntity(); record.Moduleno = moduleno; record.Url = url; proxy.SaveRequestRecord(record); }
public override void PreExcute(string MethodName, IDictionary <string, object> InParams) { #region 异步处理 Task.Run(() => { RequestRecordEntity requestRecord = new RequestRecordEntity() { direction = 1, // 1 WIP接收 2 WIP 推送 happenHost = WIPCommon.GetHostName(msgSource), fullFun = namespaceName + "." + MethodName, //方法名 param = JsonConvert.SerializeObject(InParams), //入参 }; Log4netHelper.WriteInfoLogByLog4Net(typeof(Log4netHelper), JsonConvert.SerializeObject(requestRecord)); requestRecordDAL.Add(requestRecord); }); //*/ #endregion }
/// <summary> /// 增加一条请求记录表数据 /// </summary> /// <param name="model">要插入的请求记录表实体</param> /// <param name="transModel">事务类</param> /// <returns>插入生成的最新主键值</returns> public void AddWithKey(RequestRecordEntity model) { try { SqlParameter param_id = new SqlParameter(); param_id.ParameterName = "@id"; param_id.SqlDbType = SqlDbType.BigInt; param_id.Direction = ParameterDirection.Output; SqlParameter[] parameters = { new SqlParameter("@host", SqlDbType.NVarChar, 50), new SqlParameter("@url", SqlDbType.NVarChar, 500), new SqlParameter("@param", SqlDbType.NVarChar, -1), new SqlParameter("@retResult", SqlDbType.NVarChar, -1), new SqlParameter("@remark", SqlDbType.NVarChar, 1000), new SqlParameter("@fullFun", SqlDbType.NVarChar, 100), new SqlParameter("@happenHost", SqlDbType.NVarChar, 100), new SqlParameter("@direction", SqlDbType.Int, -1), new SqlParameter("@key1", SqlDbType.NVarChar, 100), new SqlParameter("@key2", SqlDbType.NVarChar, 100), param_id }; parameters[0].Value = model.host; parameters[1].Value = model.url; parameters[2].Value = model.param; parameters[3].Value = model.retResult; parameters[4].Value = model.remark; parameters[5].Value = model.fullFun; parameters[6].Value = model.happenHost; parameters[7].Value = model.direction; parameters[8].Value = model.key1; parameters[9].Value = model.key2; int rowsAffected; SQLServerHelper.RunProcedure("uspWip_AddRequestRecordWithKey", parameters, out rowsAffected); } catch { } }
//public bool UserConfigDel_DefaultTab(long userid, int usertype) //{ // try // { // string sqlText = "delete from fg3_defaultopen_tab where userid = '" + userid + "' and usertype = '" + usertype + "'"; // DbHelper.ExecuteNonQuery(sqlText); // return true; // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //} public void SaveRequestRecord(RequestRecordEntity record) { record.UserId = AppInfoBase.UserID; record.Guid = Guid.NewGuid().ToString(); record.SN = NGCOM.Instance.SN; record.Frequency = 1; //不过滤userid string connstr = NG3.AppInfoBase.PubConnectString; try { DbHelper.Open(connstr); DbHelper.BeginTran(connstr); string sql = String.Format(@"select frequency from request_record where url ='{1}' and sn = '{3}'", record.UserId, record.Url, record.Moduleno, record.SN); string obj = DbHelper.GetString(connstr, sql); int frequency = 0; int.TryParse(obj, out frequency); if (frequency > 0) { sql = String.Format(@"update request_record set frequency = {0},userid = {1} where url ='{2}' and sn = '{4}'", (frequency + 1), record.UserId, record.Url, record.Moduleno, record.SN); } else { sql = String.Format(@"insert into request_record (frequency,userid,url,moduleno,sn,guid) values({0},{1},'{2}','{3}','{4}','{5}')", record.Frequency, record.UserId, record.Url, record.Moduleno, record.SN, record.Guid); //sql = "insert into fg3_mainframe_individual (phid,userid,treetabconfig,usertype) values ( " + phid + "," + userid + ",'" + treetabconfig + "',0)"; } DbHelper.ExecuteScalar(connstr, sql); DbHelper.CommitTran(connstr); } catch (Exception ex) { DbHelper.RollbackTran(connstr); throw ex; } finally { DbHelper.Close(connstr); } }
/// <summary> /// 记录请求日志 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="namespaceName"></param> /// <param name="exceptionFun"></param> /// <param name="param"></param> public static void WriteRequestRecord <T>(string host, string url, T param, Guid guid, string retResult = "") { RequestRecordEntity requestRecord = null; try { requestRecord = new RequestRecordEntity() { direction = 2,// 1 WIP接收 2 WIP 推送 happenHost = WIPCommon.GetHostName(), remark = guid.ToString(), host = host, url = url, retResult = retResult, param = JsonConvert.SerializeObject(param), //入参 }; requestRecordDAL.Add(requestRecord); } catch (Exception ex) { Log4netHelper.WriteErrorLogByLog4Net(typeof(Log4netHelper), "WriteRequestRecord记录异常表出现异常,exception:" + JsonConvert.SerializeObject(requestRecord), ex); } }
public void SaveRequestRecord(RequestRecordEntity record) { dac.SaveRequestRecord(record); }