Ejemplo n.º 1
0
        /// <summary>
        /// Registra un mensaje con un nivel de importancia en el flujo del método actual.
        /// Requiere que el inicio y el retorno del método esté logeado.
        /// </summary>
        /// <example>
        ///     public class UsuarioBO
        ///     {
        ///         private UsuarioDAO dao = new UsuarioDAO();
        ///
        ///         public void Agregar(UsuarioTO usuario)
        ///         {
        ///             log.Mensaje("Antes de llamar al DAO", Nivel.INFO);
        ///             dao.Agregar(usuario);
        ///             log.Mensaje("Luego de llamar al DAO", Nivel.INFO);
        ///         }
        ///     }
        /// </example>
        /// <remarks>
        ///     Registro de versiones:
        ///
        ///         1.0 02/03/2015 Marcos Abraham Hernández Bravo (Ada Ltda.): versión inicial.
        /// </remarks>
        /// <param name="mensaje">Mensaje a registrar.</param>
        /// <param name="nivel">Nivel de importancia o tipo del mensaje.</param>
        public void Mensaje(string mensaje, Nivel nivel)
        {
            Llamada++;

            RegistroInLineTO registro = new RegistroInLineTO()
            {
                ThreadGUID  = Log4MeManager.ThreadGUID,
                MethodGUID  = InstanciaLog.MethodGUID,
                Namespace   = InstanciaLog.Metodo.DeclaringType.Namespace,
                Clase       = InstanciaLog.Metodo.DeclaringType.Name,
                Metodo      = InstanciaLog.Metodo.ToString(),
                Mensaje     = mensaje,
                Nivel       = nivel,
                Correlativo = Llamada,
                Tipo        = Tipo.Mensaje
            };

            foreach (ALogWriter writer in Writers)
            {
                if (writer.PermiteNivel(nivel))
                {
                    writer.Guardar(registro);
                }
            }
        }
Ejemplo n.º 2
0
        }//pendiente

        #endregion

        #region BUSQUEDAS DE OBJETOS PERSONALIZADOS
        /// <summary>
        /// Obtiene la lista de niveles
        /// </summary>
        /// <returns>
        /// DEvuelve los niveles correspondientes al periodo indicado
        /// </returns>
        public List <Nivel> getNivelesPeriodoById(Periodo obj)
        {
            List <Nivel> niveles = new List <Nivel>();

            this.Query = String.Format("SELECT ID_NIVEL FROM PERIODOS WHERE ID_PERIODO = {0}", obj.ID_PERIODO);
            IDataReader r = this.ExecuteReader(this.Query);

            while (r.Read())
            {
                this.Query = String.Format("SELECT * FROM NIVELES WHERE ID_NIVEL IN ({0})", r[""].ToString());
                IDataReader reader = this.ExecuteReader(this.Query);
                if (this.ExistError)
                {
                    //this.MessageError;
                }
                while (reader.Read())
                {
                    Nivel nivel = new Nivel();
                    nivel.ID_NIVEL    = Convert.ToInt32(reader["ID_NIVEL"]);
                    nivel.NIVEL       = reader["NIVEL"].ToString();
                    nivel.DESCRIPCION = reader["DESCRIPCION"].ToString();
                    nivel.MISION      = reader["MISION"].ToString();
                    nivel.OBJETIVO    = reader["OBJETIVO"].ToString();
                    nivel.VISION      = reader["VISION"].ToString();
                    niveles.Add(nivel);
                }
            }


            return(niveles);
        }
Ejemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboNiveles.Items.Count > 0 && comboNiveles.SelectedItem != null)
     {
         currentNivel = (Nivel)comboNiveles.SelectedItem;
         bool seguir = true;
         if (seHicieronCambios)
         {
             DialogResult result = MessageBox.Show(traducciones["com.td.descartar"], "", MessageBoxButtons.OKCancel);
             if (result != DialogResult.OK)
             {
                 seguir            = false;
                 seHicieronCambios = false;
             }
         }
         try
         {
             if (seguir)
             {
                 List <Materia> materias = this.administracion.traerMateriasPorNivel(currentNivel);
                 this.dgAsignadas.DataSource = null;
                 this.asignadas = materias;
                 this.dgAsignadas.DataSource = new BindingList <Materia>(this.asignadas);
                 mostrarMateriasNoAsignadasAlNivel(materias);
                 this.btAsignar.Enabled    = true;
                 this.btDesasignar.Enabled = true;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Ejemplo n.º 4
0
        public List <Nivel> SeleccionarTodos()
        {
            List <Nivel> lista = new List <Nivel>();
            //Paso 1:
            SqlConnection conexion = new SqlConnection(Conexion.ObtenerCadena());

            try
            {
                conexion.Open();
                //Paso 2:
                string sql = "Sp_Nivel_SelectAll";
                //Paso 3:
                SqlCommand comando = new SqlCommand(sql, conexion);
                comando.CommandType = CommandType.StoredProcedure;
                IDataReader reader = comando.ExecuteReader();
                while (reader.Read())
                {
                    Nivel tipo = new Nivel()
                    {
                        ID     = (int)reader["ID"],
                        Nombre = reader["Nombre"].ToString()
                    };
                    lista.Add(tipo);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(lista);
        }
Ejemplo n.º 5
0
 private int IdentificarBonusVelocidade(Nivel nivel)
 {
     if (nivel == Nivel.Um)
     {
         return(1);
     }
     else if (nivel == Nivel.Dois)
     {
         return(2);
     }
     else if (nivel == Nivel.Tres)
     {
         return(3);
     }
     else if (nivel == Nivel.Quatro)
     {
         return(4);
     }
     else if (nivel == Nivel.Cinco)
     {
         return(5);
     }
     else
     {
         return(2);
     }
 }
Ejemplo n.º 6
0
        private void btExport_Click(object sender, EventArgs e)
        {
            List <Nivel> nivelesParaElReporte = new List <Nivel>();

            foreach (Nivel iter in this.comboNiveles.DataSource as List <Nivel> )
            {
                Nivel nivel = new Nivel();
                nivel.id          = iter.id;
                nivel.descripcion = iter.descripcion;
                nivel.orientacion = iter.orientacion;
                if (iter.orientacion != null && iter.orientacion.ToString() != "")
                {
                    nivel.orientacionCodigo = iter.orientacion.nombre;
                }
                else
                {
                    nivel.orientacionCodigo = "";
                }
                nivel.codigo = iter.codigo;
                List <Materia> materiasDelNivel = this.administracion.traerMateriasPorNivel(nivel);
                nivel.materia = materiasDelNivel;
                nivelesParaElReporte.Add(nivel);
            }
            new ServicioReportes().ejecutarReporte <Nivel>("ReportePlanDeEstudios", nivelesParaElReporte);
        }
Ejemplo n.º 7
0
        public void AddNivel(string id, int idNivel, bool ok)
        {
            //var max = db.Nivel.DefaultIfEmpty().Max(n => n == null ? 0 : n.Id);

            if (ok)
            {
                Nivel nivel = new Nivel
                {
                    Id     = idNivel,
                    Nombre = "SA"
                };

                db.Nivel.Add(nivel);
                db.SaveChanges();
            }

            RolNivel rolNivel = new RolNivel
            {
                IdRol    = id,
                IdNivel  = idNivel,
                UsuaReg  = "sistemas",
                FechaReg = DateTime.Now
            };

            db.RolNivel.Add(rolNivel);
            db.SaveChanges();
        }
Ejemplo n.º 8
0
    void LoadModal(Nivel level)
    {
        selectedLevel = level.LevelName;
        GameObject.Find("LevelText").GetComponent <Text>().text               = "LEVEL " + (level.ID + 1).ToString();
        GameObject.Find("LevelTextShadow").GetComponent <Text>().text         = "LEVEL " + (level.ID + 1).ToString();
        GameObject.FindWithTag("CanvasModal").GetComponent <Canvas>().enabled = true;
        GameObject.FindWithTag("CanvasModal").transform.Find("ModalContent").gameObject.GetComponent <Animator>().SetBool("open", true);
        GameObject.Find("marcoLocked").GetComponent <Image>().enabled      = false;
        GameObject.Find("botonJugar").GetComponent <Button>().interactable = true;
        GameObject.Find("imageNivel").GetComponent <Image>().sprite        = miniaturas[level.ID];
        if (level.LevelName == "Level Tutorial")
        {
            GameObject.Find("TextObsequio").GetComponent <Text>().text = "Complete Tutorial";
        }
        else
        {
            GameObject.Find("TextObsequio").GetComponent <Text>().text = "Complete level " + (level.ID + 1);
        }
        GameObject.Find("TextHabilidad").GetComponent <Text>().text = "Finish in less than " + level.MaxTime + "''";
        GameObject.Find("TextPrestigio").GetComponent <Text>().text = "Clear course in " + level.MaxInteractions + " touches";
        if (level.RecordTime != -1)
        {
            GameObject.Find("TextTime").GetComponent <Text>().text = System.Math.Round(level.RecordTime, 0).ToString() + "''";
        }
        else
        {
            GameObject.Find("TextTime").GetComponent <Text>().text = "--";
        }

        if (level.Locked)
        {
            GameObject.Find("marcoLocked").GetComponent <Image>().enabled      = true;
            GameObject.Find("botonJugar").GetComponent <Button>().interactable = false;
        }

        if (level.Insignias >= 1)
        {
            GameObject.Find("imageObsequioDes").GetComponent <Image>().enabled = false;
        }
        else
        {
            GameObject.Find("imageObsequioDes").GetComponent <Image>().enabled = true;
        }
        if (level.Insignias >= 2)
        {
            GameObject.Find("imageHabilidadDes").GetComponent <Image>().enabled = false;
        }
        else
        {
            GameObject.Find("imageHabilidadDes").GetComponent <Image>().enabled = true;
        }
        if (level.Insignias >= 3)
        {
            GameObject.Find("imagePrestigioDes").GetComponent <Image>().enabled = false;
        }
        else
        {
            GameObject.Find("imagePrestigioDes").GetComponent <Image>().enabled = true;
        }
    }
        public Forja(Nivel nivel, string menuTitle)
            : base(menuTitle)
        {
            this.Nivel = nivel;

            //Reinicia globales
            NivelArma = 0;
            NivelArmadura = 0;
            TrampasDisponibles = 0;

            armaEntry = new MenuEntry(this, string.Empty);
            armaduraEntry = new MenuEntry(this, string.Empty);
            trampasEntry = new MenuEntry(this, string.Empty);

            SetMenuEntryText();

            armaEntry.Selected += ArmaEntrySelected;
            armaduraEntry.Selected += ArmaduraEntrySelected;
            trampasEntry.Selected += TrampasEntrySelected;

            MenuEntries.Add(armaEntry);
            MenuEntries.Add(armaduraEntry);
            MenuEntries.Add(trampasEntry);

            Initialice();
        }
        public IHttpActionResult Atualizar(string id, [FromBody] NivelModel obj)
        {
            if (String.IsNullOrWhiteSpace(id) || obj == null || String.IsNullOrWhiteSpace(obj.Nome) || String.IsNullOrWhiteSpace(obj.Descricao))
            {
                return(ResponseMessage(Request.CreateResponse <string>(HttpStatusCode.NotAcceptable, "Necessário informar campos: Id, Nome e Descricao.")));
            }

            try
            {
                Nivel nivel = new Nivel(obj.Id, obj.Nome, obj.Descricao);

                var result = _nivelRepository.Update(id, nivel);

                if (result != null)
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK)));
                }
                else
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, "Nivel não localizado.")));
                }
            }
            catch (Exception erro)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, "Ocorreu um erro ao tentar processar a requisição.")));
            }
        }
Ejemplo n.º 11
0
    // Constructor
    public Mapa(Partida p)
    {
        listaNiveles = new Nivel[MAX_NIVELES];
        listaNiveles[0] = new Nivel01();
        listaNiveles[1] = new Nivel02();
        listaNiveles[2] = new Nivel03();
        listaNiveles[3] = new Nivel04();
        listaNiveles[4] = new Nivel05();
        listaNiveles[5] = new Nivel06();
        listaNiveles[6] = new Nivel07();
        listaNiveles[7] = new Nivel08();
        listaNiveles[8] = new Nivel09();
        listaNiveles[9] = new Nivel10();
        listaNiveles[10] = new Nivel11();
        listaNiveles[11] = new Nivel12();
        listaNiveles[12] = new Nivel13();
        listaNiveles[13] = new Nivel14();
        listaNiveles[14] = new Nivel15();
        listaNiveles[15] = new Nivel16();
        listaNiveles[16] = new Nivel17();
        listaNiveles[17] = new Nivel18();
        listaNiveles[18] = new Nivel19();
        listaNiveles[19] = new Nivel20();

        nivelActual = listaNiveles[ numeroNivelActual ];
        fuente18 = new Fuente("FreeSansBold.ttf", 18);
    }
Ejemplo n.º 12
0
        //Alumnos
        /// <summary>
        /// este metodo cubre la falta del modulo de notas, no esta registrado porque, si
        /// estuviese todo el sistema junto, este metodo no existiria.
        /// </summary>
        /// <param name="alumno"></param>
        public void generarPlanillasDeEvaluacion(Alumno alumno)
        {
            Nivel nivel = alumno.curso.nivel;

            List <Materia> materias = this.traerMateriasPorNivel(nivel);

            if (materias.Count > 0)
            {
                StringBuilder sb = new StringBuilder();

                SqlConnection connection = ConexionSingleton.obtenerConexion();
                connection.Open();
                SqlTransaction tx = connection.BeginTransaction();

                SqlCommand cmd  = new SqlCommand("", connection, tx);
                Random     rand = new Random();
                int        iter = 0;
                cmd.Parameters.Add(new SqlParameter("@nivel", SqlDbType.BigInt)).Value  = nivel.id;
                cmd.Parameters.Add(new SqlParameter("@alumno", SqlDbType.BigInt)).Value = alumno.legajo;
                foreach (Materia materia in materias)
                {
                    iter++;
                    sb.Append(" insert into planilla_de_evaluacion " +
                              "(pde_alumno_id,pde_nivel_id,pde_trimestre_1,pde_trimestre_2,pde_trimestre_3,pde_nota_final,pde_condicion,pde_dvh,pde_materia_id) ");
                    sb.Append(" values(@alumno,@nivel, ");
                    int    tri1      = rand.Next(1, 10);
                    int    tri2      = rand.Next(1, 10);
                    int    tri3      = rand.Next(1, 10);
                    Double promedio  = (tri1 + tri2 + tri3) / 3;
                    int    condicion = promedio >= 7 ? 1 : 0;
                    sb.Append("@tri1" + iter + ", " + "@tri2" + iter + ", " + "@tri3" + iter + ", " + "@promedio" + iter + ", " + "@condicion" + iter + ", ");
                    sb.Append(" @dvh" + iter + " , @materia" + iter + ")");
                    String trim1 = SeguridadUtiles.encriptarAES(tri1.ToString());
                    String trim2 = SeguridadUtiles.encriptarAES(tri2.ToString());
                    String trim3 = SeguridadUtiles.encriptarAES(tri3.ToString());
                    cmd.Parameters.Add(new SqlParameter("@tri1" + iter, SqlDbType.NVarChar)).Value     = trim1;
                    cmd.Parameters.Add(new SqlParameter("@tri2" + iter, SqlDbType.NVarChar)).Value     = trim2;
                    cmd.Parameters.Add(new SqlParameter("@tri3" + iter, SqlDbType.NVarChar)).Value     = trim3;
                    cmd.Parameters.Add(new SqlParameter("@promedio" + iter, SqlDbType.NVarChar)).Value = SeguridadUtiles.encriptarAES(promedio.ToString());
                    cmd.Parameters.Add(new SqlParameter("@condicion" + iter, SqlDbType.BigInt)).Value  = condicion;
                    cmd.Parameters.Add(new SqlParameter("@dvh" + iter, SqlDbType.NVarChar)).Value      = new DAOSeguridad().recalcularDigitoHorizontal(new String[] { trim1, trim2, trim3, alumno.legajo.ToString() });
                    cmd.Parameters.Add(new SqlParameter("@materia" + iter, SqlDbType.BigInt)).Value    = materia.id;
                }
                cmd.CommandText = sb.ToString();

                try
                {
                    cmd.ExecuteNonQuery();
                    tx.Commit();
                    connection.Close();
                    new DAOSeguridad().recalcularDigitoVertical("PLANILLA_DE_EVALUACION");
                }
                catch (Exception ex)
                {
                    tx.Rollback();
                    connection.Close();
                    throw;
                }
            }
        }
Ejemplo n.º 13
0
        public void Update(Nivel entity, int id)
        {
            var exist = _context.Nivels.Find(id);

            _context.Entry(exist).CurrentValues.SetValues(entity);
            _context.SaveChanges();
        }
Ejemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            Nivel objNivel = new Nivel();

            objNivel.ID_NIVEL    = 1;
            objNivel.DESCRIPCION = "Esta es la prueba";
            objNivel.MISION      = "esta si es una verdadera prueba";
            objNivel.VISION      = "ojdnbvonv";
            objNivel.OBJETIVO    = "El objetivo antonio";
            Carrera objCarrera = new Carrera();

            objCarrera.NOMBRE      = "ingenieria en sistemasc omputacionales";
            objCarrera.DESCRIPCION = "carrera pesada para estudiar sistemas";


            List <Carrera>      carreras       = objBll.getCarreras();
            List <Calificacion> calificaciones = objBll.getCalificaciones();
            List <Curso>        cursos         = objBll.getCursos();
            List <Docente>      docentes       = objBll.getDocentes();
            List <Horario>      horarios       = objBll.getHorarios();
            List <Nivel>        niveles        = objBll.getCatNiveles();
            List <Periodo>      periodos       = objBll.getPeriodos();

            MessageBox.Show("");
        }
        public void TestSetEdificiIdInNivel()
        {
            Nivel nivel = new Nivel("Nivel", "Nivel de teste");

            //nivel.SetEdifioId("1261das9d81");
            Assert.Null(nivel.EdificioId);
        }
Ejemplo n.º 16
0
 public Avaliacao(Colaborador colaborador, Tecnologia tecnologia, Nivel nivel)
 {
     Colaborador = colaborador;
     Nivel       = nivel;
     Tecnologia  = tecnologia;
     AvaliadoEm  = DateTime.UtcNow;
 }
Ejemplo n.º 17
0
    public void Avanzar()
    {
        numeroNivelActual++;
        if (numeroNivelActual >= MAX_NIVELES)
        {
            numeroNivelActual = 0;
        }

        // Rectángulo de fondo
        Hardware.RectanguloRellenoRGBA(
            200, 100, 600, 300, // Posicion, ancho y alto de la pantalla
            200, 200, 200,      // Gris claro
            200);               // Con algo de transparencia

        // Y texto de aviso
        Hardware.EscribirTextoOculta(
            "Pasando al nivel " + (numeroNivelActual + 1),
            300, 200, 0, 0, 0, fuente18);

        Hardware.VisualizarOculta();
        Hardware.Pausa(2000);

        nivelActual = listaNiveles[numeroNivelActual];
        nivelActual.Reiniciar();
    }
Ejemplo n.º 18
0
        public void Eliminar()
        {
            if (DgvGeneral.RowCount > 0 && DgvGeneral.GetFocusedRow() != null)
            {
                int   idGeneral = Convert.ToInt32(DgvGeneral.GetFocusedRowCellValue("Id"));
                Nivel nivel     = new Nivel();
                nivel.Id = idGeneral;


                if (XtraMessageBox.Show("¿Esta seguro que desea eliminar el nivel?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CtrlNiveles.Eliminar(nivel);

                    if (!BkgwBuscar.IsBusy)
                    {
                        PrgBuscar.Visible = true;
                        BkgwBuscar.RunWorkerAsync();
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Debe seleccionar un registro.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        protected override void FillContents()
        {
            foreach (Nivel nvl in topNiveis)
            {
                float        indentation    = 0;
                Nivel        n              = nvl;
                List <Nivel> niveisContexto = new List <Nivel>();
                while (n.Uppers != null && n.Uppers.Count > 0 && ((Nivel)n.Uppers.ToArray()[0]).IDTipoNivel == 3)
                {
                    n = (Nivel)n.Uppers.ToArray()[0];
                    niveisContexto.Insert(0, n);
                }

                //foreach (Nivel nContexto in niveisContexto)
                //{
                //    AddNivelEstrutural(doc, nContexto, indentation, true);
                //    indentation = (float)(indentation + 0.5);
                //}

                AddNivelEstrutural(base.mDoc, nvl, indentation, niveisContexto);



                //if (nvl.Uppers != null && nvl.Uppers.Count > 0 && ((Nivel)nvl.Uppers(0)).IDTipoNivel == 3)
                //    AddNivelEstrutural(doc, nvl, 0.0F);
                //else
                //    AddNivelEstrutural(doc, nvl, 0.0F);
            }
        }
Ejemplo n.º 20
0
        public ActionResult CourseLevelTypes(int courseId, int levelId)
        {
            Kurs  course = courseService.GetCourseById(courseId);
            Nivel level  = levelService.GetLevelById(levelId);

            if (course == null || level == null)
            {
                return(HttpNotFound());
            }

            List <KursNivelTip> courseSections = courseService.GetCourseSections(courseId);

            //marrim nga lista vetem seksionet e kursit perkates qe kane si nivel
            //nivelin e perzgjedhur nga useri
            courseSections = courseSections.Where(x => x.Kursi.KursId == courseId && x.Niveli.Id == levelId).ToList();
            Dictionary <int, Tip> section_types = new Dictionary <int, Tip>();

            foreach (var section in courseSections)
            {
                if (section.Tipi != null && !section_types.ContainsValue(section.Tipi))
                {
                    section_types.Add(section.Id, section.Tipi);
                }
            }
            ViewBag.Kursi        = course.Emri;
            ViewBag.KursId       = course.KursId;
            ViewBag.Niveli       = level.Emri;
            ViewBag.NivelId      = level.Id;
            ViewBag.InstruktorId = course.InstruktoriId;
            return(View(section_types.OrderBy(x => x.Value.Id).ToDictionary(x => x.Key, x => section_types[x.Key])));
        }
Ejemplo n.º 21
0
        public TransactionResult create(NivelVo nivel_vo, User user_log)
        {
            Nivel obj = NivelAdapter.voToObject(nivel_vo);

            obj.user = user_log;
            return(nivel_repository.create(obj));
        }
        private void ValidaPergunta(ViewPergunta dados, List <string> erros)
        {
            Refute(dados.IdTema <= 0, "Informe o Tema da Pergunta.");
            Refute(dados.IdNivel <= 0, "Informe o Nível da Pergunta.");
            Refute(string.IsNullOrEmpty(dados.Pergunta), "Informe a Pergunta.");

            using (ctx = new JogoMasterEntities())
            {
                Nivel nivel = null;
                nivel = ctx.Niveis.Where(x => x.Id == dados.IdNivel)
                        .FirstOrDefault();
                Refute(nivel == null, "Nível inexistente.");

                Tema tema = null;
                tema = ctx.Temas
                       .FirstOrDefault(x => x.Id == dados.IdTema);
                Refute(tema == null, "Tema inexistente.");

                Pergunta pergunta = null;
                pergunta = ctx.Perguntas
                           .Where(x => x.Pergunta1.ToLower() == dados.Pergunta.ToLower())
                           .FirstOrDefault();
                Refute(pergunta != null, $"Pergunta já cadastrada \"{ pergunta?.Pergunta1}\".");
            }
        }
Ejemplo n.º 23
0
        private void InsertarActualizar(string modo)
        {
            try
            {
                if (modo == "INSERT")
                {
                    Nivel nivel = new Nivel();
                    nivel.Nombre = TxtNombre.Text.Trim();

                    if (CtrlNiveles.Insertar(nivel) > 0)
                    {
                        XtraMessageBox.Show("Nivel insertado con exito.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    }
                }
                else
                {
                    Nivel nivel = new Nivel();
                    nivel.Id     = Id;
                    nivel.Nombre = TxtNombre.Text.Trim();


                    if (CtrlNiveles.Actualizar(nivel) > 0)
                    {
                        XtraMessageBox.Show("Nivel actualizado con exito.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
            }
        }
 public Trampa(Nivel nivel, string nombreTextura)
 {
     this.nombreTextura = nombreTextura;
     this.Escala = Vector2.One;
     this.Posicion = Vector2.Zero;
     this.ContadorMuertes = 0;
 }
Ejemplo n.º 25
0
 public void AddProdutor(Nivel nvl)
 {
     if (!this.Produtores.Contains(nvl))
     {
         this.Produtores.Add(nvl);
     }
 }
Ejemplo n.º 26
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome")] Nivel nivel)
        {
            if (id != nivel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nivel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NivelExists(nivel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nivel));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Obtiene el tipo de configuración para el writer.
        /// </summary>
        /// <remarks>
        ///     Registro de versiones:
        ///
        ///         1.0 10/04/2016 Marcos Abraham Hernández Bravo (Ada Ltda.): versión inicial.
        /// </remarks>
        /// <param name="tipo">Tipo a logear.</param>
        /// <param name="nivel">Nivel del mensaje. Parámetro opcional.</param>
        /// <returns><value>true</value> en caso de permitirse, o <value>false</value> de lo contrario.</returns>
        public virtual TypeTag ObtenerTipo(Tipo tipo, Nivel nivel = null)
        {
            if (nivel != null)
            {
                if (Tipos.Count(c => c.Nombre == tipo && c.Nivel != null && c.Nivel.Codigo.Equals(nivel.Codigo, StringComparison.InvariantCultureIgnoreCase)) > 0)
                {
                    return(Tipos.First(c => c.Nombre == tipo && c.Nivel.Codigo.Equals(nivel.Codigo, StringComparison.InvariantCultureIgnoreCase)));
                }

                if (Tipos.Count(c => c.Nombre == tipo && c._Nivel == "*") > 0)
                {
                    return(Tipos.First(c => c.Nombre == tipo && c._Nivel == "*"));
                }
            }

            if (Tipos.Count(c => c.Nombre == tipo) > 0)
            {
                return(Tipos.First(c => c.Nombre == tipo));
            }

            if (Tipos.Count(c => c._Nombre == "*") > 0)
            {
                return(Tipos.First(c => c._Nombre == "*"));
            }

            return(null);
        }
Ejemplo n.º 28
0
        private void InsertTraza(string mensaje, int acceso = -1, Nivel nivel = 0, SubNivel subNivel = 0, int elemento = 0, SubElemento subElemento = 0, Terciario terciario = 0, Accion accion = 0, SubAccion subAccion = 0)
        {
            using (var connection = new MySql.Data.MySqlClient.MySqlConnection(_config.GetConnectionString(_connectionString)))
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = "INSERT INTO log (IdNivel,IdSubNivel,IdentificadorAcceso,IdElemento,IdSubElemento,IdTerciario,IdAccion,IdSubAccion,Texto) " +
                                          " VALUES ( @IdNivel,@IdSubNivel,@IdentificadorAcceso,@IdElemento,@IdSubElemento,@IdTerciario,@IdAccion,@IdSubAccion,@Texto);";

                    command.Parameters.Add("@IdNivel", MySqlDbType.Int16);
                    command.Parameters.Add("@IdSubNivel", MySqlDbType.Int16);
                    command.Parameters.Add("@IdentificadorAcceso", MySqlDbType.Int16);
                    command.Parameters.Add("@IdElemento", MySqlDbType.Int16);
                    command.Parameters.Add("@IdSubElemento", MySqlDbType.Int16);
                    command.Parameters.Add("@IdTerciario", MySqlDbType.Int16);
                    command.Parameters.Add("@IdAccion", MySqlDbType.Int16);
                    command.Parameters.Add("@IdSubAccion", MySqlDbType.Int16);
                    command.Parameters.Add("@Texto", MySqlDbType.String);

                    command.Parameters["@IdNivel"].Value             = (int)nivel;
                    command.Parameters["@IdSubNivel"].Value          = (int)subNivel;
                    command.Parameters["@IdentificadorAcceso"].Value = acceso;
                    command.Parameters["@IdElemento"].Value          = elemento;
                    command.Parameters["@IdSubElemento"].Value       = (int)subElemento;
                    command.Parameters["@IdTerciario"].Value         = (int)terciario;
                    command.Parameters["@IdAccion"].Value            = (int)accion;
                    command.Parameters["@IdSubAccion"].Value         = (int)subAccion;
                    command.Parameters["@Texto"].Value = LimitSize(mensaje, 5000);

                    connection.Open();
                    command.ExecuteNonQuery();
                    connection.Close();
                }
        }
        public void TestInstanciaNivel()
        {
            Nivel nivel = new Nivel("Nivel", "Nivel de teste");

            Assert.Equal(nivel.Nome, "Nivel");
            Assert.Equal(nivel.Descricao, "Nivel de teste");
        }
        public async Task <IActionResult> Edit(int id, [Bind("NivelId,Denumire,Punctaj_min,Punctaj_max")] Nivel nivel)
        {
            if (id != nivel.NivelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    nivelService.UpdateNivel(nivel);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!nivelService.NivelExists(nivel.NivelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nivel));
        }
Ejemplo n.º 31
0
        public Nivel  Niveles(int id)
        {
            var   repo = new NivelRepository();
            Nivel niv  = repo.Retrieve(id);

            return(niv);
        }
Ejemplo n.º 32
0
        public void Insertar(Nivel nivel)
        {
            // SqlConnection requiere el using System.Data.SqlClient;
            SqlConnection conexion = new SqlConnection(Conexion.Cadena);

            try
            {
                conexion.Open(); // un error aca: revisar cadena de conexion
                // El command permite ejecutar un comando en la conexion establecida
                SqlCommand comando = new SqlCommand("PA_InsertarNivel", conexion);
                // Como es en Store Procedure se debe indicar el tipo de comando
                comando.CommandType = System.Data.CommandType.StoredProcedure;
                // Si el SP requeire parametros se le deben asignar al comando
                // comando.Parameters.AddWithValue("@Id", pro.Id);
                comando.Parameters.AddWithValue("@Ciclo", nivel.Ciclo.Id);
                comando.Parameters.AddWithValue("@Nombre", nivel.Nombre);


                // Finalmente ejecutamos el comando
                // al ser un insert no requiere retornar un consulta
                comando.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conexion.Close();
            }
        }
Ejemplo n.º 33
0
        public static List <Nivel> comboNivel()
        {
            SqlConnection cn    = null;
            List <Nivel>  lista = new List <Nivel>();

            try
            {
                cn = new SqlConnection(cadenaConexion);
                cn.Open();
                string        sqlText = "SELECT idNivel, nombre FROM Nivel";
                SqlCommand    cmd     = new SqlCommand(sqlText, cn);
                SqlDataReader dr      = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Nivel nivel   = new Nivel();
                    int   idNivel = dr.GetInt32(dr.GetOrdinal("idNivel"));
                    nivel.idNivel = idNivel;
                    String nombre = dr.GetString(dr.GetOrdinal("nombre"));
                    nivel.nombre = nombre;
                    lista.Add(nivel);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.ToString());
            }
            finally
            {
                if (cn != null && cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }
            return(lista);
        }
Ejemplo n.º 34
0
 public Usuario(bool activo, string contrasenia, Nivel lvl, string user, string apellido, string correo, DateTime cumpleanios, string direccion, string nombre, string telefono)
     : base(apellido, correo, cumpleanios, direccion, nombre, telefono)
 {
     this.activo = activo;
     this.contrasenia = contrasenia;
     this.lvl = lvl;
     this.user = user;
 }
 public Humano(Nivel nivel, string nombreTextura)
     : base(nivel, nombreTextura)
 {
     this.OrientaciónIzquierda = false;
     this.FrameHight = 22;
     this.Herramientas = 10;
     this.ArmaduraBase = 0;
     DanoCorrectnessPosition = 10;
 }
 public Goblin(Nivel nivel, int id, string nombreTextura)
     : base(nivel, nombreTextura)
 {
     this.ID = id;
     this.OrientaciónIzquierda = true;
     this.FrameHight = 22;
     SpriteEffect = SpriteEffects.FlipHorizontally;
     DanoCorrectnessPosition = 30;
 }
 public GoblinRey(Nivel nivel, string nombreTextura)
     : base(nivel, nombreTextura)
 {
     this.Vida = 200;
     this.FrameHight = 20;
     SpriteEffect = SpriteEffects.FlipHorizontally;
     this.YOffsetBarraVida = 9;
     DanoCorrectnessPosition = 30;
 }
Ejemplo n.º 38
0
 public override void Trazar(string mensaje, Nivel nivel)
 {
     if (base.Niveles[nivel] <= base.Niveles[_nivel])
     {
         using (StreamWriter logger = File.AppendText(this._nombreArchivo))
         {
             logger.WriteLine("---- Logger");
             logger.WriteLine(DateTime.Now.ToString());
             logger.WriteLine(nivel.ToString() + " - " + mensaje);
         }
     }
 }
Ejemplo n.º 39
0
        public override void Trazar(string mensaje, Nivel nivel)
        {
            ;

            if (base.Niveles[nivel] <= base.Niveles[_nivel])
            {
            Console.WriteLine("---- Logger");
            Console.WriteLine(DateTime.Now.ToString());
            Console.WriteLine(nivel.ToString() + " - " + mensaje);

            }
        }
Ejemplo n.º 40
0
        public string RetornaValor(Nivel valor)
        {
            switch (valor)
            {
                case Nivel.Administrador:
                    return "A";

                case Nivel.Colaborador:
                    return "C";

                default:
                    return "L";
            }
        }
Ejemplo n.º 41
0
        //Al presionar el boton aceptar me cambia el nombre ingresado en el arbol.
        //Y crea la opcion de ingresar un nuevo SUbSistema(o subnivel)
        private void button1_Click(object sender, EventArgs e)
        {
            Nivel nivel  = new Nivel(nombre_textBox.Text);
            if (existe() == false)
            {
                repetidoStripStatusLabel1.Text = "";
                sistema.agregarNivel(nivel);
                nivelesStripStatusLabel1.Text = "Niveles :" + sistema.niveles.Count;
                update_tree();
                Forms_Load(sender, e);
            }

            llenarTablas();
        }
 public Pinchos(Nivel nivel, string nombreTextura)
     : base(nivel, nombreTextura)
 {
     this.Nivel = nivel;
         this.isRetracting = false;
         this.activo = false;
         this.velocidad = 10;
         this.Ataque = 30f;
         this.attackDelay = 3000f;
         this.maxAttackDelay = 3000f;
         this.retracDelay = 0f;
         this.maxRetracDelay = 500f;
         this.Escala = new Vector2(2, 2);
 }
Ejemplo n.º 43
0
 public void agregarNivel(Nivel nuevo)
 {
     niveles.Add(nuevo);
 }
Ejemplo n.º 44
0
 public void Reiniciar()
 {
     numeroNivelActual = 0;
        nivelActual = listaNiveles[ numeroNivelActual ];
        nivelActual.Reiniciar();
 }
Ejemplo n.º 45
0
    public void Avanzar()
    {
        numeroNivelActual++;
           if (numeroNivelActual >= MAX_NIVELES)
           numeroNivelActual = 0;

           // Rectángulo de fondo
           Hardware.RectanguloRellenoRGBA(
          200, 100, 600, 300,  // Posicion, ancho y alto de la pantalla
          200, 200, 200,   // Gris claro
          200);         // Con algo de transparencia

           // Y texto de aviso
           Hardware.EscribirTextoOculta(
               "Pasando al nivel "+(numeroNivelActual+1),
               300, 200, 0, 0, 0, fuente18);

           Hardware.VisualizarOculta();
           Hardware.Pausa(2000);

           nivelActual = listaNiveles[numeroNivelActual];
           nivelActual.Reiniciar();
    }
Ejemplo n.º 46
0
        public void cargarEjemploColectivo()
        {
            Elemento gananciaColectivo = new Elemento("Ganancia colectivo", 2000);
            Elemento gananciaMicro = new Elemento("Ganancia microbus", 0);
            Elemento precioPasajeColectivo = new Elemento("Precio pasaje colectivo", 200);
            Elemento precioPasajeMicro = new Elemento("Precio pasaje micro", 150);
            Elemento cantidadTotalUsuarios = new Elemento("Cantidad total de usuarios", 0);
            Elemento precioPetroleo = new Elemento("Precio petróleo", 140);
            Elemento precioBencina = new Elemento("Precio bencina", 0);
            Elemento gananciaDiariaColectivero = new Elemento("Ganancia diaria colectivero", 0);

            Nivel primerNivel = new Nivel("Primer nivel");
            primerNivel.agregarElemento(gananciaDiariaColectivero);
            primerNivel.agregarElemento(new Elemento("Ganancia diaria conductor microbús", 0));
            primerNivel.agregarElemento(gananciaColectivo);
            primerNivel.agregarElemento(gananciaMicro);
            primerNivel.agregarElemento(new Elemento("Número de vueltas al día colectivo", 20));
            primerNivel.agregarElemento(new Elemento("Número de vueltas al día microbús", 10));
            primerNivel.agregarElemento(precioPasajeColectivo);
            primerNivel.agregarElemento(precioPasajeMicro);
            primerNivel.agregarElemento(cantidadTotalUsuarios);

            primerNivel.agregarRelacion(2, 0, new relacion("x", new regla(1)));
            primerNivel.agregarRelacion(3, 1, new relacion("x", new regla(1)));
            primerNivel.agregarRelacion(4, 0, new relacion("y*x", new regla(1)));
            primerNivel.agregarRelacion(5, 1, new relacion("y*x", new regla(1)));

            Nivel nivelColectivo = new Nivel("Colectivo");

            Elemento demandaColectivo = new Elemento("Demanda de clientes colectivo", 40);

            nivelColectivo.agregarElemento(precioPasajeColectivo);
            nivelColectivo.agregarElemento(precioBencina);
            nivelColectivo.agregarElemento(demandaColectivo);
            nivelColectivo.agregarElemento(gananciaColectivo);
            nivelColectivo.agregarElemento(new Elemento("Distancia recorrida", 1000));
            nivelColectivo.agregarElemento(new Elemento("Bencina ocupada", 10));
            nivelColectivo.agregarElemento(new Elemento("Perdida por desgaste", 0));
            nivelColectivo.agregarElemento(new Elemento("Perdida por reparacion", 0));
            nivelColectivo.agregarElemento(new Elemento("Desgaste (Kilometraje acumulado)", 0));

            //Relaciones
            //nivelColectivo.agregarRelacion(1, 3, new relacion("x*(6/13)", new regla(1)));
            nivelColectivo.agregarRelacion(0, 3, new relacion("x", new regla(1)));
            nivelColectivo.agregarRelacion(0, 2, new relacion("logx*(x/35)", new regla(1)));

            nivelColectivo.agregarRelacion(1, 0, new relacion("x*(6/7)", new regla(1)));
            nivelColectivo.agregarRelacion(1, 5, new relacion("x", new regla(1)));

            nivelColectivo.agregarRelacion(2, 3, new relacion("y*x", new regla(1)));
            nivelColectivo.agregarRelacion(2, 4, new relacion("x*10", new regla(1)));

            nivelColectivo.agregarRelacion(4, 5, new relacion("y*(x/14)", new regla(1)));
            nivelColectivo.agregarRelacion(4, 8, new relacion("y+x", new regla(1)));

            nivelColectivo.agregarRelacion(5, 3, new relacion("y-x", new regla(1)));

            nivelColectivo.agregarRelacion(6, 3, new relacion("y-x", new regla(1)));

            nivelColectivo.agregarRelacion(7, 3, new relacion("y-x", new regla(1)));

            nivelColectivo.agregarRelacion(8, 6, new relacion("x/15", new regla(1)));
            nivelColectivo.agregarRelacion(8, 7, new relacion("x/25", new regla(350, ">")));
            nivelColectivo.agregarRelacion(8, 8, new relacion("0", new regla(500, ">=")));

            Nivel nivelMicrobus = new Nivel("Microbus");

            Elemento demandaMicrobus = new Elemento("Demanda de clientes microbus", 0);

            nivelMicrobus.agregarElemento(precioPasajeMicro);
            nivelMicrobus.agregarElemento(precioPetroleo);
            nivelMicrobus.agregarElemento(demandaMicrobus);
            nivelMicrobus.agregarElemento(gananciaMicro);
            nivelMicrobus.agregarElemento(new Elemento("Distancia recorrida", 40));
            nivelMicrobus.agregarElemento(new Elemento("Petroleo ocupado", 200));
            nivelMicrobus.agregarElemento(new Elemento("Perdida por desgaste", 0));
            nivelMicrobus.agregarElemento(new Elemento("Perdida por reparacion", 0));
            nivelMicrobus.agregarElemento(new Elemento("Desgaste (Kilometraje acumulado)", 0));

            //Relaciones:
            //nivelMicrobus.agregarRelacion(1, 3, new relacion("x", new regla(1)));
            nivelMicrobus.agregarRelacion(0, 3, new relacion("x", new regla(1)));
            nivelMicrobus.agregarRelacion(0, 2, new relacion("logx*(x/6)", new regla(1)));

            nivelMicrobus.agregarRelacion(1, 0, new relacion("logx*(x/5)", new regla(1)));
            nivelMicrobus.agregarRelacion(1, 5, new relacion("x", new regla(1)));

            nivelMicrobus.agregarRelacion(2, 3, new relacion("y*x", new regla(1)));

            nivelMicrobus.agregarRelacion(4, 5, new relacion("y*(x/6)", new regla(1)));
            nivelMicrobus.agregarRelacion(4, 8, new relacion("y+x", new regla(1)));

            nivelMicrobus.agregarRelacion(5, 3, new relacion("y-x", new regla(1)));

            nivelMicrobus.agregarRelacion(6, 3, new relacion("y-x", new regla(1)));

            nivelMicrobus.agregarRelacion(7, 3, new relacion("y-x", new regla(1)));

            nivelMicrobus.agregarRelacion(8, 6, new relacion("x/10", new regla(1)));
            nivelMicrobus.agregarRelacion(8, 7, new relacion("x/15", new regla(350, ">")));
            nivelMicrobus.agregarRelacion(8, 8, new relacion("0", new regla(500, ">=")));

            Nivel nivelUsuario = new Nivel("Demanda usuarios");
            nivelUsuario.agregarElemento(cantidadTotalUsuarios);
            nivelUsuario.agregarElemento(demandaColectivo);
            nivelUsuario.agregarElemento(demandaMicrobus);

            nivelUsuario.agregarRelacion(1, 0, new relacion("x", new regla(1)));
            nivelUsuario.agregarRelacion(2, 0, new relacion("y+x", new regla(1)));

            Nivel petroleo = new Nivel("Indicadores economicos");

            Elemento inflacion = new Elemento("Inflación económica", 1);
            Elemento deuda = new Elemento("Deuda familiar acumulada del mes", 7000);
            Elemento gastoDiario = new Elemento("Gasto familiar diario", 6000);

            petroleo.agregarElemento(precioPetroleo);
            petroleo.agregarElemento(precioBencina);
            petroleo.agregarElemento(inflacion);
            petroleo.agregarElemento(gastoDiario);

            petroleo.agregarRelacion(0, 1, new relacion("x*(15/10)", new regla(1)));
            petroleo.agregarRelacion(0, 2, new relacion("y-2", new regla(3)));

            petroleo.agregarRelacion(1, 2, new relacion("y+4", new regla(5)));

            petroleo.agregarRelacion(2, 0, new relacion("((x/100)+1)*y", new regla(30)));
            petroleo.agregarRelacion(2, 2, new relacion("y*(-1)", new regla(0, "<", 5)));
            petroleo.agregarRelacion(2, 3, new relacion("((x/100)+1)*y", new regla(30)));

            Elemento ahorro = new Elemento("Ahorro familiar", 0);
            Nivel familiaColectivero = new Nivel("Familia colectivero");

            familiaColectivero.agregarElemento(gananciaDiariaColectivero);
            familiaColectivero.agregarElemento(gastoDiario);
            familiaColectivero.agregarElemento(ahorro);
            familiaColectivero.agregarElemento(deuda);

            familiaColectivero.agregarRelacion(0, 2, new relacion("y+x", new regla(1)));

            familiaColectivero.agregarRelacion(1, 3, new relacion("y+x", new regla(1)));

            //Si el ahorro es mayor a 120000 pesos, la familia comienza a gastar más dinero
            familiaColectivero.agregarRelacion(2, 3, new relacion("(x/20)+y", new regla(120000, ">")));

            familiaColectivero.agregarRelacion(3, 2, new relacion("y-x", new regla(30)));
            familiaColectivero.agregarRelacion(3, 3, new relacion("0", new regla(30)));

            sistema.agregarNivel(primerNivel);
            sistema.agregarNivel(nivelColectivo);
            sistema.agregarNivel(nivelMicrobus);
            sistema.agregarNivel(nivelUsuario);
            sistema.agregarNivel(petroleo);
            sistema.agregarNivel(familiaColectivero);
        }
Ejemplo n.º 47
0
        public void CreateElemento(Elemento elemento, Nivel n)
        {
            if (this.nombreselementos.Any(x => x == elemento.nombre))
            {
                // such a person already exists: there should be some validation message, but
                // it is not so important in a demo
                return;
            }

            var p = new ElementoGrafo(this.Graph) { nombre = elemento.nombre, valor = (int)elemento.valor };
            int i = revisarsubgrafo(n);
            if (i != -1)
            {
                this.Graph.SubGraphs.ElementAt(i).AddVertex(p);
            }
            else
            {
                SubGraph<ElementoGrafo> sg2 = new SubGraph<ElementoGrafo>() { Label = n.nombre};
                sg2.AddVertex(p);
                this.Graph.AddSubGraph(sg2);
                if (existeenotrosubgrafo(sg2.Label))
                {
                    createlink(sg2, buscarsubgrafo(n.nombre));
                }
            }
        }
Ejemplo n.º 48
0
 public void Createsubgraph(Nivel n)
 {
     sg.Add(new SubGraph<ElementoGrafo>() {Label = n.nombre});
 }
Ejemplo n.º 49
0
 private int revisarsubgrafo(Nivel n)
 {
     int i = 0;
     foreach(SubGraph<ElementoGrafo> sb in this.Graph.SubGraphs)
     {
         if(sb.Label.Equals(n.nombre))
         {
             return i;
         }
         i++;
     }
     return -1;
 }
Ejemplo n.º 50
0
 public void modificarNivel(int posicion, Nivel nivel)
 {
     niveles[posicion] = nivel;
 }
Ejemplo n.º 51
0
 public void IniTraza(string logger, Nivel nivel)
 {
     this._nivelLog = nivel;
     this._nombreLogger = logger;
 }
Ejemplo n.º 52
0
    int largoCadenaMasLarga(Nivel unNivel)
    {
        int retorno = 0;

        for (int i = 0; i < unNivel.listaElementos.Count; i++)
            if (retorno < unNivel.listaElementos[i].nombre.Length)
                retorno = unNivel.listaElementos[i].nombre.Length;

            return retorno;
    }
Ejemplo n.º 53
0
    void aplicarIteracion(Nivel unNivel)
    {
        for (int i = 0; i < unNivel.listaElementos.Count; i++)
        {
            for (int j = 0; j < unNivel.listaElementos.Count; j++)
            {

                if (unNivel.matriz[i][j] != null)
                {
                    if (unNivel.matriz[i][j].seCumpleRegla(unNivel.listaElementos[i].valor))
                        unNivel.listaElementos[j].valor =
                            unNivel.matriz[i][j].aplicarRelacion(unNivel.listaElementos[i].valor, unNivel.listaElementos[j].valor);
                }
            }
        }
    }
Ejemplo n.º 54
0
 public override void IniTraza( Nivel nivel)
 {
     base.IniTraza(nivel);
     this._nombreArchivo = "Logger.log";
 }
Ejemplo n.º 55
0
 public abstract void Trazar(string mensaje, Nivel nivel);
Ejemplo n.º 56
0
 public void Trazar(string mensaje, Nivel nivel)
 {
     if (this._nivelLog == nivel)
     {
         using (StreamWriter _Logger = File.AppendText(_nombreLogger))
         {
             _Logger.WriteLine(">-------- {0}", DateTime.Now.ToString());
             _Logger.WriteLine(this.descripcion);
             _Logger.WriteLine(this.fecha_adquisicion.ToString());
             _Logger.WriteLine(mensaje);
         }
     }
 }
Ejemplo n.º 57
0
 public virtual void IniTraza(Nivel nivel)
 {
     _nivel = nivel;
 }
Ejemplo n.º 58
0
    public static void Main(string[] args)
    {
        /*uno=new Elemento("uno", 1);
        dos=new Elemento("dos", 2);
        Elemento tres = new Elemento("tres", 3);
        Elemento cuatro = new Elemento("cuatro", 4);

        miNivel=new Nivel("Nivel Uno");

        miNivel.agregarElemento(uno);
        miNivel.agregarElemento(dos);

        miNivel.agregarRelacion(0,1,new relacion("4*x",new regla(1)));
        miNivel.agregarRelacion(1,0, new relacion("y-x", new regla(1)));

        miNivel.agregarElemento(tres);

        miNivel.agregarRelacion(2, 0, new relacion("x/2", new regla(2)));

        Nivel nivelDos = new Nivel("Nivel dos");

        nivelDos.agregarElemento(tres);
        nivelDos.agregarElemento(cuatro);
        nivelDos.agregarRelacion(1, 0, new relacion("x^2-2", new regla(2)));
        nivelDos.agregarRelacion(0, 1, new relacion("x+1", new regla(4)));
        nivelDos.agregarRelacion(0, 0, new relacion("3", new regla(50000, ">")));

        Sistema elSistema = new Sistema();

        elSistema.agregarNivel(miNivel);
        elSistema.agregarNivel(nivelDos);

        //*/

        //Console.WriteLine(new calculos().leerFuncion("(x^2/6000)+300", 1));
        //Console.ReadKey();

        Sistema unSistema = new Sistema();

        Nivel primerNivel = new Nivel("Primer nivel");
        primerNivel.agregarElemento(new Elemento("Colectivo", 0));
        primerNivel.agregarElemento(new Elemento("Microbus", 0));
        primerNivel.agregarElemento(new Elemento("Usuario", 0));
        primerNivel.agregarElemento(new Elemento("Combustible", 0));

        Nivel nivelColectivo = new Nivel("Colectivo");

        Elemento demandaColectivo = new Elemento("Demanda de clientes colectivo", 0);

        nivelColectivo.agregarElemento(primerNivel.listaElementos[0]);
        nivelColectivo.agregarElemento(new Elemento("Precio pasaje colectivo", 200));
        nivelColectivo.agregarElemento(new Elemento("Precio Bencina", 150));
        nivelColectivo.agregarElemento(demandaColectivo);
        nivelColectivo.agregarElemento(new Elemento("Ganancia", 2000));
        nivelColectivo.agregarElemento(new Elemento("Distancia recorrida", 1000));
        nivelColectivo.agregarElemento(new Elemento("Bencina ocupada", 10));

        //Relaciones
        //nivelColectivo.agregarRelacion(1, 3, new relacion("x*(6/13)", new regla(1)));
        nivelColectivo.agregarRelacion(1, 4, new relacion("x", new regla(1)));

        nivelColectivo.agregarRelacion(2, 1, new relacion("x*(6/7)", new regla(1)));
        nivelColectivo.agregarRelacion(2, 2, new relacion("y+5", new regla(10)));
        nivelColectivo.agregarRelacion(2, 3, new relacion("x*(1/10)", new regla(1)));
        nivelColectivo.agregarRelacion(2, 6, new relacion("x", new regla(1)));

        nivelColectivo.agregarRelacion(3, 4, new relacion("y*x", new regla(1)));
        nivelColectivo.agregarRelacion(3, 5, new relacion("x*10", new regla(1)));

        nivelColectivo.agregarRelacion(5, 6, new relacion("y*(x/12)", new regla(1)));
        nivelColectivo.agregarRelacion(6, 4, new relacion("y-x", new regla(1)));

        Nivel nivelMicrobus = new Nivel("Microbus");

        Elemento demandaMicrobus = new Elemento("Demanda de clientes microbus", 0);

        nivelMicrobus.agregarElemento(primerNivel.listaElementos[1]);
        nivelMicrobus.agregarElemento(new Elemento("Precio pasaje", 150));
        nivelMicrobus.agregarElemento(new Elemento("Precio petróleo", 140));
        nivelMicrobus.agregarElemento(demandaMicrobus);
        nivelMicrobus.agregarElemento(new Elemento("Ganancia", 0));
        nivelMicrobus.agregarElemento(new Elemento("Distancia recorrida", 1000));
        nivelMicrobus.agregarElemento(new Elemento("Petroleo ocupado", 200));

        //Relaciones:
        //nivelMicrobus.agregarRelacion(1, 3, new relacion("x", new regla(1)));
        nivelMicrobus.agregarRelacion(1, 4, new relacion("x", new regla(1)));

        nivelMicrobus.agregarRelacion(2, 1, new relacion("x*(4/7)", new regla(1)));
        nivelMicrobus.agregarRelacion(2, 2, new relacion("y+(48/10)", new regla(10)));
        nivelMicrobus.agregarRelacion(2, 3, new relacion("x*(1/10)", new regla(1)));
        nivelMicrobus.agregarRelacion(2, 6, new relacion("x", new regla(1)));

        nivelMicrobus.agregarRelacion(3, 4, new relacion("y*x", new regla(1)));
        nivelMicrobus.agregarRelacion(3, 5, new relacion("100", new regla(1)));

        nivelMicrobus.agregarRelacion(5, 6, new relacion("y*(x/12)", new regla(1)));
        nivelMicrobus.agregarRelacion(6, 4, new relacion("y-x", new regla(1)));

        Nivel nivelUsuario = new Nivel("Demanda usuarios");
        nivelUsuario.agregarElemento(primerNivel.listaElementos[2]);
        nivelUsuario.agregarElemento(demandaColectivo);
        nivelUsuario.agregarElemento(demandaMicrobus);

        //nivelUsuario.agregarRelacion(1, 2, new relacion("y-x/100", new regla(1)));

        unSistema.agregarNivel(primerNivel);
        unSistema.agregarNivel(nivelColectivo);
        unSistema.agregarNivel(nivelMicrobus);
        unSistema.agregarNivel(nivelUsuario);

        while (true)
        {
            Console.Clear();
            unSistema.iterar();
            unSistema.imprimirSistema();
            Console.WriteLine(unSistema.obtenerEstado() + "\n");
            System.Threading.Thread.Sleep(1000);
        }

        /*
        for(int j=0; j<elSistema.valores.Count;j++){
            for(int k=0; k< elSistema.valores[j].Count;k++){
                Console.Write(elSistema.valores[j][k]+ " ");
            }
            Console.WriteLine();
        }*/
    }