public void verificarCheckBoxs() { if (ckAlumno.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 4; JohanaWS.queryAllUserByUserType(usuario.idUser, ut.idUserType); ckApoderado.Enabled = false; ckProfesor.Enabled = false; ckAuxiliar.Enabled = false; ckSecretaria.Enabled = false; } else { ckApoderado.Enabled = true; ckProfesor.Enabled = true; ckAuxiliar.Enabled = true; ckSecretaria.Enabled = true; } if (ckApoderado.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 2; JohanaWS.queryAllUserByUserType(usuario.idUser, ut.idUserType); ckAlumno.Enabled = false; ckProfesor.Enabled = false; ckAuxiliar.Enabled = false; ckSecretaria.Enabled = false; } else { ckAlumno.Enabled = true; ckProfesor.Enabled = true; ckAuxiliar.Enabled = true; ckSecretaria.Enabled = true; } if (ckProfesor.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 3; JohanaWS.queryAllUserByUserType(usuario.idUser, ut.idUserType); ckAlumno.Enabled = false; ckApoderado.Enabled = false; ckAuxiliar.Enabled = false; ckSecretaria.Enabled = false; } else { ckAlumno.Enabled = true; ckApoderado.Enabled = true; ckAuxiliar.Enabled = true; ckSecretaria.Enabled = true; } if (ckSecretaria.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 1; JohanaWS.queryAllUserByUserType(usuario.idUser, ut.idUserType); ckAlumno.Enabled = false; ckApoderado.Enabled = false; ckAuxiliar.Enabled = false; ckProfesor.Enabled = false; } else { ckAlumno.Enabled = true; ckProfesor.Enabled = true; ckAuxiliar.Enabled = true; ckApoderado.Enabled = true; } if (ckAuxiliar.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 5; JohanaWS.queryAllUserByUserType(usuario.idUser, ut.idUserType); ckAlumno.Enabled = false; ckApoderado.Enabled = false; ckAuxiliar.Enabled = false; ckProfesor.Enabled = false; } else { ckAlumno.Enabled = true; ckProfesor.Enabled = true; ckApoderado.Enabled = true; ckSecretaria.Enabled = true; } }
public void guardarDatosAlumno() { if (verificarRango(txtNombre, 45) && (txtNombre.Text.Length != 0)) { usuario.names = txtNombre.Text; } else { MessageBox.Show("El valor asignado a la casilla es demasiado largo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); lbly2.Text = "*"; } if (verificarRango(txtApPat, 45) && (txtApPat.Text.Length != 0)) { usuario.firstLastName = txtApPat.Text; } else { MessageBox.Show("El valor asignado a la casilla es demasiado largo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); lbly3.Text = "*"; } if (verificarRango(txtApMat, 45) && (txtApMat.Text.Length != 0)) { usuario.secondLastName = txtApMat.Text; } else { MessageBox.Show("El valor asignado a la casilla es demasiado largo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); lbly4.Text = "*"; } if (verificarRango(txtApDir, 45)) { usuario.address = txtApDir.Text; } else { MessageBox.Show("El valor asignado a la casilla es demasiado largo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); lbly5.Text = "*"; } if (verificarRango(txtEmail, 45) && (txtApMat.Text.Length != 0) && txtEmail.Text.Contains("@") && txtEmail.Text.Contains(".") && !(txtEmail.Text.Substring(txtEmail.Text.IndexOf("@") + 1, txtEmail.Text.Length).Contains("@")) && !(txtEmail.Text.Substring(txtEmail.Text.IndexOf(".") + 1, txtEmail.Text.Length).Contains("."))) { usuario.email = txtEmail.Text; } else { MessageBox.Show("El valor asignado a la casilla es demasiado largo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); lbly6.Text = "*"; } if (verificarCheckBoxsNoVacios()) { if (ckAlumno.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 4; JohanaWS.insertUserTypeXUser(usuario.idUser, ut.idUserType); } if (ckApoderado.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 2; JohanaWS.insertUserTypeXUser(usuario.idUser, ut.idUserType); } if (ckProfesor.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 3; JohanaWS.insertUserTypeXUser(usuario.idUser, ut.idUserType); } if (ckSecretaria.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 1; JohanaWS.insertUserTypeXUser(usuario.idUser, ut.idUserType); } if (ckAuxiliar.Checked) { JohanaWS.userType ut = new JohanaWS.userType(); ut.idUserType = 5; JohanaWS.insertUserTypeXUser(usuario.idUser, ut.idUserType); } } else { MessageBox.Show("Escoga por lo menos un tipo de usuario", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }