public IActionResult Post([FromBody] OrientacaoRequest orientacaoRequest) { var orientacao = new Orientacao { ProjetoId = orientacaoRequest.ProjetoId, ProfessorPessoaId = orientacaoRequest.ProfessorPessoaId, DataRegistro = orientacaoRequest.DataRegistro, TipoOrientacaoId = orientacaoRequest.TipoOrientacaoId }; contexto.Orientacao.Add(orientacao); contexto.SaveChanges(); var orientacaoRetorno = contexto.Orientacao.Where (x => x.ProfessorPessoaId == orientacao.ProfessorPessoaId && x.ProjetoId == orientacao.ProjetoId) .FirstOrDefault(); OrientacaoResponse response = new OrientacaoResponse(); if (orientacaoRetorno != null) { response.ProfessorPessoaId = orientacaoRetorno.ProfessorPessoaId; response.ProjetoId = orientacaoRetorno.ProjetoId; response.TipoOrientacaoId = orientacaoRetorno.TipoOrientacaoId; response.DataRegistro = orientacaoRetorno.DataRegistro; } return(StatusCode(200, response)); }
public IActionResult Post([FromBody] OrientacaoRequest orientacaoRequest) { var orientacao = new Orientacao { IdProjeto = orientacaoRequest.IdProjeto, IdPessoa = orientacaoRequest.IdPessoa, IdTipoOrientacao = orientacaoRequest.IdTipoOrientacao, DataRegistro = orientacaoRequest.DataRegistro }; contexto.Orientacao.Add(orientacao); contexto.SaveChanges(); var orientacaoRetorno = contexto.Orientacao.Where (x => x.IdProjeto == orientacao.IdProjeto && x.IdPessoa == orientacao.IdPessoa) .FirstOrDefault(); OrientacaoResponse response = new OrientacaoResponse(); if (orientacaoRetorno != null) { response.IdProjeto = orientacaoRetorno.IdProjeto; response.IdPessoa = orientacaoRetorno.IdPessoa; response.IdTipoOrientacao = orientacaoRetorno.IdTipoOrientacao; response.DataRegistro = orientacaoRetorno.DataRegistro; } return(StatusCode(200, response)); }
public ActionResult DeleteConfirmed(int id) { Orientacao orientacao = db.Orientacaos.Find(id); db.Orientacaos.Remove(orientacao); db.SaveChanges(); return(RedirectToAction("Index")); }
static void Enumeracoes() { Orientacao orientacao = Orientacao.Norte; Console.WriteLine("Orientação: {0}", (byte)orientacao); Enum.TryParse("Leste", out Orientacao orientacaoConvertida); Console.WriteLine("Orientação convertida: {0}", (byte)orientacaoConvertida); }
/// <summary> /// Por padrão, o relatório é gerado em modo retrato. /// </summary> /// <param name="reportPath"></param> /// <param name="downloadFileName"></param> /// <param name="orientacao"></param> public WebReportRenderer(string reportPath, string downloadFileName, Orientacao orientacao, string papel = "A4", string margensVerticais = null, string margensLaterais = null) { if (!downloadFileName.EndsWith(".pdf")) { downloadFileName = downloadFileName + "." + HttpContext.Current.Session["FormatoRelatorioTipoArquivoImpressao"].ToString(); } if (HttpContext.Current == null) throw new InvalidOperationException("Esta classe somente para aplicacoes WEB."); this.downloadFileName = downloadFileName; var altura = ""; var largura = ""; switch (papel) { case "A4": altura = "29.7cm"; largura = "21cm"; break; case "Carta": altura = "27.94cm"; largura = "21.59cm"; break; } deviceInfo = "<DeviceInfo>" + " <OutputFormat>PDF</OutputFormat>"; if (orientacao == Orientacao.Paisagem) deviceInfo += " <PageWidth>" + altura + "</PageWidth>" + " <PageHeight>" + largura + "</PageHeight>"; else deviceInfo += " <PageWidth>" + largura + "</PageWidth>" + " <PageHeight>" + altura + "</PageHeight>"; if (!String.IsNullOrEmpty(margensVerticais)) deviceInfo += " <MarginBottom>" + "0.2cm" + "</MarginBottom>" + " <MarginTop>" + margensVerticais + "</MarginTop>"; else deviceInfo += " <MarginBottom>0.2in</MarginBottom>" + " <MarginTop>0.5in</MarginTop>"; if (!String.IsNullOrEmpty(margensLaterais)) deviceInfo += " <MarginLeft> " + margensLaterais + "</MarginLeft>" + " <MarginRight>" + margensLaterais + "</MarginRight>"; else deviceInfo += " <MarginLeft>0.2in</MarginLeft>" + " <MarginRight>0.2in</MarginRight>"; deviceInfo += " <Language>pt-BR</Language>" + "</DeviceInfo>"; reportInstance = new Microsoft.Reporting.WebForms.LocalReport(); reportInstance.ReportPath = HttpContext.Current.Server.MapPath(reportPath); }
private void MudarDirecaoParaLadoMaisPerto(Orientacao orientacao, int posicaoXObjetivo, int posicaoYObjetivo, List <Direcao> direcoesTentadas) { if (orientacao == Orientacao.Horizontal) { if (PosicaoX > posicaoXObjetivo) { if (!direcoesTentadas.Contains(Direcao.Norte)) { MudarDirecao(Direcao.Norte); } else { MudarDirecao(Direcao.Sul); } } else { if (!direcoesTentadas.Contains(Direcao.Sul)) { MudarDirecao(Direcao.Sul); } else { MudarDirecao(Direcao.Norte); } } } else { if (PosicaoY > posicaoYObjetivo) { if (!direcoesTentadas.Contains(Direcao.Leste)) { MudarDirecao(Direcao.Leste); } else { MudarDirecao(Direcao.Oeste); } } else { if (!direcoesTentadas.Contains(Direcao.Oeste)) { MudarDirecao(Direcao.Oeste); } else { MudarDirecao(Direcao.Leste); } } } }
public ActionResult Edit([Bind(Include = "IdPessoa,IdTipoOrientacao,IdProjeto,Data")] Orientacao orientacao) { if (ModelState.IsValid) { db.Entry(orientacao).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdPessoa = new SelectList(db.Professors, "IdPessoa", "IdPessoa", orientacao.IdPessoa); ViewBag.IdProjeto = new SelectList(db.Projetoes, "IdProjeto", "NomeProjeto", orientacao.IdProjeto); ViewBag.IdTipoOrientacao = new SelectList(db.TipoOrientacaos, "IdTipoOrientacao", "Descricao", orientacao.IdTipoOrientacao); return(View(orientacao)); }
// GET: Orientacao/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Orientacao orientacao = db.Orientacaos.Find(id); if (orientacao == null) { return(HttpNotFound()); } return(View(orientacao)); }
// GET: Orientacao/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Orientacao orientacao = db.Orientacaos.Find(id); if (orientacao == null) { return(HttpNotFound()); } ViewBag.IdPessoa = new SelectList(db.Professors, "IdPessoa", "IdPessoa", orientacao.IdPessoa); ViewBag.IdProjeto = new SelectList(db.Projetoes, "IdProjeto", "NomeProjeto", orientacao.IdProjeto); ViewBag.IdTipoOrientacao = new SelectList(db.TipoOrientacaos, "IdTipoOrientacao", "Descricao", orientacao.IdTipoOrientacao); return(View(orientacao)); }
// Update is called once per frame void Update() { playerIndex = Criogenia.GetIndex(this.transform.position); // Verifica se o player pode se mover/interagir if (isInControl) { if (rb.velocity == Vector2.zero) { Criogenia.lastSafePosList[playerIndex - 1].Push(this.gameObject.transform.position); } //MOVIMENTO rb.velocity = new Vector2(Input.GetAxis(Horizontal) * velocidade, Input.GetAxisRaw(Vertical) * velocidade); //define a componente velocity a partir de um vetor //if(rb.velocity.magnitude > velocidade) // rb.velocity = rb.velocity.normalized * velocidade; if (rb.velocity.magnitude != 0f) //analisa o angulo em que o personagem { //se move, indo de 0 a 359 graus if (Input.GetAxis(Vertical) >= 0) { angulo = Vector2.Angle(new Vector2(1, 0), rb.velocity); } else if (Input.GetAxis(Vertical) < 0) { angulo = 360 - Vector2.Angle(new Vector2(1, 0), rb.velocity); } } //CONTROLE DA ORIENTAÇÃO if (angulo <= 60 || angulo >= 300) //muda o valor da variavel orientacao { orientacao = Orientacao.Direita; //dependendo do angulo em que } else if (angulo > 60 && angulo < 120) //o personagem se move { orientacao = Orientacao.Cima; } else if (angulo >= 120 && angulo <= 250) { orientacao = Orientacao.Esquerda; } else { orientacao = Orientacao.Baixo; } animator.SetFloat("SpeedVertical", Mathf.Abs(rb.velocity.y)); animator.SetFloat("SpeedHorizontal", Mathf.Abs(rb.velocity.x)); animator.SetInteger("Orientation", (int)orientacao); //CORRER if (correndo == false) { if (Input.GetButtonDown(Correr) && rb.velocity.magnitude != 0f) { velocidade *= 1.5f; correndo = true; } } else { if (Input.GetButtonUp(Correr) || rb.velocity.magnitude == 0f) { velocidade /= 1.5f; correndo = false; } } } else { if ((Criogenia.WhichTileIsPlayerAt(this.gameObject.transform.position, playerIndex) == Criogenia.TileType.Dry && playerIndex == 1) || (Criogenia.WhichTileIsPlayerAt(this.gameObject.transform.position, playerIndex) == Criogenia.TileType.Dry && playerIndex == 2)) { Debug.Log("Stop."); rb.velocity = Vector2.zero; isInControl = true; } } }
public bool Posicionar(int X, int Y, Orientacao ori) { bool bolOK = true; int iMax, jMax; int segAtual = 0; switch (ori) { case Orientacao.Horizontal: iMax = this.Tamanho - 1; jMax = 0; break; case Orientacao.Vertical: iMax = 0; jMax = this.Tamanho - 1; break; default: iMax = this.Tamanho - 1; jMax = 0; break; } if (this.pJogador.Grade == null) { bolOK = false; } else { if (this.pJogador.Grade.TamanhoX - (iMax + X + 1) < 0) { bolOK = false; } if (this.pJogador.Grade.TamanhoY - (jMax + Y + 1) < 0) { bolOK = false; } } if (bolOK) { for (int j = 0; j <= jMax; j++) { for (int i = 0; i <= iMax; i++) { if (this.pJogador.Grade.Celulas[X + i, Y + j].Conteudo != null) { bolOK = false; break; } segAtual++; } } } segAtual = 0; if (bolOK) { for (int j = 0; j <= jMax; j++) { for (int i = 0; i <= iMax; i++) { this.pJogador.Grade.Celulas[X + i, Y + j].Alocar(this.Segmentos[segAtual]); segAtual++; } } } return(bolOK); }