Ejemplo n.º 1
0
        void AccountStatus_Delete(object sender, EventArgs e)
        {
            AuthoriseRequestSid();

            long messageId = core.Functions.FormLong("id", 0);

            if (messageId > 0)
            {
                StatusMessage message = new StatusMessage(core, messageId);

                if (message.Owner.Id == Owner.Id)
                {
                    ItemKey messageKey = message.ItemKey;
                    long count = message.Delete();

                    DeleteQuery dQuery = new DeleteQuery(typeof(BoxSocial.Internals.Action));
                    dQuery.AddCondition("action_primitive_id", Owner.Id);
                    dQuery.AddCondition("action_primitive_type_id", Owner.TypeId);
                    dQuery.AddCondition("action_item_id", messageKey.Id);
                    dQuery.AddCondition("action_item_type_id", messageKey.TypeId);

                    core.Db.Query(dQuery);

                    core.Response.SendStatus("messageDeleted");
                    return;
                }
            }

            // IsAjax true
            core.Response.ShowMessage("permissionDenied", "Permission Denied", "You cannot delete this item.");
        }