private static void DelButtonClick(object sender, AlertButtonClickEventArgs e) { var notifcation = e.AlertForm.AlertInfo.Tag as NotificationDTO; if (notifcation == null) { return; } if (notifcation.NotificationRecipientId == Guid.Empty) { return; } IObjectSpace objectSpace = new ODataObjectSpace(); if (e.ButtonName == "DelNotification") { e.Button.Name = "Deleted"; var recipent = objectSpace.GetOrNew("NotificationRecipient", notifcation.NotificationRecipientId, null); objectSpace.DeleteObject("NotificationRecipient", recipent); objectSpace.SaveChanges(); notifcation.NotificationRecipientId = Guid.Empty; timer_Elapsed(null, null); } else if (e.ButtonName == "MarkReaded") { e.Button.Name = "Marked"; MarkReaded(objectSpace, notifcation); e.Button.Image = new Bitmap(WinFormsResourceService.GetBitmap("sendsysmsg"), new Size(16, 16)); timer_Elapsed(null, null); } }