protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(NID.Text))
     {
         this.Log().Debug("Deleting message: {0}", NID.Text);
         int nid;
         if (int.TryParse(NID.Text, out nid))
         {
             Notifications notification = null;
             try {
                 notification = Notifications.FetchObject(nid);
                 if (notification != null)
                 {
                     notification.Delete();
                 }
             } catch (Exception ex) {
                 this.Log().Error("Unable to delete message, nid text = {0}, nid = {1}, notification = {2}: {3} - {4}",
                                  NID.Text,
                                  nid,
                                  notification,
                                  ex.Message,
                                  ex.StackTrace);
             }
         }
         else
         {
             this.Log().Error("Unable to convert message ID to number: {0}", NID.Text);
         }
     }
     Response.Redirect("~/Mail/");
 }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var o = new Notifications();

            o.Fetch(int.Parse(NID.Text));

            o.Delete();
            Response.Redirect("~/MyNotifications.aspx");
        }
Exemplo n.º 3
0
        public void should_be_able_to_add_a_new_notification()
        {
            var schema = Notifications.Schema();

            var xbmc = schema.Single(s => s.Implementation.Equals("Xbmc", StringComparison.InvariantCultureIgnoreCase));

            xbmc.Name = "Test XBMC";
            xbmc.Fields.Single(f => f.Name.Equals("Host")).Value = "localhost";

            var result = Notifications.Post(xbmc);

            Notifications.Delete(result.Id);
        }
Exemplo n.º 4
0
        public void should_be_able_to_add_a_new_notification()
        {
            var schema = Notifications.Schema();

            var xbmc = schema.Single(s => s.Implementation.Equals("Webhook", StringComparison.InvariantCultureIgnoreCase));

            xbmc.Name = "Test Webhook";
            xbmc.Fields.Single(f => f.Name.Equals("url")).Value = "http://httpbin.org/post";

            var result = Notifications.Post(xbmc);

            Notifications.Delete(result.Id);
        }