private void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            RealizarJogadas realizarJogadas = new RealizarJogadas();
            MontarTabuleiro montarTabuleiro = new MontarTabuleiro();
            Centro          centro          = new Centro();
            Fabricas        fabricas        = new Fabricas();

            if (pause == false)
            {
                string[] dados = new VerificarVez().Verificar(idJogador, senhaJogador);
                if (dados != null)
                {
                    if (Convert.ToInt32(dados[1]).Equals(idJogador))
                    {
                        realizarJogadas.PreparaJogadas(idJogador, senhaJogador);
                        montarTabuleiro.Montar(this, idJogador, senhaJogador);
                        centro.MontarCentro(this, idJogador, senhaJogador);
                        fabricas.MontarFabricas(this, idJogador, senhaJogador);
                    }
                    else
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
        }
Esempio n. 2
0
        private void InitializeFromEntity(Centro c)
        {
            Nombre   = c.Nombre;
            UniqueId = c.unique_id;

            Votantes      = c.votantes ?? 0;
            CantidadMesas = c.mesas;
            Cuadernos     = c.cuadernos ?? 0;

            Grupo             = c.grupo;
            GrupoMovilizacion = c.grupoMovilizacion;
            GrupoQuickCount   = c.qcGroup;
            Tag1 = c.tag1;
            Tag2 = c.tag2;

            Ubicacion = new UbicacionGeografica(c);
            Settings  = new CentroSettings(c);

            EnlacesMovilizacion = c.Movilizadors.Select(m => new EnlaceMovilizacion(m)).ToList();
            EnlacesExitPoll     = c.TestigoExitPolls.Select(m => new EnlaceExitPoll(m)).ToList();

            Alertas = new List <Alerta>();
            Alertas.AddRange(c.ExitPollAlertas.Select(a => new Alerta(a)));
            Alertas.AddRange(c.MovilizacionAlertas.Select(a => new Alerta(a)));
            Alertas.AddRange(c.QuickCountAlertas.Select(a => new Alerta(a)));

            Mesas = c.Mesas1.Select(m => new Mesa(m)).ToList();
        }
Esempio n. 3
0
        public void CentroGrabar(string id, string descripcion)
        {
            Centro centro;

            int _id = -1;

            if (!int.TryParse(id, out _id))
            {
                _id = -1;
            }

            if (_id == -1)
            {
                centro = new Centro();
            }
            else
            {
                centro = this.CentroObtener(_id);
            }

            centro.Descripcion = descripcion == null ? string.Empty : descripcion;
            centro.Vigente     = true;
            centro.Validar();

            RepositoryGenerico <Centro> repository = new RepositoryGenerico <Centro>();

            repository.Actualizar(centro);
        }
Esempio n. 4
0
        public ActionResult Edit(Centro centro)
        {
            //public ActionResult Edit([Bind(Include = "id,nombre,provincia,direccion,estado,idUsuario")] Centro centro)

            if (ModelState.IsValid)
            {
                if (consultaCentro(centro.idUsuario))
                {
                    TempData["mensajeCentro"] = "Este usuario ya tiene asignado un centro";
                    ViewBag.Usuario           = cargarUsuarioDropDownList();
                    ViewBag.Provincia         = cargarProvinciasDropDownList();



                    if (TempData.ContainsKey("mensajeCentro"))
                    {
                        ViewBag.MensajeCentro = TempData["mensajeCentro"].ToString();
                    }

                    return(View(centro));
                }

                db.Entry(centro).State = EntityState.Modified;
                db.SaveChanges();
                TempData["mensaje"] = "Centro de Acopio modificado con éxito";
                return(RedirectToAction("Index"));
            }
            TempData["mensaje"] = "No se pudo modificar el centro de acopio";
            ViewBag.Usuario     = cargarUsuarioDropDownList();
            ViewBag.Provincia   = cargarProvinciasDropDownList();

            return(View(centro));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "id,nombre,provincia,direccion,estado,idUsuario")] Centro centro)
        {
            if (ModelState.IsValid)
            {
                if (consultaCentro(centro.idUsuario))
                {
                    ViewBag.Provincia = cargarProvinciasDropDownList();
                    ViewBag.Usuario   = cargarUsuarioDropDownList();
                    TempData["mensajeCentroEdita"] = "Este usuario ya tiene asignado un centro";

                    if (TempData.ContainsKey("mensajeCentroEdita"))
                    {
                        ViewBag.MensajeCentroEdita = TempData["mensajeCentroEdita"].ToString();
                    }
                    return(View(centro));
                }

                db.Centro.Add(centro);
                db.SaveChanges();
                TempData["mensaje"] = "Centro de Acopio guardado con éxito";
                return(RedirectToAction("Index"));
            }
            ViewBag.Provincia   = cargarProvinciasDropDownList();
            ViewBag.Usuario     = cargarUsuarioDropDownList();
            TempData["mensaje"] = "No se pudo guadar el centro de acopio";

            return(View(centro));
        }
Esempio n. 6
0
 public CentroSettings(Centro centroDeVotacion)
 {
     ExitPollActive     = centroDeVotacion.exitPollActive ?? false;
     QuickCountActive   = centroDeVotacion.quickCountActive ?? false;
     Totalizado         = centroDeVotacion.totalizado;
     MovilizacionActive = centroDeVotacion.movilizacion;
 }
Esempio n. 7
0
        // GET: Centro/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                //Respuesta al usuario
                TempData["mensaje"] = "Especifique un centro de acopio";
                return(RedirectToAction("Index"));
            }
            Centro centro = db.Centro.Find(id);

            if (centro == null)
            {
                TempData["mensaje"] = "No existe el centro de acopio";
                return(RedirectToAction("Index"));
            }

            ViewBag.Provincia = cargarProvinciasDropDownList(centro.provincia);
            ViewBag.Usuario   = cargarUsuarioDropDownList();

            if (TempData.ContainsKey("mensajeCentro"))
            {
                ViewBag.MensajeCentro = TempData["mensajeCentro"].ToString();
            }

            return(View(centro));
        }
Esempio n. 8
0
        public void CrearCentroTest()
        {
            Centros CentroWS  = new Centros();
            Centro  resultado = CentroWS.CrearCentro("Aguas Calientes", 1);

            Assert.AreEqual("Aguas Calientes", resultado.DESCRIPCION);
        }
Esempio n. 9
0
 public async Task <IActionResult> Edit(int id, [Bind("Nombre, Id")] Centro centro, string calle, string localidad, int altura, string provincia)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Direccion direccion = new Direccion()
             {
                 Calle     = calle,
                 Altura    = altura,
                 Localidad = localidad,
                 Provincia = provincia
             };
             centro.Direccion = direccion;
             _context.Update(centro);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!CentroExists(centro.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(centro));
 }
Esempio n. 10
0
        public void ObtenerCentroTest()
        {
            Centros CentroWS  = new Centros();
            Centro  resultado = CentroWS.ObtenerCentro(1);

            Assert.AreEqual("SANTUARIO", resultado.DESCRIPCION);
        }
Esempio n. 11
0
        public async Task <IActionResult> PutAdminEmpleado(int id, Empleado empleado)
        {
            if (empleado != null && id != empleado.EmpleadoId)
            {
                return(BadRequest());
            }
            var     empActual = _context.Empleados.Find(id);
            Centro  c         = _context.Centros.Find(empleado.IdCentro);
            Cliente cl        = _context.Clientes.Find(c.CodCliente);
            var     guidAdmin = new Guid("b3086b0c-0a59-4a7f-addd-60c725b7bedd");
            var     mensaje   = $"Hola {empleado.Nombre}." +
                                $" Hemos detectado un cambio en su correo electrónico para la empresa {cl.Descripcion}." +
                                $" Acepte la invitación para seguir resgistrando sus fichajes y continar donde lo dejó.";

            if (empleado.Email != empActual.Email)
            {
                await DeleteUserAsync(empleado.oid);

                var oid = await PostUserAsync(empleado.Email, empleado.Nombre, mensaje);

                empActual.oid = oid;
                await PostRolAsync(oid, guidAdmin);
            }

            empActual.Cp              = empleado.Cp;
            empActual.Direccion       = empleado.Direccion;
            empActual.Dni             = empleado.Dni;
            empActual.Email           = empleado.Email;
            empActual.Estado          = empleado.Estado;
            empActual.FechaAlta       = empleado.FechaAlta;
            empActual.FechaNacimiento = empleado.FechaNacimiento;
            empActual.IdCentro        = empleado.IdCentro;
            empActual.Municipio       = empleado.Municipio;
            empActual.Nombre          = empleado.Nombre;
            empActual.NumeroVia       = empleado.NumeroVia;
            empActual.PrimerApellido  = empleado.PrimerApellido;
            empActual.Provincia       = empleado.Provincia;
            empActual.SegundoApellido = empleado.SegundoApellido;
            empActual.Telefono        = empleado.Telefono;

            _context.SaveChanges();

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

            return(NoContent());
        }
Esempio n. 12
0
        private void Inicializar()
        {
            Centro c = new Centro();

            this.cbbCentro.DataSource    = c.Buscar("");
            this.cbbCentro.ValueMember   = "CentroID";
            this.cbbCentro.DisplayMember = "nombre";

            this.CargarAulas();
            cbbDia1.DataSource    = this.seccion.ListadoDias();;
            cbbDia1.ValueMember   = "DiaID";
            cbbDia1.DisplayMember = "Nombre";

            cbbDia2.DataSource    = this.seccion.ListadoDias();;
            cbbDia2.ValueMember   = "DiaID";
            cbbDia2.DisplayMember = "Nombre";


            Profesor p = new Profesor();

            cbbProfesor.DataSource    = p.BuscarProfesores("");
            cbbProfesor.DisplayMember = "Nombre";
            cbbProfesor.ValueMember   = "ProfesorID";

            Asignatura asig = new Asignatura();

            cbbAsignatura.DataSource    = asig.Buscar("");
            cbbAsignatura.ValueMember   = "AsignaturaID";
            cbbAsignatura.DisplayMember = "Descripcion";
        }
Esempio n. 13
0
        public async Task <IActionResult> PutCentro(int id, Centro centro)
        {
            if (centro != null && id != centro.IdCentro)
            {
                return(BadRequest());
            }

            _context.Entry(centro).State = EntityState.Modified;

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

            return(NoContent());
        }
Esempio n. 14
0
        public static Centro CreateCentro(global::System.Guid ID)
        {
            Centro centro = new Centro();

            centro.Id = ID;
            return(centro);
        }
Esempio n. 15
0
        private void Inicializar()
        {
            Centro c = new Centro();

            this.cbbCentro.DataSource    = c.Buscar("");
            this.cbbCentro.ValueMember   = "CentroID";
            this.cbbCentro.DisplayMember = "nombre";
        }
Esempio n. 16
0
 private static CentroViewModel ConvertToCentroRowViewModel(this Centro centro)
 {
     return(new CentroViewModel()
     {
         CentroId = centro.CentroId,
         Nombre = centro.Nombre,
     });
 }
Esempio n. 17
0
        public override string ToString()
        {
            var resultado = "";

            resultado += Nombre + "; ";
            resultado += "Centro =" + (Centro.Medidas.Count == 0 ? "" : Centro.ToString()) + "; ";
            return(resultado);
        }
 public void EliminarCentro(Centro c)
 {
     if (c == null)
     {
         throw new ArgumentNullException(nameof(c));
     }
     db.Centro.Remove(c);
 }
        public void CrearCentro(Centro c)
        {
            if (c == null)
            {
                throw new ArgumentNullException(nameof(c));
            }

            db.Centro.Add(c);
        }
Esempio n. 20
0
        public static string actualizarCentros(string p_id, string p_nombre, string p_domicilio, string p_localidad, string p_email, string p_contacto_1, string p_contacto_2)

        {
            Centro        centro        = new Centro();
            GestorCentros gestorCentros = new GestorCentros();

            try
            {
                string mensaje = "OK";

                if (!string.IsNullOrEmpty(p_nombre))
                {
                    centro.NombreCentro = p_nombre;
                }

                if (!string.IsNullOrEmpty(p_domicilio))
                {
                    centro.DomicilioCentro = p_domicilio;
                }

                if (!string.IsNullOrEmpty(p_localidad))
                {
                    centro.LocalidadCentro = p_localidad;
                }

                if (!string.IsNullOrEmpty(p_email))
                {
                    centro.EmailCentro = p_email;
                }

                if (!string.IsNullOrEmpty(p_contacto_1))
                {
                    centro.NroCentro1 = p_contacto_1;
                }

                if (!string.IsNullOrEmpty(p_contacto_2))
                {
                    centro.NroCentro2 = p_contacto_2;
                }

                centro.IdCentro = Convert.ToInt32(p_id);

                centro.UsuarioMod = 1;
                centro.FechaMod   = DateTime.Today;


                gestorCentros.ActualizarCentros(centro);

                return(mensaje);
            }

            catch (Exception e)
            {
                string error = "Se produjo un error al actualizar los datos del centro" + e.Message;
                return(error);
            }
        }
Esempio n. 21
0
        public void Insert(Centro centro, bool commit = true)
        {
            this.db.Centros.Add(centro);

            if (commit)
            {
                db.SaveChanges();
            }
        }
        public void PreparaJogadas(int idJogador, string senhaJogador)
        {
            List <AzulejoFabrica> azulejoFabricas        = new Fabricas().LerFabricas(idJogador, senhaJogador);
            List <AzulejoCentro>  azulejoCentros         = new Centro().LerCentro(idJogador, senhaJogador);
            List <Modelo>         listaModeloIncompletos = Azulejos(idJogador, senhaJogador);

            pula     = false;
            contador = 0;
            Jogar(listaModeloIncompletos, azulejoFabricas, azulejoCentros, idJogador, senhaJogador);
        }
        public Instalacion(Usuario usuario, Centro centro)
        {
            InitializeComponent();
            Usuario = usuario;
            Centro  = centro;
            lblNombreUsuario.Text = "Bienvenido: " + usuario.cli_nombre + " " + usuario.cli_apellido;
            lblCentro.Text        = centro.cen_descripcion;

            obtenerInstalaciones(centro.cen_id);
        }
Esempio n. 24
0
        public void Update(Centro centro, bool commit = true)
        {
            var c = Get(centro.Nombre);

            c.FechaInicio = centro.FechaInicio;

            if (commit)
            {
                db.SaveChanges();
            }
        }
        public Centro CrearCentro(string descripcion, int empresa)
        {
            Empresa empresaExistente = EmpresaDAO.Obtener(empresa);
            Centro  CentroACrear     = new Centro()
            {
                DESCRIPCION = descripcion,
                EMPRESA     = empresaExistente
            };

            return(CentroDAO.Crear(CentroACrear));
        }
Esempio n. 26
0
        public Centro CrearCentro(string descripcion, int empresa)
        {
            Empresa empresaExistente = EmpresasDAO.Obtener(empresa);
            Centro  centroACrear     = new Centro()
            {
                Descripcion = descripcion,
                Empresa     = empresaExistente
            };

            return(CentroDAO.Crear(centroACrear));
        }
        public Centro ModificarCentro(int codigo, string descripcion, int empresa)
        {
            Empresa empresaExistente = EmpresaDAO.Obtener(empresa);
            Centro  centroAModificar = new Centro()
            {
                ID_CENTRO   = codigo,
                DESCRIPCION = descripcion,
                EMPRESA     = empresaExistente
            };

            return(CentroDAO.Modificar(centroAModificar));
        }
Esempio n. 28
0
 public string ActualizarCentros(Centro centro)
 {
     try
     {
         DACentros DaCentros = new DACentros();
         return(DaCentros.DaActualizarCentro(centro));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 29
0
 public string RegistrarCentros(Centro centro)
 {
     try
     {
         DACentros DaCentros = new DACentros();
         return(DaCentros.DaRegistrarCentros(centro));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 30
0
        public CentroStatus(Centro c)
        {
            Movilizacion            = c.movilizacionCount ?? 0;
            MovilizacionTarget      = c.movilizacionTarget;
            Participacion           = c.participacionContada ?? 0;
            ParticipacionProyectada = c.participacionProyectada ?? 0;
            ParticipacionTarget     = c.participacionTarget;

            LastMovilizacionUpdate  = c.lastMovilizacionContact;
            LastParticipacionUpdate = c.lastParticipacionContact;
            NextMovilizacionUpdate  = c.nextMovilizacionContact;
        }
Esempio n. 31
0
 public CentroBusiness(Centro centro)
     : base(centro)
 {
     this._centro = centro;
 }
Esempio n. 32
0
 public static Centro Guardar(Centro centro)
 {
     CentroBusiness cb = new CentroBusiness(centro);
     cb.Guardar();
     return cb.GetDomain<Centro>();
 }