예제 #1
0
        protected void ButtonEliminar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TextBoxID.Text))
            {
                Utilidades.ShowToastr(this, "Llene campo Id ", "Consejo", "info");


                Limpiar();
            }
            else
            {
                int id       = int.Parse(TextBoxID.Text);
                var bll      = new BLLProfesor();
                var profesor = BLLProfesor.Buscar(p => p.IdProfesores == id);
                if (BLLProfesor.Eliminar(profesor))
                {
                    Utilidades.ShowToastr(this, "Eliminado con exito", "CORRECTO", "success");

                    Limpiar();
                }
                else
                {
                    Utilidades.ShowToastr(this, "No se puedo eliminar ", "ERROR", "error");
                }
            }
        }
예제 #2
0
        protected void ButtGuardar_Click(object sender, EventArgs e)
        {
            int id = 0;

            if (IsValid)
            {
                profesor = LlenarCampos();


                if (id != profesor.IdProfesores)
                {
                    if (BLLProfesor.Mofidicar(profesor))
                    {
                        Utilidades.ShowToastr(this, "Se modifico Satisfactoriamente", "Correcto", "success");
                    }
                    else
                    {
                        Utilidades.ShowToastr(this, "No se pudo modificar", "Error", "Error");
                    }
                }
                else
                {
                    if (BLLProfesor.Guardar(profesor))
                    {
                        Utilidades.ShowToastr(this, " Agregado", "Correcto", "success");
                    }
                    else
                    {
                        Utilidades.ShowToastr(this, "No se agrego", "Error", "error");
                    }
                }
            }
            Limpiar();
        }
예제 #3
0
        protected void BotonBuscar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TextBoxID.Text))
            {
                Utilidades.ShowToastr(this, "Llene Campo   id", "CONSEJO", "info");

                Limpiar();
            }
            else

            {
                int id       = int.Parse(TextBoxID.Text);
                var profesro = BLLProfesor.Buscar(p => p.IdProfesores == id);
                if (profesro != null)
                {
                    TextFecha.Text        = profesro.FechaNacimiento.ToString("yyyy-MM-dd");
                    TextBoxNombre.Text    = profesro.Nombre;
                    TextBoxDireccion.Text = profesro.Direccion;
                    DropSexo.Text         = profesro.Sexo;
                    TexboEmail.Text       = profesro.Email;
                    TexboCedula.Text      = profesro.Cedula;
                    TexboTelefono.Text    = profesro.Telefono;
                    TextBoxCurso.Text     = profesro.CursoImpartido;
                    TextBoxSueldo.Text    = profesro.Sueldo.ToString();
                    Utilidades.ShowToastr(this, "Resultados", "RESULTADOS", "success");
                }
                else
                {
                    Utilidades.ShowToastr(this, "No existe Profesor con ese ID", "ERROR", "error");

                    Limpiar();
                }
            }
        }