Esempio n. 1
0
 public WriteBusiness(IWriteRepository repository, IServiceLog serviceLog)
 {
     _repository = repository;
     _serviceLog = serviceLog;
     _running = true;
     Task.Factory.StartNew(Run);
 }
Esempio n. 2
0
        /// <summary>
        /// 请求开始
        /// </summary>
        /// <param name="reqMsg"></param>
        internal static void BeginRequest(this IServiceLog logger, RequestMessage reqMsg)
        {
            if (logger == null)
            {
                return;
            }

            try
            {
                var callMsg = new CallMessage
                {
                    AppName     = reqMsg.AppName,
                    IPAddress   = reqMsg.IPAddress,
                    HostName    = reqMsg.HostName,
                    ServiceName = reqMsg.ServiceName,
                    MethodName  = reqMsg.MethodName,
                    Parameters  = reqMsg.Parameters
                };

                //开始调用
                logger.Begin(callMsg);
            }
            catch
            {
            }
        }
 public ImportService(ISapphireRepository SapphireRepository, IPurchaseOrderHeaderRepository purchaseOrderHeaderRepository, IQueueRepository QueueRepository, IServiceLog ServiceLog)
 {
     _sapphireRepository            = SapphireRepository;
     _purchaseOrderHeaderRepository = purchaseOrderHeaderRepository;
     _queueRepository = QueueRepository;
     _serviceLog      = ServiceLog;
 }
Esempio n. 4
0
 public ServiceBusiness(IRepository repository, IServiceLog serviceLog, ISettingBusiness settingBusiness, Quilt4Net.Interfaces.ISessionHandler sessionHandler)
 {
     _repository = repository;
     _serviceLog = serviceLog;
     _settingBusiness = settingBusiness;
     _sessionHandler = sessionHandler;
 }
Esempio n. 5
0
        public Reconciler(
            ISapphireRepository sapphireRepository,
            ICompanyRepository companyRepository,
            IPurchaseOrderHeaderRepository purchaseOrderHeaderRepository,
            IQueueRepository queueRepository,
            IServiceLog serviceLog,
            IConsoleLogger consoleLogger,
            IImportService importService,
            IExportService exportService,
            IJobCostActivityService jobCostActivityService,
            IJobService jobService,
            IVariancePurchaseOrderService variancePurchaseOrderService)
        {
            _sapphireRepository            = sapphireRepository;
            _companyRepository             = companyRepository;
            _purchaseOrderHeaderRepository = purchaseOrderHeaderRepository;
            _queueRepository = queueRepository;
            _serviceLog      = serviceLog;
            _consoleLogger   = consoleLogger;

            _importService                = importService;
            _exportService                = exportService;
            _jobCostActivityService       = jobCostActivityService;
            _jobService                   = jobService;
            _variancePurchaseOrderService = variancePurchaseOrderService;
        }
Esempio n. 6
0
 /// <summary>
 /// Construtor Controller de Login
 /// </summary>
 public LoginController(IServiceUser serviceUser, IServiceLogin serviceLogin, IConfiguration configuration, IServiceLog serviceLog)
 {
     _serviceUser   = serviceUser;
     _serviceLogin  = serviceLogin;
     _configuration = configuration;
     _serviceLog    = serviceLog;
 }
 public PurchaseOrderService(ISapphireRepository sapphireRepository, IPurchaseOrderHeaderRepository purchaseOrderHeaderRepository, IServiceLog serviceLog, IExportService exportService, IDateService dateService)
 {
     _sapphireRepository            = sapphireRepository;
     _purchaseOrderHeaderRepository = purchaseOrderHeaderRepository;
     _serviceLog    = serviceLog;
     _exportService = exportService;
     _dateService   = dateService;
 }
Esempio n. 8
0
        public void Add(IServiceLog log)
        {
            m_logs.Add(log);
            var l = log.Level;

            if (l < Level)
            {
                Level = l;
            }
        }
Esempio n. 9
0
        public CustomBatchWatchdog(IServiceLog log)
        {
            m_user = new UserInfo();
            InitializeComponent();
            var file = new Uri(GetType().Assembly.Location).LocalPath;

            m_assemblyDirectory = Path.GetDirectoryName(file);
            m_defaultLog        = log ?? new ServiceLogEvent(this);
            m_log.Add(m_defaultLog);
        }
 public JobCostActivityService(ISapphireRepository sapphireRepository, ICompanyRepository companyRepository, IPurchaseOrderHeaderRepository purchaseOrderHeaderRepository, IServiceLog serviceLog, IExportService exportService, IJobService jobService, IJobCostActivityRepository jobCostActivityRepository, IWorkflowService workflowService)
 {
     _sapphireRepository            = sapphireRepository;
     _companyRepository             = companyRepository;
     _purchaseOrderHeaderRepository = purchaseOrderHeaderRepository;
     _serviceLog                = serviceLog;
     _exportService             = exportService;
     _jobService                = jobService;
     _jobCostActivityRepository = jobCostActivityRepository;
     _workflowService           = workflowService;
 }
        /// <summary>
        /// Behaves as.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="service">The service.</param>
        /// <returns></returns>
        public static T BehaveAs <T>(this IServiceLog service)
            where T : class, IServiceLog
        {
            IServiceWrapper <IServiceLog> serviceWrapper;

            do
            {
                serviceWrapper = (service as IServiceWrapper <IServiceLog>);
                if (serviceWrapper != null)
                {
                    service = serviceWrapper.Parent;
                }
            } while (serviceWrapper != null);
            return(service as T);
        }
Esempio n. 12
0
        public void InsertServiceLog(IServiceLog model)
        {
            var item = new ServiceLog()
            {
                ServiceName = model.ServiceName,
                LogDateTime = model.LogDateTime,
                LogSubject  = model.LogSubject,
                LogLevel    = model.LogLevel,
                LogMessage  = model.LogMessage,
                MessageID   = model.MessageID,
                Data        = model.Data
            };

            Session.Save(item);

            model.ServiceLogID = item.ServiceLogID;
        }
        /// <summary>
        ///  Initializes a new instance of the <see cref="ServiceInvocationHandler"/> class.
        /// </summary>
        /// <param name="config"></param>
        /// <param name="container"></param>
        /// <param name="service"></param>
        /// <param name="serviceType"></param>
        /// <param name="cache"></param>
        public ServiceInvocationHandler(CastleFactoryConfiguration config, IServiceContainer container, IService service, Type serviceType, ICacheStrategy cache, IServiceLog logger)
        {
            this.config = config;
            this.container = container;
            this.serviceType = serviceType;
            this.service = service;
            this.cache = cache;
            this.logger = logger;

            this.hostName = DnsHelper.GetHostName();
            this.ipAddress = DnsHelper.GetIPAddress();

            this.cacheTimes = new Dictionary<string, int>();
            var methods = CoreHelper.GetMethodsFromType(serviceType);
            foreach (var method in methods)
            {
                var contract = CoreHelper.GetMemberAttribute<OperationContractAttribute>(method);
                if (contract != null && contract.CacheTime > 0)
                    cacheTimes[method.ToString()] = contract.CacheTime;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 请求结束
        /// </summary>
        /// <param name="reqMsg"></param>
        /// <param name="resMsg"></param>
        /// <param name="elapsedMilliseconds"></param>
        internal static void EndRequest(this IServiceLog logger, RequestMessage reqMsg, ResponseMessage resMsg, long elapsedMilliseconds)
        {
            if (logger == null)
            {
                return;
            }

            try
            {
                var callMsg = new CallMessage
                {
                    AppName     = reqMsg.AppName,
                    IPAddress   = reqMsg.IPAddress,
                    HostName    = reqMsg.HostName,
                    ServiceName = reqMsg.ServiceName,
                    MethodName  = reqMsg.MethodName,
                    Parameters  = reqMsg.Parameters
                };

                var returnMsg = new ReturnMessage
                {
                    ServiceName = resMsg.ServiceName,
                    MethodName  = resMsg.MethodName,
                    Parameters  = resMsg.Parameters,
                    Count       = resMsg.Count,
                    Error       = resMsg.Error,
                    Value       = resMsg.Value
                };

                //结束调用
                logger.End(callMsg, returnMsg, elapsedMilliseconds);
            }
            catch
            {
            }
        }
        /// <summary>
        ///  Initializes a new instance of the <see cref="ServiceInvocationHandler"/> class.
        /// </summary>
        /// <param name="config"></param>
        /// <param name="container"></param>
        /// <param name="service"></param>
        /// <param name="serviceType"></param>
        /// <param name="cache"></param>
        public ServiceInvocationHandler(CastleFactoryConfiguration config, IServiceContainer container, IService service, Type serviceType, ICacheStrategy cache, IServiceLog logger)
        {
            this.config      = config;
            this.container   = container;
            this.serviceType = serviceType;
            this.service     = service;
            this.cache       = cache;
            this.logger      = logger;

            this.hostName  = DnsHelper.GetHostName();
            this.ipAddress = DnsHelper.GetIPAddress();

            this.cacheTimes = new Dictionary <string, int>();
            var methods = CoreHelper.GetMethodsFromType(serviceType);

            foreach (var method in methods)
            {
                var contract = CoreHelper.GetMemberAttribute <OperationContractAttribute>(method);
                if (contract != null && contract.CacheTime > 0)
                {
                    cacheTimes[method.ToString()] = contract.CacheTime;
                }
            }
        }
 /// <summary>
 /// Fatals the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 /// <param name="s">The s.</param>
 /// <param name="args">The args.</param>
 public static void FatalFormat(this IServiceLog service, Exception ex, string s, params object[] args)
 {
     s = (!string.IsNullOrEmpty(s) ? string.Format(CultureInfo.CurrentCulture, s, args) : string.Empty);
     service.Write(ServiceLog.LogLevel.Fatal, ex, s);
 }
 // log
 /// <summary>
 /// Fatals the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 public static void Fatal(this IServiceLog service, string s)
 {
     service.Write(ServiceLog.LogLevel.Fatal, null, s);
 }
 /// <summary>
 /// Fatals the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 public static void Fatal(this IServiceLog service, Exception ex)
 {
     service.Write(ServiceLog.LogLevel.Fatal, ex, null);
 }
Esempio n. 19
0
 public HomeController(IServiceLog serviceLog, ISettingBusiness settingBusiness)
 {
     _serviceLog = serviceLog;
     _settingBusiness = settingBusiness;
 }
 // get
 /// <summary>
 /// Gets the specified service.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="service">The service.</param>
 /// <returns></returns>
 public static IServiceLog Get <T>(this IServiceLog service)
 {
     return(service.Get(typeof(T)));
 }
 public LogController(IServiceLog service)
 {
     _service = service;
 }
 /// <summary>
 /// Debugs the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 /// <param name="args">The args.</param>
 public static void DebugFormat(this IServiceLog service, string s, params object[] args)
 {
     s = (!string.IsNullOrEmpty(s) ? string.Format(CultureInfo.CurrentCulture, s, args) : string.Empty);
     service.Write(ServiceLog.LogLevel.Debug, null, s);
 }
 /// <summary>
 /// Informations the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 public static void Information(this IServiceLog service, Exception ex)
 {
     service.Write(ServiceLog.LogLevel.Information, ex, null);
 }
 /// <summary>
 /// Debugs the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 public static void Debug(this IServiceLog service, string s)
 {
     service.Write(ServiceLog.LogLevel.Debug, null, s);
 }
 /// <summary>
 /// Warnings the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 public static void Warning(this IServiceLog service, Exception ex)
 {
     service.Write(ServiceLog.LogLevel.Warning, ex, null);
 }
 /// <summary>
 /// Informations the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 public static void Information(this IServiceLog service, string s)
 {
     service.Write(ServiceLog.LogLevel.Information, null, s);
 }
 /// <summary>
 ///  Initializes a new instance of the <see cref="ServiceInvocationHandler"/> class.
 /// </summary>
 /// <param name="config"></param>
 /// <param name="container"></param>
 /// <param name="service"></param>
 /// <param name="serviceType"></param>
 /// <param name="cache"></param>
 public LocalInvocationHandler(CastleFactoryConfiguration config, IServiceContainer container, IService service, Type serviceType, ICacheStrategy cache, IServiceLog logger)
     : base(config, container, service, serviceType, cache, logger)
 {
     this.container = container;
     //TO DO
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommonLoggingFactoryAdapter"/> class.
 /// </summary>
 /// <param name="log">The log.</param>
 public CommonLoggingFactoryAdapter(IServiceLog log)
 {
     _log = log;
 }
Esempio n. 29
0
 public DateService(IServiceLog serviceLog)
 {
     _serviceLog = serviceLog;
 }
 /// <summary>
 /// Errors the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 public static void Error(this IServiceLog service, string s)
 {
     service.Write(ServiceLog.LogLevel.Error, null, s);
 }
 /// <summary>
 /// Debugs the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 public static void Debug(this IServiceLog service, Exception ex)
 {
     service.Write(ServiceLog.LogLevel.Debug, ex, null);
 }
 public QueueRepository(ISqlClient sqlClient, IServiceLog serviceLog)
 {
     _sqlClient  = sqlClient;
     _serviceLog = serviceLog;
 }
Esempio n. 33
0
 /// <summary>
 /// 注册日志依赖
 /// </summary>
 /// <param name="logger"></param>
 public void RegisterLogger(IServiceLog logger)
 {
     this.logger = logger;
 }
Esempio n. 34
0
        public void InsertServiceLog(IServiceLog model)
        {
            var item = Post <ServiceLogItem>("webapi/data/servicelog", model);

            model.ServiceLogID = item.ServiceLogID;
        }
Esempio n. 35
0
 public SharedController(IServiceLog serviceLog, IServiceBusiness serviceBusiness)
 {
     _serviceLog = serviceLog;
     _serviceBusiness = serviceBusiness;
 }
 /// <summary>
 /// Errors the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="ex">The ex.</param>
 public static void Error(this IServiceLog service, Exception ex)
 {
     service.Write(ServiceLog.LogLevel.Error, ex, null);
 }
 /// <summary>
 /// Warnings the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="s">The s.</param>
 public static void Warning(this IServiceLog service, string s)
 {
     service.Write(ServiceLog.LogLevel.Warning, null, s);
 }
 public LogAdapter(IServiceLog log)
 {
     _log = log;
 }
 public ClientServiceLogController(IServiceLog serviceLog)
 {
     _serviceLog = serviceLog;
 }