Пример #1
0
        public override object Do(object obj)
        {
            CreateCallWSLogSV bpObj    = (CreateCallWSLogSV)obj;
            WSLogDTOData      wsLogDTO = bpObj.WSLogDTO;

            if (wsLogDTO == null)
            {
                return(null);
            }
            WSLog wsLog = null;

            using (ISession s = Session.Open())
            {
                if (wsLogDTO.LogID > 0)
                {
                    wsLog = WSLog.Finder.FindByID(wsLogDTO.LogID);
                    if (wsLog == null)
                    {
                        throw new ApplicationExceptionBase(string.Format("LogID:{0} 未找到相应的日志记录", wsLogDTO.LogID));
                    }
                }
                if (wsLog == null)
                {
                    wsLog = WSLog.Create();
                    //RequestUrl	请求地址
                    wsLog.RequestUrl = wsLogDTO.RequestUrl;
                    //ClassName	类名
                    wsLog.ClassName = wsLogDTO.ClassName;
                    //MethodName	方法名
                    wsLog.MethodName = wsLogDTO.MethodName;
                    //MethodDescription 方法描述
                    wsLog.MethodDescription = wsLogDTO.MethodDescription;
                    //RequestContent	请求内容
                    wsLog.RequestContent = wsLogDTO.RequestContent;
                }
                //StartTime	开始时间
                wsLog.StartTime = wsLogDTO.StartTime;
                //EndTime	结束时间
                wsLog.EndTime = wsLogDTO.EndTime;
                //ElapsedSecond	历时(秒)
                wsLog.ElapsedSecond = wsLogDTO.ElapsedSecond;
                //ResponseContent	返回内容
                wsLog.ResponseContent = wsLogDTO.ResponseContent;
                //CallResult	调用结果
                wsLog.CallResult = wsLogDTO.CallResult ? CallResultEnum.Success : CallResultEnum.Failure;
                //ErrorMessage	错误信息
                wsLog.ErrorMessage = wsLogDTO.ErrorMessage;
                //CallCount 请求次数
                wsLog.CallCount++;
                s.Commit();
            }
            return(wsLog.ID);
        }
Пример #2
0
        public override object Do(object obj)
        {
            CreateBeforeCallWSLogSV bpObj    = (CreateBeforeCallWSLogSV)obj;
            WSLogDTOData            wsLogDTO = bpObj.WSLogDTO;

            if (wsLogDTO == null)
            {
                return(null);
            }
            WSLog wsLog = null;

            using (ISession s = Session.Open())
            {
                if (wsLogDTO.LogID > 0)
                {
                    wsLog = WSLog.Finder.FindByID(wsLogDTO.LogID);
                }
                else
                {
                    wsLog = WSLog.Create();
                    //RequestUrl	请求地址
                    wsLog.RequestUrl = wsLogDTO.RequestUrl;
                    //ClassName	类名
                    wsLog.ClassName = wsLogDTO.ClassName;
                    //MethodName	方法名
                    wsLog.MethodName = wsLogDTO.MethodName;
                    //MethodDescription 方法描述
                    wsLog.MethodDescription = wsLogDTO.MethodDescription;
                    //RequestContent	请求内容
                    wsLog.RequestContent = wsLogDTO.RequestContent;
                }
                //StartTime	开始时间
                wsLog.StartTime = wsLogDTO.StartTime;
                //CallCount 请求次数
                wsLog.CallCount++;
                s.InList(wsLog);
                s.Commit();
            }
            return(wsLog.ID);
        }
Пример #3
0
        public override object Do(object obj)
        {
            CreateAfterCallWSLogSV bpObj    = (CreateAfterCallWSLogSV)obj;
            WSLogDTOData           wsLogDTO = bpObj.WSLogDTO;

            if (wsLogDTO == null)
            {
                return(null);
            }
            if (wsLogDTO.LogID <= 0)
            {
                throw new ApplicationExceptionBase("LogID 不能为空");
            }
            WSLog wsLog = WSLog.Finder.FindByID(wsLogDTO.LogID);

            if (wsLog == null)
            {
                throw new ApplicationExceptionBase(string.Format("LogID:{0} 未找到相应的日志记录", wsLogDTO.LogID));
            }
            using (ISession s = Session.Open())
            {
                //EndTime	结束时间
                wsLog.EndTime = wsLogDTO.EndTime;
                //ElapsedSecond	历时(秒)
                wsLog.ElapsedSecond = wsLogDTO.ElapsedSecond;
                //ResponseContent	返回内容
                wsLog.ResponseContent = wsLogDTO.ResponseContent;
                //CallResult	调用结果
                wsLog.CallResult = wsLogDTO.CallResult ? CallResultEnum.Success : CallResultEnum.Failure;
                //ErrorMessage	错误信息
                wsLog.ErrorMessage = wsLogDTO.ErrorMessage;
                s.InList(wsLog);
                s.Commit();
            }
            return(wsLog.ID);
        }