示例#1
3
        public void WriteLog(ICorrelation correlation, LogEventLevel eventLevel, Exception exception, string formatMessage, params object[] args)
        {
            if (log == null)
            {
                log = loggerRepository.GetLogger(sourceType);
            }

            if (eventLevel == LogEventLevel.Verbose && !log.IsDebugEnabled)
            {
                return;
            }

            if (args != null && args.Length != 0)
            {
                formatMessage = string.Format(formatMessage, args);
            }

            log4net.Core.ILogger logger = log.Logger;

            LoggingEvent logEvent = new LoggingEvent(sourceType, logger.Repository, logger.Name, MapEventLevel(eventLevel), formatMessage, exception);

            if (correlation != null)
            {
                logEvent.Properties["CallerId"] = correlation.CallerId;
                logEvent.Properties["CorrelationId"] = correlation.CorrelationId;
            }

            logger.Log(logEvent);
        }
示例#2
1
        //--- Constructors ---
        public S3Storage(XDoc configuration, ILog log) {
            _timerFactory = TaskTimerFactory.Create(this);
            _log = log;
            _publicKey = configuration["publickey"].AsText;
            _privateKey = configuration["privatekey"].AsText;
            _bucket = configuration["bucket"].AsText;
            _prefix = configuration["prefix"].AsText;
            if(string.IsNullOrEmpty(_publicKey)) {
                throw new ArgumentException("Invalid Amazon S3 publickey");
            }
            if(string.IsNullOrEmpty(_privateKey)) {
                throw new ArgumentException("Invalid Amazon S3 privatekey");
            }
            if(string.IsNullOrEmpty(_bucket)) {
                throw new ArgumentException("Invalid Amazon S3 bucket");
            }
            if(string.IsNullOrEmpty(_prefix)) {
                throw new ArgumentException("Invalid Amazon S3 prefix");
            }
            _tempDirectory = Path.Combine(Path.GetTempPath(), "s3_cache_" + XUri.EncodeSegment(_prefix));
            if(Directory.Exists(_tempDirectory)) {
                Directory.Delete(_tempDirectory, true);
            }
            Directory.CreateDirectory(_tempDirectory);
            _allowRedirects = configuration["allowredirects"].AsBool ?? false;
            _redirectTimeout = TimeSpan.FromSeconds(configuration["redirecttimeout"].AsInt ?? 60);
            _cacheTtl = (configuration["cachetimeout"].AsInt ?? 60 * 60).Seconds();

            // initialize S3 plug
            _s3 = Plug.New("http://s3.amazonaws.com", TimeSpan.FromSeconds(configuration["timeout"].AsDouble ?? DEFAUTL_S3_TIMEOUT)).WithPreHandler(S3AuthenticationHeader).At(_bucket);
        }
示例#3
1
        public static void Init()
        {
            _log = LogManager.GetLogger("AppDomain");

            var _fa =
                new FileAppender()
                {
                    Layout = new log4net.Layout.PatternLayout("%timestamp [%thread] %-5level %logger - %message%newline"),
                    File = Path.Combine(Environment.CurrentDirectory, "update.log"),
                    AppendToFile = false
                };
            _fa.ActivateOptions();
            BasicConfigurator.Configure(
                _fa,
                new ConsoleAppender()
            );

            AppDomain.CurrentDomain.AssemblyLoad += (sender, e) =>
            {
                _log.DebugFormat("Assembly load: {0}", e.LoadedAssembly.FullName);
            };
            AppDomain.CurrentDomain.ProcessExit += (sender, e) =>
            {
                _log.Info("Process exiting.");
            };
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                _log.ErrorFormat("Unhandled exception: {0}", e.ExceptionObject.ToString());
            };
        }
示例#4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                String log4net = String.Format(BogheApp.Properties.Resources.log4net_xml, Win32ServiceManager.SharedManager.ApplicationDataPath);
                using (Stream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(log4net)))
                {
                    XmlConfigurator.Configure(stream);
                    LOG = LogManager.GetLogger(typeof(App));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                this.Shutdown();
            }

            LOG.Debug("====================================================");
            LOG.Debug(String.Format("======Starting Boghe - IMS/RCS Client v{0} ====", System.Reflection.Assembly.GetEntryAssembly().GetName().Version));
            LOG.Debug("====================================================");

            //CultureInfo culture = new CultureInfo("fr-FR");
               // System.Threading.Thread.CurrentThread.CurrentCulture = culture;
               // System.Threading.Thread.CurrentThread.CurrentUICulture = culture;

            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            if (!Win32ServiceManager.SharedManager.Start())
            {
                MessageBox.Show("Failed to start service manager");
                this.Shutdown();
            }
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReactorServiceBase"/> class.
        /// </summary>
        /// <param name="configurationAggregator">The configuration aggregator.</param>
        protected ReactorServiceBase(IConfigurationAggregator configurationAggregator)
        {
            if (configurationAggregator == null) throw new ArgumentNullException("configurationAggregator");

            ConfigurationAggregator = configurationAggregator;
            Log = LogManager.GetLogger(GetType());
        }
 /// <summary>
 ///   Creates a new instance of the ProxyConnection class with the remote socket of the client 
 ///   and the ProxyServer this connection should belong to.
 /// </summary>
 /// <param name="networkSocket"> The network socket of the network client </param>
 /// <param name="server"> The proxy server this connection belongs to </param>
 public ProxyConnection(Socket networkSocket, ProxyServer server)
 {
     _logger = LogManager.GetLogger("Proxy Connection");
     _networkSocket = networkSocket;
     _server = server;
     _random = new Random ();
 }
示例#7
0
        //---------------------------------------------------------------------

        static Log()
        {
            //Hierarchy hierarchy = LogManager.GetLoggerRepository() as Hierarchy;
            //logger = hierarchy.Root;
            //log4net.Config.XmlConfigurator.Configure();
            logger = LogManager.GetLogger("Landis");
        }
示例#8
0
        public Client(int id, Config cfg, SynchronizationContext ctx)
        {
            ClientStatisticsGatherer = new ClientStatisticsGatherer();

              _ctx = ctx;
              _id = id;

              Data = new TestData(this);
              IsStopped = false;

              _log = LogManager.GetLogger("Client_" + _id);
              _log.Debug("Client created");

              Configure(cfg);

              if (String.IsNullOrEmpty(_login))
              {
            const string err = "Login command is not specified!!! Can't do any test.";
            _log.Error(err);

            throw new Exception(err);
              }

              _ajaxHelper = new AjaxHelper(new AjaxConn(_login, cfg.ServerIp, cfg.AjaxPort, _ctx));
              _webSock = new WebSockConn(_login, cfg.ServerIp, cfg.WsPort, ctx);

              _webSock.CcsStateChanged += WsOnCcsStateChanged;
              _webSock.InitializationFinished += () => _testMng.GetTest<LoginTest>().OnClientInitialized();
              _testMng.SetEnv(_login, _ajaxHelper.AjaxConn, _webSock);
        }
        public EmulatorManagementWindow()
        {
            InitializeComponent();

            mLogger = LogManager.GetLogger(GetType().Name);
            mEmulatorNames = new List<string>();
        }
 public ActiveFeatureFactory(IKernel kernel, IInstanceConfiguration instanceConfiguration, ILog log, ILoggingConfiguration loggingConfiguration)
 {
     _kernel = kernel;
     _instanceConfiguration = instanceConfiguration;
     _log = log;
     _loggingConfiguration = loggingConfiguration;
 }
        public CreateReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log, IPackageVersionResolver versionResolver)
            : base(repositoryFactory, log)
        {
            this.versionResolver = versionResolver;

            DeployToEnvironmentNames = new List<string>();
            DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
            DeploymentTimeout = TimeSpan.FromMinutes(10);

            var options = Options.For("Release creation");
            options.Add("project=", "Name of the project", v => ProjectName = v);
            options.Add("channel=", "[Optional] Channel to use for the new release.", v => ChannelName = v);
            options.Add("version=|releaseNumber=", "[Optional] Release number to use for the new release.", v => VersionNumber = v);
            options.Add("packageversion=|defaultpackageversion=", "Default version number of all packages to use for this release.", v => versionResolver.Default(v));
            options.Add("package=", "[Optional] Version number to use for a package in the release. Format: --package={StepName}:{Version}", v => versionResolver.Add(v));
            options.Add("packagesFolder=", "[Optional] A folder containing NuGet packages from which we should get versions.", v => versionResolver.AddFolder(v));
            options.Add("releasenotes=", "[Optional] Release Notes for the new release.", v => ReleaseNotes = v);
            options.Add("releasenotesfile=", "[Optional] Path to a file that contains Release Notes for the new release.", ReadReleaseNotesFromFile);
            options.Add("ignoreexisting", "If a release with the version number already exists, ignore it", v => IgnoreIfAlreadyExists = true);
            options.Add("ignorechannelrules", "[Optional] Ignore package version matching rules", v => Force = true);
            options.Add("packageprerelease=", "[Optional] Pre-release for latest version of all packages to use for this release.", v => VersionPrerelease = v);

            options = Options.For("Deployment");
            options.Add("deployto=", "[Optional] Environment to automatically deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
        }
示例#12
0
    /// <summary>
    ///     A logger to be used for logging statements in the code.
    ///     It is recommended to follow a pattern for instantiating this:
    ///     <code>
    ///         private static readonly JCsLogger log = new JCsLogger(typeof(YourClassName));
    ///         ...
    ///         log.*(yourLoggingStuff); // Debug/Info/Warn/Error/Fatal[Format]
    ///     </code>
    /// </summary>
    /// <param name="type">the type that is using this logger</param>
    public MyLogHelper(Type type)
    {
        MyLogHelperConfig();
#if LOG4NET
        log = log4net.LogManager.GetLogger(type);
#endif
    }
示例#13
0
        public override void Execute(DataModel context, ILog log)
        {
            var today = DateTime.Today;
            var scannedEmployees = context.ScannedInEmployees
                .Include(e => e.InScan)
                .Where(s => DbFunctions.TruncateTime(s.InScan.CreatedAt) < today)
                .ToList();
            foreach (var scannedEmployee in scannedEmployees)
            {
                var scanIn = context.EmployeeScans.Find(scannedEmployee.ScanID);
                var scan = new EmployeeScan()
                {
                    CreatedAt = scanIn.CreatedAt,
                    EmployeeNumber = scannedEmployee.EmployeeNumber,
                    Division = scanIn.Division,
                    Details = "Out (System)",
                    ScanType = "Type",
                    PartnerID = scanIn.ID,
                    Username = "******"
                };

                log.Info($"Scanning out Employee: {scan.EmployeeNumber} from {scan.Division}");
                context.EmployeeScans.Add(scan);
            }
            context.ScannedInEmployees.RemoveRange(scannedEmployees);
            context.SaveChanges();
        }
示例#14
0
 public CommandDatagram()
 {
     this.type = (int) XPiPlaneConstants.DatagramTypes.COMMAND;
     this.opcode = "CMND0";
     log = LogManager.GetLogger(opcode.Substring(0, 4));
     log.Debug("New XP Command Created");
 }
示例#15
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Count() < 3 || args.Count() > 4)
                {
                    Console.WriteLine("HELP: SvcRestart.exe [ldap] [service name] [Timeout in seconds] [optional computerName contrains]");
                }
                else
                {
                    log = LogManager.GetLogger("log");
                    log4net.Config.XmlConfigurator.Configure();
                    var conputernamecontains = "";
                    var ldap = args[0];
                    var serviceName = args[1];
                    var timeoutSeconds = Convert.ToInt32(args[2]);
                    var application = new Application(ldap, log);
                    if (args.Count() == 4)
                    {
                        conputernamecontains = args[3];
                    }
                    application.Run(conputernamecontains, serviceName, timeoutSeconds);
                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }
        }
 protected AssemblyConfiguration(Dictionary<string, object> defaultValues, ILog logger)
 {
     NameValueCollection nameValues = ConfigurationManager.AppSettings;
     CreateConfiguration(defaultValues, nameValues);
     foreach (KeyValuePair<string, string> pair in usedValues)
         logger.InfoFormat("Using {0}={1}", pair.Key, pair.Value);
 }
        public GameMonitorDisplayViewModel(ISynchronizeInvoke synchronizeInvoke, string fileNameAndPath, PollWatcherFactory pollWatcherFactory, Func<Type, ILog> loggerFactory)
        {
            this.synchronizeInvoke = synchronizeInvoke;
            logger = loggerFactory(typeof(GameMonitorDisplayViewModel));

            LoadGameToBeMonitored(fileNameAndPath, pollWatcherFactory);
        }
示例#18
0
 public SchedulerService(IBus bus, IRawByteBus rawByteBus, ILog log, IScheduleRepository scheduleRepository)
 {
     this.bus = bus;
     this.scheduleRepository = scheduleRepository;
     this.rawByteBus = rawByteBus;
     this.log = log;
 }
示例#19
0
 private LogHelper()
 {
     String logConfigFile = AppDomain.CurrentDomain.BaseDirectory + "log4net.config";
     log4net.Config.XmlConfigurator.Configure(new FileInfo(logConfigFile));
     m_Loger = LogManager.GetLogger("Default");
     //m_SACalcLoger = LogManager.GetLogger("SA");
 }
示例#20
0
        public void Init(string[] args)
        {
            ParseArgs(args);
            mLogger = LogManager.GetLogger(GetType().Name);
            mLogger.Info(string.Format("Initializing Emulator Manager processor with args: [{0}]",string.Join(",",args)));

            if (configPath == null)
            {
                ConfigComponent.Instance.Initialize();
            }
            else
            {
                ConfigComponent.Instance.Initialize(configPath);
            }

            if (serverUrl == null)
            {
                RomDataComponent.Instance.Initialize();
            }
            else
            {
                RomDataComponent.Instance.Initialize(serverUrl);
            }

            mLogger.Info("Done Initializing Emulator Manager processor");
        }
        public OSAELog()
        {
            StackFrame frame = new StackFrame(1);
            MethodBase method = frame.GetMethod();
            Type type = method.DeclaringType;
            Log = LogManager.GetLogger(type);

            var root = ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
            var attachable = root as log4net.Core.IAppenderAttachable;

            if (attachable != null)
            {
                log4net.Repository.Hierarchy.Hierarchy hier = log4net.LogManager.GetRepository() as log4net.Repository.Hierarchy.Hierarchy;
                if (hier != null)
                {
                    var fileAppender =
                        (log4net.Appender.RollingFileAppender)hier.GetAppenders().Where(
                            appender => appender.Name.Equals("RollingLogFileAppender", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

                    var adoAppender =
                        (log4net.Appender.AdoNetAppender)hier.GetAppenders().Where(
                            appender => appender.Name.Equals("MySql_ADONetAppender", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

                    if (Common.TestConnection().Success)
                    {
                        if (adoAppender != null)
                        {
                            adoAppender.ConnectionString = Common.ConnectionString;
                            adoAppender.ActivateOptions();
                        }
                        root.RemoveAppender(fileAppender);
                    }
                }
            }
        }
示例#22
0
 public FeedZmQPublisher(string address, ILog log)
 {
     _log = log;
     _context = NetMQContext.Create();
     _socket = _context.CreatePushSocket();
     _socket.Bind(address);
 }
示例#23
0
        /// <summary>
        /// Performs all the operations needed to init the plugin/App
        /// </summary>
        /// <param name="user">singleton instance of UserPlugin</param>
        /// <param name="rootPath">path where the config files can be found</param>
        /// <returns>true if the user is already logged in; false if still logged out</returns>
        public static bool InitApp(UserClient user, string rootPath, IPluginManager pluginManager)
        {
            if (user == null)
                return false;

            // initialize the config file
            Snip2Code.Utils.AppConfig.Current.Initialize(rootPath);
            log = LogManager.GetLogger("ClientUtils");
 
            // login the user
            bool res = user.RetrieveUserPreferences();
            bool loggedIn = false;
            if (res && ((!BaseWS.Username.IsNullOrWhiteSpaceOrEOF()) || (!BaseWS.IdentToken.IsNullOrWhiteSpaceOrEOF())))
            {
                LoginPoller poller = new LoginPoller(BaseWS.Username, BaseWS.Password, BaseWS.IdentToken, BaseWS.UseOneAll,
                                                        pluginManager);
                LoginTimer = new System.Threading.Timer(poller.RecallLogin, null, 0, AppConfig.Current.LoginRefreshTimeSec * 1000);
                loggedIn = true;
            }

            System.Threading.ThreadPool.QueueUserWorkItem(delegate
            {
                user.LoadSearchHistoryFromFile();
            }, null);

            //set the empty profile picture for search list results:
            PictureManager.SetEmptyProfilePic(rootPath);

            return loggedIn;
        }
 public DeployReleaseCommand(IOctopusRepositoryFactory repositoryFactory, ILog log)
     : base(repositoryFactory, log)
 {
     DeployToEnvironmentNames = new List<string>();
     DeploymentStatusCheckSleepCycle = TimeSpan.FromSeconds(10);
     DeploymentTimeout = TimeSpan.FromMinutes(10);
 }
 public FixtureServiceController(
     IFixtureService fixtureService,
     ILog logger)
 {
     this.fixtureService = fixtureService;
     this.logger = logger;
 }
        public PackageInstallLogger(
			IPackageInstallTracker tracker,
			ILog log)
        {
            Tracker = tracker;
            Log = log;
        }
示例#27
0
 protected BasePersistance(ICommandLine commandLine, ILog logger)
 {
     CommandLine = commandLine;
     _logger = logger;
     CoverageSession = new CoverageSession();
     _trackedMethodId = 0;
 }
示例#28
0
        public static void Log(ILog log, object message)
        {
            if (log == null) return;

            Logger logger = log.Logger as Logger;

            if (logger != null)
            {
                try
                {
                    // Save current log level and layouts
                    Dictionary<AppenderSkeleton, ILayout> existingLayout = new Dictionary<AppenderSkeleton, ILayout>();
                    Level existingLevel = logger.Level;

                    foreach (var appender in logger.Repository.GetAppenders().OfType<AppenderSkeleton>())
                    {
                        existingLayout[appender] = appender.Layout;
                        appender.Layout = _simpleLayout;
                    }

                    logger.Level = Level.Verbose;

                    logger.Log(Level.Verbose, message, null);

                    // Restore layouts and log level
                    foreach (KeyValuePair<AppenderSkeleton, ILayout> kv in existingLayout)
                    {
                        kv.Key.Layout = kv.Value;
                    }

                    logger.Level = existingLevel;
                }
                catch { } // Ignore exception
            }
        }
示例#29
0
 public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategy[] trackedMethodStrategies)
 {
     _commandLine = commandLine;
     _filter = filter;
     _logger = logger;
     _trackedMethodStrategies = trackedMethodStrategies;
 }
示例#30
0
        private string ReturnWhere()
        {
            string str             = string.Empty;
            string makeWhereClause = string.Empty;

            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                List <String> arr = new List <String>();
                arr.Add("test");

                if (txtItemName.Text.Trim() != "")
                {
                    if (arr.Count == 1)
                    {
                        makeWhereClause = " where ";
                        str            += " and Item_Name='" + txtItemName.Text + "'";
                        //str += " where Item_Name='" + txtItemName.Text + "'";
                        //arr.Add("1");
                    }
                    else
                    {
                        //str += " and Item_Name='" + txtItemName.Text + "'";
                        str += " where Item_Name='" + txtItemName.Text + "'";
                        arr.Add("1");
                    }
                }
                if (txtModel.Text.Trim() != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " and Model_No = '" + txtModel.Text + "'";
                        //str += " where Model_No = '" + txtModel.Text + "'";
                        //arr.Add("2");
                    }
                    else
                    {
                        //str += " and Model_No = '" + txtModel.Text + "'";
                        str += " where Model_No = '" + txtModel.Text + "'";
                        arr.Add("2");
                    }
                }


                if (txtIssuedTo.Text.Trim() != "")
                {
                    if (arr.Count == 1)
                    {
                        makeWhereClause = " where ";
                        str            += " and IssuedTo_Name='" + txtIssuedTo.Text + "'";
                        //str += " where IssuedTo_Name='" + txtIssuedTo.Text + "'";
                        //arr.Add("3");
                    }
                    else
                    {
                        str += " where IssuedTo_Name='" + txtIssuedTo.Text + "'";
                        arr.Add("3");
                        //str += " and IssuedTo_Name='" + txtIssuedTo.Text + "'";
                    }
                }
                if (txtIssuedBy.Text.Trim() != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " and IssuedBy_Name = '" + txtIssuedBy.Text + "'";
                        //str += " where IssuedBy_Name = '" + txtIssuedBy.Text + "'";
                        //arr.Add("4");
                    }
                    else
                    {
                        str += " where IssuedBy_Name = '" + txtIssuedBy.Text + "'";
                        arr.Add("4");
                        //str += " and IssuedBy_Name = '" + txtIssuedBy.Text + "'";
                    }
                }


                if (txtdateto.Text != "" && txtdatefrom.Text != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " and IssuedBy_Time BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                        // str += " where IssuedBy_Time BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                        //arr.Add("5");
                    }
                    else
                    {
                        str += " where IssuedBy_Time BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                        arr.Add("5");
                        //str += " and IssuedBy_Time BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                    }
                }
                if (txtdatefrom.Text != "" && txtdateto.Text == "")
                {
                    if (arr.Count == 1)
                    {
                        str += " and IssuedBy_Time ='" + txtdatefrom.Text + "'";
                        //str += " where IssuedBy_Time ='" + txtdatefrom.Text + "'";
                        //arr.Add("6");
                    }
                    else
                    {
                        str += " where IssuedBy_Time ='" + txtdatefrom.Text + "'";
                        arr.Add("6");
                        //str += " and IssuedBy_Time ='" + txtdatefrom.Text + "'";
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
            return(str);
        }
示例#31
0
 // Log4Net to get the Log path
 static Log4NetLogger()
 {
     Log = log4net.LogManager.GetLogger(typeof(Log4NetLogger));
 }
示例#32
0
 /// <summary>
 /// 警告信息
 /// </summary>
 /// <param name="message"></param>
 public static void Warning(string message)
 {
     log4net.ILog logger = log4net.LogManager.GetLogger(loggerRepository.Name, "warninfo");
     logger.Warn(message);
 }
        protected void btnItemAdd_Click(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                lblid.Text = GlobalVar.Risk_ID.ToString();

                SqlParameter[] para = new SqlParameter[53];
                para[0] = new SqlParameter("@Risk_id", lblid.Text.Trim());
                para[1] = new SqlParameter("@DateFrom", DateTime.Now);

                para[2]  = new SqlParameter("@R6", ddlR6.Text.Trim());
                para[3]  = new SqlParameter("@R7", ddlR7.Text.Trim());
                para[4]  = new SqlParameter("@R8", ddlR8.Text.Trim());
                para[5]  = new SqlParameter("@R9", ddlR9.Text.Trim());
                para[6]  = new SqlParameter("@R10", ddlR10.Text.Trim());
                para[7]  = new SqlParameter("@R11", ddlR11.Text.Trim());
                para[8]  = new SqlParameter("@R12", ddlR12.Text.Trim());
                para[9]  = new SqlParameter("@R13", ddlR13.Text.Trim());
                para[10] = new SqlParameter("@R14", ddlR14.Text.Trim());

                para[11] = new SqlParameter("@S1", ddlS1.Text.Trim());
                para[12] = new SqlParameter("@S2", ddlS2.Text.Trim());
                para[13] = new SqlParameter("@S3", ddlS3.Text.Trim());
                para[14] = new SqlParameter("@S3Comment", txtS3.Text.Trim());

                para[15] = new SqlParameter("@T1", ddlT1.Text.Trim());
                para[16] = new SqlParameter("@T1txt", txtT1.Text.Trim());
                para[17] = new SqlParameter("@T2", ddlT2.Text.Trim());
                para[18] = new SqlParameter("@T2txt", txtT2.Text.Trim());
                para[19] = new SqlParameter("@T3", ddlT3.Text.Trim());
                para[20] = new SqlParameter("@T3txt", txtT3.Text.Trim());
                para[21] = new SqlParameter("@T4", ddlT4.Text.Trim());
                para[22] = new SqlParameter("@T4txt", txtT4.Text.Trim());
                para[23] = new SqlParameter("@T5", ddlT5.Text.Trim());
                para[24] = new SqlParameter("@T5txt", txtT5.Text.Trim());
                para[25] = new SqlParameter("@T6", ddlT6.Text.Trim());
                para[26] = new SqlParameter("@T6txt", txtT6.Text.Trim());
                para[27] = new SqlParameter("@T7", ddlT7.Text.Trim());
                para[28] = new SqlParameter("@T7txt", txtT7.Text.Trim());
                para[29] = new SqlParameter("@T8", ddlT8.Text.Trim());
                para[30] = new SqlParameter("@T8txt", txtT8.Text.Trim());

                para[31] = new SqlParameter("@T9", ddlT9.Text.Trim());
                para[32] = new SqlParameter("@T10", ddlT10.Text.Trim());
                para[33] = new SqlParameter("@T11", ddlT11.Text.Trim());
                para[34] = new SqlParameter("@T12", ddlT12.Text.Trim());

                para[35] = new SqlParameter("@T13", ddlT13.Text.Trim());
                para[36] = new SqlParameter("@T13Name1", txtT13Name1.Text.Trim());
                para[37] = new SqlParameter("@T13Auth1", txtT13Aut1.Text.Trim());
                para[38] = new SqlParameter("@T13Name2", txtT13Name2.Text.Trim());
                para[40] = new SqlParameter("@T13Auth2", txtT13Aut2.Text.Trim());
                para[41] = new SqlParameter("@T13Name3", txtT13Name3.Text.Trim());
                para[42] = new SqlParameter("@T13Auth3", txtT13Aut3.Text.Trim());
                para[43] = new SqlParameter("@T13Name4", txtT13Name4.Text.Trim());
                para[44] = new SqlParameter("@T13Auth4", txtT13Aut4.Text.Trim());

                para[45] = new SqlParameter("@T14", ddlT14.Text.Trim());
                para[46] = new SqlParameter("@T15", ddlT15.Text.Trim());
                para[47] = new SqlParameter("@T16", ddlT16.Text.Trim());
                para[48] = new SqlParameter("@T17", ddlT17.Text.Trim());
                para[49] = new SqlParameter("@T18", ddlT18.Text.Trim());
                para[50] = new SqlParameter("@T19", ddlT19.Text.Trim());

                para[51] = new SqlParameter("@T20", ddlT20.Text.Trim());
                para[52] = new SqlParameter("@T21", ddlT21.Text.Trim());
                para[39] = new SqlParameter("@T22", ddlT22.Text.Trim());


                dal.executeprocedure("SP_RiskSurvey12", para);
                Response.Redirect("RiskAssessmentSurvey13.aspx");


                //Server.Transfer("RiskAssessmentSurvey13.aspx");
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                ddlV_Type.Focus();
                lblerror.Visible = false;
                lblerr.Visible   = false;
                lblerr1.Visible  = false;

                if (!IsPostBack)
                {
                    ColorTab();

                    lnkVehicle_Alert.BackColor = System.Drawing.Color.Maroon;
                    lnkVehicle_Alert.ForeColor = System.Drawing.Color.White;

                    if (Session["ManagementRole"].ToString().ToLower() == "superuser" || Session["ManagementRole"].ToString().ToLower() == "super security officer")
                    {
                        fillLocation();
                    }
                    else
                    {
                        getLocationNameById(Session["LCID"].ToString());
                    }
                }

                string ctrlname  = Page.Request.Params.Get("__EVENTTARGET");
                string ctrlname1 = Page.Request.Params.Get("__eventargument");
                if (ctrlname != null)
                {
                    string controlname = ctrlname;//.Split('$')[ctrlname.Split('$').Length - 1].ToString();
                    if (!controlname.Contains("imdAdd") && !controlname.Contains("imgDelete") && !controlname.Contains("CheckBox1"))
                    {
                        if (controlname.ToUpper().Contains("gvLoctionTable".ToUpper()))
                        {
                            if (ctrlname1 != null)
                            {
                                if (ctrlname1.Contains("RowClick"))
                                {
                                }
                                else if (ctrlname1.ToUpper().Contains("FIRECOMMAND") || ctrlname1 == "")
                                {
                                    BindGridWithFilter();
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                }
                else
                {
                    BindGridWithFilter();
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#35
0
 /// <summary>
 /// desc:出错信息记录
 /// </summary>
 /// <param name="message">消息</param>
 public static void Error(string message)
 {
     log4net.ILog logger = log4net.LogManager.GetLogger(loggerRepository.Name, "logerror");
     logger.Error(message);
 }
示例#36
0
 /// <summary>
 /// 日志信息记录,可以记录多个参数
 /// </summary>
 /// <param name="message">消息内容</param>
 /// <param name="objects">参数内容</param>
 public static void InfoFormat(string message, params object[] objects)
 {
     log4net.ILog logger = log4net.LogManager.GetLogger(loggerRepository.Name, "loginfo");
     logger.InfoFormat(message, objects);
 }
示例#37
0
 /// <summary>
 /// desc:处理日志信息记录
 /// </summary>
 /// <param name="message">消息</param>
 public static void Info(string message)
 {
     log4net.ILog logger = log4net.LogManager.GetLogger(loggerRepository.Name, "loginfo");
     logger.Info(message);
 }
 public MedicineSupplyProvider(IMedicineSupply repo)
 {
     _repocontext = repo;
     _log4net     = log4net.LogManager.GetLogger(typeof(MedicineSupplyProvider));
 }
示例#39
0
 /// <summary>
 /// Debug信息记录
 /// </summary>
 /// <param name="message">消息内容</param>
 public static void Debug(string message)
 {
     log4net.ILog logger = log4net.LogManager.GetLogger(loggerRepository.Name, "debuginfo");
     logger.Debug(message);
 }
示例#40
0
        /// <summary>
        /// Creation of a row in the database
        /// </summary>
        /// <param name="Ex"></param>
        /// <param name="type"></param>
        /// <param name="Details"></param>
        /// <param name="Url"></param>
        public static void GenerateError(Exception Ex, System.Type type = null, string Details = null, string Url = null)
        {
            bool LoggeError = true;

            try
            {
                log4net.ILog logger = null;
                if (type == null)
                {
                    logger = log4net.LogManager.GetLogger("Unkwnon");
                }
                else
                {
                    logger = log4net.LogManager.GetLogger(type);
                }
                Url = "Unknown";
                try
                {
                    Url = HttpContext.Current?.Request?.Url?.AbsoluteUri;
                }
                catch
                {
                    Url = "Unknown";
                }
                string ExceptionMessage = "";
                if (Ex != null)
                {
                    ExceptionMessage = Ex.Message;
                }
                else
                {
                    Ex = new Exception("Unknown exception");
                }

                string UrlReferrer = HttpContext.Current?.Request?.UrlReferrer?.AbsoluteUri;
                string Form        = "";
                try
                {
                    Form = HttpContext.Current?.Request?.Form?.ToString();
                }
                catch
                {
                }
                string Message = "";

                LoggeError = Logger.IsErrorLogged(Url, ExceptionMessage) && Logger.IsErrorLogged(UrlReferrer, ExceptionMessage);

                if (LoggeError)
                {
                    if (!String.IsNullOrEmpty(Form) && !Utils.IsProductionWebsite())
                    {
                        Message = "- Form => " + Form;
                    }
                    if (!String.IsNullOrEmpty(Details))
                    {
                        Message = "- Details => " + Details + " </br></br>" + Message;
                    }
                    Message = "- HttpMethod => " + (HttpContext.Current?.Request?.HttpMethod ?? "N/A") + " </br></br>" + Message;
                    if (!String.IsNullOrEmpty(Url) && !String.IsNullOrEmpty(UrlReferrer) && UrlReferrer.Trim().ToLower() != Url.Trim().ToLower())
                    {
                        Message = "- Url Referrer => " + UrlReferrer + " </br></br>" + Message;
                    }
                    if (!String.IsNullOrEmpty(Url))
                    {
                        Message = "- Url => " + Url + " </br></br>" + Message;
                    }
                    Message = "- Message => " + ExceptionMessage + " </br></br>" + Message;
                    logger.Error(Message, Ex);
                }
            }
            catch (Exception ex2)
            {
                if (ex2 == null)
                {
                    Logger.GenerateInfo("Error while creating a Log.");
                }
                else
                {
                    Logger.GenerateInfo("Error while creating a Log : " + ex2?.ToString());
                }
            }
        }
示例#41
0
 /// <summary>
 /// Static class constructor
 /// </summary>
 static App()
 {
     XmlConfigurator.Configure();
     Logger = LogManager.GetLogger("default");
 }
示例#42
0
 public static void WriteLog(Type type, string msg)
 {
     log4net.ILog log = log4net.LogManager.GetLogger(type);
     log.Error(msg);
 }
 public Calculation(ILog logger)
 {
     _logger = logger;
 }
示例#44
0
        /// <summary>
        /// Append asynchronous
        /// </summary>
        /// <param name="loggingEvent">The logging event.</param>
        public static void AsyncAppend(object loggingEvent)
        {
            LoggingEvent Event = (LoggingEvent)loggingEvent;

            try
            {
                if (loggingEvent != null)
                {
                    //scrivo il messaggio nella coda configurata
                    System.Messaging.MessageQueue mq        = new System.Messaging.MessageQueue();
                    System.Messaging.Message      mqMessage = new Message();
                    //System.Messaging.Message mqMessage = new System.Messaging.Message(((BaseLogInfo)Event.MessageObject).Serialize().InnerXml);
                    {
                        mqMessage.AttachSenderId   = false;
                        mqMessage.Recoverable      = true;
                        mqMessage.Label            = appName + "-" + Event.Level.DisplayName;
                        mqMessage.TimeToReachQueue = System.Messaging.Message.InfiniteTimeout;
                        mqMessage.TimeToBeReceived = System.Messaging.Message.InfiniteTimeout;
                        mqMessage.Body             = ((BaseLogInfo)Event.MessageObject).Serialize().DocumentElement;
                    }

                    try
                    {
                        mq.Path      = "FormatName:" + m_queueName;
                        mq.Formatter = new XmlMessageFormatter();
                        mq.Send(mqMessage, MessageQueueTransactionType.None);
                    }
                    catch (Exception)
                    {
                        if ((backupQueueName != null && !backupQueueName.Equals("")))
                        {
                            try
                            {
                                mq.Path = "FormatName:" + backupQueueName;
                                mq.Send(mqMessage, MessageQueueTransactionType.None);
                            }
                            catch (Exception e1)
                            {
                                ErrorLog error = new ErrorLog();
                                error.freeTextDetails = e1.Message;
                                error.logCode         = "ERR003";
                                error.loggingAppCode  = "LOG";
                                error.loggingTime     = System.DateTime.Now;
                                error.uniqueLogID     = System.DateTime.Now.Ticks.ToString();
                                log.Error(error);
                                throw e1;
                            }
                        }
                    }
                }
            }
            catch (Exception e2)
            {
                //log di 2° backup//
                string       error = e2.Message;
                log4net.ILog log   = log4net.LogManager.GetLogger(typeof(Com.Delta.Logging.MsmqAppender));
                log.Info(Event.MessageObject);

                //notifico il sistema del problema
                if (notify)
                {
                    if (System.Diagnostics.EventLog.SourceExists(eventLog))
                    {
                        System.Diagnostics.EventLog myEventLog = null;
                        try
                        {
                            string msg = "Errore durante la scrittura nella coda:" +
                                         m_queueName +
                                         "\\r\\n Dettaglio:\\r\\n+" +
                                         Event.MessageObject.ToString() +
                                         "\\r\\n Errore:\\r\\n" +
                                         e2.Message +
                                         "\\r\\n\\r\\n Dettaglio Errore:\\r\\n" +
                                         e2.StackTrace;

                            myEventLog        = new System.Diagnostics.EventLog();
                            myEventLog.Source = eventLog;
                            myEventLog.WriteEntry(msg, System.Diagnostics.EventLogEntryType.Error);
                            myEventLog.Close();
                        }
                        finally
                        {
                            if (myEventLog != null)
                            {
                                myEventLog.Dispose();
                            }
                        }
                    }
                }
            }
        }
示例#45
0
 public static void WriteLog(Type type, Exception ex)
 {
     log4net.ILog log = log4net.LogManager.GetLogger(type);
     log.Error("Error", ex);
 }
示例#46
0
        public void DownloadHtmlFormat()
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                Int32  intcellCount  = gvKeySearch.Columns.Count;
                string strContent    = "";
                string strHeaderText = "";
                string strHtmlFile   = "TxnHtmlFile";
                Response.ClearHeaders();
                Response.ClearContent();


                string datetime = string.Empty;
                datetime = Convert.ToString(System.DateTime.Now);

                string str = string.Empty;

                if (txtkeyno1.Text != "")
                {
                    str = ("   Key No. : " + txtkeyno1.Text);
                }
                if (txtKeyName.Text != "")
                {
                    str = ("    Name : " + txtKeyName.Text);
                }


                if (txtdatefrom.Text != "" && txtdateto.Text != "")
                {
                    str = ("   Date  From : " + txtdatefrom.Text + "      To :" + txtdateto.Text);
                }



                Response.AddHeader("content-disposition", string.Format("attachment;filename=testhtml.html"));
                Response.Charset     = "";
                Response.ContentType = "text/html";
                StringWriter sw = new StringWriter();
                sw.Write("<table border =1>");
                sw.Write("<CAPTION><b>Key Report</b></CAPTION>");

                sw.Write("Generated On : ");
                sw.Write(datetime);
                sw.Write("<CAPTION><br/></CAPTION>");
                sw.Write("Searching Parameter : ");
                sw.Write(str);



                sw.Write("<tr>");
                for (int i = 0; i < intcellCount; i++)
                {
                    strHeaderText = gvKeySearch.Columns[i].HeaderText.ToString();
                    sw.Write("<th>");
                    sw.Write(strHeaderText);
                    sw.Write("</th>");
                    sw.Write("<td>");
                    sw.Write("&nbsp");
                    sw.Write("</td>");
                }
                sw.Write("</tr>");

                foreach (GridViewRow grvRow in gvKeySearch.Rows)
                {
                    sw.Write("<tr>");
                    for (Int32 i = 0; i < intcellCount; i++)
                    {
                        strContent = grvRow.Cells[i].Text.ToString();
                        sw.Write("<td>");
                        sw.Write(strContent);
                        sw.Write("</td>");
                        sw.Write("<td>");
                        sw.Write("&nbsp");
                        sw.Write("</td>");
                    }
                    sw.Write("</tr>");
                }
                sw.Write("</table>");

                Response.Write(sw.ToString());
                Response.End();
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#47
0
 public AbsProcess()
 {
     log = LogUtils.GetLogger(this.GetType());
 }
示例#48
0
        private string ReturnWhere()
        {
            string str             = string.Empty;
            string makeWhereClause = string.Empty;

            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                List <String> arr = new List <String>();
                arr.Add("test");

                if (txtkeyno1.Text != "")
                {
                    if (arr.Count == 1)
                    {
                        makeWhereClause = " where ";
                        str            += " where Key_no='" + txtkeyno1.Text + "'";
                        arr.Add("1");
                    }
                    else
                    {
                        str += " and Key_no='" + txtkeyno1.Text + "'";
                    }
                }
                if (txtKeyName.Text != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " where name='" + txtKeyName.Text + "'";
                        arr.Add("3");
                    }
                    else
                    {
                        str += " and name='" + txtKeyName.Text + "'";
                    }
                }
                if (ddlstatus.Text != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " where status='" + ddlstatus.Text + "'";
                        arr.Add("3");
                    }
                    else
                    {
                        str += " and status='" + ddlstatus.Text + "'";
                    }
                }



                if (txtdatefrom.Text != "" && txtdateto.Text != "")
                {
                    if (arr.Count == 1)
                    {
                        str += " where Date_From BETWEEN '" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                        arr.Add("6");
                    }
                    else
                    {
                        str += " and Date_From BETWEEN'" + txtdatefrom.Text + "' AND '" + txtdateto.Text + "'";
                    }
                }

                if (txtdatefrom.Text != "" && txtdateto.Text == "")
                {
                    if (arr.Count == 1)
                    {
                        str += " where Date_From='" + txtdatefrom.Text + "'";
                        arr.Add("7");
                    }
                    else
                    {
                        str += " and Date_From='" + txtdatefrom.Text + "'";
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
            return(str);
        }
示例#49
0
        public void DownloadPDFFormat()
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                Document pdfReport = new Document(PageSize.A4, 25, 25, 40, 25);
                System.IO.MemoryStream msReport = new System.IO.MemoryStream();
                PdfWriter writer = PdfWriter.GetInstance(pdfReport, msReport);
                pdfReport.Open();



                string datetime = string.Empty;
                datetime = Convert.ToString(System.DateTime.Now);

                string str = string.Empty;

                if (txtkeyno1.Text != "")
                {
                    str = ("   Key No. : " + txtkeyno1.Text);
                }
                if (txtKeyName.Text != "")
                {
                    str = ("    Name : " + txtKeyName.Text);
                }


                if (txtdatefrom.Text != "" && txtdateto.Text != "")
                {
                    str = ("   Date  From : " + txtdatefrom.Text + "      To :" + txtdateto.Text);
                }



                Phrase headerPhrase = new Phrase("Key Report                                                       ", FontFactory.GetFont("Garamond", 14));

                headerPhrase.Add("                                                     Generated On : ");
                headerPhrase.Add(datetime);
                headerPhrase.Add("                                                                           Searching Parameter  : ");
                headerPhrase.Add(str);


                HeaderFooter header = new HeaderFooter(headerPhrase, false);
                header.Border    = Rectangle.NO_BORDER;
                header.Alignment = Element.ALIGN_CENTER;
                header.Alignment = Element.ALIGN_BOTTOM;
                pdfReport.Header = header;
                pdfReport.Add(headerPhrase);


                // Creates the Table
                PdfPTable ptData = new PdfPTable(gvKeySearch.Columns.Count);
                ptData.SpacingBefore       = 8;
                ptData.DefaultCell.Padding = 1;

                float[] headerwidths = new float[gvKeySearch.Columns.Count]; // percentage


                headerwidths[0] = 3.2F;
                headerwidths[1] = 3.2F;
                headerwidths[2] = 3.2F;
                headerwidths[3] = 3.2F;
                headerwidths[4] = 3.2F;
                headerwidths[5] = 3.2F;
                headerwidths[6] = 3.2F;
                headerwidths[7] = 3.2F;
                headerwidths[8] = 4.5F;

                ptData.SetWidths(headerwidths);
                ptData.WidthPercentage = 100;
                ptData.DefaultCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED;
                ptData.DefaultCell.VerticalAlignment   = Element.ALIGN_MIDDLE;

                //Insert the Table Headers
                for (int intK = 0; intK < gvKeySearch.Columns.Count; intK++)
                {
                    PdfPCell cell = new PdfPCell();
                    cell.BorderWidth     = 0.001f;
                    cell.BackgroundColor = new Color(200, 200, 200);
                    cell.BorderColor     = new Color(100, 100, 100);
                    cell.Phrase          = new Phrase(gvKeySearch.Columns[intK].HeaderText.ToString(), FontFactory.GetFont("TIMES_ROMAN", BaseFont.WINANSI, 7, Font.BOLD));
                    ptData.AddCell(cell);
                }

                ptData.HeaderRows = 1;  // this is the end of the table header

                //Insert the Table Data

                for (int intJ = 0; intJ < gvKeySearch.Rows.Count; intJ++)
                {
                    for (int intK = 0; intK < gvKeySearch.Columns.Count; intK++)
                    {
                        PdfPCell cell = new PdfPCell();
                        cell.BorderWidth     = 0.001f;
                        cell.BorderColor     = new Color(100, 100, 100);
                        cell.BackgroundColor = new Color(250, 250, 250);
                        if (gvKeySearch.Rows[intJ].Cells[intK].Text.ToString() != "&nbsp;")
                        {
                            cell.Phrase = new Phrase(gvKeySearch.Rows[intJ].Cells[intK].Text.ToString(), FontFactory.GetFont("TIMES_ROMAN", BaseFont.WINANSI, 6));
                        }
                        else
                        {
                            cell.Phrase = new Phrase("", FontFactory.GetFont("TIMES_ROMAN", BaseFont.WINANSI, 6));
                        }
                        ptData.AddCell(cell);
                    }
                }

                //Insert the Table

                pdfReport.Add(ptData);

                //Closes the Report and writes to Memory Stream

                pdfReport.Close();

                //Writes the Memory Stream Data to Response Object
                Response.Clear();

                Response.AddHeader("content-disposition", string.Format("attachment;filename=testpfd.pdf"));
                Response.Charset     = "";
                Response.ContentType = "application/pdf";
                Response.BinaryWrite(msReport.ToArray());
                Response.End();
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#50
0
 public log4netLogger(Type type)
 {
     _innerLogger = Log4Net.LogManager.GetLogger(type);
 }
示例#51
0
        private void BindGridWithFilter()
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                AdminBLL  ws     = new AdminBLL();
                GetNewKey objReq = new GetNewKey();

                string WhereClause = ReturnWhere();
                if (!string.IsNullOrEmpty(txtkeyno1.Text))
                {
                    objReq.key_no = txtkeyno1.Text;
                }
                if (!string.IsNullOrEmpty(txtKeyName.Text))
                {
                    objReq.name = txtKeyName.Text;
                }
                if (!string.IsNullOrEmpty(ddlstatus.Text))
                {
                    objReq.status = ddlstatus.Text;
                }
                if (!string.IsNullOrEmpty(txtKeyName.Text))
                {
                    objReq.name = txtKeyName.Text;
                }

                if (!string.IsNullOrEmpty(WhereClause))
                {
                    objReq.WhereClause = WhereClause;
                }

                if (!string.IsNullOrEmpty(txtdateto.Text))
                {
                    if (!string.IsNullOrEmpty(txtdatefrom.Text))
                    {
                        objReq.Date_From = txtdatefrom.Text;
                        objReq.Date_From = txtdatefrom.Text;
                    }
                }

                if (!string.IsNullOrEmpty(txtdatefrom.Text))
                {
                    if (string.IsNullOrEmpty(txtdateto.Text))
                    {
                        objReq.Date_From = txtdatefrom.Text;
                    }
                }


                GetNewKeyRequest ret = ws.GetNewKey(objReq);
                int pageSize         = ContextKeys.GRID_PAGE_SIZE;
                gvKeySearch.PageSize   = pageSize;
                gvKeySearch.DataSource = ret.Key;
                if (ret.Key.Count == 0)
                {
                    key2.Visible = false;
                }
                gvKeySearch.DataBind();
                key2.Text = ret.Key.Count.ToString();
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#52
0
 public Log4NetAdapter()
 {
     XmlConfigurator.Configure();
     _log = LogManager
            .GetLogger(ApplicationSettingsFactory.GetApplicationSettings().LoggerName);
 }
示例#53
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Logger" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 public Logger(log4net.ILog logger)
 {
     InternaLogger = logger;
 }
示例#54
0
 public static void logInfo(string className, string msg)
 {
     logger = log4net.LogManager.GetLogger(className);
     logger.Info(string.Format("{0}: {1}", className, msg));
 }
示例#55
0
 public static void logDebug(string className, string msg)
 {
     logger = log4net.LogManager.GetLogger(className);
     logger.Debug(msg);
 }
示例#56
0
 public static void logError(string className, string msg, Exception exc)
 {
     logger = log4net.LogManager.GetLogger(className);
     logger.Error(string.Format("{0}: {1}", className, msg), exc);
 }
示例#57
0
 public static log4net.ILog initialize_logger()
 {
     log4net.Config.XmlConfigurator.Configure();
     Logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     return(Logger);
 }
示例#58
0
        protected void txtItemNo_TextChanged(object sender, EventArgs e)
        {
            log4net.ILog logger = log4net.LogManager.GetLogger("File");
            try
            {
                if (chksingout.Checked == true)
                {
                    String ZipRegex = "^[0-9]+$";
                    if (Regex.IsMatch(txtItemNo.Text, ZipRegex))
                    {
                        cn = a.getconnection();
                        SqlCommand    command = new SqlCommand("select Top 1 Item_no,Item_Description,Item_quantity,loged_Nric,loged_Name,loged_CompName,loged_Time,Found_Nric,Status from Item_Manager where Item_no='" + txtItemNo.Text + "' ", cn);
                        SqlDataReader rd      = command.ExecuteReader();

                        if (rd.HasRows)
                        {
                            if (rd.Read())
                            {
                                txtItemNo.Text          = rd.GetValue(0).ToString();
                                txtItemdescription.Text = rd.GetValue(1).ToString();
                                txtItemquantity.Text    = rd.GetValue(2).ToString();

                                txtlogednric.Text     = rd.GetValue(3).ToString();
                                txtlogedname.Text     = rd.GetValue(4).ToString();
                                txtlogedcompname.Text = rd.GetValue(5).ToString();
                                lbllogedtime.Text     = rd.GetValue(6).ToString();

                                txtfoundnric.Text = rd.GetValue(7).ToString();
                                cmbstatus.Text    = rd.GetValue(8).ToString();
                            }
                            rd.Close();
                            //===============================//
                            rd.Dispose();
                            //==================================//
                        }
                        else
                        {
                            lblerror.Visible = true;
                            lblerror.Text    = "Invalid Item No. ..!";
                            lblerr2.Visible  = true;
                        }
                    }
                    else
                    {
                        lblerror.Visible = true;
                        lblerror.Text    = "Invalid Item No. ..!";
                        lblerr2.Visible  = true;
                    }
                }

                if (chklost.Checked == true)
                {
                    String ZipRegex = "^[0-9]+$";
                    if (Regex.IsMatch(txtItemNo.Text, ZipRegex))
                    {
                        cn = a.getconnection();
                        SqlCommand    command = new SqlCommand("select Top 1 Item_no,Item_Description,Item_quantity,loged_Time from Item_Manager where Item_no='" + txtItemNo.Text + "' ", cn);
                        SqlDataReader rd      = command.ExecuteReader();

                        if (rd.HasRows)
                        {
                            if (rd.Read())
                            {
                                txtItemNo.Text          = rd.GetValue(0).ToString();
                                txtItemdescription.Text = rd.GetValue(1).ToString();
                                txtItemquantity.Text    = rd.GetValue(2).ToString();
                                lbllogedtime.Text       = rd.GetValue(3).ToString();
                            }
                            rd.Close();
                            //======================//
                            rd.Dispose();
                            //========================//
                        }
                        else
                        {
                            lblerror.Visible = true;
                            lblerror.Text    = "Invalid Item No. ..!";
                            lblerr2.Visible  = true;
                        }
                    }
                    else
                    {
                        lblerror.Visible = true;
                        lblerror.Text    = "Invalid Item No. ..!";
                        lblerr2.Visible  = true;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Info(ex.Message);
            }
        }
示例#59
0
 public static void logError(string className, string msg)
 {
     logger = log4net.LogManager.GetLogger(className);
     logger.Error(msg);
 }
 public NHibernateBoxQueryEvaluator(ILog log, 
     RepositoryFinder repoFinder, IComponentContext context)
 {
     this.log = log;
     _repoFinder = repoFinder;
     this.context = context;
 }