/// <summary> /// /// </summary> /// <param name="log"></param> /// <param name="connectionString"></param> /// <param name="catalog"></param> /// <param name="schema"></param> /// <param name="prefix"></param> public SqlProcedureLoader(LogWrapper log, string connectionString, string catalog, string schema, string prefix) : base(connectionString, log) { _catalog = catalog; _schema = schema; _prefix = prefix; }
public TILED_MapTileset GetMapTilesetWithFirstgid(string mapPath, int gid) { if (gid == 0) { LogWrapper.Error("[{0}] the gid 0 is dedicated to void cells with no TILED_MapTileset, will return null", GetType()); return(null); } var map = GetMap(mapPath); if (gid > 0 && map.tilesets.Length == 1 && gid >= map.tilesets[0].firstgid) { return(map.tilesets[0]); } else if (map.tilesets.Length > 1) { for (int i = 0; i < map.tilesets.Length - 1; i++) { var tl_1 = map.tilesets[i]; var tl_2 = map.tilesets[i + 1]; if (gid >= tl_1.firstgid && gid < tl_2.firstgid) { return(tl_1); } } if (gid >= map.tilesets[map.tilesets.Length - 1].firstgid) { return(map.tilesets[map.tilesets.Length - 1]); } } return(null); }
public DATEXIINTISModelVMSProcessService() : base() { logWrapper = new LogWrapper("DATEXIINTISModelVMSProcessService"); vmsStaticDataStore = (VMSStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.VMS_STATIC_DATA_STORE); matrixSignalStaticDataStore = (MatrixSignalStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.MATRIX_SIGNAL_STATIC_DATA_STORE); }
/// <summary> /// Creates a unique group of key events identified by a key /// Key consists of : EmployeeId, EventType, MachineId /// </summary> /// <returns>Dictionary of unique key events</returns> public IDictionary <string, KeyEvent> GetKeyEventGrp() { try { if (this.KeyEvents == null || this.KeyEvents.Count() == 0) { return(null); } Dictionary <string, KeyEvent> keyevntsGrpDict = new Dictionary <string, KeyEvent>(); foreach (var item in this.KeyEvents) { if (!keyevntsGrpDict.ContainsKey(item.Key)) { LogWrapper.Log($"Found new key to add to Group dictionary. Key is {item.Key}. Key event is {item.ToString()}", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Verbose); keyevntsGrpDict.Add(item.Key, new KeyEvent(item.KeyEventId, item.MachineId, item.StockNumber, item.EmployeeId, item.EventType, item.TimeStamp)); } else { LogWrapper.Log($"Key {item.Key} already exists in Group dictionary. Key event is {item.ToString()} not getting added", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Verbose); } } return(keyevntsGrpDict); } catch (Exception ex) { LogWrapper.Log($"Error in creating key event group. Error message is {ex.Message}", $"Thread id is : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Error); return(null); } }
private void ReadApplicationConfig() { var appConfig = Utils.ReadJsonFromResources <ApplicationConfig>(Constants.PATH_APP_CONFIG); AddReadonly(Constants.DB_KEY_APP_CONFIG, appConfig, false); LogWrapper.Log("[{0}] loaded app config succesfully and added to the database with key: {1}", GetType(), Constants.DB_KEY_APP_CONFIG); }
public virtual void ExecuteReader() { SetUpProviderAndConnection(); using (DBConnection) { DBCommand = DBConnection.CreateCommand(); DBCommand.CommandText = QueryString != null?QueryString:"Select * from State"; DBCommand.CommandType = CommandType.Text; try { //Open Connection DBConnection.Open(); //Execute Reader DBDataReader = DBCommand.ExecuteReader(); //SE: update this with something usable var retList = new List <string>(); while (DBDataReader.Read()) { retList.Add(DBDataReader[0].ToString()); } } catch (Exception ex) { LogWrapper.Log(ex.Message); } } }
public DataExtractServiceProcessor() { LogWrapper.Log("Enter DataExtractServiceProcess .ctor", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Information); _dal = new DataAccessImpl(); _serviceProxy = new ExternalServiceAgent(); LogWrapper.Log("Exit DataExtractServiceProcess .ctor", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Information); }
private IEnumerable <IntegrationLog> CreateIntegrationLog(KeyEventWrapper originalKeyEvents, KeyEventResponse response) { try { IList <IntegrationLog> logs = new List <IntegrationLog>(); foreach (var item in originalKeyEvents.KeyEvents) { try { IntegrationLog _log = new IntegrationLog(); _log.DateTimeSent = response.RequestSentDateTime; _log.IsSuccessFlg = response.IsSuccessful; _log.KeyEventId = item.KeyEventId; _log.RequestJsonDatainString = response.RequestJsonString; _log.ResponseDescription = response.ResponseMessage; _log.ResponseReceivedinSecs = response.ResponseTimeinSecs; logs.Add(_log); } catch (Exception ex) { LogWrapper.Log($"Error in generating Integration log for KeyeventId {item.KeyEventId}. Error is {ex.Message}. Skipping to next one", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Error); } } return(logs as IEnumerable <IntegrationLog>); } catch (Exception ex) { LogWrapper.Log($"Error in generating Integration log. Error is {ex.Message}", $"Thread id : {System.Threading.Thread.CurrentThread.ManagedThreadId}", 1, System.Diagnostics.TraceEventType.Error); return(null); } }
public void DatabaseFailureLog(string str, params object[] args) { var sb = new StringBuilder(); sb.AppendFormat(str, args); LogWrapper.InfoFormat("[FATAL] {0}", sb.ToString()); }
/// <summary> /// Export the data to the specified location with avro. /// </summary> /// <param name="exportLocation"></param> /// <param name="values"></param> /// <param name="fileType"></param> /// <param name="logger"></param> public ExportToAvro(string exportLocation, IEnumerable <Models.Claim> values, string fileType, LogWrapper logger) { this.exportLocation = exportLocation; this.values = values; this.fileType = fileType; this.logger = logger; }
public void Boot(string str, params object[] args) { var sb = new StringBuilder(); sb.AppendFormat(str, args); LogWrapper.InfoFormat("[BOOT] {0}", sb.ToString()); }
private PackagePhysicalFileMetadata DownloadChart(string packageId, IVersion version, Uri feedUri, ICredentials feedCredentials, string cacheDirectory) { var cred = feedCredentials.GetCredential(feedUri, "basic"); var tempDirectory = fileSystem.CreateTemporaryDirectory(); using (new TemporaryDirectory(tempDirectory)) { var homeDir = Path.Combine(tempDirectory, "helm"); if (!Directory.Exists(homeDir)) { Directory.CreateDirectory(homeDir); } var stagingDir = Path.Combine(tempDirectory, "staging"); if (!Directory.Exists(stagingDir)) { Directory.CreateDirectory(stagingDir); } var log = new LogWrapper(); Invoke($"init --home \"{homeDir}\" --client-only", tempDirectory, log); Invoke($"repo add --home \"{homeDir}\" {(string.IsNullOrEmpty(cred.UserName) ? "" : $"--username \"{cred.UserName}\" --password \"{cred.Password}\"")} {TempRepoName} {feedUri.ToString()}", tempDirectory, log); Invoke($"fetch --home \"{homeDir}\" --version \"{version}\" --destination \"{stagingDir}\" {TempRepoName}/{packageId}", tempDirectory, log); var localDownloadName = Path.Combine(cacheDirectory, PackageName.ToCachedFileName(packageId, version, Extension)); fileSystem.MoveFile(Directory.GetFiles(stagingDir)[0], localDownloadName); return(PackagePhysicalFileMetadata.Build(localDownloadName)); }
public override void InstallBindings() { Container.Bind <DataBindingInitializerSystem>().AsSingle().NonLazy(); Container.Bind <DataProviderSystem>().AsSingle().NonLazy(); Container.Bind <SceneSystem>().AsSingle().NonLazy(); Container.Bind <DragSystem>().AsSingle().NonLazy(); Container.Bind <PinchSystem>().AsSingle().NonLazy(); Container.Bind <TapCommandSystem>().AsSingle().NonLazy(); Container.Bind <CampSystem>().AsSingle().NonLazy(); Container.Bind <TimedCommandSystem>().AsSingle().NonLazy(); Container.Bind <MergeSystem>().AsSingle().NonLazy(); Container.Bind <OrderListSystem>().AsSingle().NonLazy(); var commandSystem = new CommandSystem(); Container.BindInstance(commandSystem); Container.QueueForInject(commandSystem); // start -- command addition Container.Bind <SpawnCommand>().AsSingle().NonLazy(); commandSystem.AddCommand(Constants.COMMAND_SPAWN_OBJ, Container.Resolve <SpawnCommand>()); // -- end LogWrapper.DebugLog("[{0}] installation of sample bindings successfull", GetType()); }
protected override void ExecuteBodyCommand(CommandData commandData, Vector3 executePos, GameEntity cell, GameEntity trigger = null) { if (!string.IsNullOrEmpty(commandData.output)) { for (int i = 0; i < commandData.count; i++) { var entity = factoryEntity.CreateGameGridObject(commandData.output); if (cell == null) { cell = gridService.GetClosestCell(executePos, true); } if (!gridService.DoesFit(entity, cell)) { cell = gridService.GetClosestFitPivotCell(entity, cell); if (cell == null) { LogWrapper.Error("[{0}] Could not fit the entity, the command will stop execution, command id: {1}", GetType(), commandData.id); entity.Destroy(); return; } } entity.position = executePos; gridService.SetEntityOn(entity, cell); entity.TweenScale(Vector3.zero, Vector3.one, 0.5f, LeanTweenType.easeOutBack); if (entity.hasCommand) { commandSystem.Execute(entity.command.onSpawnCommand, cell.position, cell, entity); } } } }
/// <summary> /// Method which is invoked by the AddIn framework when the control is created. /// </summary> /// <param name="inDesignMode">Flag which indicates if the control is being drawn on the Workspace Designer. (Use this flag to determine if code should perform any logic on the workspace record)</param> /// <param name="RecordContext">The current workspace record context.</param> /// <returns>The control which implements the IWorkspaceComponent2 interface.</returns> public IWorkspaceComponent2 CreateControl(bool inDesignMode, IRecordContext RecordContext) { if (!ConfigurationSetting.configVerbPerfect) { if (!ConfigurationSetting.loginUserIsAdmin) { MessageBox.Show("RepairOrderAddIn is not initialized properly. \nPlease contact your system administrator.\n You are now logged out."); _gContext.Logout(); } else // don't want to logout admin { MessageBox.Show("RepairOrderAddIn is not loaded because of invalid configuration verb."); return(new RepairOrderAddIn(inDesignMode, RecordContext, isEnabledEditing)); } } _rContext = RecordContext; string logMessage, logNote; if (!inDesignMode && _rContext != null) { // Set config according to custom configuration verb ConfigurationSetting instance = ConfigurationSetting.Instance(_gContext); _usr = ConfigurationSetting.username; _pwd = ConfigurationSetting.password; _log = ConfigurationSetting.logWrap; _ebsDefaultSrOwnerId = ConfigurationSetting.ebsDefaultSrOwnerId; RepairOrder.ServiceProvider = ConfigurationSetting.EBSProvider; RepairOrder.CreateURL = ConfigurationSetting.CreateRepair_WSDL; RepairOrder.UpdateURL = ConfigurationSetting.UpdateRepair_WSDL; //RepairOrder.LookupURL = ConfigurationSetting.LookupRepair_WSDL; //RepairOrder.ListLookupURL = ConfigurationSetting.LookupRepairList_WSDL; RepairOrder.ListURL = ConfigurationSetting.RepairOrderList_WSDL; RepairOrder.ServiceUsername = _usr; RepairOrder.ServicePassword = _pwd; RepairOrder.ServiceClientTimeout = ConfigurationSetting.EBSServiceTimeout; RepairOrder.InitEBSProvider(); logMessage = "Repair Order is initiated."; logNote = ""; _log.DebugLog(logMessage: logMessage, logNote: logNote); } /* * bool isEnabled = false; * if (isEnabledEditing == "true") * { * isEnabled = true; * }*/ _wsAddIn = new RepairOrderAddIn(inDesignMode, _rContext, isEnabledEditing); _wsAddIn._log = _log; _wsAddIn._ebsDefaultSrOwnerId = _ebsDefaultSrOwnerId; if (_log != null) { logMessage = "Repair Order AddIn is setup."; logNote = ""; _log.DebugLog(logMessage: logMessage, logNote: logNote); } return(_wsAddIn); }
/// <summary> /// Initializes a new instance of the <see cref="ShaderPool"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="cbPool">The cb pool.</param> /// <param name="logger">The logger.</param> public ShaderPool(Device device, IConstantBufferPool cbPool, LogWrapper logger) : base(false) { ConstantBufferPool = cbPool; this.device = device; this.logger = logger; }
public IEnumerable <Comment> GetFileComments(Guid fileId) { using (LogWrapper logger = new LogWrapper()) { var result = new List <Comment>(); try { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "select Comments.Id as Id from Shared join Comments on Shared.Id = Comments.SharedId where Shared.FileId = @fileId"; command.Parameters.AddWithValue("@fileId", fileId); using (var reader = command.ExecuteReader()) { while (reader.Read()) { result.Add(GetComment(reader.GetGuid(reader.GetOrdinal("Id")))); } return(result); } } } } catch (Exception ex) { logger.Error(ex.Message); } return(result); } }
public void Shared(Share share) { using (LogWrapper logger = new LogWrapper()) { try { using (SqlConnection connect = new SqlConnection(_connectionString)) { connect.Open(); using (SqlCommand command = new SqlCommand("up_Shared_file", connect)) { command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@ownerId", share.OwnerId); command.Parameters.AddWithValue("@fileId", share.FileId); command.Parameters.AddWithValue("@userId", share.PartOwnerId); command.Parameters.AddWithValue("@readOnlyAccess", share.ReadOnlyAccess); command.ExecuteNonQuery(); } } } catch (Exception ex) { logger.Error(ex.Message); } } }
public File Add(File file) { using (LogWrapper logger = new LogWrapper()) { try { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); using (var command = new SqlCommand("up_Insert_file", connection)) { command.CommandType = System.Data.CommandType.StoredProcedure; var fileId = Guid.NewGuid(); command.Parameters.AddWithValue("@id", fileId); command.Parameters.AddWithValue("@name", file.Name); command.Parameters.AddWithValue("@type", GetFileType(file.Name)); command.Parameters.AddWithValue("@owner", file.Owner.Id); command.Parameters.AddWithValue("@creationTime", file.CreationTime); command.Parameters.AddWithValue("@lastWriteTime", file.LastWriteTime); command.ExecuteNonQuery(); file.Id = fileId; return(file); } } } catch (Exception ex) { logger.Error(ex.Message); return(null); } } }
public IEnumerable <File> GetUserFiles(Guid userId) { using (LogWrapper logger = new LogWrapper()) { var result = new List <File>(); try { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = "select FileId from Shared where UserId = @userid"; command.Parameters.AddWithValue("@userid", userId); using (var reader = command.ExecuteReader()) { while (reader.Read()) { result.Add(GetInfo(reader.GetGuid(reader.GetOrdinal("id")))); } } } } } catch (Exception ex) { logger.Error(ex.Message); } return(result); } }
public LogWrapperFacts() { _eventArgs = null; _mockLog = A.Fake <ILog>(); _wrapper = new LogWrapper(_mockLog, LogLevel.Info); _wrapper.OnLoggingEvent += WrapperOnOnLoggingEvent; }
protected AbstractImporter(string importPath, string fileType, string fileName, LogWrapper logger) { this.importPath = importPath; this.fileType = fileType; this.fileName = fileName; this.loggerWrapper = logger; ReadData(); }
public DATEXIINetworkModelUpdateService(DATEXIIUpdateService datexIIUpdateService) { this.datexIIUpdateService = datexIIUpdateService; logWrapper = new LogWrapper("DATEXIINetworkModelUpdateService"); nwkModelDirectory = ConfigurationManager.AppSettings["rootDirectory"] + ConfigurationManager.AppSettings["nwkModelDirectory"]; nwkModelPath = ConfigurationManager.AppSettings["nwkModelPath"]; }
public DATEXIINTISModelMeasurementSitesProcessService() : base() { logWrapper = new LogWrapper("DATEXIINTISModelMeasurementSitesProcessService"); tameStaticDataStore = (TAMEStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.TAME_STATIC_DATA_STORE); midasStaticDataStore = (MIDASStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.MIDAS_STATIC_DATA_STORE); anprStaticDataStore = (ANPRStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.ANPR_STATIC_DATA_STORE); tmuStaticDataStore = (TMUStaticDataStore)DataStoreFactory.GetInstance().GetDataStore(DataStoreFactory.DATA_STORES.TMU_STATIC_DATA_STORE); }
public static IStorage NewStorage(StorageConfig config) { #pragma warning disable CA2000,CA1062 var storage = new Storage(config); #pragma warning restore CA2000,CA1062 var proxy = LogWrapper <IStorage> .Create(storage); return(proxy); }
/// <summary> /// Initializes a new instance of the <see cref="EffectsManager"/> class. /// </summary> /// <param name="adapterIndex">Index of the adapter.</param> public EffectsManager(int adapterIndex) { #if DEBUG logger = new LogWrapper(new DebugLogger()); #else logger = new LogWrapper(new NullLogger()); #endif Initialize(adapterIndex); }
/// <summary> /// Initializes a new instance of the <see cref="EffectsManager"/> class. /// </summary> public EffectsManager() { #if DEBUG logger = new LogWrapper(new DebugLogger()); #else logger = new LogWrapper(new NullLogger()); #endif Initialize(); }
public bool Register(Int64 aUserId) { if (_AccountValidator == null) { LogWrapper.Log(MessageType.MESSAGE_ERROR, "Ошибка регистрации : Валидатор аккаунтов не задан"); throw new SecurityTokenException(); } return(_AccountValidator.RegisterAccount(aUserId)); }
public UserRequestCollection GetRequests(Int64 UserId) { if (_RequestProvider == null) { LogWrapper.Log(MessageType.MESSAGE_ERROR, "Ошибка : Стратегии предоставления данных не заданы"); return(new UserRequestCollection()); } return(_RequestProvider.GetRequests(UserId)); }
public bool Create(Int64 UserId, RequestType requestType, object requestParams) { if (_RequestCreater == null) { LogWrapper.Log(MessageType.MESSAGE_ERROR, "Ошибка создания : Метод создания заявок не задан"); return(false); } return(_RequestCreater.Create(UserId, requestType, requestParams)); }
private void RunSingleUpdateFromMultipleInstance(DbUpdaterMultipleSourceConfigurationSection settings, LogWrapper.ILogger logger, int configurationIndex, CommandLineParams commandLineParams) { if (settings == null || settings.DbUpdaterConfigurations == null) { OnFinishUpdateProcess(false); return; } if (configurationIndex >= settings.DbUpdaterConfigurations.Count) { OnFinishUpdateProcess(false); return; } DbUpdaterConfigurationSection currentSettings = settings.DbUpdaterConfigurations[configurationIndex]; if (string.IsNullOrEmpty(currentSettings.ConnectionString)) { currentSettings.ConnectionString = settings.ConnectionString; } RunSingleUpdate(currentSettings, logger, settings, configurationIndex + 1, commandLineParams); }
private void RunSingleUpdate(DbUpdaterConfigurationSection settings, LogWrapper.ILogger logger, DbUpdaterMultipleSourceConfigurationSection multipleSettings, int configurationIndex, CommandLineParams commandLineParams) { var bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.DoWork += (sender, args) => { var updater = new UpdateManager(settings, logger, commandLineParams); updater.UpdateProgress += (s, e) => bw.ReportProgress(0, e); updater.Update(); }; bw.ProgressChanged += Update_ProgressChanged; bw.RunWorkerCompleted += (s, e) => { IsUpdateInProgress = false; if (e.Error != null) { DisplayText += "Error: " + e.Error.Message +Environment.NewLine; OnFinishUpdateProcess(true); return; } if (e.Cancelled) { DisplayText += "Cancelled" + Environment.NewLine; OnFinishUpdateProcess(true); return; } RunSingleUpdateFromMultipleInstance(multipleSettings, logger, configurationIndex, commandLineParams); }; IsUpdateInProgress = true; bw.RunWorkerAsync(); }