/// <summary> /// Receives incoming notifications and informs any subscribers. /// </summary> private void NotificationProcessingThread() { while (!_isDisposed) { Thread.Sleep(1); // only bother if it's been fully converted, otherwise it will gobble up the initial status response if (NotificationSession == null || !NotificationSession.Options.HasFlag(XboxConnectionOptions.NotificationSession)) { continue; } // look for a new notification string notification = NotificationSession?.TryReceiveLine(); if (notification == null) { continue; } // save for later Logger?.Debug($"Notification received: {notification}"); NotificationHistory.Enqueue(notification); // start dequeuing old entries if greater than max history count if (NotificationHistory.Count > MaxNotificationHistoryCount) { string garbage; NotificationHistory.TryDequeue(out garbage); } // inform any subscribers NotificationReceived?.Invoke(this, new XboxNotificationEventArgs(notification)); } }
public async Task <ActionResult> SendNotification(NotificaitonViewModel notificaitonViewModel) { if (notificaitonViewModel != null) { try { NotificationHistory objNotification = new NotificationHistory() { Title = notificaitonViewModel.Title, NotificationText = notificaitonViewModel.NotificaitonText, CreatedBy = User.Identity.GetUserId() }; await Repository <NotificationHistory> .InsertEntity(objNotification, entity => { return(entity.Id); }); await SendNotificaitons(notificaitonViewModel.Title, notificaitonViewModel.NotificaitonText); TempData["SuccessMsg"] = "Notification Sent Successfully"; } catch (Exception ex) { TempData["ErrorMsg"] = "Something wrong!! Please try after sometime"; } } return(RedirectToAction("Index", "Notifications")); }
/// <summary> /// This method loads a 'NotificationHistory' object /// from the dataRow passed in. /// </summary> /// <param name='dataRow'>The 'DataRow' to load from.</param> /// <returns>A 'NotificationHistory' DataObject.</returns> public static NotificationHistory Load(DataRow dataRow) { // Initial Value NotificationHistory notificationHistory = new NotificationHistory(); // Create field Integers int deliveredfield = 0; int idfield = 1; int notificationIdfield = 2; int sendDatefield = 3; try { // Load Each field notificationHistory.Delivered = DataHelper.ParseBoolean(dataRow.ItemArray[deliveredfield], false); notificationHistory.UpdateIdentity(DataHelper.ParseInteger(dataRow.ItemArray[idfield], 0)); notificationHistory.NotificationId = DataHelper.ParseInteger(dataRow.ItemArray[notificationIdfield], 0); notificationHistory.SendDate = DataHelper.ParseDate(dataRow.ItemArray[sendDatefield]); } catch { } // return value return(notificationHistory); }
/// <summary> /// This method is used to find 'NotificationHistory' objects. /// </summary> /// <param name="id">Find the NotificationHistory with this id</param> /// <param name="tempNotificationHistory">Pass in a tempNotificationHistory to perform a custom find.</param> public NotificationHistory FindNotificationHistory(int id, NotificationHistory tempNotificationHistory = null) { // initial value NotificationHistory notificationHistory = null; // if the AppController exists if (this.HasAppController) { // if the tempNotificationHistory does not exist if (tempNotificationHistory == null) { // create a temp NotificationHistory tempNotificationHistory = new NotificationHistory(); } // if the id is set if (id > 0) { // set the primary key tempNotificationHistory.UpdateIdentity(id); } // perform the find notificationHistory = this.AppController.ControllerManager.NotificationHistoryController.Find(tempNotificationHistory); } // return value return(notificationHistory); }
/// <summary> /// Saves a 'NotificationHistory' object into the database. /// This method calls the 'Insert' or 'Update' method. /// </summary> /// <param name='notificationHistory'>The 'NotificationHistory' object to save.</param> /// <returns>True if successful or false if not.</returns> public bool Save(ref NotificationHistory notificationHistory) { // Initial value bool saved = false; // If the notificationHistory exists. if (notificationHistory != null) { // Since this is not an Autonumber field, we must attempt to look up this item before we decide to Insert or Update // Look up this item to see if it already exists NotificationHistory tempNotificationHistory = this.Find(notificationHistory); // Is this a new object ? bool isNew = (tempNotificationHistory == null); // If this is a new object if (isNew) { // Perform the insert saved = this.Insert(notificationHistory); } else { // Perform the update saved = this.Update(notificationHistory); } } // return value return(saved); }
/// <summary> /// This method finds a 'NotificationHistory' object. /// This method uses the 'NotificationHistory_Find' procedure. /// </summary> /// <returns>A 'NotificationHistory' object.</returns> /// </summary> public NotificationHistory FindNotificationHistory(FindNotificationHistoryStoredProcedure findNotificationHistoryProc, DataConnector databaseConnector) { // Initial Value NotificationHistory notificationHistory = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet notificationHistoryDataSet = this.DataHelper.LoadDataSet(findNotificationHistoryProc, databaseConnector); // Verify DataSet Exists if (notificationHistoryDataSet != null) { // Get DataTable From DataSet DataRow row = this.DataHelper.ReturnFirstRow(notificationHistoryDataSet); // if row exists if (row != null) { // Load NotificationHistory notificationHistory = NotificationHistoryReader.Load(row); } } } // return value return(notificationHistory); }
public async Task ProcessFillState(ContainerFillState fillState) { await _documentStorageService.InsertAsync(fillState); //check if a notification has been sent recently NotificationHistory mostRecentNotification = (await _documentStorageService.GetManyAsync <NotificationHistory, DateTimeOffset>( null, h => h.NotificationTime, 1, false)).FirstOrDefault(); if (mostRecentNotification?.NotificationTime >= DateTimeOffset.Now.Subtract(TimeSpan.FromMinutes(_notificationSettings.MinutesBetweenNotifications))) { return; } //examine sensor history to confirm a stable state IEnumerable <ContainerFillState> mostRecentStates = await _documentStorageService.GetManyAsync <ContainerFillState, DateTimeOffset>( c => c.Container.ContainerId == fillState.Container.ContainerId, c => c.Timestamp.Value, NumConsecutiveReadings, false); if (mostRecentStates.All(s => !s.FillState)) { await Notify(); } }
/// <summary> /// This method is used to delete NotificationHistory objects. /// </summary> /// <param name="id">Delete the NotificationHistory with this id</param> /// <param name="tempNotificationHistory">Pass in a tempNotificationHistory to perform a custom delete.</param> public bool DeleteNotificationHistory(int id, NotificationHistory tempNotificationHistory = null) { // initial value bool deleted = false; // if the AppController exists if (this.HasAppController) { // if the tempNotificationHistory does not exist if (tempNotificationHistory == null) { // create a temp NotificationHistory tempNotificationHistory = new NotificationHistory(); } // if the id is set if (id > 0) { // set the primary key tempNotificationHistory.UpdateIdentity(id); } // perform the delete deleted = this.AppController.ControllerManager.NotificationHistoryController.Delete(tempNotificationHistory); } // return value return(deleted); }
public NotificationHistory Add(NotificationHistory notificationHistory) { var notificationHistoryToDb = new EntitiesDb.NotificationHistory().MapFromEntity(notificationHistory); var notificationHistoryFromDb = dataContext.Add(notificationHistoryToDb).Entity; dataContext.SaveChanges(); return(notificationHistoryFromDb.MapToEntity()); }
/// <summary> /// This method deletes a 'NotificationHistory' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'NotificationHistory' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject DeleteNotificationHistory(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Delete StoredProcedure DeleteNotificationHistoryStoredProcedure deleteNotificationHistoryProc = null; // verify the first parameters is a(n) 'NotificationHistory'. if (parameters[0].ObjectValue as NotificationHistory != null) { // Create NotificationHistory NotificationHistory notificationHistory = (NotificationHistory)parameters[0].ObjectValue; // verify notificationHistory exists if (notificationHistory != null) { // Now create deleteNotificationHistoryProc from NotificationHistoryWriter // The DataWriter converts the 'NotificationHistory' // to the SqlParameter[] array needed to delete a 'NotificationHistory'. deleteNotificationHistoryProc = NotificationHistoryWriter.CreateDeleteNotificationHistoryStoredProcedure(notificationHistory); } } // Verify deleteNotificationHistoryProc exists if (deleteNotificationHistoryProc != null) { // Execute Delete Stored Procedure bool deleted = this.DataManager.NotificationHistoryManager.DeleteNotificationHistory(deleteNotificationHistoryProc, dataConnector); // Create returnObject.Boolean returnObject.Boolean = new NullableBoolean(); // If delete was successful if (deleted) { // Set returnObject.Boolean.Value to true returnObject.Boolean.Value = NullableBooleanEnum.True; } else { // Set returnObject.Boolean.Value to false returnObject.Boolean.Value = NullableBooleanEnum.False; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }
/// <summary> /// This method finds a 'NotificationHistory' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'NotificationHistory' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject FindNotificationHistory(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals NotificationHistory notificationHistory = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Find StoredProcedure FindNotificationHistoryStoredProcedure findNotificationHistoryProc = null; // verify the first parameters is a 'NotificationHistory'. if (parameters[0].ObjectValue as NotificationHistory != null) { // Get NotificationHistoryParameter NotificationHistory paramNotificationHistory = (NotificationHistory)parameters[0].ObjectValue; // verify paramNotificationHistory exists if (paramNotificationHistory != null) { // Now create findNotificationHistoryProc from NotificationHistoryWriter // The DataWriter converts the 'NotificationHistory' // to the SqlParameter[] array needed to find a 'NotificationHistory'. findNotificationHistoryProc = NotificationHistoryWriter.CreateFindNotificationHistoryStoredProcedure(paramNotificationHistory); } // Verify findNotificationHistoryProc exists if (findNotificationHistoryProc != null) { // Execute Find Stored Procedure notificationHistory = this.DataManager.NotificationHistoryManager.FindNotificationHistory(findNotificationHistoryProc, dataConnector); // if dataObject exists if (notificationHistory != null) { // set returnObject.ObjectValue returnObject.ObjectValue = notificationHistory; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } // return value return(returnObject); }
/// <summary> /// This method fetches all 'NotificationHistory' objects. /// </summary> /// <param name='List<PolymorphicObject>'>The 'NotificationHistory' to delete. /// <returns>A PolymorphicObject object with all 'NotificationHistorys' objects. internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals List <NotificationHistory> notificationHistoryListCollection = null; // Create FetchAll StoredProcedure FetchAllNotificationHistorysStoredProcedure fetchAllProc = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Get NotificationHistoryParameter // Declare Parameter NotificationHistory paramNotificationHistory = null; // verify the first parameters is a(n) 'NotificationHistory'. if (parameters[0].ObjectValue as NotificationHistory != null) { // Get NotificationHistoryParameter paramNotificationHistory = (NotificationHistory)parameters[0].ObjectValue; } // Now create FetchAllNotificationHistorysProc from NotificationHistoryWriter fetchAllProc = NotificationHistoryWriter.CreateFetchAllNotificationHistorysStoredProcedure(paramNotificationHistory); } // Verify fetchAllProc exists if (fetchAllProc != null) { // Execute FetchAll Stored Procedure notificationHistoryListCollection = this.DataManager.NotificationHistoryManager.FetchAllNotificationHistorys(fetchAllProc, dataConnector); // if dataObjectCollection exists if (notificationHistoryListCollection != null) { // set returnObject.ObjectValue returnObject.ObjectValue = notificationHistoryListCollection; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }
protected virtual void SaveNotification(string message) { using (var context = new BotContext()) { NotificationHistory h = new NotificationHistory() { Created = DateTime.Now, Notification = message, Plugin = PluginId }; context.NotificationHistories.Add(h); context.SaveChanges(); } }
/// <summary> /// This method creates the sql Parameters[] needed for /// update an existing notificationHistory. /// </summary> /// <param name="notificationHistory">The 'NotificationHistory' to update.</param> /// <returns></returns> internal static SqlParameter[] CreateUpdateParameters(NotificationHistory notificationHistory) { // Initial Values SqlParameter[] parameters = new SqlParameter[4]; SqlParameter param = null; // verify notificationHistoryexists if (notificationHistory != null) { // Create parameter for [Delivered] param = new SqlParameter("@Delivered", notificationHistory.Delivered); // set parameters[0] parameters[0] = param; // Create parameter for [NotificationId] param = new SqlParameter("@NotificationId", notificationHistory.NotificationId); // set parameters[1] parameters[1] = param; // Create parameter for [SendDate] // Create [SendDate] Parameter param = new SqlParameter("@SendDate", SqlDbType.DateTime); // If notificationHistory.SendDate does not exist. if ((notificationHistory.SendDate == null) || (notificationHistory.SendDate.Year < 1900)) { // Set the value to 1/1/1900 param.Value = new DateTime(1900, 1, 1); } else { // Set the parameter value param.Value = notificationHistory.SendDate; } // set parameters[2] parameters[2] = param; // Create parameter for [Id] param = new SqlParameter("@Id", notificationHistory.Id); parameters[3] = param; } // return value return(parameters); }
/// <summary> /// This method loads a collection of 'NotificationHistory' objects. /// </summary> public List <NotificationHistory> LoadNotificationHistorys(NotificationHistory tempNotificationHistory = null) { // initial value List <NotificationHistory> notificationHistorys = null; // if the AppController exists if (this.HasAppController) { // perform the load notificationHistorys = this.AppController.ControllerManager.NotificationHistoryController.FetchAll(tempNotificationHistory); } // return value return(notificationHistorys); }
/// <summary> /// This method is used to save 'NotificationHistory' objects. /// </summary> /// <param name="notificationHistory">The NotificationHistory to save.</param> public bool SaveNotificationHistory(ref NotificationHistory notificationHistory) { // initial value bool saved = false; // if the AppController exists if (this.HasAppController) { // perform the save saved = this.AppController.ControllerManager.NotificationHistoryController.Save(ref notificationHistory); } // return value return(saved); }
/// <summary> /// Deletes a 'NotificationHistory' from the database /// This method calls the DataBridgeManager to execute the delete using the /// procedure 'NotificationHistory_Delete'. /// </summary> /// <param name='notificationhistory'>The 'NotificationHistory' to delete.</param> /// <returns>True if the delete is successful or false if not.</returns> public bool Delete(NotificationHistory tempNotificationHistory) { // locals bool deleted = false; // Get information for calling 'DataBridgeManager.PerformDataOperation' method. string methodName = "DeleteNotificationHistory"; string objectName = "ApplicationLogicComponent.Controllers"; try { // verify tempnotificationHistory exists before attemptintg to delete if (tempNotificationHistory != null) { // Create Delegate For DataOperation ApplicationController.DataOperationMethod deleteNotificationHistoryMethod = this.AppController.DataBridge.DataOperations.NotificationHistoryMethods.DeleteNotificationHistory; // Create parameters for this method List <PolymorphicObject> parameters = CreateNotificationHistoryParameter(tempNotificationHistory); // Perform DataOperation PolymorphicObject returnObject = this.AppController.DataBridge.PerformDataOperation(methodName, objectName, deleteNotificationHistoryMethod, parameters); // If return object exists if (returnObject != null) { // Test For True if (returnObject.Boolean.Value == NullableBooleanEnum.True) { // Set Deleted To True deleted = true; } } } } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // Log the current error this.ErrorProcessor.LogError(methodName, objectName, error); } } // return value return(deleted); }
/// <summary> /// check how oftne we have to send the notification throuight the caller ( investor), e.g: once, unlimited, /// we can improve this by adding some more meta data in the notification interface like data, time, week,... /// then we could manage all diffrent senarioes like once per day m once per week , or all other combination that investor will inject by the time that /// set the investor in the stocket object or later attch new one... /// </summary> /// <param name="investor"></param> /// <param name="tradeTrigger"></param> /// <returns></returns> private bool hasPermissionToSendNotification(IInvestor investor, ITradeTrigger tradeTrigger) { if (tradeTrigger.NotificationType == ReceiveNotificationType.Unlimited) { return(true); } else if (tradeTrigger.NotificationType == ReceiveNotificationType.Once) { if (NotificationHistory.Where(h => h.Investor == investor.InvestorName && h.TradeTriggerType == tradeTrigger.TradeTriggerType && h.TriggerName == tradeTrigger.TriggerName).FirstOrDefault() == null) { return(true); } } return(false); }
/// <summary> /// update the history of hit through the caller ( investors) /// </summary> /// <param name="investor"></param> /// <param name="sellingStock"></param> /// <param name="tradeTrigger"></param> private void updateNotificationHistory(IInvestor investor, TradeTriggerType tradeTriggerType, ITradeTrigger tradeTrigger) { var histoiry = NotificationHistory.Where(h => h.Investor == investor.InvestorName && h.TradeTriggerType == tradeTriggerType && h.TriggerName == tradeTrigger.TriggerName).FirstOrDefault(); if (histoiry == null) { NotificationHistory.Add(new Notification() { Investor = investor.InvestorName, TradeTriggerType = tradeTriggerType, TriggerName = tradeTrigger.TriggerName, Counter = 1 }); } else { histoiry.Counter = histoiry.Counter + 1; } }
/// <summary> /// This method creates the parameter for a 'NotificationHistory' data operation. /// </summary> /// <param name='notificationhistory'>The 'NotificationHistory' to use as the first /// parameter (parameters[0]).</param> /// <returns>A List<PolymorphicObject> collection.</returns> private List <PolymorphicObject> CreateNotificationHistoryParameter(NotificationHistory notificationHistory) { // Initial Value List <PolymorphicObject> parameters = new List <PolymorphicObject>(); // Create PolymorphicObject to hold the parameter PolymorphicObject parameter = new PolymorphicObject(); // Set parameter.ObjectValue parameter.ObjectValue = notificationHistory; // Add userParameter to parameters parameters.Add(parameter); // return value return(parameters); }
/// <summary> /// This method creates the sql Parameter[] array /// that holds the primary key value. /// </summary> /// <param name='notificationHistory'>The 'NotificationHistory' to get the primary key of.</param> /// <returns>A SqlParameter[] array which contains the primary key value. /// to delete.</returns> internal static SqlParameter[] CreatePrimaryKeyParameter(NotificationHistory notificationHistory) { // Initial Value SqlParameter[] parameters = new SqlParameter[1]; // verify user exists if (notificationHistory != null) { // Create PrimaryKey Parameter SqlParameter @Id = new SqlParameter("@Id", notificationHistory.Id); // Set parameters[0] to @Id parameters[0] = @Id; } // return value return(parameters); }
/// <summary> /// Finds a 'NotificationHistory' object by the primary key. /// This method used the DataBridgeManager to execute the 'Find' using the /// procedure 'NotificationHistory_Find'</param> /// </summary> /// <param name='tempNotificationHistory'>A temporary NotificationHistory for passing values.</param> /// <returns>A 'NotificationHistory' object if found else a null 'NotificationHistory'.</returns> public NotificationHistory Find(NotificationHistory tempNotificationHistory) { // Initial values NotificationHistory notificationHistory = null; // Get information for calling 'DataBridgeManager.PerformDataOperation' method. string methodName = "Find"; string objectName = "ApplicationLogicComponent.Controllers"; try { // If object exists if (tempNotificationHistory != null) { // Create DataOperation ApplicationController.DataOperationMethod findMethod = this.AppController.DataBridge.DataOperations.NotificationHistoryMethods.FindNotificationHistory; // Create parameters for this method List <PolymorphicObject> parameters = CreateNotificationHistoryParameter(tempNotificationHistory); // Perform DataOperation PolymorphicObject returnObject = this.AppController.DataBridge.PerformDataOperation(methodName, objectName, findMethod, parameters); // If return object exists if ((returnObject != null) && (returnObject.ObjectValue as NotificationHistory != null)) { // Get ReturnObject notificationHistory = (NotificationHistory)returnObject.ObjectValue; } } } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // Log the current error this.ErrorProcessor.LogError(methodName, objectName, error); } } // return value return(notificationHistory); }
/// <summary> /// Adds a new entry to the history of notifications /// </summary> /// <param name="history">History data</param> public async Task <int> AddHistoryForTypeAsync(Type dataType) { // Extract notifier name from data type var history = new NotificationHistory( dataType .GetCustomAttributes(false) .Where(a => a is NotifierAttribute) .Cast <NotifierAttribute>() .Select(a => a.Name) .SingleOrDefault()); // Add new history entry await _dbContext.NotificationHistory.AddAsync(history); // save await _dbContext.SaveChangesAsync(); return(history.Id); }
/// <summary> /// This method Updates a 'NotificationHistory' object in the database. /// This method used the DataBridgeManager to execute the 'Update' using the /// procedure 'NotificationHistory_Update'.</param> /// </summary> /// <param name='notificationHistory'>The 'NotificationHistory' object to update.</param> /// <returns>True if successful else false if not.</returns> public bool Update(NotificationHistory notificationHistory) { // Initial value bool saved = false; // Get information for calling 'DataBridgeManager.PerformDataOperation' method. string methodName = "Update"; string objectName = "ApplicationLogicComponent.Controllers"; try { if (notificationHistory != null) { // Create Delegate ApplicationController.DataOperationMethod updateMethod = this.AppController.DataBridge.DataOperations.NotificationHistoryMethods.UpdateNotificationHistory; // Create parameters for this method List <PolymorphicObject> parameters = CreateNotificationHistoryParameter(notificationHistory); // Perform DataOperation PolymorphicObject returnObject = this.AppController.DataBridge.PerformDataOperation(methodName, objectName, updateMethod, parameters); // If return object exists if ((returnObject != null) && (returnObject.Boolean != null) && (returnObject.Boolean.Value == NullableBooleanEnum.True)) { // Set saved to true saved = true; } } } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // Log the current error this.ErrorProcessor.LogError(methodName, objectName, error); } } // return value return(saved); }
/// <summary> /// Insert a 'NotificationHistory' object into the database. /// This method uses the DataBridgeManager to execute the 'Insert' using the /// procedure 'NotificationHistory_Insert'.</param> /// </summary> /// <param name='notificationHistory'>The 'NotificationHistory' object to insert.</param> /// <returns>True if successful or false if not.</returns> public bool Insert(NotificationHistory notificationHistory) { // Initial values bool inserted = false; // Get information for calling 'DataBridgeManager.PerformDataOperation' method. string methodName = "Insert"; string objectName = "ApplicationLogicComponent.Controllers"; try { // If NotificationHistoryexists if (notificationHistory != null) { ApplicationController.DataOperationMethod insertMethod = this.AppController.DataBridge.DataOperations.NotificationHistoryMethods.InsertNotificationHistory; // Create parameters for this method List <PolymorphicObject> parameters = CreateNotificationHistoryParameter(notificationHistory); // Perform DataOperation PolymorphicObject returnObject = this.AppController.DataBridge.PerformDataOperation(methodName, objectName, insertMethod, parameters); // Set the return value to true inserted = true; } } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // Set inserted to false inserted = false; // Log the current error this.ErrorProcessor.LogError(methodName, objectName, error); } } // return value return(inserted); }
/// <summary> /// This method fetches a collection of 'NotificationHistory' objects. /// This method used the DataBridgeManager to execute the fetch all using the /// procedure 'NotificationHistory_FetchAll'.</summary> /// <param name='tempNotificationHistory'>A temporary NotificationHistory for passing values.</param> /// <returns>A collection of 'NotificationHistory' objects.</returns> public List <NotificationHistory> FetchAll(NotificationHistory tempNotificationHistory) { // Initial value List <NotificationHistory> notificationHistoryList = null; // Get information for calling 'DataBridgeManager.PerformDataOperation' method. string methodName = "FetchAll"; string objectName = "ApplicationLogicComponent.Controllers"; try { // Create DataOperation Method ApplicationController.DataOperationMethod fetchAllMethod = this.AppController.DataBridge.DataOperations.NotificationHistoryMethods.FetchAll; // Create parameters for this method List <PolymorphicObject> parameters = CreateNotificationHistoryParameter(tempNotificationHistory); // Perform DataOperation PolymorphicObject returnObject = this.AppController.DataBridge.PerformDataOperation(methodName, objectName, fetchAllMethod, parameters); // If return object exists if ((returnObject != null) && (returnObject.ObjectValue as List <NotificationHistory> != null)) { // Create Collection From ReturnObject.ObjectValue notificationHistoryList = (List <NotificationHistory>)returnObject.ObjectValue; } } catch (Exception error) { // If ErrorProcessor exists if (this.ErrorProcessor != null) { // Log the current error this.ErrorProcessor.LogError(methodName, objectName, error); } } // return value return(notificationHistoryList); }
/// <summary> /// This method loads a collection of 'NotificationHistory' objects. /// from the dataTable.Rows object passed in. /// </summary> /// <param name='dataTable'>The 'DataTable.Rows' to load from.</param> /// <returns>A NotificationHistory Collection.</returns> public static List <NotificationHistory> LoadCollection(DataTable dataTable) { // Initial Value List <NotificationHistory> notificationHistorys = new List <NotificationHistory>(); try { // Load Each row In DataTable foreach (DataRow row in dataTable.Rows) { // Create 'NotificationHistory' from rows NotificationHistory notificationHistory = Load(row); // Add this object to collection notificationHistorys.Add(notificationHistory); } } catch { } // return value return(notificationHistorys); }
/// <summary> /// This method creates an instance of an /// 'DeleteNotificationHistory'StoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'NotificationHistory_Delete'. /// </summary> /// <param name="notificationHistory">The 'NotificationHistory' to Delete.</param> /// <returns>An instance of a 'DeleteNotificationHistoryStoredProcedure' object.</returns> public static DeleteNotificationHistoryStoredProcedure CreateDeleteNotificationHistoryStoredProcedure(NotificationHistory notificationHistory) { // Initial Value DeleteNotificationHistoryStoredProcedure deleteNotificationHistoryStoredProcedure = new DeleteNotificationHistoryStoredProcedure(); // Now Create Parameters For The DeleteProc deleteNotificationHistoryStoredProcedure.Parameters = CreatePrimaryKeyParameter(notificationHistory); // return value return(deleteNotificationHistoryStoredProcedure); }
public void Add(NotificationHistory notificationHistory) { Database.NotificationHistoryService.Add(notificationHistory); }
/// <summary> /// This method creates an instance of a /// 'FindNotificationHistoryStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'NotificationHistory_Find'. /// </summary> /// <param name="notificationHistory">The 'NotificationHistory' to use to /// get the primary key parameter.</param> /// <returns>An instance of an FetchUserStoredProcedure</returns> public static FindNotificationHistoryStoredProcedure CreateFindNotificationHistoryStoredProcedure(NotificationHistory notificationHistory) { // Initial Value FindNotificationHistoryStoredProcedure findNotificationHistoryStoredProcedure = null; // verify notificationHistory exists if (notificationHistory != null) { // Instanciate findNotificationHistoryStoredProcedure findNotificationHistoryStoredProcedure = new FindNotificationHistoryStoredProcedure(); // Now create parameters for this procedure findNotificationHistoryStoredProcedure.Parameters = CreatePrimaryKeyParameter(notificationHistory); } // return value return(findNotificationHistoryStoredProcedure); }