Ejemplo n.º 1
0
    private void UpdateMessagesStatus(string status)
    {
        UserMessageRepository messageRepo = new UserMessageRepository();
        foreach (GridDataItem selectedItem in MessageGrid.SelectedItems)
        {
            TableCell messageIDCell = selectedItem["MessageID"];
            if (messageIDCell != null)
            {
                int messageID = Convert.ToInt32(messageIDCell.Text);
                UserMessage message = messageRepo.FindOne(new UserMessage(messageID));
                if (message != null)
                {
                    if (status == "MarkAsRead")
                    {
                        message.IsUnread = false;
                    }
                    else if (status == "MarkAsUnread")
                    {
                        message.IsUnread = true;
                    }
                    messageRepo.Update(message);
                }

            }
        }
        MessageGrid.Rebind();
    }
Ejemplo n.º 2
0
    private void DeleteMessages()
    {
        UserMessageRepository messageRepo = new UserMessageRepository();
        foreach (GridDataItem selectedItem in MessageGrid.SelectedItems)
        {
            TableCell messageIDCell = selectedItem["MessageID"];
            if (messageIDCell != null)
            {
                int messageID = Convert.ToInt32(messageIDCell.Text);
                UserMessage message = messageRepo.FindOne(new UserMessage(messageID));
                if (message != null)
                {
                    messageRepo.Delete(message);
                }

            }
        }
        MessageGrid.Rebind();
    }