Exemple #1
0
 public Cita(Alumno alumno, Maestro maestro, string asunto, DateTime fecha)
 {
     this.Alumno = alumno;
     this.Maestro = maestro;
     this.Asunto = asunto;
     this.Fecha = fecha;
 }
        protected override object obtener(OPCIONES opcion, string url, params object[] parametros)
        {
            Object regreso = null;
            Console.WriteLine ("Usando STUB");
            if (Alerta != null) {
                Alerta.DismissWithClickedButtonIndex (Alerta.CancelButtonIndex, true);
            }

            switch (opcion) {
            case OPCIONES.ENVIAR_CITA:
                regreso = true;
                break;
            case OPCIONES.VER_HORARIO:
                regreso = new long[]{
                    new DateTime (2013, 5, 3, 14, 30, 0).Ticks,
                    new DateTime (2013, 5, 3, 15, 0, 0).Ticks,
                    new DateTime (2013, 5, 3, 19, 0, 0).Ticks
                };
                break;
            case OPCIONES.LISTA_MAESTROS:
                regreso = new Maestro[]
                {
                    new Maestro (1, "Adrian Macias", "LV-322"),
                    new Maestro (2, "Guillermo Salazar", "LV-322"),
                    new Maestro (3, "Jesus Gaxiola", "CAD 60"),
                    new Maestro (4, "Elsa Padilla", "CAD 52"),
                };
                break;
            case OPCIONES.VALIDA_ALUMNO:
                Alumno alumnoParametro;
                string password;

                    // Si los tipos de los parametros son correctos
                if (parametros [0] is Alumno && parametros [1] is String) {
                    alumnoParametro = (Alumno)parametros [0];
                    password = (string)parametros [1];

                    // Validacion
                    if (alumnoParametro.IdAlumno == 50172 && password.Equals ("")) {
                        regreso = new Alumno (50172, "Juan Leal", "Isw", "*****@*****.**");
                    }
                }
                break;
            default:
                    // ALGO SALIO MAL!
                break;
            }

            return regreso;
        }
partial         void accionIniciarSesion(NSObject sender)
        {
            int idAlumno;
            string password;
            Alumno alumno, alumnoRespuesta;

            CrearAlerta ();

            // Valida que la alerta sea un numero
            if (regexNum.IsMatch (this.txtId.Text)) {
                idAlumno = Convert.ToInt32 (this.txtId.Text);
                password = this.txtNip.Text;
                alumno = new Alumno (idAlumno);

                alumnoRespuesta = this.mConexion.validaAlumno (alumno, password);

                if (alumnoRespuesta != null) {
                    // Correcto y te envia al Login

                    // Guarda el alumno
                    this.alumno = alumnoRespuesta;

                    // Desaparece el dialogo
                    this.mAlert.DismissWithClickedButtonIndex (0, true);

                    // Envia a la pantalla principal
                    this.PerformSegue (Constants.SEGUE_LOGIN, this);
                } else {

                    // Datos incorrectos
                    MostrarAlertaError ("ID o NIP Incorrecto");

                }
            } else {
                // El Id no tiene el formato correcto
                MostrarAlertaError ("El ID debe ser numerico");
            }
        }
Exemple #4
0
 public Cita(Alumno alumno, Maestro maestro)
     : this(alumno, maestro, null, default(DateTime))
 {
 }
Exemple #5
0
 public Alumno validaAlumno(Alumno alumno, string password)
 {
     Alumno alumnoRespuesta;
     alumnoRespuesta = (Alumno)obtener (OPCIONES.VALIDA_ALUMNO, "/validaAlumno", alumno, password);
     return alumnoRespuesta;
 }