IEnumerator ChangeToExitCorountine() { this.GetComponent<NavMeshAgent>().destination = Game.Instance.exit.position; yield return new WaitForEndOfFrame(); state = State.ExitParking; this.vaga.owner = null; this.vaga = null; }
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; }
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)); }
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(); } }
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(); }
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)); }
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); } }
/// <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)); }
// 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)); }
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)); }
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)); }
public DetalheVaga(Vaga vaga) { //ASSIM RECEBEMOS A VAGA //VAMOS USAR O BINDING SEM UM LIST VIEW InitializeComponent(); BindingContext = vaga; //DisplayAlert("MSG", vaga.NomeVaga, "Okay"); }
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)); }
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(); } }
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)); }
public IHttpActionResult GetVaga(int id) { Vaga vaga = db.Vagas.Find(id); if (vaga == null) { return(NotFound()); } return(Ok(vaga)); }
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(); }
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)); }
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); }
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(); }
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)); }
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(); }
public async Task <IHttpActionResult> GetVaga(int id) { Vaga vaga = await db.Vagas.FindAsync(id); if (vaga == null) { return(NotFound()); } return(Ok(vaga)); }
// // 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)); }
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); }
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(); }
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)); }
public VagaVeiculo(Estacionamento estacionamento, Vaga vaga, Veiculo veiculo) { Estacionamento = estacionamento; Vaga = vaga; Veiculo = veiculo; DataEntrada = DateTime.Now; }
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); } }