private void dependency_OnChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { MessagesHub.SendMessages(); } }
//event fired whenever db entites in the select list change private void dependency_OnChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { //calls to hub message to broadvast changes MessagesHub.SendMessages(); } }
public void chart_OnChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { status3 = true; MessagesHub.SendMessages(); notifchart(); } }
private void dependency_OnChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { SqlDependency dependency = (SqlDependency)sender; dependency.OnChange -= dependency_OnChange; // remove event MessagesHub.SendMessages(); } }
private static void dependency_OnChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { lock (mutex) { dependency = null; } var locos = GetAllMessages(); MessagesHub.SendMessages(locos); } }
public string DeleteMessages(int GridId) { //var messages = new List<Messages>(); string messages = string.Empty; using (var connection = new SqlConnection(_connString)) { connection.Open(); using (var command = new SqlCommand("sp_Delete_Messages", connection)) { command.Notification = null; var dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(dependency_OnChange); if (connection.State == ConnectionState.Closed) { connection.Open(); } command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@gridId", GridId); //var reader = command.ExecuteReader(); int reader = command.ExecuteNonQuery(); if (reader >= 1) { messages = "Success"; MessagesHub.SendMessages(); } else { messages = "Failed"; } //while (reader.Read()) //{ // messages.Add(item: new Messages { ID = (int)reader["ID"], CampaignName = (string)reader["CampaignName"], MessageDate = Convert.ToDateTime(reader["Date"]), Clicks = (int)reader["Clicks"], Conversions = (int)reader["Conversions"], Impressions = (int)reader["Impressions"], AffiliateName = (string)reader["AffiliateName"] }); //} } } return(messages); }
private void dependency_Onchange(object sender, SqlNotificationEventArgs e) { MessagesHub messagesHub = new MessagesHub(); messagesHub.SendMessages(); }
public void Test(string text) { MessagesHub.SendMessages(text); }