示例#1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //frmUpdateAlumno frmUpdate = new frmUpdateAlumno();
            //frmUpdate.Show();

            dgvAlumno.DataSource = null;
            dgvAlumno.Rows.Clear();
            dgvAlumno.Columns.Clear();
            dgvAlumno.Refresh();

            ReferenceWeb.Service1Client svc = new ReferenceWeb.Service1Client("Http");

            Students foundStudent = svc.GetById(Guid.Parse(txtBoxId.Text));

            string[] row = new string[] {
                foundStudent.id.ToString(),
                     foundStudent.name,
                     foundStudent.surname,
                     foundStudent.email
            };


            dgvAlumno.DataSource = row;
            AddButtons(dgvAlumno);
        }
示例#2
0
        private void btnTcp_Click(object sender, EventArgs e)
        {
            //ReferenceWeb.Service1Client svc = new ReferenceWeb.Service1Client("Tcp");
            ReferenceWeb.Service1Client  svc          = new ReferenceWeb.Service1Client("Tcp");
            List <ReferenceWeb.Students> listaAlumnos = svc.GetAll();

            dgvAlumno.DataSource = listaAlumnos;
        }
示例#3
0
        private void btnHttp_Click(object sender, EventArgs e)
        {
            ReferenceWeb.Service1Client svc = new ReferenceWeb.Service1Client("Http");

            List <ReferenceWeb.Students> listaAlumnos = svc.GetAll();

            dgvAlumno.DataSource = listaAlumnos;
            //MessageBox.Show(listaAlumnos.Count.ToString());
        }
示例#4
0
        private void btnSaveAdd_Click(object sender, EventArgs e)
        {
            Students student = new Students();

            student.name    = txtBoxNameAdd.Text;
            student.surname = txtBoxSurnameAdd.Text;
            student.email   = txtBoxEmailAdd.Text;
            ReferenceWeb.Service1Client svc =
                new ReferenceWeb.Service1Client("Tcp");
            svc.Post(student);
            if (addedStudent != null)  // mirar que no es null, para ver que el evento apunta a algo, sino no se ejecuta
            {
                addedStudent(this, e); // cual es el objeto que lanza el evento. se podria pasar un e.AlumnoAdded, así no tendriamos que vovler a ir al servicio para agregar los datos (tendrias que agregar un alumno en el grid)
            }
        }
示例#5
0
        private void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            ReferenceWeb.Service1Client svc = new ReferenceWeb.Service1Client("Tcp");

            Students newStudent = new Students {
                name = txtBoxNameUpdate.Text, surname = txtBoxSurnameUpdate.Text, email = txtBoxEmailUpdate.Text
            };

            Students updatedStudent = svc.Put(Guid.Parse(txtBoxId.Text), newStudent);

            if (updatedStudent != null && OnEdit != null)
            {
                OnEdit(this, e);
            }

            Close();
        }