コード例 #1
0
ファイル: Form1.cs プロジェクト: hercat/InterfacesMonitor
        /// <summary>
        /// 新增接口异常日志信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button13_Click(object sender, EventArgs e)
        {
            InterfaceExceptionlog log = new InterfaceExceptionlog();

            log.ConfigId      = new Guid("ad6fb4e4-96c0-4e15-a072-dd921bcac243");
            log.StateCode     = 500;
            log.ExceptionInfo = "接口连接异常,尝试连接多次超时,不拉不拉不拉不拉";
            log.CreateTime    = DateTime.Now;
            InterfaceExceptionlogOperation.AddInterfaceExceptionlogInfo(log);
        }
コード例 #2
0
        /// <summary>
        /// 更新接口实时状态信息、接口异常日志信息业务逻辑
        /// </summary>
        /// <param name="interfaceName">接口名</param>
        /// <param name="applicationName">应用系统名</param>
        /// <param name="server">服务器地址</param>
        /// <param name="stateCode">状态码</param>
        /// <param name="exceptionInfo">接口异常信息内容</param>
        public static void UpdateInterfaceRealtimeInfoWithException(string interfaceName, string applicationName, string server, int stateCode, string exceptionInfo)
        {
            InterfaceRealtimeInfo realtime = InterfaceRealtimeInfoOperation.GetInterfaceRealtimeInfo(interfaceName, applicationName, server);
            InterfaceConfigInfo   config   = InterfaceConfigInfoOperation.GetInterfaceConfigInfo(interfaceName, server);

            if (null != realtime)
            {
                realtime.StateCode  = stateCode;
                realtime.UpdateTime = DateTime.Now;
                InterfaceRealtimeInfoOperation.AddOrUpdateInterceRealtimeInfo(realtime, ModifierType.Update);
            }
            if (!string.IsNullOrEmpty(exceptionInfo))
            {
                InterfaceExceptionlog log = new InterfaceExceptionlog();
                log.ConfigId      = config.Id;
                log.StateCode     = stateCode;
                log.ExceptionInfo = exceptionInfo;
                log.CreateTime    = DateTime.Now;
                InterfaceExceptionlogOperation.AddInterfaceExceptionlogInfo(log);
            }
        }
コード例 #3
0
 public object GetInterfaceLogs(string id)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         StringBuilder sb = new StringBuilder();
         if (!string.IsNullOrEmpty(id))
         {
             sb.AppendFormat(" where ConfigId = '{0}' order by CreateTime desc ", id);
         }
         List <InterfaceExceptionlog> logs = InterfaceExceptionlogOperation.GetInterfaceExceptionlogList(string.Empty, sb.ToString());
         return(new JsonResult(logs));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 public object GetInterfaceLogsPageList(string fields, string id, int page, int rows)
 {
     try
     {
         SystemSettingBase settings = SystemSettingBase.CreateInstance();
         if (settings.SysMySqlDB != null)
         {
             ConnString.MySqldb = settings.SysMySqlDB.ConnectionString;
         }
         PageInfo pageInfo = new PageInfo()
         {
             PageIndex = rows * (page - 1),
             PageSize  = rows,
             RecCount  = 0
         };
         if (string.IsNullOrEmpty(fields))
         {
             fields = "*";
         }
         string where = string.Empty;
         if (!string.IsNullOrEmpty(id))
         {
             where = string.Format(" where ConfigId = '{0}' order by CreateTime desc ", id);
         }
         string limit = string.Empty;
         limit = string.Format("limit {0},{1}", pageInfo.PageIndex, pageInfo.PageSize);
         List <InterfaceExceptionlog> list = InterfaceExceptionlogOperation.GetInterfaceExceptionlogList(fields, where);
         pageInfo.RecCount = list.Count;
         List <InterfaceExceptionlog>       target = InterfaceExceptionlogOperation.GetInterfaceExceptionByCondition(fields, where, limit);
         GridResult <InterfaceExceptionlog> result = new GridResult <InterfaceExceptionlog>(target, pageInfo.RecCount);
         return(new JsonResult(result));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: hercat/InterfacesMonitor
 /// <summary>
 /// 接口配置信息、接口实时状态信息及接口异常日志信息分页逻辑测试
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button17_Click(object sender, EventArgs e)
 {
     List <InterfaceConfigInfo>   configs   = InterfaceConfigInfoOperation.GetInterfaceConfigInfoPageList("Id,InterfaceName,ApplicationName,ServerAddress", "where UserPwd = 'test123'", 1, 2);
     List <InterfaceExceptionlog> logs      = InterfaceExceptionlogOperation.GetInterfaceExceptionlogPageList("Id,ConfigId,StateCode,ExceptionInfo,CreateTime", "where StateCode = 500", 1, 3);
     List <InterfaceRealtimeInfo> realtimes = InterfaceRealtimeInfoOperation.GetInterfaceRealtimeInfoPageList("Id,InterfaceName,ApplicationName,ServerAddress,StateCode,UpdateTime", "where ApplicationName like '%测试接口%'", 1, 2);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: hercat/InterfacesMonitor
 /// <summary>
 /// 获取接口异常日志信息列表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button14_Click(object sender, EventArgs e)
 {
     string fields        = "Id,ConfigId,StateCode,ExceptionInfo,CreateTime";
     string whereCndition = "where StateCode = 500";
     List <InterfaceExceptionlog> list = InterfaceExceptionlogOperation.GetInterfaceExceptionlogList(fields, whereCndition);
 }