Esempio n. 1
0
 IEnumerator ChangeToExitCorountine()
 {
     this.GetComponent<NavMeshAgent>().destination = Game.Instance.exit.position;
     yield return new WaitForEndOfFrame();
     state = State.ExitParking;
     this.vaga.owner = null;
     this.vaga = null;
 }
Esempio n. 2
0
 public IEnumerator SetVaga(Vaga vaga)
 {
     this.vaga = vaga;
     vaga.owner = this;
     this.GetComponent<NavMeshAgent>().destination = vaga.transform.position;
     yield return new WaitForEndOfFrame();
     state = State.SearchingParking;
 }
Esempio n. 3
0
        public void Retirar(Vaga vaga)
        {
            if (vaga == null)
                throw new ValorNullException("Selecione a vaga que será liberada");

            var vagaAtual = VagasUtilizadas.ToList().Where(x => x.Vaga != null && x.Vaga.Id == vaga.Id).ToList();
            for (int i = 0; i < vagaAtual.Count; i++)
                VagasUtilizadas.Remove(vagaAtual[i]);
        }
 public ActionResult Edit([Bind(Include = "VagaID,Placa,Entrada,Saida,Duracao,Tempo,ValorPagar,TabelaPrecoID")] Vaga vaga)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vaga).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TabelaPrecoID = new SelectList(db.TabelaPrecos.Where(t => t.DataInicio <= DateTime.Now && t.DataFim >= DateTime.Now), "TabelaPrecoID", "Preco", vaga.TabelaPrecoID);
     return(View(vaga));
 }
Esempio n. 5
0
 public void Delete(Vaga vaga)
 {
     using (ISession session = NHibernateHelper.OpenSession())
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.CreateQuery("delete from Vaga u where u.Id = (:id)")
             .SetParameter("id", vaga.Id)
             .ExecuteUpdate();
             transaction.Commit();
         }
 }
Esempio n. 6
0
        private void listarToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            FormVagaListar form = new FormVagaListar();

            VagaController c = new VagaController();
            Vaga           p = new Vaga();

            c.ExecutarOpBD('l', p);

            form.ShowDialog();
        }
Esempio n. 7
0
        public void ExcluirAction(object sender, EventArgs args)
        {
            Label LblExluir = (Label)sender;
            Vaga  vaga      = ((TapGestureRecognizer)LblExluir.GestureRecognizers[0]).CommandParameter as Vaga;

            Database database = new Database();

            database.Exclusao(vaga);

            ConsultarVagas();
        }
        // GET: Vagas/Edit/5
        public ActionResult Edit(int id)
        {
            Vaga vaga = vagaregras.buscarporID(id);

            if (vaga == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SetorId = new SelectList(setorregras.buscarTodos(), "Id", "Nome", vaga.SetorId);
            return(View(vaga));
        }
Esempio n. 9
0
        private void SaveVagaIntoHD(Vaga vaga)
        {
            var stringJson = JsonConvert.SerializeObject(vaga, Formatting.Indented);

            var nomeArquivo = vaga.Id.ToString() + ".json";

            using (StreamWriter sw = new StreamWriter(diretorio + "/" + nomeArquivo))
            {
                sw.Write(stringJson);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Metodo responsavel por cadastrar a vaga
        /// </summary>
        /// <param name="model">Informacoes da vaga</param>
        /// <returns>Status de cadastro</returns>
        public async Task <bool> CreateVaga(Vaga model)
        {
            var vaga = await GetVagaByDescricaoAndEmpresa(model.Descricao, model.Empresa);

            if (vaga != null)
            {
                return(false);
            }

            return(await _repository.CreateVaga(model));
        }
Esempio n. 11
0
        // GET: Estacionamento/Estacionar
        public ActionResult Estacionar(int id)
        {
            Estacionamento estacionamento   = new Estacionamento();
            var            vagasDisponiveis = new Vaga().Listar(); //.Select(p => new SelectListItem() { Text = p.Descricao, Value = p.Id.ToString()});

            ViewBag.ListaVagas              = vagasDisponiveis;
            estacionamento.IdVeiculo        = ViewBag.IdVeiculo = id;
            estacionamento.DataHora_Entrada = DateTime.Now;
            estacionamento.Estado           = "A";
            return(View(estacionamento));
        }
Esempio n. 12
0
        public IActionResult Delete(long id, Vaga evento)
        {
            Vaga eventoDb = this.db.Vagas
                            .Include(m => m.Estacionamento)
                            .Where(x => x.Id == id)
                            .FirstOrDefault();

            db.Vagas.Remove(eventoDb);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult OcuparVaga(int id)
        {
            Vaga      vaga      = VagaDAO.BuscarVagaPorId(id);
            Historico historico = new Historico
            {
                Vaga        = vaga,
                DataEntrada = DateTime.Now
            };

            return(View(historico));
        }
Esempio n. 14
0
 public ActionResult Edit([Bind(Include = "ID_Vagas,CPF,Status,Cidade,Bairro,Rua,Numero")] Vaga vaga)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vaga).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CPF = new SelectList(db.locadors1, "CPF", "Nome_Dono", vaga.CPF);
     return(View(vaga));
 }
Esempio n. 15
0
        public DetalheVaga(Vaga vaga)
        {
            //ASSIM RECEBEMOS A VAGA
            //VAMOS USAR O BINDING SEM UM LIST VIEW

            InitializeComponent();

            BindingContext = vaga;

            //DisplayAlert("MSG", vaga.NomeVaga, "Okay");
        }
Esempio n. 16
0
        public VagaDto Get(int vagaId)
        {
            Vaga vaga = rhUow.Vaga.GetById(vagaId);

            vaga.ListaVagaTecnologia = rhUow.VagaTecnologia.GetAll().Where(t => t.VagaId == vagaId).ToList();
            vaga.ListaEntrevista     = rhUow.Entrevista.GetAll().Where(t => t.VagaId == vagaId).ToList();

            VagaDto dto = (VagaDto)vaga;

            return(dto);
        }
        public void MaisDetalheAction(object sender, EventArgs args)
        {
            //USANDO O CommandParameter PASSANDO PARA O METODO CONSTRUTOR DO OUTRO
            //PASSANDO A VAGA

            Label LblDetalhe = (Label)sender;

            Vaga vaga = ((TapGestureRecognizer)LblDetalhe.GestureRecognizers[0]).CommandParameter as Vaga;

            Navigation.PushAsync(new DetalheVaga(vaga));
        }
Esempio n. 18
0
        private void OnClickExcluirVaga(object sender, RoutedEventArgs e)
        {
            Vaga vaga = ((FrameworkElement)sender).DataContext as Vaga;

            if (Dialog.OnConfirma("Você deseja realmente excluir?", "Excluir"))
            {
                controller.Delete(vaga);
                Dialog.OnInforma("Vaga excluída com sucesso");
                CarregarVagas();
            }
        }
Esempio n. 19
0
        public ActionResult Create([Bind(Include = "VagaId,Nome,Descricao,Situacao,DataCadastro")] Vaga vaga)
        {
            if (ModelState.IsValid)
            {
                var vagaBo = new VagaBo();
                vagaBo.Adicionar(vaga);
                return(RedirectToAction("Index"));
            }

            return(View(vaga));
        }
Esempio n. 20
0
        public IHttpActionResult GetVaga(int id)
        {
            Vaga vaga = db.Vagas.Find(id);

            if (vaga == null)
            {
                return(NotFound());
            }

            return(Ok(vaga));
        }
Esempio n. 21
0
        private void GestureExcluir_Tapped(object sender, EventArgs e)
        {
            Label lblExcluir             = (Label)sender;
            TapGestureRecognizer tapGest = (TapGestureRecognizer)lblExcluir.GestureRecognizers[0];
            Vaga vaga = tapGest.CommandParameter as Vaga;

            Database database = new Database();

            database.Exclusao(vaga);
            ConsultarVagas();
        }
Esempio n. 22
0
        public ActionResult Create([Bind(Include = "VagaID,Ocupada")] Vaga vaga)
        {
            if (ModelState.IsValid)
            {
                db.Vagas.Add(vaga);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vaga));
        }
        public ActionResult Create([Bind(Include = "Id,Numero,Situacao,SetorId")] Vaga vaga)
        {
            if (ModelState.IsValid)
            {
                vagaregras.Adicionar(vaga);
                return(RedirectToAction("Index"));
            }

            ViewBag.SetorId = new SelectList(setorregras.buscarTodos(), "Id", "Nome", vaga.SetorId);
            return(View(vaga));
        }
Esempio n. 24
0
 public ActionResult <VagaComTecnologiaDto> IncluirVaga(VagaComTecnologiaDto vagaDto)
 {
     if (_vagaValidation.ValidaSeVagaDtoEstaPreenchido(vagaDto))
     {
         var vaga = new Vaga(vagaDto.Descricao);
         _vagaRepository.Armazenar(vaga);
         _uow.Commit();
         return(vagaDto);
     }
     return(null);
 }
Esempio n. 25
0
        public void ExcluirAction(object sender, EventArgs args)
        {
            Label lblExcluir             = (Label)sender;
            TapGestureRecognizer tapGest = (TapGestureRecognizer)lblExcluir.GestureRecognizers[0];
            Vaga vaga = tapGest.CommandParameter as Vaga;

            DataBase database = new DataBase();

            database.Deletar(vaga);
            ConsultarVagas();
        }
Esempio n. 26
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Descricao,Status")] Vaga vaga)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vaga);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vaga));
        }
        public IHttpActionResult PostVaga(Vaga vaga)
        {
            validador.ValidateAndThrow(vaga);

            vaga.Ativa = true;

            db.Vagas.Add(vaga);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = vaga.Id }, vaga));
        }
Esempio n. 28
0
        public ActionResult Cadastrar([Bind(Include = "Id,Nome,Tipo")] Vaga vaga)
        {
            if (ModelState.IsValid)
            {
                db.Vagas.Add(vaga);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vaga));
        }
        private void ExcluirAction(object sender, EventArgs e)
        {
            var lblExcluir           = (Label)sender;
            var tapGestureRecognizer = (TapGestureRecognizer)lblExcluir.GestureRecognizers[0];

            Vaga vaga = tapGestureRecognizer.CommandParameter as Vaga;

            _repo.Exclusao(vaga);

            ConsultarVagas();
        }
Esempio n. 30
0
        public async Task <IHttpActionResult> GetVaga(int id)
        {
            Vaga vaga = await db.Vagas.FindAsync(id);

            if (vaga == null)
            {
                return(NotFound());
            }

            return(Ok(vaga));
        }
Esempio n. 31
0
        //
        // GET: /Vaga/Edit/5
        public ActionResult Edit(int id)
        {
            Vaga vaga = db.Vaga.Find(id);

            if (vaga == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Tipo_Id    = new SelectList(db.Tipo, "Id", "Tipo1", vaga.Tipo_Id);
            ViewBag.Empresa_Id = new SelectList(db.Usuario, "Id", "Email", vaga.Empresa_Id);
            return(View(vaga));
        }
Esempio n. 32
0
        public double CalculaDistanciaEntreUsuarioEVaga(Usuario usuario, Vaga vaga)
        {
            if (usuario.Latitude != 0.0 &&
                usuario.Longitude != 0.0 &&
                vaga.Latitude != 0.0 &&
                vaga.Longitude != 0.0)
            {
                return(googleApi.CalculaDistanciaEntreDoisPontos(usuario.Latitude, usuario.Longitude, vaga.Latitude, vaga.Longitude));
            }

            return(0.0);
        }
Esempio n. 33
0
        public void AlocarEmVaga(Vaga vaga, Funcionario funcionario)
        {
            funcionario.vaga       = vaga;
            funcionario.termino_wa = DateTime.Now;

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

            vaga.qtdVaga--;
            _context.Entry(vaga).State = EntityState.Modified;

            _context.SaveChanges();
        }
Esempio n. 34
0
        public void Estacionar(Veiculo veiculo, Vaga vaga)
        {
            if (veiculo == null)
                throw new ValorNullException("Selecione um veiculo para estacionar");

            if (vaga == null)
                throw new ValorNullException("Selecione a vaga que será estacionado o veiculo");

            if (!Vagas.Contains(vaga))
                throw new EstacionarException("Vaga selecionada não é do estacionado");

            var vagaAtual = VagasUtilizadas.ToList().FirstOrDefault(x => x.Vaga != null && x.Vaga.Id == vaga.Id);
            var vagaDoVeiculoAtual = VagasUtilizadas.ToList().FirstOrDefault(x => x.Veiculo!= null && x.Veiculo.Id == veiculo.Id);

            if (vagaDoVeiculoAtual != null)
                throw new EstacionarException("O veiculo já está estacionado.");

            if (vagaAtual != null)
                throw new EstacionarException("A vaga já possui um veiculo estacionado");

            this.VagasUtilizadas.Add(new VagaVeiculo(this, vaga,veiculo));
        }
Esempio n. 35
0
 public VagaVeiculo(Estacionamento estacionamento, Vaga vaga, Veiculo veiculo)
 {
     Estacionamento = estacionamento;
     Vaga = vaga;
     Veiculo = veiculo;
     DataEntrada = DateTime.Now;
 }
Esempio n. 36
0
        private static void GerarVagas(ParkingDBEntities ct)
        {
            Console.WriteLine("Apagando Registros Antigos...");

            foreach (var E in ct.Vaga.ToList())
            {
                ct.Vaga.Remove(E);
            }

            foreach (var E in ct.Bloco.ToList())
            {
                ct.Bloco.Remove(E);
            }

            foreach (var E in ct.Andar.ToList())
            {
                ct.Andar.Remove(E);
            }

            Console.WriteLine("Criando Registros Novos...");

            for (int i = 1; i < 5; i++)
            {

                Andar andar = new Andar();
                andar.Nome = string.Format("{0}º Andar", i);

                Console.WriteLine("Andar: " + andar.Nome);

                char NomeBloco = 'A';
                int NomeVaga = 1;

                for (int j = 0; j < 10; j++)
                {
                    Bloco bloco = new Bloco();
                    bloco.Nome = NomeBloco.ToString() + i.ToString();

                    andar.Bloco.Add(bloco);

                    NomeBloco++;

                    Console.WriteLine(" Bloco: " + bloco.Nome);

                    for (int k = 1; k < 11; k++)
                    {
                        Vaga vaga = new Vaga();
                        vaga.Nome = NomeVaga.ToString();
                        vaga.Situacao = "Livre";

                        bloco.Vaga.Add(vaga);

                        NomeVaga++;

                        Console.WriteLine("  Vaga: " + vaga.Nome);

                    }

                    Console.WriteLine();

                }

                Console.WriteLine();

                ct.Andar.Add(andar);
            }
        }