Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            alertUserLabel.Text  = "";
            purgeMessage.Text    = "";
            messagesTextBox.Text = "";
            string receiveID = receiveIdTextBox.Text.Trim();

            if (receiveID.Length == 0)
            {
                alertUserLabel.Text = "Please enter a valid receiver ID";
                return;
            }


            MsgService.MessagingServiceClient service = new MsgService.MessagingServiceClient();
            string[] messages = service.receiveMessage(receiveID, purgeCheckBox.Checked);

            for (int i = 0; i < messages.Length; i++)
            {
                messagesTextBox.Text += messages[i] + "\n";
            }


            if (messages.Length == 0)
            {
                alertUserLabel.Text = "You have no unread messages";
            }

            if (purgeCheckBox.Checked)
            {
                purgeMessage.Text = "You messages have been purged.";
            }
        }
Exemplo n.º 2
0
        protected void sendButton_Click(object sender, EventArgs e)
        {
            alertUserMessage.Text = "";
            string receiverID = receiverIDTextBox.Text.Trim();
            string senderID   = senderIDTextBox.Text.Trim();
            string message    = messageTextBox.Text.Trim();

            if (receiverID.Length == 0 || senderID.Length == 0 || message.Length == 0)
            {
                alertUserMessage.Text = "Please enter a valid receiver ID, sender ID and a non blank message";
                return;
            }
            MsgService.MessagingServiceClient service = new MsgService.MessagingServiceClient();
            service.sendMessage(senderID, receiverID, message);

            alertUserMessage.Text = "Message sent!";
        }