private void BtnSalvarJ_Click(object sender, EventArgs e) { if (ValidaControles()) { if (Incluir) { CadastroJogo oJogo = new CadastroJogo(); oJogo.AddMembrosj = TxtMembros.Text; oJogo.AddObjeto = TxtObjetos.Text; oJogo.Bairroj = TxtBairroJ.Text; oJogo.Cidadej = TxtCidadeJ.Text; oJogo.Dataj = TxtDateJ.Text; oJogo.DescricaoJ = TxtDescricaoJ.Text; oJogo.QtdPessoas = TxtPessoas.Text; oJogo.RuaJ = TxtRuaJ.Text; oJogo.TipoJ = TxtTipoJogo.Text; oJogo.Ufj = TxtUfJ.Text; oJogo.Valorj = TxtUfJ.Text; oJogo.Telefone = TxtTelefoneJ.Text; Bitmap bmp = new Bitmap(PbImagem.Image); MemoryStream memory = new MemoryStream(); bmp.Save(memory, ImageFormat.Bmp); byte[] Imagem = memory.ToArray(); oJogo.FotoJ = Imagem; _Control.Incluir(oJogo); } TxtMembros.Text = ""; TxtObjetos.Text = ""; TxtBairroJ.Text = ""; TxtCidadeJ.Text = ""; TxtDateJ.Text = ""; TxtDescricaoJ.Text = ""; TxtPessoas.Text = ""; TxtRuaJ.Text = ""; TxtTipoJogo.Text = ""; TxtUfJ.Text = ""; TxtUfJ.Text = ""; TxtTelefoneJ.Text = ""; PbImagem.Image = null; TxtAbrir.Text = String.Empty; CarregaGrid(); } }
private void GridJogo_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (GridJogo.Rows[e.RowIndex].DataBoundItem != null) { CadastroJogo oJogo = ((CadastroJogo)GridJogo.Rows[e.RowIndex].DataBoundItem); if (GridJogo.Columns[e.ColumnIndex].Name == "BtnAlterar") { Incluir = false; TxtMembros.Text = oJogo.AddMembrosj; TxtObjetos.Text = oJogo.AddObjeto; TxtBairroJ.Text = oJogo.Bairroj; TxtCidadeJ.Text = oJogo.Cidadej; TxtDateJ.Text = oJogo.Dataj; TxtDescricaoJ.Text = oJogo.DescricaoJ; TxtPessoas.Text = oJogo.QtdPessoas; TxtRuaJ.Text = oJogo.RuaJ; TxtTipoJogo.Text = oJogo.TipoJ; TxtUfJ.Text = oJogo.Ufj; TxtUfJ.Text = oJogo.Valorj; TxtTelefoneJ.Text = oJogo.Telefone; PbImagem.Image = null; TxtAbrir.Text = String.Empty; } else if (GridJogo.Columns[e.ColumnIndex].Name == "BtnExcluir") { _Control.Excluir(oJogo); TxtMembros.Text = ""; TxtObjetos.Text = ""; TxtBairroJ.Text = ""; TxtCidadeJ.Text = ""; TxtDateJ.Text = ""; TxtDescricaoJ.Text = ""; TxtPessoas.Text = ""; TxtRuaJ.Text = ""; TxtTipoJogo.Text = ""; TxtUfJ.Text = ""; TxtUfJ.Text = ""; TxtTelefoneJ.Text = ""; PbImagem.Image = null; TxtAbrir.Text = String.Empty; CarregaGrid(); } } }
public void Excluir(CadastroJogo oJogo) { _Repository.Excluir(oJogo); }
public void Alterar(CadastroJogo oJogo, bool attach = false) { _Repository.Alterar(oJogo, attach); }
public void Incluir(CadastroJogo oJogo) { _Repository.Incluir(oJogo); }
public void Incluir(CadastroJogo oCadastroJogo) { //odb.Entry(oCadastroUsuario).State = System.Data.Entity.EntityState.Added; odb.CadastroJogo.Add(oCadastroJogo); odb.SaveChanges(); }