Ejemplo n.º 1
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     using (Server.RequestStart(Database))
     {
         MongoCollection Contactos = Database.GetCollection <Contact>("contacts");
         if (AccionFormulario == Accion.Guardar)
         {
             Contactos.Insert(new Contact()
             {
                 Apellidos         = txtApellidos.Text,
                 Nombres           = txtNombres.Text,
                 Telefono          = txtTelefono.Text,
                 CorreoElectronico = txtCorreoElectronico.Text
             });
         }
         else
         {
             Contact item = Contactos.FindOneByIdAs <Contact>(IdContacto);
             item.Apellidos         = txtApellidos.Text;
             item.Nombres           = txtNombres.Text;
             item.Telefono          = txtTelefono.Text;
             item.CorreoElectronico = txtCorreoElectronico.Text;
             Contactos.Save(item, SafeMode.True);
             AccionFormulario = Accion.Guardar;
         }
     }
     LlenarGrilla();
     LimpiarControles();
 }
Ejemplo n.º 2
0
 public frm_Man_Perfiles(Accion _aAccion, Cls_T_Perfil_DAL Obj_Perfil_DAL)
 {
     InitializeComponent();
     Obj_CatyMan_BLL     = new Cls_CatyMan_BLL();
     this._aAccion       = _aAccion;
     this.Obj_Perfil_DAL = Obj_Perfil_DAL;
 }
Ejemplo n.º 3
0
    private void actualizarIcono(Accion a)
    {
        GameObject iconoAccion = transform.GetChild(1).gameObject;

        switch (a)
        {
        case Accion.buscaEnemigo:
            iconoAccion.GetComponent <SpriteRenderer>().sprite = spriteBuscaEnemigo;
            break;

        case Accion.patrulla:
            iconoAccion.GetComponent <SpriteRenderer>().sprite = spritePatrulla;
            break;

        case Accion.ataqueBase:
            iconoAccion.GetComponent <SpriteRenderer>().sprite = spriteAtacaBaseEnemiga;
            break;

        case Accion.defensaBase:
            iconoAccion.GetComponent <SpriteRenderer>().sprite = spriteDefiendeBase;
            break;

        case Accion.curacion:
            iconoAccion.GetComponent <SpriteRenderer>().sprite = spriteCuracion;
            break;

        default:
            break;
        }
    }
Ejemplo n.º 4
0
        private void GuardarLog(Usuario usuario, bool esLogOn)
        {
            var accion = _accionesRepository.ObtenerPorNombre(esLogOn ? "LogOn" : "LogOff", "Account");

            if (accion == null)
            {
                var controlador = _controladoresRepository.ObtenerPorNombre("Account");
                if (controlador == null)
                {
                    controlador = new Controlador()
                    {
                        Descripcion = "Controlador de registro de sesión",
                        Nombre      = "Account"
                    };
                    _controladoresRepository.Guardar(controlador);
                }
                accion = new Accion()
                {
                    IdControlador  = controlador.Id,
                    Descripcion    = esLogOn ? "Registro de sesión" : "Cerrar sesión",
                    NombreAmigable = esLogOn ? "Login" : "Logoff",
                    NombreAccion   = esLogOn ? "LogOn" : "LogOff"
                };
                _accionesRepository.Guardar(accion);
            }
            //var log = new Log()
            //{
            //    IdAccion = accion.Id,
            //    Fecha = DateTime.Now,
            //    IdUsuario = usuario.Id,
            //    Parametros = usuario.NombreUsuario,
            //};
            //_logsRepository.Guardar(log);
        }
        public async Task <IActionResult> Edit(int id, [Bind("AccionId,Nombre")] Accion accion)
        {
            if (id != accion.AccionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accion);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccionExists(accion.AccionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accion));
        }
Ejemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.button1.Enabled  = false;
            this.button3.Text     = "Alta Cliente";
            this.accion           = Accion.alta;
            this.textBox2.Enabled = true;
            this.textBox3.Enabled = true;
            this.textBox4.Enabled = true;
            this.textBox5.Enabled = true;
            this.textBox6.Enabled = true;
            this.textBox7.Enabled = true;
            this.button3.Enabled  = true;
            this.textBox1.Enabled = false;
            _cliente           = new Cliente();
            _cliente.Dni       = this.textBox2.Text;
            _cliente.Nombre    = this.textBox4.Text;
            _cliente.Apellido  = this.textBox3.Text;
            _cliente.Domicilio = this.textBox5.Text;
            _cliente.Telefono  = this.textBox6.Text;

            if (this.textBox6.Text == "")
            {
                _cliente.Sueldo = 0;
            }
            else
            {
                _cliente.Sueldo = Convert.ToDouble(this.textBox7.Text);
            }
        }
Ejemplo n.º 7
0
        public AccionVo(Accion accion)
        {
            Id          = accion.Id;
            Descripcion = accion.Descripcion;
            Location    = accion.Empresa != null
                           ? accion.Linea != null?string.Concat(accion.Empresa.RazonSocial, " - ", accion.Linea.Descripcion)
                                 : accion.Empresa.RazonSocial : accion.Linea != null ? accion.Linea.Descripcion : "-";

            GrabaEnBase        = accion.GrabaEnBase;
            EsPopUp            = accion.EsPopUp;
            RequiereAtencion   = accion.RequiereAtencion;
            EsAlarmaSonora     = accion.EsAlarmaSonora;
            EsAlarmaDeMail     = accion.EsAlarmaDeMail;
            EsAlarmaSms        = accion.EsAlarmaSms;
            Habilita           = accion.Habilita;
            Inhabilita         = accion.Inhabilita;
            ModificaIcono      = accion.ModificaIcono;
            EvaluaGeocerca     = accion.EvaluaGeocerca;
            CambiaMensaje      = accion.CambiaMensaje;
            PideFoto           = accion.PideFoto;
            ReportaAssistCargo = accion.ReportarAssistCargo;
            EnviaReporte       = accion.EnviaReporte;
            ReportaResponsable = accion.ReportaResponsableCuenta;

            Alpha = accion.Alfa;
            Red   = accion.Red;
            Green = accion.Green;
            Blue  = accion.Blue;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Determines if the givenn action applies for the specified message.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="accion"></param>
        /// <returns></returns>
        protected static Boolean ApplyAction(Object context, Accion accion)
        {
            if (String.IsNullOrEmpty(accion.Condicion))
            {
                return(true);
            }

            try
            {
                var expression = ExpressionContext.CreateExpression(accion.Condicion, context);

                var cachedResult = LogicCache.Retrieve <Object>(typeof(Boolean), expression);

                if (cachedResult != null)
                {
                    return(Convert.ToBoolean(cachedResult));
                }

                var result = Logictracker.ExpressionEvaluator.ExpressionEvaluator.Evaluate <bool>(expression);

                LogicCache.Store(typeof(Boolean), expression, result);

                return(result);
            }
            catch (Exception e)
            {
                STrace.Exception(typeof(BaseEventSaver).FullName, e, String.Format("Error procesando condicion: {0} | Accion: {1}", accion.Condicion, accion.Descripcion));

                return(false);
            }
        }
Ejemplo n.º 9
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            if (accion != Accion.nulo)
            {
                Asistencia asistencia2 = dtgAsistencias.SelectedItem as Asistencia;
                Asistencia asistencia  = new Asistencia()
                {
                    id            = asistencia2.id,
                    id_emp        = asistencia2.id_emp,
                    estado        = txtEstado.Text,
                    fecha_entrada = Convert.ToDateTime(dpFechaEntrada.SelectedDate),
                    fecha_salida  = Convert.ToDateTime(dpFechaSalida.SelectedDate),
                    hora_entrada  = Convert.ToDateTime(dpHoraEntrada.SelectedTime),
                    hora_salida   = Convert.ToDateTime(dpHoraSalida.SelectedTime)
                };

                if (asistenciasManager.editar(asistencia2, asistencia))
                {
                    MessageBox.Show("Registro actualizado");
                    ActualizarGrid();
                    ActivarCampos(false);
                    LimpiarCampos();
                    accion = Accion.nulo;
                }
                else
                {
                    MessageBox.Show("No se pudo actualizar");
                    ActivarCampos(false);
                    LimpiarCampos();
                    accion = Accion.nulo;
                }
            }
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }
            await this._context.AddAsync(this.Oferta);

            await this._context.SaveChangesAsync();

            for (int i = 0; i < this.IdProductos.Length; i++)
            {
                var OfertaPrducto = new Ofertaproducto();
                OfertaPrducto.IdProducto = this.IdProductos[i];
                OfertaPrducto.IdOferta   = Oferta.Id;
                OfertaPrducto.Cantidad   = 1;
                await this._context.AddAsync(OfertaPrducto);

                await this._context.SaveChangesAsync();
            }
            Accion Accion = new Accion();

            Accion.IdBitacora  = HttpContext.Session.GetInt32("IdBitacora").Value;
            Accion.Hora        = DateTime.Now;
            Accion.Descripcion = "registro una oferta";
            this._context.Add(Accion);
            this._context.SaveChanges();
            return(Page());
        }
Ejemplo n.º 11
0
 // OK 03/06/12
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     this.Id   = 0;
     this.Acto = Accion.Nuevo;
     frmAuxiliar_Load(sender, e);
     this.Nuevo();
 }
        /// <summary>
        /// Actualiza los controles con los valores del registro.
        /// </summary>
        public void ColocarValoresEnControles()
        {
            //Combo box Proveedores
            var proveedores = db.Suppliers.Select(p => new { p.SupplierID, p.CompanyName });

            cboProveedor.DataSource    = proveedores.ToList();
            cboProveedor.DisplayMember = "CompanyName";
            cboProveedor.ValueMember   = "SupplierID";
            //Combo box Categorías
            var categorias = db.Categories.Select(c => new { c.CategoryID, c.CategoryName });

            cboCategoría.DataSource    = categorias.ToList();
            cboCategoría.DisplayMember = "CategoryName";
            cboCategoría.ValueMember   = "CategoryID";
            //Elegir valor actual en controles.
            if (Accion.Equals(AccionPopup.Nuevo))
            {
                this.Text = "Agregar Producto";
            }
            else
            {
                this.Text                  = "Modificar Producto";
                txtID.Enabled              = false;
                producto                   = db.Products.First(p => p.ProductID.Equals(Id));
                txtID.Text                 = producto.ProductID.ToString();
                txtNombre.Text             = producto.ProductName;
                cboProveedor.SelectedValue = producto.SupplierID;
                cboCategoría.SelectedValue = (int)producto.CategoryID;
            }
        }
Ejemplo n.º 13
0
 private void _ButtonAgregar_Click(object sender, EventArgs e)
 {
     _Accion = Accion.Agregar;
     _PanelFormulario.Visible = true;
     _ButtonAccion.Text       = "Agregar";
     limpiarFormulario();
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Metodo utilizado para diligenciar el fomulario, si la accion es Borrar el metodo le retornar la confirmacion.
        /// </summary>
        /// <param name="accion"></param>
        /// <param name="codProyecto"></param>
        /// <param name="idGasto"></param>
        /// <param name="tipo"></param>
        public string Cargar(Accion accion, string codProyecto, string idGasto, string tipo)
        {
            hddAccion.Value      = accion.ToString();
            hddCodProyecto.Value = codProyecto;
            hddIdGasto.Value     = idGasto;
            hddTipo.Value        = tipo;

            if (accion == Accion.Nuevo)
            {
                btnGasto.Text = "Crear";
                LimpiarCampos();
            }

            if (accion == Accion.Editar)
            {
                btnGasto.Text = "Actualizar";
                LimpiarCampos();
                llenarCampos();
            }

            if (accion == Accion.Borrar)
            {
                return(BorrarCargo());
            }
            return("OK");
        }
Ejemplo n.º 15
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            int      respuesta = 0;
            Producto nProducto = new Producto();

            nProducto.Codigo       = int.Parse(txtCodProducto.Text);
            nProducto.Descripcion  = txtDescripcion.Text;
            nProducto.TipoProducto = (TipoProducto)cboTipo.SelectedItem;
            nProducto.Marca        = (Marca)cboMarca.SelectedItem;
            nProducto.Precio       = decimal.Parse(txtPrecio.Text);
            nProducto.Cantidad     = int.Parse(txtCantidad.Text);
            nProducto.Talle        = txtTalle.Text;
            nProducto.Estado       = cboEstado.SelectedIndex;


            if (Accion.Equals("A"))
            {
                respuesta = nProducto.Agregar();
            }
            else if (Accion.Equals("M"))
            {
                respuesta = nProducto.Modificar();
            }


            if (respuesta.Equals(1))
            {
                MessageBox.Show("Producto agregado correctamente");
                Limpiar();
            }
            else
            {
                MessageBox.Show("Error al Ingresar el Producto");
            }
        }
Ejemplo n.º 16
0
        public ActionResult Edit(Accion accion)
        {
            if (!verificarPermiso(ROLES, (Usuario)Session["usuario"]))
            {
                return(View(@"~\Views\Shared\AccessDenied.cshtml"));
            }
            try
            {
                if (accion != null)
                {
                    accionBll.Grabar(accion);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.mensaje = "accion inexistente";
                    return(View(accion));
                }
            }
            catch
            {
                ViewBag.mensaje = "Error";
                return(View());
            }
        }
Ejemplo n.º 17
0
        public List <Accion> listarAccion()
        {
            Conexion   aux = new Conexion();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = aux.conectar();
            cmd.CommandText = "ListarAccion";
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader dr    = cmd.ExecuteReader();
            List <Accion> lista = new List <Accion>();

            while (dr.Read())
            {
                Accion accion = new Accion();

                accion.Id_Accion            = Convert.ToInt32(dr["Id_Accion"].ToString());
                accion.FK_Id_Modulo         = Convert.ToInt32(dr["FK_Id_Modulo"].ToString());
                accion.Codigo               = dr["Codigo"].ToString();
                accion.Descripcion          = dr["Descripcion"].ToString();
                accion.Estado               = Convert.ToBoolean(dr["Estado"].ToString());
                accion.Estado_Accion        = dr["Estado_Accion"].ToString();
                accion.Usuario_Ingreso      = dr["Usuario_Ingreso"].ToString();
                accion.Fecha_Ingreso        = Convert.ToDateTime(dr["Fecha_Ingreso"].ToString());
                accion.Usuario_Modificacion = dr["Usuario_Modificacion"].ToString();
                accion.Fecha_Modificacion   = Convert.ToDateTime(dr["Fecha_Modificacion"].ToString());

                lista.Add(accion);
            }
            aux.conectar();
            return(lista);
        }
Ejemplo n.º 18
0
        private void button12_Click_1(object sender, EventArgs e)
        {
            AccVslidacion v = new AccVslidacion();

            v.noValidacion = "34";
            string cadeV = "";

            cadeV = JsonConvert.SerializeObject(v);
            Console.WriteLine(cadeV);


            Accion a    = new Accion();
            string cade = "";

            a.titulo = "Validacion";
            a.dato   = cadeV;
            cade     = JsonConvert.SerializeObject(a);
            Console.WriteLine(cade);


            Accion aa = JsonConvert.DeserializeObject <Accion>(cade);


            AccVslidacion av = JsonConvert.DeserializeObject <AccVslidacion>(cadeV);

            Console.WriteLine();
        }
Ejemplo n.º 19
0
        protected void Submit_nuevo(object sender, EventArgs e)
        {
            try
            {
                Accion accion;
                Plan   val = _planBusinessLogic.BuscarPlanPublicado();
                if (val == null)
                {
                    ClientMessageBox.Show("No existe ningun Plan publicado nose puede crear la acción", this);
                    return;
                }

                accion = new Accion
                {
                    Nombre      = txtAccion.Value,
                    Codigo      = txtCodigoAccion.Value,
                    Descripcion = txtDescripcion.Value,
                    IdPlan      = _planBusinessLogic.BuscarPlanPublicado().Id,
                    UsuRegistro = UsuarioSession().DetCodigo,
                    FecRegistro = DateTime.Now,
                    FlActivo    = (int)Constantes.EstadoFlag.ACTIVO
                };
                _accionBusinessLogic.GuardarAccion(accion);
                Limpiar();
                CargarLista();
                ClientMessageBox.Show("Se registro la nueva Acción", this);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Ejemplo n.º 20
0
    public Vector2 decideAccion(Accion accion)
    {
        // TO DO. ASOCIAR ACCIONES A DESTINOS
        switch (accion)
        {
        case Accion.ataque:
            return(Vector2.zero);

        case Accion.buscaEnemigo:
            return(Vector2.zero);

        case Accion.defensaBase:
            return(Vector2.zero);

        case Accion.defensaRP:
            return(Vector2.zero);

        case Accion.huida:
            return(Vector2.zero);

        case Accion.batallaTotal:
            return(Vector2.zero);

        default:
            return(Vector2.zero);
        }
    }
Ejemplo n.º 21
0
 private void _ButtonModificar_Click(object sender, EventArgs e)
 {
     _Accion            = Accion.Modificar;
     _ButtonAccion.Text = "Modificar";
     cargar_Formulario();
     _PanelFormulario.Visible = true;
 }
        public Accion GuardarNuevaAccion(Accion accion)
        {
            _db.Acciones.Add(accion);
            _db.SaveChanges();

            return(accion);
        }
        private void Cargar(Accion accion)
        {
            switch (accion)
            {
            case Accion.Agregar:
                dgvProductos.Visible = false;
                txtBusqueda.Visible  = false;
                btnBusqueda.Visible  = false;
                btnAccion.Text       = "Agregar Producto";
                btnAccion.Click     += new EventHandler(btnAccionAgregar_Click);
                break;

            case Accion.Modificar:
                btnAccion.Text   = "Modificar Producto";
                btnAccion.Click += new EventHandler(btnAccionModificar_Click);
                break;

            case Accion.Eliminar:
                txtCodigo.Enabled              = false;
                txtDescripcion.Enabled         = false;
                nudCantidad.Enabled            = false;
                txtPublico.Enabled             = false;
                txtDistribuidor.Enabled        = false;
                btnAccion.Text                 = "Eliminar Producto";
                btnAccion.Click               += new EventHandler(btnAccionEliminar_Click);
                txtPrecioDeCompra.Enabled      = false;
                txtCantidadMinima.Enabled      = false;
                txtPrecioDeVentaMinimo.Enabled = false;
                break;
            }
            lblTitulo.Text = btnAccion.Text;
        }
Ejemplo n.º 24
0
 public ListadoAfiliados(Accion accion)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.accion = accion;
     //tiposDeDocumentos
 }
Ejemplo n.º 25
0
        public async Task <IHttpActionResult> PutAccion(int id, Accion accion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accion.Codigo)
            {
                return(BadRequest());
            }

            db.Entry(accion).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 26
0
        public void Rol_Administrador_Tiene_Todos_Permisos()
        {
            Rol rolAdministrador = new Rol();

            rolAdministrador.EsAdministrador = true;


            Mock <IApplication> applicationMock = new Mock <IApplication>();

            applicationMock.Setup(m => m.GetCurrentRol()).Returns(rolAdministrador);

            Mock <IRepository <Rol> >    repositoryRolMock        = new Mock <IRepository <Rol> >();
            Mock <ICacheManager>         cacheManagerMock         = new Mock <ICacheManager>();
            Mock <IFuncionalidadService> funcionalidadServiceMock = new Mock <IFuncionalidadService>();
            Mock <IRolService>           rolServiceMock           = new Mock <IRolService>();


            AuthorizationService servicio = new AuthorizationService(applicationMock.Object, repositoryRolMock.Object, cacheManagerMock.Object, funcionalidadServiceMock.Object, rolServiceMock.Object);

            var accion = new Accion();

            accion.Codigo = "Foo";

            var result = servicio.Authorize(accion);


            Assert.IsTrue(result);
        }
Ejemplo n.º 27
0
        public async Task <IHttpActionResult> PostAccion(Accion accion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Accions.Add(accion);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (AccionExists(accion.Codigo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = accion.Codigo }, accion));
        }
Ejemplo n.º 28
0
        public void Habilitar(Accion accion)
        {
            if (accion == Accion.Inicio)
            {
                gbxContactos.Enabled = false;
                btnEliminar.Enabled  = false;
                btnGuardar.Enabled   = false;
                btnNuevo.Enabled     = true;
                btnModificar.Enabled = true;
                txtNombre.Text       = "";
                txtEmail.Text        = "";
                grdContactos.ClearSelection();
                grdContactos.Enabled = true;
            }
            else
            {
                gbxContactos.Enabled = true;
                btnEliminar.Enabled  = false;
                btnGuardar.Enabled   = true;
                btnNuevo.Enabled     = false;
                btnModificar.Enabled = false;

                grdContactos.Enabled = false;

                if (accion == Accion.Crear)
                {
                    txtNombre.Text = "";
                    txtEmail.Text  = "";
                    grdContactos.ClearSelection();
                }
            }
        }
Ejemplo n.º 29
0
    public IEnumerator rutinaZombiCyti()
    {
        while (true)
        {
            int accionInt = Random.Range(1, 4);

            //Indicadior que  accion realisara el Zombi y el Aldeano los cuales son: Idle => Quieto y Moving => Mover y Rotating => Rotar
            switch (accionInt)
            {
            case 1:
                accion = Accion.Idle;
                break;

            case 2:
                direccion = Random.Range(0, 4);
                accion    = Accion.Moving;
                break;

            case 3:
                accion = Accion.Rotating;
                break;
            }
            yield return(new WaitForSeconds(3f));
        }
    }
 public UserControlAdminProductos()
 {
     InitializeComponent();
     productoManager = new ManejadorProducto();
     ActualizarGrid();
     accion = Accion.nulo;
 }
 public Object parse(string str, Accion action)
 {
     LanguageData lenguaje = new LanguageData(gramatica);
     Parser p = new Parser(lenguaje);
     ParseTree s_tree = p.Parse(str);
     if (s_tree.Root != null)
     {
         ActionMaker act = new ActionMaker(s_tree.Root);
         act.escribir_arbol();
         return act.getEval(action);
     }
     return null;
 }
Ejemplo n.º 32
0
 public Object parse(string str, Accion action)
 {
     LanguageData lenguaje = new LanguageData(gramatica);
     Parser p = new Parser(lenguaje);
     ParseTree s_tree = p.Parse(str);
     if (s_tree.Root != null)
     {
         ActionMaker act = new ActionMaker(s_tree.Root);
         return act.getEval(action);
     }
     else 
     {
         MessageBox.Show("fail, go home!");
     }
     return null;
 }
Ejemplo n.º 33
0
 public void setAccAct(Accion aa)
 {
     MostrarOcultar(panel);
     AccionActual = aa;
     if (!esRegla) panelEscribir.GetComponentInChildren<Text>().text = UIController.Lista.PropiedadesToString(AccionActual);
     else if (esRegla)
     {
         if (esAntecedente)
         {
             reglasManager.GetComponent<Reglas>().agregarAntec(aa);
         }
         else
         {
             reglasManager.GetComponent<Reglas>().agregarConsec(aa);
         }
     }
 }
Ejemplo n.º 34
0
        private void btnBaja_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.gridEmpleados.CurrentRow != null)
                {
                    this.Operacion = Accion.Modificacion;

                    Empleado empleado = (Empleado)this.gridEmpleados.CurrentRow.DataBoundItem;

                    DialogResult dialogo = MessageBox.Show("¿Desea eliminar definitivamente al Empleado " + empleado.ToString() + "?", "Gestión de Empleados", MessageBoxButtons.YesNo);

                    if (dialogo == DialogResult.Yes)
                    {
                        if (GestorReserva.ObtenerInstancia().EliminarEmpleado(empleado))
                        {
                            MessageBox.Show("El empleado se ha eliminado correctamente", "Gestión de Empleados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            CargarEmpleados();
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                string mensajeError = ErrorManager.ObtenerInstancia().LoguearGenerarMensajeError(ex, MensajeError.BajaEmpleadoFallida, FormHelper.ObtenerInstancia().TraerUltimoIdioma());
                MessageBox.Show(mensajeError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 35
0
 private void btnAlta_Click(object sender, EventArgs e)
 {
     this.Operacion = Accion.Alta;
     this.gbDatosServicio.Enabled = true;
     HabilitarControles(false);
 }
Ejemplo n.º 36
0
        private void btnModificacion_Click(object sender, EventArgs e)
        {
            try
            {
                HabilitarControles(false);

                if (this.gridServicios.CurrentRow != null)
                {
                    this.Operacion = Accion.Modificacion;
                    this.gbDatosServicio.Enabled = true;

                    Servicio servicio = (Servicio)this.gridServicios.CurrentRow.DataBoundItem;

                    servicioSeleccionado = servicio;

                    this.txtDescripcion.Text = servicio.Descripcion;
                    this.txtPrecio.Text = servicio.Precio.ToString("N2");
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ObtenerInstancia().LoguearErrorBD(ex);
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 37
0
        private void btnModificacion_Click(object sender, EventArgs e)
        {
            try
            {
                HabilitarControles(false);

                if (this.gridEmpleados.CurrentRow != null)
                {
                    this.Operacion = Accion.Modificacion;
                    this.gbDatosEmpleado.Enabled = true;
                    this.txtDU.Enabled = false;

                    Empleado empleado = (Empleado)this.gridEmpleados.CurrentRow.DataBoundItem;

                    this.txtDU.Text = empleado.DU.ToString();
                    this.txtApellido.Text = empleado.Apellido;
                    this.txtNombre.Text = empleado.Nombre;
                    this.txtTelefono.Text = empleado.Telefono;
                    this.cboCargo.SelectedValue = empleado.Cargo.Descripcion;
                    this.chkActivo.Checked = empleado.Activo;

                    if (empleado.Direccion != null)
                    {
                        this.txtCalle.Text = empleado.Direccion.Calle;
                        this.txtAltura.Text = empleado.Direccion.Altura.ToString();
                        this.txtLocalidad.Text = empleado.Direccion.Localidad;
                        this.txtPiso.Text = empleado.Direccion.Piso == 0 ? "" : empleado.Direccion.Piso.ToString();
                        this.txtDepto.Text = empleado.Direccion.Departamento == "N/A" ? "" : empleado.Direccion.Departamento;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ObtenerInstancia().LoguearErrorBD(ex);
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 38
0
 public Object getEval(Accion action)
 {
     //evaluar el árbol
     return action.do_action(root);
 }
Ejemplo n.º 39
0
    void leerXML(string xml)
    {
        XmlDocument xmlDoc = new XmlDocument(); // xmlDoc is the new xml document.
        xmlDoc.LoadXml(BaseDeDatosXML.text); // load the file.
        string nombre = "";
        string ID = "";
        Dictionary<string, string> propiedades;

        XmlNodeList personajes = xmlDoc.GetElementsByTagName("Personaje"); // Personajes
        foreach (XmlNode personaje in personajes)
        {
            Personaje aux;
            nombre = "";
            ID = "";
            propiedades = new Dictionary<string, string>();
            XmlNodeList elementos = personaje.ChildNodes;
            foreach (XmlNode elemento in elementos)
            {
                if (elemento.Name == "Nombre")
                {
                    nombre = elemento.InnerText.ToLower();
                }
                if (elemento.Name == "ID")
                {
                    ID = elemento.InnerText;
                }
                if (elemento.Name == "Propiedades")
                {
                    foreach (XmlNode propiedad in elemento)
                    {
                        propiedades[propiedad.Name] = propiedad.InnerText.ToLower();
                    }
                }
            }
            aux = new Personaje(nombre, int.Parse(ID), propiedades);
            Controller.Personajes.Add(aux);
        } // /Personajes

        XmlNodeList npcs = xmlDoc.GetElementsByTagName("NPC"); // NPCs
        foreach (XmlNode npc in npcs)
        {
            NPC aux;
            nombre = "";
            ID = "";
            propiedades = new Dictionary<string, string>();
            XmlNodeList elementos = npc.ChildNodes;
            foreach (XmlNode elemento in elementos)
            {
                if (elemento.Name == "Nombre")
                {
                    nombre = elemento.InnerText.ToLower();
                }
                if (elemento.Name == "ID")
                {
                    ID = elemento.InnerText;
                }
                if (elemento.Name == "Propiedades")
                {
                    foreach (XmlNode propiedad in elemento)
                    {
                        propiedades[propiedad.Name] = propiedad.InnerText.ToLower();
                    }
                }
            }
            aux = new NPC(nombre, int.Parse(ID), propiedades);
            Controller.NPCs.Add(aux);
        } // /NPCs

        XmlNodeList objetos = xmlDoc.GetElementsByTagName("Objeto"); // Objetos
        foreach (XmlNode objeto in objetos)
        {
            Objeto aux;
            nombre = "";
            ID = "";
            propiedades = new Dictionary<string, string>();
            XmlNodeList elementos = objeto.ChildNodes;
            foreach (XmlNode elemento in elementos)
            {
                if (elemento.Name == "Nombre")
                {
                    nombre = elemento.InnerText.ToLower();
                }
                if (elemento.Name == "ID")
                {
                    ID = elemento.InnerText;
                }
                if (elemento.Name == "Propiedades")
                {
                    foreach (XmlNode propiedad in elemento)
                    {
                        if (propiedad.Name != "texto") propiedades[propiedad.Name] = propiedad.InnerText.ToLower();
                        else propiedades[propiedad.Name] = propiedad.InnerText;
                    }
                }
            }
            aux = new Objeto(nombre, int.Parse(ID), propiedades);
            Controller.Objetos.Add(aux);
        } // /Objetos

        XmlNodeList acciones = xmlDoc.GetElementsByTagName("Accion"); // Acciones
        foreach (XmlNode accion in acciones)
        {
            Accion aux;
            nombre = "";
            ID = "";
            propiedades = new Dictionary<string, string>();
            XmlNodeList elementos = accion.ChildNodes;
            foreach (XmlNode elemento in elementos)
            {
                if (elemento.Name == "Nombre")
                {
                    nombre = elemento.InnerText.ToLower();
                }
                if (elemento.Name == "ID")
                {
                    ID = elemento.InnerText;
                }
                if (elemento.Name == "Propiedades")
                {
                    foreach (XmlNode propiedad in elemento)
                    {
                        propiedades[propiedad.Name] = propiedad.InnerText.ToLower();
                    }
                }
            }
            aux = new Accion(nombre, int.Parse(ID), propiedades);
            Controller.Acciones.Add(aux);
        } // /Acciones

        List<List<Elemento>> antecedentes;
        List<Elemento> antecedente;
        List<Elemento> consecuente;
        string IDElem = "";
        string tipo = "";

        XmlNodeList reglas = xmlDoc.GetElementsByTagName("Regla"); // Reglas
        foreach (XmlNode regla in reglas)
        {
            Regla aux;
            antecedentes = new List<List<Elemento>>();
            consecuente = new List<Elemento>();

            XmlNodeList elementos = regla.ChildNodes;
            foreach (XmlNode elemento in elementos)
            {
                if (elemento.Name == "Antecedentes")
                {
                    foreach (XmlNode antec in elemento)
                    {
                        antecedente = new List<Elemento>();
                        foreach (XmlNode elem in antec)
                        {
                            foreach (XmlNode propElem in elem)
                            {
                                if (propElem.Name == "ID")
                                {
                                    IDElem = propElem.InnerText;
                                }
                                if (propElem.Name == "Tipo")
                                {
                                    tipo = propElem.InnerText;
                                }
                            }
                            antecedente.Add(buscarElemento(int.Parse(IDElem), tipo));
                        }
                        antecedentes.Add(antecedente);
                    }
                }
                if (elemento.Name == "Consecuente")
                {
                    foreach (XmlNode elem in elemento)
                    {
                        foreach (XmlNode propElem in elem)
                        {
                            if (propElem.Name == "ID")
                            {
                                IDElem = propElem.InnerText;
                            }
                            if (propElem.Name == "Tipo")
                            {
                                tipo = propElem.InnerText;
                            }
                        }
                        consecuente.Add(buscarElemento(int.Parse(IDElem), tipo));
                    }
                }
            }
            aux = new Regla(antecedentes, consecuente);
            Controller.Reglas.Add(aux);
        } // /Reglas
    }
Ejemplo n.º 40
0
        private void btnBaja_Click(object sender, EventArgs e)
        {
            try
            {

                if (this.gridEventos.CurrentRow != null)
                {
                    this.Operacion = Accion.Modificacion;

                    Evento evento = (Evento)this.gridEventos.CurrentRow.DataBoundItem;

                    DialogResult dialogo = MessageBox.Show("¿Desea eliminar definitivamente al evento " + evento.Descripcion + "?", "Baja de Evento", MessageBoxButtons.YesNo);

                    if (dialogo == DialogResult.Yes)
                    {
                        if (GestorReserva.ObtenerInstancia().EliminarEvento(evento))
                        {
                            if (GestorBD.ObtenerInstancia().ActualizarDVV("EVENTO"))
                            {
                                MessageBox.Show("El evento se ha eliminado correctamente.", "Baja de Evento", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                CargarEventos();
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                string mensajeError = ErrorManager.ObtenerInstancia().LoguearGenerarMensajeError(ex, MensajeError.BajaEventoFallida, FormHelper.ObtenerInstancia().TraerUltimoIdioma());
                MessageBox.Show(mensajeError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 41
0
        private void btnModificacion_Click(object sender, EventArgs e)
        {
            try
            {

                HabilitarControles(false);

                if (this.gridEventos.CurrentRow != null)
                {
                    this.Operacion = Accion.Modificacion;
                    this.gbDatosEvento.Enabled = true;

                    Evento evento = (Evento)this.gridEventos.CurrentRow.DataBoundItem;

                    eventoSeleccionado = evento;

                    this.txtDescripcion.Text = evento.Descripcion;
                    this.txtPrecio.Text = evento.Precio.ToString("N2");
                    this.txtPrecioBloque.Text = evento.PrecioBloqueExtra.ToString("N2");
                    this.txtPrecioDecena.Text = evento.PrecioDecenaExtra.ToString("N2");
                    this.numCantidadAdultos.Value = evento.CantidadAdultos;
                    this.numCantidadNiños.Value = evento.CantidadNiños;
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ObtenerInstancia().LoguearErrorBD(ex);
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 42
0
    void Update()
    {
        if(userMon.estado.statActual.vida == 0){
            SaveMonster.AddMonster(userMon,false);
            act1.stg = act2.stg = Stage.elegir;
            user.clicks = accionesEntrenador.nula;
            user.menuActivo = menus.capa1;
            if( user.Change() < 0){
                battleStage = (int) Stage.derrota;
            }
        }
        if(opoMon.estado.statActual.vida == 0){
            userMon.AddExp(opoMon.exp*(opoMon.lv/userMon.lv));
            act1.stg = act2.stg = Stage.elegir;
            if( oponent.Change() < 0){
                battleStage = (int) Stage.victoria;
            }
        }
        if((battleStage == (int)Stage.resultado) || (battleStage == (int)Stage.derrota) || (battleStage == (int)Stage.victoria)){
            Salir(battleStage);
        }

        InitPanels();

        if(act1.stg == Stage.elegir){
            battleStage = (int)Stage.elegir;
            act1 = user.accionEntrenador();
        }
        if(userMon.estado.statActual.vida == 0){
            if( user.Change() < 0){
                battleStage = (int) Stage.resultado;
            }
        }
        if(act2.stg == Stage.elegir){
            battleStageOp = (int)Stage.elegir;
            act2 = oponent.accionEntrenador();
        }
        if(opoMon.estado.statActual.vida == 0){
        }
        if(act1.stg != Stage.elegir){
            if(battleStage == (int)act1.stg){
                act1.ac();
                act1.stg = Stage.elegir;
            }else{
                if(!waiting){
                    waiting = true;
                    StartCoroutine(Wait(0));
                }
            }
        }
        if(act2.stg != Stage.elegir){
            if(battleStageOp == (int)act2.stg){
                act2.ac();
                act2.stg = Stage.elegir;
            }else{
                if(!waiting){
                    waiting = true;
                    StartCoroutine(Wait(1));
                }
            }
        }
    }
Ejemplo n.º 43
0
        private void btnModificacion_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridUsuarios.SelectedRows.Count != 0)
                {
                    this.Operacion = FABMUsuario.Accion.Modificacion;
                    this.gbDatosUsuario.Enabled = true;
                    HabilitarControles(false);
                    this.txtUsuario.Enabled = false;

                    DataGridViewRow row = this.gridUsuarios.SelectedRows[0];
                    this.txtUsuario.Text = row.Cells["Nombre"].Value.ToString();
                    this.cboIdioma.SelectedValue = row.Cells["Idioma"].Value.ToString();
                    this.cboPerfil.SelectedValue = row.Cells["Perfil"].Value.ToString();
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ObtenerInstancia().LoguearErrorBD(ex);
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 44
0
    void Start()
    {
        user = (ClaseJugador)Entrenador.CreateTrainer("ClaseJugador","PEPE");
        opoN = PlayerPrefs.GetString("Entrenador");
        oponent = (Entrenador)Entrenador.CreateTrainer(opoN,opoN);
        PlayerPrefs.DeleteKey("Entrenador");
        battleStageOp = battleStage = (int)Stage.elegir;
        userMon = user.equipo[user.activo];
        opoMon = oponent.equipo[oponent.activo];
        act1 = user.accionEntrenador();
        act2 = Accion.CreateAccion("Elegir");

        GameObject.Find("OponentIm").GetComponent<Image>().sprite = Resources.Load(opoMon.imgDir, typeof(Sprite)) as Sprite;
        GameObject.Find("UserIm").GetComponent<Image>().sprite = Resources.Load(userMon.imgDir, typeof(Sprite)) as Sprite;
        actionPanel.SetActive(true);
        if(oponent.catchRate <= 0){
            GameObject.Find("ItemBtn").SetActive(false);
        }
    }
Ejemplo n.º 45
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     using (Server.RequestStart(Database))
     {
         MongoCollection Contactos = Database.GetCollection<Contact>("contacts");
         if (AccionFormulario == Accion.Guardar)
             Contactos.Insert(new Contact()
             {
                 Apellidos = txtApellidos.Text,
                 Nombres = txtNombres.Text,
                 Telefono = txtTelefono.Text,
                 CorreoElectronico = txtCorreoElectronico.Text
             });
         else
         {
             Contact item = Contactos.FindOneByIdAs<Contact>(IdContacto);
             item.Apellidos = txtApellidos.Text;
             item.Nombres = txtNombres.Text;
             item.Telefono = txtTelefono.Text;
             item.CorreoElectronico = txtCorreoElectronico.Text;
             Contactos.Save(item, SafeMode.True);
             AccionFormulario = Accion.Guardar;
         }
     }
     LlenarGrilla();
     LimpiarControles();
 }
Ejemplo n.º 46
0
 private void tsmiActualizar_Click(object sender, EventArgs e)
 {
     BsonObjectId Id = (BsonObjectId)dgvEmpleados.CurrentRow.Cells["Id"].Value;
     using (Server.RequestStart(Database))
     {
         MongoCollection Contactos = Database.GetCollection<Contact>("contacts");
         Contact item = Contactos.FindOneByIdAs<Contact>(Id);
         IdContacto = item.Id;
         txtApellidos.Text = item.Apellidos;
         txtNombres.Text = item.Nombres;
         txtTelefono.Text = item.Telefono;
         txtCorreoElectronico.Text = item.CorreoElectronico;
         AccionFormulario = Accion.Actualizar;
     }
 }
Ejemplo n.º 47
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     LimpiarControles();
     AccionFormulario = Accion.Guardar;
 }