コード例 #1
0
        private void btnRegistrarAten_Click(object sender, EventArgs e)
        {
            JavaScriptSerializer js             = new JavaScriptSerializer();
            Atencion             atencionACrear = new Atencion();

            atencionACrear.NunAtencion  = Convert.ToInt32(txtNumAtencion.Text);
            atencionACrear.NumSolicitud = Convert.ToInt32(txtNumSolicitud.Text);
            atencionACrear.NumDni       = Convert.ToInt32(txtMedico.Text);
            atencionACrear.Observacion  = txtObservacion.Text;
            atencionACrear.FecRegistro  = txtFecha.Text;
            atencionACrear.HoraInicio   = txtHinicio.Text;
            atencionACrear.HoraFin      = txtHfin.Text;


            //START > IMPLEMENTACIÓN DE COLAS DE MENSAJE
            System.Messaging.Message message = new System.Messaging.Message();
            System.Messaging.Message msg     = message;
            msg.Body = atencionACrear;
            MessageQueue msgQ = new MessageQueue(".\\Private$\\in");

            msgQ.Send(msg);
            StringBuilder sb = new StringBuilder();

            sb.Append("                Registro Exitoso");
            sb.Append("\n");
            sb.Append("\n");
            sb.Append("¡Gracias por ser parte de la familia");
            sb.Append("\n");
            sb.Append("                     MEDICAL!");
            MessageBox.Show(sb.ToString(), "Mensaje");
            //END > IMPLEMENTACIÓN DE COLAS DE MENSAJE



            string postdata = js.Serialize(atencionACrear);

            byte[]         data    = Encoding.UTF8.GetBytes(postdata);
            HttpWebRequest request = (HttpWebRequest)WebRequest.
                                     Create("http://localhost:50389/Atenciones.svc/Atenciones");

            request.Method        = "POST";
            request.ContentLength = data.Length;
            request.ContentType   = "application/json";
            var requestStream = request.GetRequestStream();

            requestStream.Write(data, 0, data.Length);
            HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
            StreamReader    reader         = new StreamReader(response.GetResponseStream());
            string          TramaJson      = reader.ReadToEnd();
            Atencion        atencionCreado = js.Deserialize <Atencion>(TramaJson);
        }
コード例 #2
0
        private void btnMensLinea_Click(object sender, EventArgs e)
        {
            MessageQueue msgQ           = new MessageQueue(".\\Private$\\in");
            Atencion     atencionACrear = new Atencion();
            Object       o = new Object();

            System.Type[] arrTypes = new System.Type[2];
            arrTypes[0]    = atencionACrear.GetType();
            arrTypes[1]    = o.GetType();
            msgQ.Formatter = new XmlMessageFormatter(arrTypes);
            atencionACrear = ((Atencion)msgQ.Receive().Body);
            StringBuilder sb = new StringBuilder();

            sb.Append("El Medico");
            sb.Append("\n");
            sb.Append("con N° de Solicitud: " + atencionACrear.NumSolicitud);
            sb.Append("\n");
            sb.Append("\n");
            sb.Append("Se ha registrado en la plataforma Medical");
            sb.Append("\n");
            MessageBox.Show(sb.ToString(), "Mensaje");
        }