public Practica GetPracticaNombre(String toSearchInBD)
        {
            Practica     instancePractica     = new Practica();
            DbConnection instanceDbConnection = new DbConnection();

            using (SqlConnection instanceSqlConnection = instanceDbConnection.GetConnection())
            {
                try
                {
                    instanceSqlConnection.Open();
                }
                catch (SqlException ex)
                {
                    throw (ex);
                }
                using (SqlCommand instanceSqlCommand = new SqlCommand("SELECT * FROM dbo.Practica WHERE Nombre = @NombreToSearch", instanceSqlConnection))
                {
                    instanceSqlCommand.Parameters.Add(new SqlParameter("NombreToSearch", toSearchInBD));
                    SqlDataReader reader = instanceSqlCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        instancePractica.NombrePractica     = reader["Id"].ToString();
                        instancePractica.NumOrgVincPractica = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.NumPracticantes    = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.NumProfesores      = Convert.ToInt16(reader["DiaEntrega"].ToString());
                        instancePractica.NumProyectos       = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.PeriodoPractica    = reader["Valor"].ToString();
                    }
                }
                instanceSqlConnection.Close();
            }
            return(instancePractica);
        }
Esempio n. 2
0
        public OperationResult AddPractica(String nombre, String nombreOrgVinc, int numEspacios, String periodo)
        {
            try
            {
                if (GetPracticaNombre(nombre).NombrePractica == null)
                {
                    Practica practica = new Practica();

                    practica.NombrePractica        = nombre;
                    practica.NombreOrgVincPractica = nombreOrgVinc;
                    practica.NumEspaciosPractica   = numEspacios;
                    practica.PeriodoPractica       = periodo;

                    PracticaDAO practicaDAO = new PracticaDAO();
                    return((OperationResult)practicaDAO.AddPractica(practica));
                }
                else
                {
                    return(OperationResult.ExistingRecord);
                }
            }
            catch
            {
                return(OperationResult.UnknowFail);
            }
        }
Esempio n. 3
0
        public override async void OnAppearing(object navigationContext)
        {
            base.OnAppearing(navigationContext);
            _Practica = (Practica)navigationContext;

            if (string.IsNullOrEmpty(_Practica.id))
            {
                await MarioService.Instance.AddPractice(_Practica);

                clock = new ClockService(5);
                clock.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
                {
                    setRunningTime();
                };
                clock.Start();
                _exercisenumber = 1;
                OnPropertyChanged("LastNumber");
                vDetails = new ObservableCollection <PracticasDetalle>();
            }
            else
            {
                this.LoadDetails();
            }
            OnPropertyChanged("TimerVisible");
        }
Esempio n. 4
0
        public Practica GetPracticaNombre(String toSearchInBD)
        {
            Practica     practica     = new Practica();
            DbConnection dbConnection = new DbConnection();

            using (SqlConnection sqlConnection = dbConnection.GetConnection())
            {
                try
                {
                    sqlConnection.Open();
                }
                catch (SqlException ex)
                {
                    throw (ex);
                }
                using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM dbo.Practica WHERE Nombre = @NombreToSearch", sqlConnection))
                {
                    sqlCommand.Parameters.Add(new SqlParameter("NombreToSearch", toSearchInBD));
                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                    while (sqlDataReader.Read())
                    {
                        practica.NombrePractica        = sqlDataReader["Nombre"].ToString();
                        practica.NombreOrgVincPractica = sqlDataReader["NombreOrgVinc"].ToString();
                        practica.NumEspaciosPractica   = Convert.ToInt16(sqlDataReader["NumEspacios"].ToString());
                        practica.PeriodoPractica       = sqlDataReader["Periodo"].ToString();
                    }
                }
                sqlConnection.Close();
            }
            return(practica);
        }
        public CrearPracticaResponse Ejecutar(CrearPracticaRequest request)
        {
            var admin = _unitOfWork.PracticaServiceRepository.FindFirstOrDefault(t => t.IdEstudiante == request.IdEstudiante);

            if (admin == null)
            {
                Practica newPractica = new Practica(request.IdEstudiante, request.IdDocente, request.IdEmpresa, request.Descripcion, request.Estado);
                var      errors      = newPractica.CanCrear();
                if (errors.Any())
                {
                    return new CrearPracticaResponse()
                           {
                               Message = errors[0]
                           }
                }
                ;
                _unitOfWork.PracticaServiceRepository.Add(newPractica);
                _unitOfWork.Commit();
                return(new CrearPracticaResponse()
                {
                    Message = $"Practica Creada Exitosamente"
                });
            }
            else
            {
                return(new CrearPracticaResponse()
                {
                    Message = $"Practica ya existe"
                });
            }
        }
    }
Esempio n. 6
0
        public List <Practica> GetPractica()
        {
            List <Practica> listPractica = new List <Practica>();
            DbConnection    dbConnection = new DbConnection();

            using (SqlConnection sqlConnection = dbConnection.GetConnection())
            {
                try
                {
                    sqlConnection.Open();
                }
                catch (SqlException ex)
                {
                    throw (ex);
                }
                using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM dbo.Practica", sqlConnection))
                {
                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                    while (sqlDataReader.Read())
                    {
                        Practica practica = new Practica();

                        practica.NombrePractica        = sqlDataReader["Nombre"].ToString();
                        practica.NombreOrgVincPractica = sqlDataReader["NombreOrgVinc"].ToString();
                        practica.NumEspaciosPractica   = Convert.ToInt32(sqlDataReader["NumEspacios"].ToString());
                        practica.PeriodoPractica       = sqlDataReader["Periodo"].ToString();

                        listPractica.Add(practica);
                    }
                }
                sqlConnection.Close();
            }
            return(listPractica);
        }
 private void actualizarCampos(int id)
 {
     oPractica      = oPracticaService.recuperarPracticasPorId(id);
     txtDesc.Text   = oPractica.Descripcion;
     txtImp.Text    = oPractica.Importe.ToString();
     txtNombre.Text = oPractica.Nombre;
     txtCodigo.Text = oPractica.Id_practica.ToString();
 }
        public CalificarPracticaResponse Ejecutar(CalificarPracticaRequest request)
        {
            Practica practica = _unitOfWork.PracticaServiceRepository.FindFirstOrDefault(t => t.IdEstudiante == request.IdEstudiante);

            if (practica == null)
            {
                return(new CalificarPracticaResponse()
                {
                    Message = $"Practica no existe"
                });
            }
            else
            {
                var errors = practica.CanCalificar(request.Nota);
                if (errors.Any())
                {
                    return new CalificarPracticaResponse()
                           {
                               Message = errors.ToString()
                           }
                }
                ;

                if (request.Corte.Equals(PrimerCorte))
                {
                    practica.PrimerCorte = request.Nota;
                }
                else
                {
                    if (request.Corte.Equals(SegundoCorte))
                    {
                        practica.SegundoCorte = request.Nota;
                    }
                    else
                    {
                        if (request.Corte.Equals(TercerCorte))
                        {
                            practica.TercerCorte = request.Nota;
                        }
                        else
                        {
                            return(new CalificarPracticaResponse()
                            {
                                Message = $"Corte no existe"
                            });
                        }
                    }
                }
                _unitOfWork.PracticaServiceRepository.Edit(practica);
                _unitOfWork.Commit();
                return(new CalificarPracticaResponse()
                {
                    Message = $"Practica Calificada Exitosamente"
                });
            }
        }
    }
Esempio n. 9
0
        private void Start()
        {
            var parameter = new Practica();

            parameter.Descripcion = _Descripcion;
            parameter.Fecha       = _Fecha;
            parameter.Minutos     = _Minutos;
            NavigationService.Instance.NavigateTo <PracticingViewModel>(parameter);
        }
Esempio n. 10
0
 private void button11_Click(object sender, EventArgs e)
 {
     if (cmbPracticas.Items.Count > 0 && cmbPracticas.SelectedIndex >= 0)
     {
         Practica practica = (Practica)cmbPracticas.SelectedItem;
         listaPracticas.Items.Add(practica);
         listaPracticas.SelectedIndex = 0;
     }
 }
Esempio n. 11
0
 public bool validarPractica(Practica obPractica)
 {
     if (obPractica.Nombre == string.Empty)
     {
         MessageBox.Show("Debe ingresar un nombre para la práctica", "Nombre de práctica vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     return(true);
 }
Esempio n. 12
0
        public void altaPractica(Practica ob, bool esAlta)
        {
            string nom  = ob.Nombre;
            string desc = ob.Descripcion;
            int    imp  = ob.Importe;
            int    id   = ob.Id_practica;

            oPracticaDao.actualizacion(nom, desc, imp, id, esAlta);
        }
Esempio n. 13
0
        public bool insert(int id, int correctas, int idtema, string user)
        {
            PracticaDAO dao = new PracticaDAO();
            Practica    obj = new Practica()
            {
                IdPractica = id, Correctas = correctas, IdTema = idtema, User = user
            };

            return(dao.insert(obj));
        }
Esempio n. 14
0
 public async Task AddPractice(Practica item)
 {
     try
     {
         await _tbPracticas.InsertAsync(item);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(@"Error {0}", ex.Message);
     }
 }
Esempio n. 15
0
 public IActionResult Registrar(Practica objPractica)
 {
     if (ModelState.IsValid)
     {
         //grabar
         _context.Add(objPractica);
         _context.SaveChanges();
         objPractica.Response = "Gracias estamos en contacto";
     }
     return(View("index", objPractica));
 }
Esempio n. 16
0
        private void btnAgregarPractica_Click(object sender, EventArgs e)
        {
            if (cmbPracticas.Items.Count > 0 && cmbPracticas.SelectedIndex >= 0)
            {
                Practica practica = (Practica)cmbPracticas.SelectedItem;
                lstPracticas.Items.Add(practica);
                lstPracticas.SelectedIndex = 0;

                dtpHoraHasta.Value = dtpHoraHasta.Value.AddMinutes((double)practica.Duracion);
            }
        }
Esempio n. 17
0
 public async Task EditPractice(Practica item)
 {
     try
     {
         await _tbPracticas.UpdateAsync(item);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(@"Error {0}", ex.Message);
     }
 }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (cboPracticas.SelectedIndex == -1)
            {
                MessageBox.Show("Debe seleccionar una práctica para cargar", "Seleccione una práctica", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            oPractica = oPracticaService.recuperarPracticasPorId(Convert.ToInt32(cboPracticas.SelectedValue));

            cargarGrilla(dgvPracticas, oPractica);

            this.importeTotal = importeTotal + (oPractica.Importe * oObraSocial.Porcentaje);

            txtImporte.Text      = oPractica.Importe.ToString();
            txtImporteTotal.Text = importeTotal.ToString();
        }
Esempio n. 19
0
        /// <summary>
        /// Obtiene una Practica por ID
        /// </summary>
        /// <param name="ID">ID del que se desea obtener su Practica</param>
        /// <returns>Una Practica del Usuario</returns>
        public Practica getPracticaByID(int ID)
        {
            Practica  res;
            Conexion  conexion = new Conexion();
            DataSet   datos    = conexion.LLenaComboGrid("SELECT * FROM Practica WHERE IdPractica = " + ID + ";");
            DataTable dt       = datos.Tables[0];

            res = new Practica();
            DataRow row = dt.Rows[0];

            res.IdPractica = (int)row.ItemArray[0];
            res.Correctas  = (int)row.ItemArray[1];
            res.IdTema     = (int)row.ItemArray[2];
            res.User       = (string)row.ItemArray[3];
            return(res);
        }
        public AddResult AddPractica(Practica instancePractica)
        {
            AddResult    instanceAddResult    = AddResult.UnknowFail;
            DbConnection instanceDbConnection = new DbConnection();
            AddResult    checkForEmpty        = AddResult.UnknowFail;

            try
            {
                checkForEmpty = CheckObjectPractica(instancePractica);
            }
            catch (ArgumentNullException)
            {
                instanceAddResult = AddResult.NullObject;
                return(instanceAddResult);
            }
            catch (FormatException ex)
            {
                throw ex;
            }
            using (SqlConnection instanceSqlConnection = instanceDbConnection.GetConnection())
            {
                instanceSqlConnection.Open();
                using (SqlCommand instanceSqlCommand = new SqlCommand("INSERT INTO dbo.Practica VALUES(@Nombre, @NumOrgVincPractica, @NumPracticantes, @NumProfesores, @NumProyectos, @Periodo)", instanceSqlConnection))
                {
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@Id", instancePractica.NombrePractica));
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@Nombre", instancePractica.NumOrgVincPractica));
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@DiaEntrega", instancePractica.NumPracticantes));
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@MesEntrega", instancePractica.NumProfesores));
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@AñoEntrega", instancePractica.NumProyectos));
                    instanceSqlCommand.Parameters.Add(new SqlParameter("@Valor", instancePractica.PeriodoPractica));
                    try
                    {
                        instanceSqlCommand.ExecuteNonQuery();
                    }
                    catch (SqlException)
                    {
                        instanceAddResult = AddResult.SQLFail;
                        return(instanceAddResult);
                    }
                    instanceAddResult = AddResult.Success;
                }
                instanceSqlConnection.Close();
            }
            return(instanceAddResult);
        }
Esempio n. 21
0
 public int getTotalVocabularioByUser(String user)
 {
     try
     {
         Practica  res;
         Conexion  conexion = new Conexion();
         DataSet   datos    = conexion.LLenaComboGrid("select max(correctas) as correctas from practica where user like '" + user + "' and idTema=4;");
         DataTable dt       = datos.Tables[0];
         res = new Practica();
         DataRow row   = dt.Rows[0];
         int     total = (int)row.ItemArray[0];
         return(total);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 22
0
        /// <summary>
        /// Elimina el registro de la Practica en base al Id de la Practica introducida
        /// </summary>
        /// <param name="t">La Practica a eliminar</param>
        /// <returns>Retorna true si se pudo eliminar el registro de lo contrario retorna false</returns>
        public bool delete(Practica t)
        {
            Conexion conexion = new Conexion();


            try
            {
                String       SQL    = "DELETE FROM Practica WHERE" + " IdPractica=" + t.IdPractica + ";";
                MySqlCommand sqlcom = new MySqlCommand();
                sqlcom.CommandText = SQL;
                conexion.EjecutaSQLComando(sqlcom);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 23
0
        public AddResult AddPractica(Practica practica)
        {
            AddResult    addResult     = AddResult.UnknowFail;
            DbConnection dbConnection  = new DbConnection();
            AddResult    checkForEmpty = AddResult.UnknowFail;

            try
            {
                checkForEmpty = CheckObjectPractica(practica);
            }
            catch (ArgumentNullException)
            {
                addResult = AddResult.NullObject;
                return(addResult);
            }
            catch (FormatException ex)
            {
                throw ex;
            }
            using (SqlConnection sqlConnection = dbConnection.GetConnection())
            {
                sqlConnection.Open();
                using (SqlCommand sqlCommand = new SqlCommand("INSERT INTO dbo.Practica VALUES(@Nombre, " +
                                                              "@NumOrgVincPractica, @NumPracticantes, @Periodo)", sqlConnection))
                {
                    sqlCommand.Parameters.Add(new SqlParameter("@Nombre", practica.NombrePractica));
                    sqlCommand.Parameters.Add(new SqlParameter("@NombreOrgVinc", practica.NombreOrgVincPractica));
                    sqlCommand.Parameters.Add(new SqlParameter("@NumEspacios", practica.NumEspaciosPractica));
                    sqlCommand.Parameters.Add(new SqlParameter("@Periodo", practica.PeriodoPractica));
                    try
                    {
                        sqlCommand.ExecuteNonQuery();
                    }
                    catch (SqlException)
                    {
                        addResult = AddResult.SQLFail;
                        return(addResult);
                    }
                    addResult = AddResult.Success;
                }
                sqlConnection.Close();
            }
            return(addResult);
        }
        public List <Practica> obtenerPracticas()
        {
            EnlaceDatos   enlace      = new EnlaceDatos();
            SqlDataReader drPracticas = enlace.getPracticas();

            if (drPracticas.HasRows)
            {
                List <Practica> lsPracticas = new List <Practica>();
                while (drPracticas.Read())
                {
                    Practica practica = new Practica();
                    practica.IdPractica = Convert.ToInt32(drPracticas[0].ToString());
                    practica.Nombre     = drPracticas.GetString(1);
                    practica.Duracion   = Convert.ToInt32(drPracticas[2].ToString());
                    lsPracticas.Add(practica);
                }
                return(lsPracticas);
            }
            return(null);
        }
Esempio n. 25
0
 /// <summary>
 /// Inserta un registro de Practica
 /// </summary>
 /// <param name="i">La nueva Practica a insertar</param>
 /// <returns>Retorna true si se pudo insertar el registro de lo contrario retorna false</returns>
 public bool insert(Practica i)
 {
     try
     {
         Conexion     conexion = new Conexion();
         String       SQL      = "INSERT INTO Practica (IdPractica,Correctas,IdTema,User) VALUES (null,@Correctas,@IdTema,@User);";
         MySqlCommand sqlcom   = new MySqlCommand();
         sqlcom.CommandText = SQL;
         //sqlcom.Parameters.AddWithValue("@IdPractica", "null");
         sqlcom.Parameters.AddWithValue("@Correctas", i.Correctas);
         sqlcom.Parameters.AddWithValue("@IdTema", i.IdTema);
         sqlcom.Parameters.AddWithValue("@User", i.User);
         conexion.EjecutaSQLComando(sqlcom);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 26
0
        /// <summary>
        /// Actualiza el registro de la Practica en base al Id de la Practica introducida
        /// </summary>
        /// <param name="e">Recibe una Practica con los nuevos datos a actualizar</param>
        /// <returns>Retorna true en caso de actualizar de lo contrario retorna false</returns>
        public bool update(Practica e)
        {
            Conexion conexion = new Conexion();


            try
            {
                String SQL = "UPDATE Practica SET" +
                             " IdPractica=" + e.IdPractica + ",Correctas=" + e.Correctas + ",IdTema=" + e.IdTema + ",User="******" WHERE IdPractica=" + e.IdPractica + ";";
                MySqlCommand sqlcom = new MySqlCommand();
                sqlcom.CommandText = SQL;
                conexion.EjecutaSQLComando(sqlcom);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Obtiene todos los registros almacenados en la tabla Practica
        /// </summary>
        /// <returns>Una lista de tipo Practica</returns>
        public List <Practica> getAll()
        {
            List <Practica> lista = new List <Practica>();
            Conexion        con   = new Conexion();

            DataSet   datos = con.LLenaComboGrid("SELECT * FROM Practica" + ";");
            DataTable dt    = datos.Tables[0];
            Practica  e;

            foreach (DataRow r in dt.Rows)
            {
                e            = new Practica();
                e.IdPractica = (int)r.ItemArray[0];
                e.Correctas  = (int)r.ItemArray[1];
                e.IdTema     = (int)r.ItemArray[2];
                e.User       = (string)r.ItemArray[3];
                lista.Add(e);
            }
            return(lista);
        }
Esempio n. 28
0
        private AddResult CheckObjectPractica(Practica practica)
        {
            CheckFields checkFields = new CheckFields();
            AddResult   addResult   = AddResult.UnknowFail;

            if (practica.NombrePractica == String.Empty ||
                practica.NombreOrgVincPractica == String.Empty ||
                practica.NumEspaciosPractica == 0 ||
                practica.PeriodoPractica == String.Empty)
            {
                throw new FormatException("Existen campos vacíos ");
            }
            if (checkFields.ValidarNombres(practica.NombrePractica) == CheckFields.ResultadosValidación.NombresInvalidos)
            {
                throw new FormatException("Nombre inválido " + practica.NombrePractica);
            }
            else
            {
                addResult = AddResult.Success;
            }
            return(addResult);
        }
        private AddResult CheckObjectPractica(Practica instancePractica)
        {
            CheckFields instanceCheckFields = new CheckFields();
            AddResult   instanceAddResult   = AddResult.UnknowFail;

            if (instancePractica.NombrePractica == String.Empty ||
                instancePractica.NumOrgVincPractica == 0 ||
                instancePractica.NumPracticantes == 0 ||
                instancePractica.NumProfesores == 0 ||
                instancePractica.NumProyectos == 0 ||
                instancePractica.PeriodoPractica == String.Empty)
            {
                throw new FormatException("Existen campos vacíos ");
            }
            if (instanceCheckFields.ValidarNombreArtefacto(instancePractica.NombrePractica) == CheckFields.ResultadosValidación.NombreArtefactoInvalido)
            {
                throw new FormatException("Nombre inválido " + instancePractica.NombrePractica);
            }
            else
            {
                instanceAddResult = AddResult.Success;
            }
            return(instanceAddResult);
        }
        public List <Practica> GetPractica()
        {
            List <Practica> instanceListaPractica = new List <Practica>();
            DbConnection    instanceDbConnection  = new DbConnection();

            using (SqlConnection instanceSqlConnection = instanceDbConnection.GetConnection())
            {
                try
                {
                    instanceSqlConnection.Open();
                }
                catch (SqlException ex)
                {
                    throw (ex);
                }
                using (SqlCommand instanceSqlCommand = new SqlCommand("SELECT * FROM dbo.Practica", instanceSqlConnection))
                {
                    SqlDataReader reader = instanceSqlCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        Practica instancePractica = new Practica();

                        instancePractica.NombrePractica     = reader["Id"].ToString();
                        instancePractica.NumOrgVincPractica = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.NumPracticantes    = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.NumProfesores      = Convert.ToInt16(reader["DiaEntrega"].ToString());
                        instancePractica.NumProyectos       = Convert.ToInt32(reader["DiaEntrega"].ToString());
                        instancePractica.PeriodoPractica    = reader["Valor"].ToString();

                        instanceListaPractica.Add(instancePractica);
                    }
                }
                instanceSqlConnection.Close();
            }
            return(instanceListaPractica);
        }