private void btnLancar_Click(object sender, EventArgs e) { try { if (cbES.SelectedItem.ToString() == "Entrada" || cbES.SelectedItem.ToString() == "Saida") { double caixa = 0; string descricao = txtDescricao.Text; string entradaSaida = cbES.Text; double valor = Convert.ToDouble(txtValor.Text); Fluxo lancamento = new Fluxo(); lancamento.descricao = descricao; lancamento.entradaSaida = entradaSaida; lancamento.valor = valor; lancamento.cadastrar(); Fluxo novoItem = new Fluxo(); foreach (Fluxo p in novoItem.listar()) { caixa = caixa + p.valor; } txtCaixa.Text = caixa.ToString(); MessageBox.Show("Operação realizada com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Erro ao tentar cadastrar. " + ex.Message, "Falha na operação", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void RemoverDaLista(int pos) { GameObject fluxo = GameObject.Find("Fluxo"); estadoJogo = fluxo.GetComponent <Fluxo>(); GameObject gamem = GameObject.Find("GUIPrincipal"); game = gamem.GetComponent <GameMananger>(); if (!estadoJogo.play && !estadoJogo.fimJogo) { Destroy(Pontos[pos].transform.GetChild(0).gameObject); i--; botoesMenu[usados[pos]].GetComponent <Image>().color = new Color32(255, 255, 255, 255); usados.RemoveAt(pos); game.PlantasUsar.RemoveAt(pos); playAtivo.SetActive(false); for (int j = pos; j < i; j++) { Vector3 scale; GameObject obj = Instantiate(Pontos[j + 1].transform.GetChild(0).gameObject, Pontos[j].transform.position, Quaternion.identity) as GameObject; scale = obj.transform.localScale; obj.transform.SetParent(Pontos[j].transform); obj.transform.localScale = scale; Destroy(Pontos[j + 1].transform.GetChild(0).gameObject); Button botao = obj.GetComponent <Button>(); int u = j; botao.onClick.AddListener(() => RemoverDaLista(u)); botao.onClick.AddListener(() => { game.PlantaUsar = u; }); botao.onClick.AddListener(() => teste(u)); } } }
public bool salvar(Fluxo f) { string sql = ""; sql = "INSERT INTO FLUXO_CAIXA VALUES (" + f.Id_empresa.ToString() + ", '" + f.Tipo + "', '" + f.Descricao + "', " + f.Valor.ToString() + ",'" + f.Data.ToString("yyyy-MM-dd HH:mm:ss.fff") + "', '" + f.Movimento + "', '" + f.Pagamento + "')"; // string sql = "INSERT INTO FLUXO_CAIXA VALUES("+f.Id_empresa.ToString()+",'"+f.Tipo+ // "','"+f.Descricao+"','"+f.Valor.ToString()"','" + f.Data.ToString("yyyy/MM/dd HH:mm:ss")+"')"; Console.WriteLine(sql); try { SqlCommand cmd = new SqlCommand(sql, conn); int res = cmd.ExecuteNonQuery(); if (res > 0) { var = true; } } catch (Exception ex) { Console.WriteLine("erro: " + ex.ToString()); MessageBox.Show("Erro ao inserir, favor verificar se os campos foram preenchidos corretamente."); } finally { Conexao.fechaConexao(); } return(var); }
public void EnviarParaGerencia(int clientId, int userId) { using var transaction = _context.Database.BeginTransaction(); try { var clientFromDb = _clientRepository.GetById(clientId); clientFromDb.SetCurrentStatus(EStatus.AGUARDANDO_GERENCIA); _context.Entry(clientFromDb).State = EntityState.Modified; var fluxo = new Fluxo(clientId, userId, clientFromDb.CurrentStatusId); _context.Entry(fluxo).State = EntityState.Added; _context.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } }
public bool Alterar(Fluxo f) { string sql = "UPDATE FLUXO_CAIXA SET INT_ID_ORG = " + f.Id_empresa.ToString() + ", STR_TIPO_FLUXO = '" + f.Tipo + "', STR_DESCRICAO_FLUXO = '" + f.Descricao + "', STR_VALOR_FLUXO = " + f.Valor.ToString() + ", DT_DATA_FLUXO = '" + f.Data.ToString("yyyy-MM-dd HH:mm:ss.fff") + "', STR_MOVIMENTO_FLUXO = '" + f.Movimento + "', STR_PAGAMENTO_FLUXO = '" + f.Pagamento + "' WHERE INT_ID_FLUXO = " + f.Id.ToString(); Console.WriteLine(sql); try { SqlCommand cmd = new SqlCommand(sql, conn); int res = cmd.ExecuteNonQuery(); if (res > 0) { var = true; } } catch (Exception ex) { Console.WriteLine("erro: " + ex.ToString()); } finally { Conexao.fechaConexao(); } return(var); }
public void EnviarParaAprovacao(int clientId, int userId) { var clientFromDb = _clientRepository.GetById(clientId); if (clientFromDb.IsInternacional == true) { using var transaction = _context.Database.BeginTransaction(); try { clientFromDb.SetCurrentStatus(EStatus.AGUARDANDO_CONTROLE_DE_RISCO); _context.Entry(clientFromDb).State = EntityState.Modified; var fluxo = new Fluxo(clientId, userId, clientFromDb.CurrentStatusId); _context.Entry(fluxo).State = EntityState.Added; _context.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } } else { AprovarCliente(clientId, userId); } }
public Histórico() { InitializeComponent(); Fluxo novoItem = new Fluxo(); dgwFluxo.DataSource = novoItem.listar(); }
public void CriarSolicitacaoDeFornecedorComFluxo() { var webForLink = new Aplicacao("WebForLink", "Cadastro De Fornecedores"); var samarco = new ClienteAncora("Samarco"); var nelson = new Usuario("nelson", webForLink, samarco); TipoEmpresa pessoaJuridica = new EmpressaPessoaJuridica(); Empresa sorteq = new Fornecedor("Sorteq", "12345678900", pessoaJuridica); Solicitacao solicitacaoCadastro = new SolicitacaoCadastro(nelson, sorteq); Assert.IsNull(solicitacaoCadastro.Fluxo); var cadastro = new Fluxo(new FluxoCriacao(), samarco, pessoaJuridica); var a = new Etapa("A"); cadastro.AdicionarPassos(a, new Passo("A.1"), new Passo("A.2")); cadastro.AdicionarPassos(new Etapa("B"), new Passo("B.1")); cadastro.AdicionarPassos(new Etapa("C"), new Passo("C.1"), new Passo("C.2"), new Passo("C.3")); solicitacaoCadastro.SetFluxo(cadastro); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, a); cadastro.AprovarPasso(new Passo("A.2")); //var cadastroDeFornecedor = new Fluxo(cadastroFornecedor, _samarco, _pessoaJuridica); //var cadastroFornecedor = new TipoFluxo("Cadastro de Fornecedor"); //solicitacaoCadastro.Tipo.SetFluxo(cadastroDeFornecedor); //cadastroDeFornecedor.AdicionarEtapas(new Etapa("Solicitacao"), new Etapa("MDA"), new Etapa("Conclusão")); //Assert.AreEqual(cadastroDeFornecedor.EtapaAtual.Nome, "Solicitacao"); //Assert.AreEqual(solicitacaoCadastro.Tipo.Fluxo.EtapaAtual.Nome, "Solicitacao"); }
private void btnCarregar_Click(object sender, EventArgs e) { double caixa = 0; Fluxo novoItem = new Fluxo(); foreach (Fluxo p in novoItem.listar()) { caixa = caixa + p.valor; } txtCaixa.Text = caixa.ToString(); }
public IList <Fluxo> ListarFluxo(DateTime startDate, DateTime endDate, int statusId = 0, string cpf = "", string name = "") { var fluxos = new List <Fluxo>(); var dbContext = new SQLDbContext(); SqlParameter[] parametros = new SqlParameter[] { new SqlParameter("@StartDate", startDate.ToShortDateString()), new SqlParameter("@EndDate", endDate.AddDays(1).ToShortDateString()), new SqlParameter("@IdStatus", statusId), new SqlParameter("@CPF", cpf ?? ""), new SqlParameter("@Name", name ?? ""), }; string SQL = "SELECT * FROM VW_Fluxo_Aprovacao WHERE DataCriacao >= @StartDate AND DataCriacao <= @EndDate"; if (statusId > 0) { SQL += " AND IdStatus = @IdStatus"; } if (!string.IsNullOrEmpty(cpf)) { SQL += " AND CPF = @CPF"; } if (!string.IsNullOrEmpty(name)) { SQL += " AND Cliente LIKE '%@Name%'"; } DataTable dtResult = dbContext.ExecutarConsulta(SQL, parametros); foreach (DataRow dataRow in dtResult.Rows) { var userId = Convert.ToInt32(dataRow["IdUsuario"]); var user = _userRepository.GetById(userId); var clientId = Convert.ToInt32(dataRow["IdCliente"]); var client = _clientRepository.GetById(clientId); var fluxo = new Fluxo( client, user, status: EnumHelper.StatusIdParaStatus(dataRow["IdStatus"].ToString()), createDate: Convert.ToDateTime(dataRow["DataCriacao"]) ); fluxos.Add(fluxo); } return(fluxos); }
public string deletar(Fluxo f) { FluxoDao login = new FluxoDao(); string aviso = null; if (login.Deletar(f)) { aviso = "Excluído com sucesso!"; } else { aviso = "Não foi possivel excluir!"; } return(aviso); }
public void CriarSolicitacaoDeFornecedorComFluxo() { TipoEmpresa pessoaJuridica = new EmpresaPessoaJuridica(); Empresa sorteq = new Fornecedor("Sorteq", "12345678900", pessoaJuridica); Solicitacao solicitacaoCadastro = new SolicitacaoCadastro(_nelson, sorteq); Assert.IsNull(solicitacaoCadastro.Fluxo); var cadastro = new Fluxo(new FluxoCriacao(), _samarco, pessoaJuridica); var a = new Etapa("A"); var b = new Etapa("B"); var c = new Etapa("C"); cadastro.AdicionarPassos(a, new Passo("A.1"), new Passo("A.2")); cadastro.AdicionarPassos(b, new Passo("B.1")); cadastro.AdicionarPassos(c, new Passo("C.1"), new Passo("C.2"), new Passo("C.3")); solicitacaoCadastro.SetFluxo(cadastro); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, a); cadastro.AprovarPasso(new Passo("A.2")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, a); cadastro.AprovarPasso(new Passo("A.1")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, b); //--- cadastro.AprovarPasso(new Passo("B.1")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, c); //--- cadastro.AprovarPasso(new Passo("C.3")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, c); cadastro.AprovarPasso(new Passo("C.1")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, c); cadastro.ReprovarPasso(new Passo("C.1")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, c); cadastro.AprovarPasso(new Passo("C.1")); Assert.AreEqual(solicitacaoCadastro.EtapaAtual, c); cadastro.AprovarPasso(new Passo("C.2")); Assert.IsNull(solicitacaoCadastro.EtapaAtual); //var cadastroDeFornecedor = new Fluxo(cadastroFornecedor, _samarco, _pessoaJuridica); //var cadastroFornecedor = new TipoFluxo("Cadastro de Fornecedor"); //solicitacaoCadastro.Tipo.SetFluxo(cadastroDeFornecedor); //cadastroDeFornecedor.AdicionarEtapas(new Etapa("Solicitacao"), new Etapa("MDA"), new Etapa("Conclusão")); //Assert.AreEqual(cadastroDeFornecedor.EtapaAtual.Nome, "Solicitacao"); //Assert.AreEqual(solicitacaoCadastro.Tipo.Fluxo.EtapaAtual.Nome, "Solicitacao"); }
private void tsSalvar_Click(object sender, EventArgs e) { Fluxo insert = new Fluxo(); var rg = new Regex(@"^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}\s([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"); if (rg.IsMatch(maskDt.Text)) { try { DateTimeFormatInfo brasil = new CultureInfo("pt-BR", false).DateTimeFormat; insert.Data = Convert.ToDateTime(maskDt.Text, brasil); } catch { MessageBox.Show("Data incorreta!"); return; } } else { MessageBox.Show("Data incorreta!"); return; } insert.Descricao = txtDesc.Text; insert.Tipo = cbTipo.Text; insert.Valor = txtValor.Text.Replace("R$", "").Replace(".", "").Replace(",", ".").Trim(); int index = dataGridView1.CurrentRow.Index; insert.Id_empresa = Convert.ToInt32(dataGridView1.Rows[index].Cells[0].Value); insert.Movimento = txtMov.Text; insert.Pagamento = cbPag.Text; try { FluxoModel fluxo = new FluxoModel(); string mensagem = fluxo.salvar(insert); MessageBox.Show(mensagem); if (mensagem == "Cadastro com sucesso!") { this.Close(); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } }
public string alterar(Fluxo f) { FluxoDao login = new FluxoDao(); string aviso = verificar(f); if (aviso == "") { if (login.Alterar(f)) { aviso = "Alterado com sucesso!"; } else { aviso = "Não foi possivel alterar!"; } } return(aviso); }
public string salvar(Fluxo f) { FluxoDao login = new FluxoDao(); string aviso = verificar(f); if (aviso == "") { if (login.salvar(f)) { aviso = "Cadastro com sucesso!"; } else { aviso = "Erro ao cadastrar!"; } } return(aviso); }
private void btnLancar_Click(object sender, EventArgs e) { int contador = 0; Fluxo novoItem = new Fluxo(); foreach (Fluxo p in novoItem.listar()) { contador++; if (p.id == Convert.ToInt16(txtId.Text)) { try { string descricao = txtDescricao.Text; string entradaSaida = cbES.Text; double valor = Convert.ToDouble(txtValor.Text); int id = Convert.ToInt16(txtId.Text); Fluxo lancamento = new Fluxo(); lancamento.descricao = descricao; lancamento.entradaSaida = entradaSaida; lancamento.valor = valor; lancamento.id = id; lancamento.Update(); MessageBox.Show("Operação realizada com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Erro ao tentar alterar. " + ex.Message, "Falha na operação", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } else if (contador.Equals(p.listar().Count)) { MessageBox.Show("Id não encontrado", "Falha na opreação", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
void FixedUpdate() { GameObject fluxo = GameObject.Find("Fluxo"); estadoJogo = fluxo.GetComponent <Fluxo>(); if (estadoJogo.play) { tempo += Time.fixedDeltaTime; } if (GameObject.FindGameObjectsWithTag("Zombie").Length == 0 && tempo > 156) { tempo = 0; GameObject.Find("BarraFundo").GetComponent <AudioSource>().Stop(); telaVitoria.SetActive(true); estadoJogo.play = false; estadoJogo.fimJogo = true; Time.timeScale = 0f; } }
private void toolStripButton1_Click(object sender, EventArgs e) { var fluxo = new Fluxo(); //usuario fluxo.Id = Convert.ToInt32(cod); try { var login = new FluxoModel(); string mensagem = login.deletar(fluxo); if (mensagem != "") { MessageBox.Show(mensagem); this.Close(); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } }
public void CriarPlanta(int numero, Transform t) // Função para criar planta nos SQMs { GameObject fluxo = GameObject.Find("Fluxo"); estadoJogo = fluxo.GetComponent <Fluxo>(); if (estadoJogo.play == true) { if (PlantasUsar[numero].preco > sol) // Confere se tem sol para comprar a planta { return; } if (t.childCount != 0) // Confere se não tem filho para poder inserir { return; } GameObject g = Instantiate(PlantasUsar[PlantaUsar].gameObject, t.position, gameObject.transform.rotation) as GameObject; // instancia a planta no sqm escolhido g.transform.SetParent(t); // atualizarSol(-PlantasUsar[numero].preco); // Atualiza a quantidade de sol apos a compra da planta plantou = true; } }
private string verificar(Fluxo f) { string msg = ""; //tipo if (f.Tipo == "") { msg += "- Tipo Incorreto!? -\n"; } //mov if (f.Movimento == "") { msg += "- Defina o tipo de movimento! -\n"; } //pag if (f.Pagamento == "") { msg += "- Defina o tipo de pagamento! -\n"; } return(msg); }
private void btnApagar_Click(object sender, EventArgs e) { int contador = 0; DialogResult confirmar = MessageBox.Show("Deseja excluir registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); Fluxo novoItem = new Fluxo(); foreach (Fluxo p in novoItem.listar()) { contador++; if (p.id == Convert.ToInt16(txtID.Text)) { if (confirmar.ToString().ToUpper() == "YES") { try { Fluxo apagar = new Fluxo(); apagar.id = Convert.ToInt16(txtID.Text); apagar.delete(); MessageBox.Show("Operação realizada com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Erro ao tentar apagar. " + ex.Message, "Falha na operação", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } } else if (contador.Equals(p.listar().Count)) { MessageBox.Show("Id não encontrado", "Falha na opreação", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public void Insert(Client client, User user) { using var transaction = _context.Database.BeginTransaction(); try { _context.Entry(client).State = EntityState.Added; _context.Entry(client.Adress).State = EntityState.Added; _context.Phones.AddRange(client.Phones); var fluxo = new Fluxo(client, user, client.CurrentStatusId); _context.Entry(fluxo).State = EntityState.Added; _context.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } }
public bool Deletar(Fluxo f) { string sql = "DELETE FROM FLUXO_CAIXA WHERE INT_ID_FLUXO =" + f.Id.ToString(); Console.WriteLine(sql); try { SqlCommand cmd = new SqlCommand(sql, conn); int res = cmd.ExecuteNonQuery(); if (res > 0) { var = true; } } catch (Exception ex) { Console.WriteLine("erro: " + ex.ToString()); } finally { Conexao.fechaConexao(); } return(var); }
public void IncluirFluxo(Fluxo fluxo) { Fluxo = fluxo; Status = StatusSolicitacao.Aguardando; }
void FixedUpdate() { GameObject car = GameObject.Find("CartasPontos"); acessoUsados = car.GetComponent <Cartas>(); GameObject fluxo = GameObject.Find("Fluxo"); estadoJogo = fluxo.GetComponent <Fluxo>(); Ray r = Camera.main.ScreenPointToRay(Input.mousePosition); // Captura posição do mouse na tela RaycastHit2D hitsol = Physics2D.Raycast(r.origin, r.direction, 1f, 1 << LayerMask.NameToLayer("Sol")); RaycastHit2D hit = Physics2D.Raycast(r.origin, r.direction, 1f, 1 << LayerMask.NameToLayer("SQMs")); // Joga um "raio" para verificar se tem algo a partir de uma origem, em uma direção if (estadoJogo.play) { decrementarCooldown(); } if (Input.GetMouseButtonDown(0)) //Quando o mouse esquerdo for pressionado { if (hitsol.collider != null) { if (hitsol.collider.CompareTag("Sol")) // Caso a colisão seja com algo com a tag SOL { atualizarSol(25); // Chama a função atualizarSol para acrescentar 25 a quantidade total de sol Destroy(hitsol.collider.gameObject); // Destroy o objeto apos o uso solTotal += 25; GetComponent <AudioSource>().clip = sons[1]; GetComponent <AudioSource>().Play(); } } else if (hit.collider != null) //Se colidir com algo, entre no if { if (hit.collider.CompareTag("SQMs") && cartaSelecionada == true) // Se a colisão foi com a tag SQM, entre no if { Transform t = hit.collider.transform; // CriarPlanta(PlantaUsar, t); // Chama a função para criar a planta no sqm escolhido cartaSelecionada = false; if (plantou == true) { cooldownAtual[PlantaUsar] = cooldown[acessoUsados.usados[PlantaUsar]]; selecionado[PlantaUsar].SetActive(false); GetComponent <AudioSource>().clip = sons[0]; GetComponent <AudioSource>().Play(); plantou = false; } } else if (hit.collider.CompareTag("SQMs") && pa == true) { if (hit.collider.gameObject.transform.childCount > 0) { Destroy(hit.collider.gameObject.transform.GetChild(0).gameObject); pa = false; } else { pa = false; } } else { pa = false; } } } }
private void btnRefresh_Click(object sender, EventArgs e) { Fluxo novoItem = new Fluxo(); dgwFluxo.DataSource = novoItem.listar(); }
private static bool checkSyntax(Fluxo fluxo) { switch (fluxo) { case Fluxo.undef: switch (Enum.Parse(typeof(Program.lexema), getLexemaName(i))) { case Program.lexema.mIf: i++; return(checkSyntax(Fluxo.If)); case Program.lexema.id: i++; switch (Enum.Parse(typeof(Program.lexema), getLexemaName(i))) { case Program.lexema.mOpAlgebrico: i++; return(checkSyntax(Fluxo.ExpAlg)); case Program.lexema.mAtribuicao: i++; return(checkSyntax(Fluxo.Atribuicao)); default: i++; return(checkSyntax(Fluxo.ExpBool)); } case Program.lexema.mInt: i++; return(checkSyntax(Fluxo.Declaracao)); case Program.lexema.mString: i++; return(checkSyntax(Fluxo.Declaracao)); case Program.lexema.mSwitch: i++; return(checkSyntax(Fluxo.Switch)); case Program.lexema.mFor: i++; return(checkSyntax(Fluxo.For)); case Program.lexema.mWhile: i++; return(checkSyntax(Fluxo.While)); case Program.lexema.mPrintf: i++; return(checkSyntax(Fluxo.Printf)); default: return(false); } case Fluxo.Declaracao: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { return(true); } else if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mAtribuicao) { i++; if (checkSyntax(Fluxo.ExpAlg)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { return(true); } } } } break; case Fluxo.Atribuicao: if (checkSyntax(Fluxo.ExpAlg) || checkSyntax(Fluxo.ExpBool)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { return(true); } else { return(false); } } else { return(false); } case Fluxo.ExpBool: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.opRel) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.valor || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mString) { i++; return(true); } } } else if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.valor || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mString) { i++; return(true); } return(false); case Fluxo.ExpAlg: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.valor) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mOpAlgebrico) { i++; return(checkSyntax(Fluxo.ExpAlg)); } else { i--; return(true); } } return(false); case Fluxo.If: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lParen) { i++; checkSyntax(Fluxo.ExpBool); if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lChave) { i++; checkSyntax(Fluxo.undef); if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rChave) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mElse) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lChave) { i++; checkSyntax(Fluxo.undef); if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rChave) { return(true); } } else if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mIf) { i++; checkSyntax(Fluxo.If); } else { return(false); } } else { i--; return(true); } } } } } break; case Fluxo.Switch: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lChave) { i++; if (checkSyntax(Fluxo.Case)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rChave) { return(true); } } else { return(false); } } } } } return(false); case Fluxo.Case: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mCase) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.valor) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.DoisPontos) { i++; if (checkSyntax(Fluxo.undef)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mBreak) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i + 1)) == Program.lexema.mCase) { i++; return(checkSyntax(Fluxo.Case)); } else { return(true); } } } } else { return(false); } } } } break; case Fluxo.Iteracao: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mFor) { return(checkSyntax(Fluxo.For)); } else if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mWhile) { return(checkSyntax(Fluxo.While)); } else { return(false); } case Fluxo.For: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mInt || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id) { if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mInt) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) != Program.lexema.id) { return(false); } } i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mAtribuicao) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id || (Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.valor) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { i++; if (checkSyntax(Fluxo.ExpBool)) { if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.id) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mAtribuicao) { i++; if (checkSyntax(Fluxo.ExpAlg)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lChave) { i++; checkSyntax(Fluxo.undef); i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rChave) { return(true); } } } } } } } } } } } } } break; case Fluxo.While: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lParen) { i++; if (checkSyntax(Fluxo.ExpBool)) { if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lChave) { i++; if (checkSyntax(Fluxo.undef)) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rChave) { return(true); } } } } } } break; case Fluxo.Printf: if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.lParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.mString) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.rParen) { i++; if ((Program.lexema)Enum.Parse(typeof(Program.lexema), getLexemaName(i)) == Program.lexema.PontoVigula) { i++; return(true); } } } } break; default: return(false); } return(false); }
public Fluxo NovoFlux() { Fluxo f = new Fluxo(); f.Atual = Iniciar(); return f; }
public void SetFluxo(Fluxo fluxo) { Fluxo = fluxo; }