Example #1
0
        public bool Read()
        {
            Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1();

            try
            {
                Datos.Curso cur = bbdd.Curso.First(e => e.curso1 == curso1);
                CommonBC.Syncronize(cur, this);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #2
0
        public bool Delete()
        {
            Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1();

            try
            {
                Datos.Curso cur = bbdd.Curso.First(e => e.curso1 == curso1);
                bbdd.Curso.Remove(cur);
                bbdd.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #3
0
        public bool Update()
        {
            Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1();
            try
            {
                Datos.Curso cur = bbdd.Curso.First(e => e.curso1 == curso1);
                CommonBC.Syncronize(this, cur);
                bbdd.SaveChanges();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Example #4
0
        public bool Create()
        {
            Datos.OnTourEntities1 bbdd = new Datos.OnTourEntities1();
            Datos.Curso           cur  = new Datos.Curso();

            try
            {
                CommonBC.Syncronize(this, cur);

                bbdd.Curso.Add(cur);
                bbdd.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                bbdd.Curso.Remove(cur);

                return(false);
            }
        }
Example #5
0
        private void LimpiarVista()
        {
            // Variables.
            this.cursoRegistros = this.cursoNegocio.ListarTodos();
            this.deporteRegistros = this.deporteNegocio.ListarTodos();
            this.profesorRegistros = this.profesorNegocio.ListarTodos();
            this.cursoSeleccion = null;
            this.deporteSeleccion = null;
            this.profesorSeleccion = null;

            this.EstaBuscando = false;
            this.EstaEditando = false;

            // Componentes.
            this.buttonInsertar.Enabled = true;
            this.buttonActualizar.Enabled = false;
            this.buttonEliminar.Enabled = false;
            this.buttonActualizar.Text = "Editar";
            this.buttonSeleccionar.Text = "Búsqueda";

            this.textBoxCodigo.Enabled = false;
            this.textBoxNombre.Enabled = true;
            this.textBoxObservaciones.Enabled = true;
            this.textBoxDuracion.Enabled = true;
            this.dateTimePickerFechaInicio.Enabled = true;
            this.dateTimePickerFechaFin.Enabled = true;
            this.comboBoxDeporte.Enabled = true;
            this.comboBoxProfesor.Enabled = true;

            this.textBoxCodigo.Text = null;
            this.textBoxNombre.Text = null;
            this.textBoxObservaciones.Text = null;
            this.textBoxDuracion.Text = null;
            this.dateTimePickerFechaInicio.Value = DateTime.Now;
            this.dateTimePickerFechaFin.Value = DateTime.Now;

            // Operaciones.
            this.Curso_CargarCodigo();
            this.Curso_CargarRegistros(this.cursoRegistros);
            this.Deporte_CargarRegistros(this.deporteRegistros);
            this.Profesor_CargarRegistros(this.profesorRegistros);
        }
Example #6
0
 private void dataGridViewRegistros_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     this.ModoEdicionOff();
     // Referenciar seleccion.
     int indiceSeleccion = this.dataGridViewRegistros.CurrentRow.Index;
     this.cursoSeleccion = this.cursoRegistros[indiceSeleccion];
     // Cargar datos de la seleccion.
     this.textBoxCodigo.Text = Convert.ToString(this.cursoSeleccion.Id);
     this.textBoxNombre.Text = this.cursoSeleccion.Nombre.Trim();
     this.textBoxObservaciones.Text = this.cursoSeleccion.Observacion;
     this.textBoxDuracion.Text = Convert.ToString(this.cursoSeleccion.Duracion);
     this.dateTimePickerFechaInicio.Value = this.cursoSeleccion.FechaInicio;
     this.dateTimePickerFechaFin.Value = (this.cursoSeleccion.FechaFin == null) ? new DateTime(0) : this.cursoSeleccion.FechaFin.Value;
     this.comboBoxDeporte.SelectedIndex = this.deporteRegistros.FindIndex(a => a.Id == this.cursoSeleccion.Deporte.Id);
     this.comboBoxProfesor.SelectedIndex = this.profesorRegistros.FindIndex(a => a.Id == this.cursoSeleccion.Profesor.Id);
 }