Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Aprendizaje aprendizaje = db.Aprendizaje.Find(id);

            db.Aprendizaje.Remove(aprendizaje);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "idAprendizaje,strDescripcion")] Aprendizaje aprendizaje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aprendizaje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aprendizaje));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "idAprendizaje,strDescripcion")] Aprendizaje aprendizaje)
        {
            if (ModelState.IsValid)
            {
                db.Aprendizaje.Add(aprendizaje);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aprendizaje));
        }
Example #4
0
        // GET: Aprendizajes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Aprendizaje aprendizaje = db.Aprendizaje.Find(id);

            if (aprendizaje == null)
            {
                return(HttpNotFound());
            }
            return(View(aprendizaje));
        }
Example #5
0
        public static Aprendizaje Crear(Aprendizaje aprendizaje)
        {
            try
            {
                Enum.TryParse("Habilitado", out EnumEstado EEstado);
                aprendizaje.Estado = EEstado;
                var command = new MySqlCommand()
                {
                    CommandText = "sp_aprendizajes_crear", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_categoria", Direction = System.Data.ParameterDirection.Input, Value = aprendizaje.Categoria
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_subCategoria", Direction = System.Data.ParameterDirection.Input, Value = aprendizaje.SubCategoria
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_descripcion", Direction = System.Data.ParameterDirection.Input, Value = aprendizaje.Descripcion
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_porcentajeLogro", Direction = System.Data.ParameterDirection.Input, Value = 0
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = aprendizaje.Estado.ToString()
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "out_codigo", Direction = System.Data.ParameterDirection.Output, Value = -1
                });

                var datos = DataSource.ExecuteProcedure(command);

                aprendizaje.Codigo = Convert.ToInt32(datos.Parameters["out_codigo"].Value);

                return(aprendizaje);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Example #6
0
        public static List <Aprendizaje> LeerTodo()
        {
            try
            {
                System.Diagnostics.Debug.WriteLine("leeeeeeeer Controlleeeeeeeeeeeer");
                var command = new MySqlCommand()
                {
                    CommandText = "sp_aprendizajes_leertodo", CommandType = System.Data.CommandType.StoredProcedure
                };
                var datos = DataSource.GetDataSet(command);
                System.Diagnostics.Debug.WriteLine("leido spppppppppppppppppp");


                List <Aprendizaje> aprendizajes = new List <Aprendizaje>();
                if (datos.Tables[0].Rows.Count > 0)
                {
                    System.Diagnostics.Debug.WriteLine("leeeeeeeer if-foreach");
                    foreach (System.Data.DataRow row in datos.Tables[0].Rows)
                    {
                        System.Diagnostics.Debug.WriteLine("leeeeeeeer foreaachhhhhhhhhh");
                        var prodData = row;
                        Enum.TryParse(prodData["estado"].ToString(), out EnumEstado EEstado);
                        var aprendizaje = new Aprendizaje()
                        {
                            Codigo          = Convert.ToInt32(prodData["codigo"]),
                            Categoria       = prodData["categoria"].ToString(),
                            SubCategoria    = prodData["subCategoria"].ToString(),
                            Descripcion     = prodData["descripcion"].ToString(),
                            PorcentajeLogro = Convert.ToInt32(prodData["porcentajeLogro"]),
                            Estado          = EEstado
                        };
                        aprendizajes.Add(aprendizaje);
                    }
                }
                return(aprendizajes);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(null);
        }
Example #7
0
        internal static List <Aprendizaje> LeerSubAprendizajes(int codigo)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "sp_competencias_leersubaprendizajes", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_codigo", Direction = System.Data.ParameterDirection.Input, Value = codigo
                });
                var datos = DataSource.GetDataSet(command);

                List <Aprendizaje> aprendizajes = new List <Aprendizaje>();
                if (datos.Tables[0].Rows.Count > 0)
                {
                    foreach (System.Data.DataRow row in datos.Tables[0].Rows)
                    {
                        var prodData = row;
                        Enum.TryParse(prodData["estado"].ToString(), out EnumEstado EEstado);
                        var aprendizaje = new Aprendizaje()
                        {
                            Codigo          = Convert.ToInt32(prodData["codigo"]),
                            Categoria       = prodData["categoria"].ToString(),
                            SubCategoria    = prodData["subCategoria"].ToString(),
                            Descripcion     = prodData["descripcion"].ToString(),
                            PorcentajeLogro = Convert.ToInt32(prodData["porcentajeLogro"]),
                            Estado          = EEstado
                        };
                        aprendizajes.Add(aprendizaje);
                    }
                }
                return(aprendizajes);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(null);
        }
Example #8
0
        public static List <Aprendizaje> LeerHabilitados()
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "sp_aprendizajes_leerHabilitados", CommandType = System.Data.CommandType.StoredProcedure
                };
                var datos = DataSource.GetDataSet(command);

                List <Aprendizaje> apr = new List <Aprendizaje>();
                if (datos.Tables[0].Rows.Count > 0)
                {
                    foreach (System.Data.DataRow row in datos.Tables[0].Rows)
                    {
                        var prodData = row;
                        Enum.TryParse("Habilitado", out EnumEstado EEstado);
                        var appr = new Aprendizaje()
                        {
                            Codigo          = Convert.ToInt32(prodData["codigo"]),
                            Categoria       = prodData["categoria"].ToString(),
                            SubCategoria    = prodData["subCategoria"].ToString(),
                            Descripcion     = prodData["descripcion"].ToString(),
                            PorcentajeLogro = Convert.ToInt32(prodData["porcentajeLogro"]),
                            Estado          = EEstado
                        };

                        apr.Add(appr);
                    }
                }
                return(apr);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(null);
        }
Example #9
0
        public static List <Competencia> LeerTodo()
        {
            try
            {
                var commandC = new MySqlCommand()
                {
                    CommandText = "sp_competencias_leertodo", CommandType = System.Data.CommandType.StoredProcedure
                };
                var datosC = DataSource.GetDataSet(commandC);

                List <Competencia> componentes = new List <Competencia>();

                if (datosC.Tables[0].Rows.Count > 0)
                {
                    System.Diagnostics.Debug.WriteLine("leeeeeeeer Competencias");


                    foreach (System.Data.DataRow row in datosC.Tables[0].Rows)
                    {
                        var prodData    = row;
                        var competencia = new Competencia()
                        {
                            Codigo           = Convert.ToInt32(prodData["codigo"]),
                            Nombre           = prodData["nombre"].ToString(),
                            Descripcion      = prodData["descripcion"].ToString(),
                            Dominio          = prodData["dominio"].ToString(),
                            Basico           = prodData["basico"].ToString(),
                            Intermedio       = prodData["intermedio"].ToString(),
                            Avanzado         = prodData["avanzado"].ToString(),
                            TiempoDesarrollo = prodData["tiempoDesarrollo"].ToString(),
                            Estado           = prodData["estado"].ToString()
                        };

                        System.Diagnostics.Debug.WriteLine("codC: " + competencia.Codigo);


                        var commandA = new MySqlCommand()
                        {
                            CommandText = "sp_competencias_leersubaprendizajes", CommandType = System.Data.CommandType.StoredProcedure
                        };
                        commandA.Parameters.Add(new MySqlParameter()
                        {
                            ParameterName = "in_codigo", Direction = System.Data.ParameterDirection.Input, Value = competencia.Codigo
                        });
                        var datosA = DataSource.GetDataSet(commandA);

                        int        nAprendizajes = 0;
                        List <int> porcentajesA  = new List <int>();
                        System.Diagnostics.Debug.WriteLine("A");

                        List <Aprendizaje> aprendizajes = new List <Aprendizaje>();

                        if (datosA.Tables[0].Rows.Count > 0)
                        {
                            foreach (System.Data.DataRow rowA in datosA.Tables[0].Rows)
                            {
                                var prodDataA = rowA;

                                Enum.TryParse(prodData["estado"].ToString(), out EnumEstado EEstado);
                                var aprendizaje = new Aprendizaje()
                                {
                                    Codigo          = Convert.ToInt32(prodData["codigo"]),
                                    Categoria       = prodData["categoria"].ToString(),
                                    SubCategoria    = prodData["subCategoria"].ToString(),
                                    Descripcion     = prodData["descripcion"].ToString(),
                                    PorcentajeLogro = Convert.ToInt32(prodData["porcentajeLogro"]),
                                    Estado          = EEstado
                                };

                                var commandS = new MySqlCommand()
                                {
                                    CommandText = "sp_aprendizajes_leersubsaberes", CommandType = System.Data.CommandType.StoredProcedure
                                };
                                commandA.Parameters.Add(new MySqlParameter()
                                {
                                    ParameterName = "in_codigo", Direction = System.Data.ParameterDirection.Input, Value = aprendizaje.Codigo
                                });
                                var datosS = DataSource.GetDataSet(commandA);

                                List <int> porcentajesS = new List <int>();

                                int          nSaberes = 0;
                                List <Saber> saberes  = new List <Saber>();
                                if (datosS.Tables[0].Rows.Count > 0)
                                {
                                    System.Diagnostics.Debug.WriteLine("leeeeeeeer Saberes");
                                    foreach (System.Data.DataRow rowS in datosS.Tables[0].Rows)
                                    {
                                        var prodDataS = rowS;

                                        Enum.TryParse(prodDataS["nivelLogro"].ToString(), out EnumLogro ELogro);
                                        Enum.TryParse(prodDataS["estado"].ToString(), out EnumEstado EEEstado);
                                        var saber = new Saber()
                                        {
                                            Codigo          = Convert.ToString(prodData["codigo"]),
                                            Descripcion     = prodData["descripcion"].ToString(),
                                            Logro           = ELogro,
                                            Estado          = EEEstado,
                                            PorcentajeLogro = prodData["porcentajeLogro"].ToString(),
                                            Id = Convert.ToInt32(prodData["id"])
                                        };

                                        porcentajesS.Add(Convert.ToInt32(saber.PorcentajeLogro));
                                        nSaberes++;

                                        //agregar saber a componentes
                                        saberes.Add(saber);
                                    }
                                }
                                //calculo de porcentaje del aprendizaje actual
                                int porcentajeAprendizaje = calcularPorcentaje(porcentajesS);

                                porcentajesA.Add(aprendizaje.PorcentajeLogro);
                                nAprendizajes++;

                                //se agregan los aprendizajes a los componentes
                                aprendizaje.PorcentajeLogro = porcentajeAprendizaje;
                                aprendizajes.Add(aprendizaje);
                            }
                        }

                        //calculo de porcentaje de la competencia actual
                        int porcentajeCompetencia = calcularPorcentaje(porcentajesA);

                        competencia.PorcentajeLogro = porcentajeCompetencia;
                        componentes.Add(competencia);
                    }
                }
                //retorna lista de componentes completa
                return(componentes);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(null);
        }
Example #10
0
 public static bool Editar(Aprendizaje aprendizaje)
 {
     return(false);
 }
Example #11
0
        public ActionResult Editar(Aprendizaje aprendizaje)
        {
            Boolean result = Aprendizajes.Editar(aprendizaje);

            return(RedirectToAction("Index", "Aprendizajes"));
        }
Example #12
0
 public ActionResult Crear(Aprendizaje aprendizaje)
 {
     aprendizaje = Aprendizajes.Crear(aprendizaje);
     return(RedirectToAction("Index", "Aprendizajes"));
 }