public EventPoster getPoster(int id) { EventPoster eventPoster = null; string query = "SELECT * FROM EventPoster "; using (MySqlCommand command = new MySqlCommand(query, new MySqlConnection(getConnectionString()))) { command.Connection.Open(); command.CommandType = System.Data.CommandType.Text; using (MySqlDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { if (reader.Read()) { eventPoster = new EventPoster(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetDateTime(6), reader.GetString(7), reader.GetBoolean(8)); } } reader.Close(); } //Close Connection command.Connection.Close(); } return(eventPoster); }
public IActionResult Post([FromForm] UploadPostersDto postersDto) { if (postersDto.Files != null) { foreach (var file in postersDto.Files) { var fileName = Path.GetFileName(file.FileName); var poster = new EventPoster() { ScheduledEventId = postersDto.EventId, FileExtension = Path.GetExtension(fileName), Name = file.FileName, ContentType = file.ContentType, Size = file.Length }; using (var memoryStream = new MemoryStream()) { file.CopyTo(memoryStream); poster.BinaryData = memoryStream.ToArray(); } _repository.Add(poster); } } return(Ok()); }
public bool updateEventPoster(EventPoster poster) { bool success = false; query = @"UPDATE eventposter SET FullName = @FullName, Number = @Number, ProfileImage = @ProfileImage WHERE Id = @Id"; using (MySqlCommand command = new MySqlCommand(query, new MySqlConnection(getConnectionString()))) { //General command.Parameters.AddWithValue("@FullName", poster.FullName); command.Parameters.AddWithValue("@Id", poster.Id); command.Parameters.AddWithValue("@Number", poster.Number); command.Parameters.AddWithValue("@ProfileImage", poster.ProfileImage); command.Connection.Open(); command.CommandType = System.Data.CommandType.Text; command.ExecuteNonQuery(); command.Connection.Close(); success = true; } return(success); }
private void ResumeSystemThreads() { ThreadRender.StartThread("Render", null); ThreadLogic.StartThread("Logic", null); ThreadAsync.StartThread("AsyncIO", null); ThreadPhysics.StartThread("Physics", null); if (CIPlatform.Instance.PlayMode != CIPlatform.enPlayMode.Game) ThreadAsyncEditor.StartThread("AsyncEditor", null); EventPoster.StartPools(Desc.ThreadPoolCount); }
private void PauseSystemThreads() { ThreadRender.StopThread(null); ThreadLogic.StopThread(null); ThreadAsync.StopThread(null); ThreadPhysics.StopThread(null); if (CIPlatform.Instance.PlayMode != CIPlatform.enPlayMode.Game) ThreadAsyncEditor.StopThread(null); EventPoster.StopPools(); }
public void AddHandler <T>(EventHandler <T> handler) where T : EventBase { EventPosterBase poster; if (!mHandlers.TryGetValue(typeof(T), out poster)) { poster = new EventPoster <T>(); mHandlers[typeof(T)] = poster; } ((EventPoster <T>)poster).Listen += handler; }
private void StopSystemThreads() { //CEngine.Instance.ThreadMain.FrameBegin(); ThreadRender.StopThread(null); ThreadLogic.StopThread(null); ThreadAsync.StopThread(null); ThreadPhysics.StopThread(null); if (CIPlatform.Instance.PlayMode != CIPlatform.enPlayMode.Game) { ThreadAsyncEditor.StopThread(null); ThreadAsyncEditorSlow.StopThread(null); } EventPoster.StopPools(); }
public void RemoveHandler <T>(EventHandler <T> handler) where T : EventBase { if (!_handlers.ContainsKey(typeof(T))) { return; } EventPoster <T> poster = (EventPoster <T>)_handlers[typeof(T)]; poster.Listen -= handler; if (_handlers[typeof(T)].IsEmpty) { _handlers.Remove(typeof(T)); } }
public void AddHandler <T>(EventHandler <T> handler) where T : EventBase { EventPoster <T> poster; if (!_handlers.ContainsKey(typeof(T))) { poster = new EventPoster <T>(); _handlers[typeof(T)] = poster; } else { poster = _handlers[typeof(T)] as EventPoster <T>; } poster.Listen += handler; }
public void RemoveHandler <T>(EventHandler <T> handler) where T : EventBase { EventPosterBase basePoster; if (!mHandlers.TryGetValue(typeof(T), out basePoster)) { Debug.LogError(string.Format("Unable to remove handler {0} of type {1} because no handlers are currently registered for this type", handler, typeof(T))); return; } EventPoster <T> poster = (EventPoster <T>)basePoster; poster.Listen -= handler; if (poster.IsEmpty) { mHandlers.Remove(typeof(T)); } }
private void StartSystemThreads() { ThreadRHI.FromCurrent("RHI"); ThreadMain.FromCurrent("Main"); ThreadEditor.FromCurrent("Editor"); ThreadLogic.StartThread("Logic", null); ThreadRender.StartThread("Render", null); ThreadAsync.StartThread("AsyncIO", null); ThreadPhysics.StartThread("Physics", null); if (CIPlatform.Instance.PlayMode != CIPlatform.enPlayMode.Game) { ThreadAsyncEditor.StartThread("AsyncEditor", null); ThreadAsyncEditorSlow.StartThread("AsyncEditorSlow", null); } EventPoster.StartPools(Desc.ThreadPoolCount); }