private void frmEditarOperacao_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.Cancel) { return; } var operacaoTipo = (OperacaoTipo)comboBoxOperacao.SelectedItem; if (operacaoTipo.SinalPositivo) { SalvarAlteracoes(); return; } var codigo = (string)comboBoxAtivo.SelectedValue; var acaoAtual = Acoes.FirstOrDefault(a => a.Codigo == codigo); var qtdDisponivel = acaoAtual == null ? 0 : Operacao.OperacaoId == 0 ? acaoAtual.Qtd : Operacao.QtdAntes; var qtd = (int)nudQtd.Value; if (qtd <= qtdDisponivel) { SalvarAlteracoes(); return; } MessageBox.Show($"{codigo} - Qtd anterior: {Operacao.QtdAntes}\n\nNão há 'saldo' para a {operacaoTipo.Tipo} de {qtd:N0} ações.", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); nudQtd.Focus(); e.Cancel = true; }
private void dgvRegistros_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { txtNome.Enabled = true; chkInativo.Enabled = true; gbxDadosCadastrais.Enabled = true; bntSalvar.Enabled = true; bntCancelar.Enabled = true; bntInativar.Enabled = true; chkPesqInativo.Checked = false; txtNomePesquisar.Text = string.Empty; //pegamos a linha selecionada no grid por meio de paCON_etro e //Se o usuario clicou na linha entao o rowIndex será > ou igual a 0 if (e.RowIndex >= 0) { txtID.Text = dgvRegistros.Rows[e.RowIndex].Cells[0].Value.ToString(); txtNome.Text = dgvRegistros.Rows[e.RowIndex].Cells[1].Value.ToString(); if (dgvRegistros.Rows[e.RowIndex].Cells[5].Value.ToString() == "Inativo") { chkInativo.Checked = true; } else { chkInativo.Checked = false; } } //define a acao acao = Acoes.alterar; txtNome.Focus(); }
public static void insertsIniciais() { StatusDAO statusDAO = new StatusDAO(); if (statusDAO.checarInserts() == 0) { for (int i = 0; i < insertStatus.Length; i++) { Status status = new Status(); status.Nome = insertStatus[i]; statusDAO.insert(status); } EstadosDAO estadosDAO = new EstadosDAO(); for (int i = 0; i < insertEstados.Length; i++) { Estados estado = new Estados(); estado.Nome = insertEstados[i]; estado.Sigla = insertSiglas[i]; estadosDAO.insert(estado); } AcoesDAO acoesDAO = new AcoesDAO(); for (int i = 0; i < insertAcoes.Length; i++) { Acoes acao = new Acoes(); acao.Descricao = insertAcoes[i]; acoesDAO.insert(acao); } } }
private void FrmLogs_Activated(object sender, EventArgs e) { //Carrega os Usuarios no comboBox try { Usuarios usuarios = new Usuarios(); ArrayList array = usuarios.selectArray("order by nome"); comboUsuario.DataSource = array; comboUsuario.DisplayMember = "nome"; comboUsuario.ValueMember = "id"; } catch { } //Carrega as ações no comboBox try { Acoes acoes = new Acoes(); ArrayList array = acoes.selectArray("order by descricao"); comboAcao.DataSource = array; comboAcao.DisplayMember = "descricao"; comboAcao.ValueMember = "id"; } catch { } }
public async Task <IActionResult> Create(int id, [Bind("Id,Acao,Quantidade,Preco,Tipo,Data_hora,Observacao")] Acoes acoes) { if (id != acoes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(acoes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcoesExists(acoes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(acoes)); }
// // Exibe as ações // @return <não há> // @param <posicao> <posição em que a ação será instancializada> // @param <nomeEvento> <evento no qual esta ação fará parte> // @exception <não há exceções> // public void exibirAcoes(int posicao, string nomeEvento) { listaAcoes.SetActive(true); ac = FindObjectOfType(typeof(Acoes)) as Acoes; ac.Posicao = posicao; ac.NomeEvento = nomeEvento; }
public ActionResult ListaAcoes() { Acoes obj = new Acoes(); obj.NomeFaculdade = "hiago"; return(View(obj)); }
public void ComecaJogo(List <Player> Jogadores, List <Peao> PeoesJogo) { this.player = Jogadores; jogouSeis = false; numTurnos = 1; proximaAcao = Acoes.JogarDado; TurnoJogador = this.player[0]; }
public ActionResult <Acoes> cadastrarAcoes([FromBody] Acoes acao) { acao.Id = Guid.NewGuid(); dataContext.Acoes.Add(acao); dataContext.SaveChanges(); return(acao); }
public ActionResult <Guid> excluirById(Guid id) { Acoes acao = dataContext.Acoes.Where(acaoTemp => acaoTemp.Id == id).FirstOrDefault(); if (acao != null) { dataContext.Acoes.Remove(acao); dataContext.SaveChanges(); } return(id); }
public ActionResult <Guid> atualizarAcoes([FromBody] Acoes acaoEdit) { Acoes acao = dataContext.Acoes.Where(acaoTemp => acaoTemp.Id == acaoEdit.Id).FirstOrDefault(); if (acao != null) { acao.Id = acaoEdit.Id; dataContext.Acoes.Update(acao); dataContext.SaveChanges(); } return(acao.Id); }
//private void bntPesquisar_Click(object sender, EventArgs e) //{ // //volta para acao incluir // acao = Acoes.incluir; // //desabilita o botao cancelar // bntCancelar.Enabled = false; // bntSalvar.Enabled = false; // gbxPerfil.Enabled = false; // //define ativo e inativo // string ativo; // if (chkPesqInativos.Checked == true) // { ativo = "'1'"; } // else // { ativo = "'0'"; } // string txtusuariopesquisar; // if (txtUsuarioPesquisar.Text.Length > 0) // { txtusuariopesquisar = " and us_nome like '" + txtUsuarioPesquisar.Text + "%'"; } // else // { txtusuariopesquisar = " "; } // string nomefuncionario; // if (txtNomePesquisar.Text.Length > 0 && chkQualquerParte.Checked == true) // { nomefuncionario = " and us_nome like '%" + txtNomePesquisar.Text + "%'"; } // else if (txtNomePesquisar.Text.Length > 0) // { nomefuncionario = " and us_nome like '" + txtNomePesquisar.Text + "%'"; } // else // { nomefuncionario = " "; } // string usuarios = "SELECT US_ID , US_NOME, US_EMAIL, US_LOGIN, REPLACE(REPLACE(REPLACE( US_PERFIL, '1','Master'), '2','Administrativo'), '3','Consultor') as US_PERFIL, US_CADASTRO, us_senha, us_inativo from USUARIOS where us_inativo = " + ativo + txtusuariopesquisar + nomefuncionario+" "; // dgvUsuarios.DataSource = null; // //MessageBox.Show(usuarios); // //usando a classe de conexao // ConexaoBanco conexao = new ConexaoBanco(); // conexao.ConexaoString(); // int i = 0; // SqlCommand cmd = new SqlCommand(usuarios, ConexaoBanco.conn); // SqlDataAdapter da = new SqlDataAdapter(cmd); // DataTable dt = new DataTable(); // da.Fill(dt); // if (dt != null && dt.Rows.Count > 0) // { // if (dgvUsuarios.Rows.Count > 0) // { dgvUsuarios.Rows.Clear(); } // dgvUsuarios.Rows.Add(dt.Rows.Count); // foreach (DataRow rw in dt.Rows) // { // dgvUsuarios.Rows[i].Cells[0].Value = rw["US_ID"].ToString(); // dgvUsuarios.Rows[i].Cells[1].Value = rw["US_NOME"].ToString(); // dgvUsuarios.Rows[i].Cells[2].Value = rw["US_EMAIL"].ToString(); // dgvUsuarios.Rows[i].Cells[3].Value = rw["US_LOGIN"].ToString(); // dgvUsuarios.Rows[i].Cells[4].Value = rw["US_PERFIL"].ToString(); // dgvUsuarios.Rows[i].Cells[5].Value = rw["US_CADASTRO"].ToString(); // dgvUsuarios.Rows[i].Cells[6].Value = rw["US_SENHA"].ToString(); // dgvUsuarios.Rows[i].Cells[7].Value = rw["US_inativo"].ToString(); // i = i + 1; // } // } // ConexaoBanco.conn.Close(); // limpaCampos(); //} private void btnPesquisar2_Click(object sender, EventArgs e) { acao = Acoes.incluir; //desabilita o botao cancelar bntCancelar.Enabled = false; bntSalvar.Enabled = false; gbxPerfil.Enabled = false; //define ativo e inativo string ativo; if (chkPesqInativos.Checked == true) { ativo = "'1'"; } else { ativo = "'0'"; } string txtusuariopesquisar; if (txtUsuarioPesquisar.Text.Length > 0) { txtusuariopesquisar = " and us_nome like '" + txtUsuarioPesquisar.Text + "%'"; } else { txtusuariopesquisar = " "; } string nomefuncionario; if (txtNomePesquisar.Text.Length > 0 && chkQualquerParte.Checked == true) { nomefuncionario = " and us_nome like '%" + txtNomePesquisar.Text + "%'"; } else if (txtNomePesquisar.Text.Length > 0) { nomefuncionario = " and us_nome like '" + txtNomePesquisar.Text + "%'"; } else { nomefuncionario = " "; } string usuarios = "SELECT US_ID , US_NOME, US_EMAIL, US_LOGIN, REPLACE(REPLACE(REPLACE( US_PERFIL, '1','Master'), '2','Administrativo'), '3','Consultor') as US_PERFIL, US_CADASTRO, us_senha, us_inativo from USUARIOS where us_inativo = " + ativo + txtusuariopesquisar + nomefuncionario + " "; this.Cursor = Cursors.WaitCursor; grid.GridPopularDataSource(dgvUsuarios, usuarios); this.Cursor = Cursors.Default; }
private void bntIncluir_Click_1(object sender, EventArgs e) { gbxDadosCadastrais.Enabled = true; bntCancelar.Enabled = true; bntInativar.Enabled = true; bntSalvar.Enabled = true; txtNome.Enabled = true; acao = Acoes.incluir; limpaCampos(); txtNome.Focus(); idUsuario(); txtID.Text = codigo.ToString(); }
public ActionResult Lista(FormCollection form) { Acoes obj = new Acoes(); obj.NomeFaculdade = Convert.ToString(form["NomeFaculdade"]); obj.LocalFaculdade = Convert.ToString(form["LocalFaculdade"]); obj.InicioAcao = Convert.ToString(form["InicioAcao"]); obj.TerminoAcao = Convert.ToString(form["TerminoAcao"]); obj.QuantFunc = Convert.ToString(form["QuantFunc"]); obj.QuantCartao = Convert.ToString(form["QuantCartao"]); return(View(obj)); }
private void bntCancelar_Click(object sender, EventArgs e) { bntIncluir.Enabled = true; //limpa campos this.limpaCampos(); //volta para acao incluir acao = Acoes.incluir; //desabilita o botao cancelar bntCancelar.Enabled = false; bntSalvar.Enabled = false; gbxPerfil.Enabled = false; }
public void Load_DGV() { //volta para acao incluir acao = Acoes.incluir; //desabilita o botao cancelar bntCancelar.Enabled = false; bntSalvar.Enabled = false; gbxDadosCadastrais.Enabled = false; txtNome.Enabled = false; string usuarios = "SELECT [CON_CODIGO],[CON_NOME],[CON_CADASTRO],[CON_ATUALIZACAO],[CON_USUARIO],replace(replace([CON_INATIVO] ,'1','Inativo'),'0','Ativo') as CON_INATIVO FROM [dbo].[CLIENTES_CONCORRENTE] where CON_INATIVO = '0'"; //usando a classe de conexao ConexaoBanco conexao = new ConexaoBanco(); conexao.ConexaoString(); int i = 0; SqlCommand cmd = new SqlCommand(usuarios, ConexaoBanco.conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt != null && dt.Rows.Count > 0) { if (dgvRegistros.Rows.Count > 0) { dgvRegistros.Rows.Clear(); } dgvRegistros.Rows.Add(dt.Rows.Count); foreach (DataRow rw in dt.Rows) { dgvRegistros.Rows[i].Cells[0].Value = rw["CON_CODIGO"].ToString(); dgvRegistros.Rows[i].Cells[1].Value = rw["CON_NOME"].ToString(); dgvRegistros.Rows[i].Cells[2].Value = rw["CON_CADASTRO"].ToString(); dgvRegistros.Rows[i].Cells[3].Value = rw["CON_ATUALIZACAO"].ToString(); dgvRegistros.Rows[i].Cells[4].Value = rw["CON_USUARIO"].ToString(); dgvRegistros.Rows[i].Cells[5].Value = rw["CON_INATIVO"].ToString(); i = i + 1; } } ConexaoBanco.conn.Close(); limpaCampos(); }
private void criarAcoes() { switch (DiaRelatorio.TipoDia) { case ETipoDiaRelatorio.FALTOU: case ETipoDiaRelatorio.FERIADO: Acoes.Add(new AcaoViewModel(this, AcaoViewModel.EAcao.Criar)); break; case ETipoDiaRelatorio.TRABALHO: case ETipoDiaRelatorio.FERIADO_TRABALHADO: Acoes.Add(new AcaoViewModel(this, AcaoViewModel.EAcao.Editar)); break; } }
private void bntIncluir_Click(object sender, EventArgs e) { txtNome.Enabled = true; txtUsuario.Enabled = true; acao = Acoes.incluir; this.limpaCampos(); gbxPerfil.Visible = true; gbxPerfil.Enabled = true; rbtAdministrador.Checked = true; bntSalvar.Enabled = true; bntCancelar.Enabled = true; txtNome.Focus(); idUsuario(); txtID.Text = codigo.ToString(); }
private void dgvUsuarios_CellClick_1(object sender, DataGridViewCellEventArgs e) { try { grid.GridRemoveNulos(dgvUsuarios, e.RowIndex); gbxPerfil.Enabled = false; bntSalvar.Enabled = false; bntCancelar.Enabled = false; if (e.RowIndex >= 0) { grid.GridRemoveNulos(dgvUsuarios, e.RowIndex); txtID.Text = dgvUsuarios.Rows[e.RowIndex].Cells[0].Value.ToString(); txtNome.Text = dgvUsuarios.Rows[e.RowIndex].Cells[1].Value.ToString(); txtEmail.Text = dgvUsuarios.Rows[e.RowIndex].Cells[2].Value.ToString(); txtUsuario.Text = dgvUsuarios.Rows[e.RowIndex].Cells[3].Value.ToString(); txtSenha.Text = dgvUsuarios.Rows[e.RowIndex].Cells[6].Value.ToString(); if (dgvUsuarios.Rows[e.RowIndex].Cells[7].Value.ToString() == "1") { chkInativo.Checked = true; } else { chkInativo.Checked = false; } if (dgvUsuarios.Rows[e.RowIndex].Cells[4].Value.ToString().Trim() == "Master") { rbtAdministrador.Checked = true; } else if (dgvUsuarios.Rows[e.RowIndex].Cells[4].Value.ToString().Trim() == "Administrativo") { rbtAuxiliarAdm.Checked = true; } else { rbtConsultor.Checked = true; } //habilita o botao cancelar bntCancelar.Enabled = true; //define a acao acao = Acoes.alterar; } } catch (Exception) { throw; } }
// Use this for initialization void Start() { // Ocultar Cursor do Mouse Cursor.visible = false; Cursor.lockState = CursorLockMode.Confined; // Inicializaçao da variavel de Movimento move = GetComponent<Movimento> (); olhar = GetComponent<Olhar> (); acoes = GetComponent<Acoes> (); mira = GameObject.Find ("Mira").GetComponent<Mira> (); travarOlhar = false; travarMovimento = false; travarAcoes = false; }
//METODO 4 public void Load_DGV() { //volta para acao incluir acao = Acoes.incluir; //desabilita o botao cancelar bntCancelar.Enabled = false; bntSalvar.Enabled = false; gbxPerfil.Enabled = false; string usuarios = "SELECT US_ID , US_NOME, US_EMAIL, US_LOGIN, REPLACE(REPLACE(REPLACE( US_PERFIL, '1','Master'), '2','Administrativo'), '3','Consultor') as US_PERFIL, US_CADASTRO, us_senha, us_inativo from USUARIOS where us_inativo = '0'"; Grid grid = new Grid(); grid.GridPopularDataSource(dgvUsuarios, usuarios); limpaCampos(); ////usando a classe de conexao //ConexaoBanco conexao = new ConexaoBanco(); //conexao.ConexaoString(); //int i = 0; //SqlCommand cmd = new SqlCommand(usuarios, ConexaoBanco.conn); //SqlDataAdapter da = new SqlDataAdapter(cmd); //DataTable dt = new DataTable(); //da.Fill(dt); //if (dt != null && dt.Rows.Count > 0) //{ // if (dgvUsuarios.Rows.Count > 0) // { dgvUsuarios.Rows.Clear(); } // dgvUsuarios.Rows.Add(dt.Rows.Count); // foreach (DataRow rw in dt.Rows) // { // dgvUsuarios.Rows[i].Cells[0].Value = rw["US_ID"].ToString(); // dgvUsuarios.Rows[i].Cells[1].Value = rw["US_NOME"].ToString(); // dgvUsuarios.Rows[i].Cells[2].Value = rw["US_EMAIL"].ToString(); // dgvUsuarios.Rows[i].Cells[3].Value = rw["US_LOGIN"].ToString(); // dgvUsuarios.Rows[i].Cells[4].Value = rw["US_PERFIL"].ToString(); // dgvUsuarios.Rows[i].Cells[5].Value = rw["US_CADASTRO"].ToString(); // dgvUsuarios.Rows[i].Cells[6].Value = rw["US_SENHA"].ToString(); // dgvUsuarios.Rows[i].Cells[7].Value = rw["US_inativo"].ToString(); // i = i + 1; // } //} //ConexaoBanco.conn.Close(); }
private void dgvUsuarios_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { gbxPerfil.Enabled = true; bntSalvar.Enabled = true; bntCancelar.Enabled = true; if (e.RowIndex <= 0) { return; } int sRow = e.RowIndex; grid.GridRemoveNulos(dgvUsuarios, sRow); txtID.Text = dgvUsuarios.Rows[e.RowIndex].Cells[0].Value.ToString().Trim(); primaryKey = int.Parse(dgvUsuarios.Rows[e.RowIndex].Cells[0].Value.ToString().Trim()); txtNome.Text = dgvUsuarios.Rows[e.RowIndex].Cells[1].Value.ToString().Trim(); txtEmail.Text = dgvUsuarios.Rows[e.RowIndex].Cells[2].Value.ToString().Trim(); txtUsuario.Text = dgvUsuarios.Rows[e.RowIndex].Cells[3].Value.ToString().Trim(); txtSenha.Text = dgvUsuarios.Rows[e.RowIndex].Cells[6].Value.ToString().Trim(); if (dgvUsuarios.Rows[e.RowIndex].Cells[7].Value.ToString().Trim() == "1") { chkInativo.Checked = true; } else { chkInativo.Checked = false; } if (dgvUsuarios.Rows[e.RowIndex].Cells[4].Value.ToString().Trim() == "Master") { rbtAdministrador.Checked = true; } else if (dgvUsuarios.Rows[e.RowIndex].Cells[4].Value.ToString().Trim() == "Administrativo") { rbtAuxiliarAdm.Checked = true; } else { rbtConsultor.Checked = true; } //habilita o botao cancelar bntCancelar.Enabled = true; //define a acao acao = Acoes.alterar; txtNome.Focus(); }
static void Main(string[] args) { Acoes funcao = new Acoes(); Aluno[] alunos = new Aluno[5]; int indice = 0; string op = ObterOpcao(); while (op.ToUpper() != "X") { switch (op) { case "1": if (indice == alunos.Length) { Console.WriteLine("Não é possível cadastrar mais alunos"); } funcao.AdicionarAluno(alunos, ref indice); // adicionar aluno break; case "2": funcao.ListarAlunos(alunos, ref indice); //Listar alunos break; case "3": //Calcular média geral break; default: Console.WriteLine("Digite um valor válido!"); break; } op = ObterOpcao(); if (op.ToUpper() == "X") { Console.WriteLine("Encerrando \n Obrigado!"); } }
public ArrayList selectArray(string options = "") { ArrayList dados = new ArrayList(); MySqlConnection cn = new MySqlConnection(dbConnection.Conecta); cn.Open(); MySqlCommand cmd = new MySqlCommand("select * from acoes " + options, cn); MySqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Acoes acoes = new Acoes(); acoes.Id = Convert.ToInt16(dr["id_acao"]); acoes.Descricao = dr["descricao"].ToString(); dados.Add(acoes); } dr.Close(); cn.Close(); return(dados); }
private void bntPesquisar_Click(object sender, EventArgs e) { if (dgvRegistros.Rows.Count > 0) { dgvRegistros.Rows.Clear(); } //volta para acao incluir acao = Acoes.incluir; //desabilita o botao cancelar txtNome.Enabled = false; bntCancelar.Enabled = false; bntSalvar.Enabled = false; bntInativar.Enabled = false; gbxDadosCadastrais.Enabled = false; //define ativo e inativo string ativo; if (chkPesqInativo.Checked == true) { ativo = "'1'"; } else { ativo = "'0'"; } string pesquisarRegistro; if (txtNomePesquisar.Text.Length > 0 && chkQualquerParte.Checked == true) { pesquisarRegistro = " and CON_nome like '%" + txtNomePesquisar.Text + "%'"; } else if (txtNomePesquisar.Text.Length > 0) { pesquisarRegistro = " and CON_nome like '" + txtNomePesquisar.Text + "%'"; } else { pesquisarRegistro = " "; } string usuarios = "SELECT [CON_CODIGO],[CON_NOME],[CON_CADASTRO],[CON_ATUALIZACAO],[CON_USUARIO], replace(replace([CON_INATIVO],'1','Inativo'),'0','Ativo') AS CON_INATIVO FROM [dbo].[CLIENTES_CONCORRENTE] where CON_inativo = " + ativo + pesquisarRegistro + " "; //MessageBox.Show(usuarios); //usando a classe de conexao ConexaoBanco conexao = new ConexaoBanco(); conexao.ConexaoString(); int i = 0; SqlCommand cmd = new SqlCommand(usuarios, ConexaoBanco.conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt != null && dt.Rows.Count > 0) { if (dgvRegistros.Rows.Count > 0) { dgvRegistros.Rows.Clear(); } dgvRegistros.Rows.Add(dt.Rows.Count); foreach (DataRow rw in dt.Rows) { dgvRegistros.Rows[i].Cells[0].Value = rw["CON_CODIGO"].ToString(); dgvRegistros.Rows[i].Cells[1].Value = rw["CON_NOME"].ToString(); dgvRegistros.Rows[i].Cells[2].Value = rw["CON_CADASTRO"].ToString(); dgvRegistros.Rows[i].Cells[3].Value = rw["CON_ATUALIZACAO"].ToString(); dgvRegistros.Rows[i].Cells[4].Value = rw["CON_USUARIO"].ToString(); dgvRegistros.Rows[i].Cells[5].Value = rw["CON_INATIVO"].ToString(); i = i + 1; } } ConexaoBanco.conn.Close(); limpaCampos(); }
public void EncerrarJogo() { proximaAcao = Acoes.EncerrarJogo; }
//METODO 6 public void incluiContato() { if (verificaCamposPreenchidos() != "") { MessageBox.Show("Necessário preenchimento do(s) campo(s): \n\n" + this.msg, "Preencha os campos"); return; } string query = "select us_login from usuarios where rtrim(ltrim(us_login)) = '" + txtUsuario.Text.Trim() + "'"; //bool nomerepetido; //bool resultado = verificaNomeRepetido(); //nomerepetido = resultado; if (sql.verificaRepetido(query)) { MessageBox.Show("Já existe um usuário com esse nome", "Nome repetido!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtUsuario.Focus(); return; } if (IsEmail(txtEmail.Text) == false) { MessageBox.Show("Verifique o formato do E-mail", "E-mail Invalido"); } else { if (chkInativo.Checked == true) { MessageBox.Show("Não é possivel incluir um novo cadastro como inativo", "Erro"); return; } ConexaoBanco conexao = new ConexaoBanco(); ConexaoBanco.conn.Open(); string id = txtID.Text; string nome = txtNome.Text; string email = txtEmail.Text; string usuario = txtUsuario.Text; string senha = txtSenha.Text; string dataCadasto = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); string perfil = verificaTipoFuncionario(); string inativo = "0"; SqlCommand cmd = new SqlCommand(); cmd.Connection = ConexaoBanco.conn; cmd.CommandText = "INSERT INTO usuarios(us_id, us_nome, us_email, us_login , us_senha, us_perfil, us_cadastro,us_inativo) VALUES (@param1,@param2,@param3,@param4,@param5,@param6,@param7, @param8)"; cmd.Parameters.AddWithValue("@param1", id); cmd.Parameters.AddWithValue("@param2", nome); cmd.Parameters.AddWithValue("@param3", email); cmd.Parameters.AddWithValue("@param4", usuario); cmd.Parameters.AddWithValue("@param5", senha); cmd.Parameters.AddWithValue("@param6", perfil); cmd.Parameters.AddWithValue("@param7", dataCadasto); cmd.Parameters.AddWithValue("@param8", inativo); cmd.ExecuteNonQuery(); ConexaoBanco.conn.Close(); //muda ação para incluir que é o valor default acao = Acoes.incluir; //desabilita o botao cancelar gbxPerfil.Enabled = false; Load_DGV(); } }
public IArCondicionado ExecutarCriacao(Acoes acao, double temperatura) { return(_factories[acao].Criar(temperatura)); }
public Opcao(Acoes acao, string descricao) { Acao = acao; Descricao = descricao; }
void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Acoes acoes = new Acoes(); acoes.janela = janela; acoes.retornno = retornno; acoes.slider = slider; acoes.texto = e.Result.Text; acoes.reconhecer(); }
public void incluiContato() { if (txtNome.Text == "") { MessageBox.Show("O Nome não pode ficar vazio", "Preencha os campos"); return; } bool nomerepetido; bool resultado = verificaNomeRepetido(); nomerepetido = resultado; if (nomerepetido) { MessageBox.Show("Já existe um Registro com esse nome", "Nome repetido!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtNome.Focus(); return; } if (chkInativo.Checked == true) { MessageBox.Show("Não é possivel incluir um novo cadastro como inativo", "Erro"); return; } ConexaoBanco conexao = new ConexaoBanco(); ConexaoBanco.conn.Open(); string id = txtID.Text; string nome = txtNome.Text; string dataCadasto = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); string inativo = "0"; string usuario = "1"; SqlCommand cmd = new SqlCommand(); cmd.Connection = ConexaoBanco.conn; cmd.CommandText = "insert into CLIENTES_CONCORRENTE ([CON_CODIGO],[CON_NOME],[CON_CADASTRO],[CON_ATUALIZACAO] ,[CON_USUARIO] ,[CON_INATIVO]) values (@param1,@param2,@param3,@param4,@param5,@param6)"; cmd.Parameters.AddWithValue("@param1", id); cmd.Parameters.AddWithValue("@param2", nome); cmd.Parameters.AddWithValue("@param3", dataCadasto); cmd.Parameters.AddWithValue("@param4", dataCadasto); cmd.Parameters.AddWithValue("@param5", usuario); cmd.Parameters.AddWithValue("@param6", inativo); cmd.ExecuteNonQuery(); ConexaoBanco.conn.Close(); //muda ação para incluir que é o valor default acao = Acoes.incluir; //desabilita o botao cancelar gbxDadosCadastrais.Enabled = false; Load_DGV(); }
public void insert(Acoes acaoInf) { db.Acoes.Add(acaoInf); db.SaveChanges(); }