Hi there,

Firstly i am sorry if i have posted this here instead of in the JAVA thread, as the content contains a mix between Java and ASP.NET.

I have a block of Java codes with i need its function for my asp.net c# web application. However this portion of code that i need to use is in Java. I was hoping of anyone can assist me with the conversion to C# for asp.net as i ma not sure sure about converting from Java.

This is the Java portion of the Code.

Code:
TextMagicMessageService service = new TextMagicMessageService ("YOUR_USERNAME", "YOUR_PASSWORD");


//this part is responsible for retrieving messages from server and represent them in a table
        try { 
            List<ReceivedMessage> messages = service.receive();
            if(!messages.isEmpty()) {

            <table width="100%" style="border: solid 1px">
            <tr>
                <th width="20%" > Sender phone </th> <th width="50%"> Message Text </th> <th width="20%"> Received </th> <th width="10%"></th>
            </tr>
          
                for(ReceivedMessage message : messages) {
                        System.out.println(message.getReceivedDate());
                        System.out.println(System.currentTimeMillis());
 
                    <tr><td><%= message.getSenderPhone() %></td> <td><%= message.getText() %></td><td><%= message.getReceivedDate() %></td><td><a href="receive.jsp?remove=<%= message.getId() %>">Delete</a></td></tr>

                }

            </table>

            }
        } catch (ServiceException ex) {

            <font color="red">Couldn't receive inbound messages. Reason : <%= ex.getMessage() %></font>
Below is the 2 classes which i noticed was used in the JAVA codes. I have both of the classes that the codes call, ReceiveMessage and Message class in C#.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test
{
    public class Message
    {

        protected long id;
        protected String text;

        public Message()
        {
        }

        public Message(long id, String text)
        {
            this.id = id;
            this.text = text;
        }

        public long getId()
        {
            return id;
        }

        public void setId(long id)
        {
            this.id = id;
        }

        public String getText()
        {
            return text;
        }

        public void setText(String text)
        {
            this.text = text;
        }


        //public  bool equals(Object o)
        //{
        //    if (this == o) return true;
        //    if (o == null) return false;

        //    Message that = (Message)o;

        //    if (!id.Equals(that.id)) return false;

        //    return true;
        //}


        public int hashCode()
        {
            return id.GetHashCode();
        }


        public String toString()
        {
            return "Message{" +
                    "id=" + id +
                    ", text='" + text + '\'' +
                    '}';
        }
    }
}
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace test
{
    public class ReceivedMessage : Message
    {
        private String senderPhone;
        private DateTime receivedDate;

        public String getSenderPhone()
        {
            return senderPhone;
        }

        public void setSenderPhone(String senderPhone)
        {
            this.senderPhone = senderPhone;
        }

        public DateTime getReceivedDate()
        {
            return receivedDate;
        }

        public void setReceivedDate(DateTime recievedDate)
        {
            this.receivedDate = recievedDate;
        }


        public String toString()
        {
            return "ReceivedMessage{" +
                    "id=" + id +
                    ", text='" + text + '\'' +
                    ", senderPhone='" + senderPhone + '\'' +
                    ", receivedDate=" + receivedDate +
                    '}';
        }
    }
}