Beispiel #1
0
    public void TestGetMessages()
    {
        MessageDAO messageDAO = new MessageDAO();
        messageDAO.AddMessage("pepe34", "pepe24", "aaaaaaa", true);
         	/*
        Entidades.Message message2 = messageDAO.AddMessage("pepe", "pepe2", "chau2", false);
        Entidades.Message message3 = messageDAO.AddMessage("pepe", "pepe2", "chau2", false);

        List<Entidades.Message> messagesTrue = MessageService.GetMessages("pepe2", true);
        List<Entidades.Message> messagesFalse = MessageService.GetMessages("pepe2", false);

        Assert.Equal(messagesTrue.Count, 1);
        Assert.Equal(messagesFalse.Count, 2);
        */
    }
Beispiel #2
0
        public GenericResponse SendMessage([FromBody] Message message)
        {
            if (!ModelState.IsValid)
            {
                return new GenericResponse {
                           IsSuccessful = false
                }
            }
            ;

            messageDAO.AddMessage(message);
            return(new GenericResponse {
                IsSuccessful = true
            });
        }
    }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            string idstr = boxID.Text;

            Debug.WriteLine("ID AL wardar: " + idstr);

            try
            {
                if (String.IsNullOrEmpty(idstr)) //new
                {
                    Message msg = new Message();
                    msg.Name    = boxNombre.Text;
                    msg.Email   = boxEmail.Text;
                    msg.Subject = boxAsunto.Text;
                    msg.Content = boxContenido.InnerText;

                    MessageDAO.AddMessage(msg);
                }
                else //update
                {
                    Message msg = new Message();
                    msg.Id      = int.Parse(idstr);
                    msg.Name    = boxNombre.Text;
                    msg.Email   = boxEmail.Text;
                    msg.Subject = boxAsunto.Text;
                    msg.Content = boxContenido.InnerText;

                    MessageDAO.ModMessage(msg);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                Debug.WriteLine(ex.Message);
            }

            Response.Redirect("~/MessageList");
            Context.ApplicationInstance.CompleteRequest();
        }
        protected void btnEnviarMensaje_Click(object sender, EventArgs e)
        {
            try
            {
                Message msg = new Message();

                msg.Name    = (string)txtNombre.Text;
                msg.Email   = (string)txtEmail.Text;
                msg.Subject = (string)txtAsunto.Text;
                msg.Content = (string)txtContenido.InnerText;

                MessageDAO.AddMessage(msg);

                ltMsg.Text  = "<br/>";
                ltMsg.Text += "Mensaje enviado";
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
                Debug.WriteLine(ex.Message);
            }
        }
Beispiel #5
0
 public static void AddMessage(Entidades.Message message)
 {
     MessageDAO messageDAO = new MessageDAO();
     messageDAO.AddMessage(message);
 }
Beispiel #6
0
 public static Entidades.Message AddMessage(string sender, string receiver, string messageText, bool isPrivate)
 {
     MessageDAO messageDAO = new MessageDAO();
     return messageDAO.AddMessage(sender, receiver, messageText, isPrivate);
 }
        public static object AddNewMessage(int chatRoomId, int recieverId, int senderId, string messageContent, string latitude = null, string longitude = null)
        {
            Message newMessage = MessageDAO.AddMessage(chatRoomId, messageContent, recieverId, senderId, latitude, longitude);

            return(new { result = newMessage });
        }