Exemplo n.º 1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            label1.Text = M4SESSION.name;
            pictureBox1.Image = M4SESSION.foto;
            label2.Text = M4SESSION.puesto;

            this.Refresh();

            //Ahora llamamos a...
            VincereWSMeta4.VincereWebServiceMeta4 a = new VincereWSMeta4.VincereWebServiceMeta4Client();

            VincereWSMeta4.meta4GetListaNotificacionesRequestBody Body2 = new VincereWSMeta4.meta4GetListaNotificacionesRequestBody();
            Body2.Base64Password = M4SESSION.Password;
            Body2.User = M4SESSION.User;
            Body2.UUID = "001S";
            Body2.Meta4SessionId = M4SESSION.SessionMeta4;
            Body2.Dispositivo = "csharp";

            VincereWSMeta4.meta4GetListaNotificacionesRequest cs2 = new VincereWSMeta4.meta4GetListaNotificacionesRequest(Body2);
            VincereWSMeta4.meta4GetListaNotificacionesResponseBody valores222 = new VincereWSMeta4.meta4GetListaNotificacionesResponseBody();
            VincereWSMeta4.meta4GetListaNotificacionesResponse res2 = new VincereWSMeta4.meta4GetListaNotificacionesResponse(valores222);
            res2 = a.meta4GetListaNotificaciones(cs2);

            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(res2.Body.meta4GetListaNotificacionesReturn);

            //Records
            XmlElement xmlElem = (XmlElement)xDoc.GetElementsByTagName("Records")[0];
            String Records = xmlElem.InnerText;

            int NumReg = Int32.Parse(Records);

            //recorremos cada registro del XML
            for (int i = 0; i < NumReg; i++)
            {
                //Titulo
                String Item = "descripcion_" + i.ToString();
                XmlElement xmlElem1 = (XmlElement)xDoc.GetElementsByTagName(Item)[0];
                String Titulo = xmlElem1.InnerText;

                listBox1.Items.Add(Titulo);

            }
        }
Exemplo n.º 2
0
        //  83.32.91.224
        private void button1_Click(object sender, EventArgs e)
        {
            VincereWSMeta4.VincereWebServiceMeta4 a = new VincereWSMeta4.VincereWebServiceMeta4Client();

            VincereWSMeta4.meta4ControlSessionRequestBody Body = new VincereWSMeta4.meta4ControlSessionRequestBody();
            Body.Base64Password = EncodeTo64(textBox2.Text.ToString());
            Body.User = EncodeTo64(textBox1.Text.ToString());
            Body.UUID = "001S";
            Body.Meta4SessionId = "";
            Body.Dispositivo = "CSharp";

            M4SESSION.User = EncodeTo64(textBox1.Text.ToString());
            M4SESSION.Password = EncodeTo64(textBox2.Text.ToString());

            VincereWSMeta4.meta4ControlSessionRequest cs = new VincereWSMeta4.meta4ControlSessionRequest(Body);
            VincereWSMeta4.meta4ControlSessionResponseBody valores = new VincereWSMeta4.meta4ControlSessionResponseBody();
            VincereWSMeta4.meta4ControlSessionResponse res = new VincereWSMeta4.meta4ControlSessionResponse( valores);
            res =  a.meta4ControlSession(cs);

            String session = res.Body.meta4ControlSessionReturn;
            M4SESSION.SessionMeta4 = session;

            if (session.Equals(""))
            {
                MessageBox.Show("Login meta4", "Credenciales incorrectas");
                return;
            }

            //traemos la ficha del usuario conectado

            VincereWSMeta4.meta4GetInfoUserAppRequestBody Body2 = new VincereWSMeta4.meta4GetInfoUserAppRequestBody();
            Body2.Base64Password = M4SESSION.Password;
            Body2.User = M4SESSION.User;
            Body2.UUID = "001S";
            Body2.Meta4SessionId = session;
            Body2.Dispositivo = "csharp";

            VincereWSMeta4.meta4GetInfoUserAppRequest cs2 = new VincereWSMeta4.meta4GetInfoUserAppRequest(Body2);
            VincereWSMeta4.meta4GetInfoUserAppResponseBody valores222 = new VincereWSMeta4.meta4GetInfoUserAppResponseBody();
            VincereWSMeta4.meta4GetInfoUserAppResponse res2 = new VincereWSMeta4.meta4GetInfoUserAppResponse(valores222);
            res2 = a.meta4GetInfoUserApp(cs2);

            XmlDocument xDoc = new XmlDocument();
            xDoc.LoadXml(res2.Body.meta4GetInfoUserAppReturn);

            //nombre
            XmlElement xmlElem = (XmlElement)xDoc.GetElementsByTagName("nombre")[0];
            M4SESSION.name = xmlElem.InnerText;

            //Puesto
            XmlElement xmlElemJob = (XmlElement)xDoc.GetElementsByTagName("puesto")[0];
            M4SESSION.puesto = xmlElemJob.InnerText;

            //foto
            XmlElement xmlElemFoto = (XmlElement)xDoc.GetElementsByTagName("foto")[0];
            string base64ImageString = xmlElemFoto.InnerText;
            Bitmap bmpFromString = base64ImageString.Base64StringToBitmap();
            M4SESSION.foto = bmpFromString;

               // this.Hide();
            this.Close();
        }