private void btnNovo_Click(object sender, EventArgs e) { ficha = geraNovoForm(); ficha.Operacao = "i"; //Setando o text do form de acordo com o Genero. String nome = ficha.Text.Substring(0, 1); if (nome == "a") { ficha.Text = "Nova " + ficha.Text.Substring(2); } if (nome == "o") { ficha.Text = "Novo " + ficha.Text.Substring(2); } Utilities.OpenMPSForm(ficha); }
private void btnAbrir_Click(object sender, EventArgs e) { if (this.dataGridView.SelectedCells.Count != 0) { ficha = geraNovoForm(); //string id = dataGridView.CurrentRow.Cells["id"].Value.ToString(); ficha.Id = dataGridView.CurrentRow.Cells["id"].Value.ToString(); ficha.CurrentRow = dataGridView.CurrentRow; ficha.Operacao = "u"; object currentRow = Utilities.GetRow(String.Format("select * from {0} where id={1}", Table, ficha.Id)); //Setando o text do form de acordo com o Genero. String nome = ficha.Text.Substring(0, 1); if (nome == "a") { ficha.Text = "Editando a " + ficha.Text.Substring(2); } if (nome == "o") { ficha.Text = "Editando o " + ficha.Text.Substring(2); } Utilities.OpenMPSForm(ficha); } }
private void btnExcluir_Click(object sender, EventArgs e) { if (dataGridView.CurrentRow != null) { ficha = geraNovoForm(); ficha.Id = dataGridView.CurrentRow.Cells["id"].Value.ToString(); ficha.Operacao = "d"; ficha.DeleteOperation(); } else { MessageBox.Show("Selecione um registro válido.","Erro", MessageBoxButtons.OK); } }
private void btnAbrir_Click(object sender, EventArgs e) { if (this.dataGridView.SelectedCells.Count != 0) { ficha = geraNovoForm(); //string id = dataGridView.CurrentRow.Cells["id"].Value.ToString(); ficha.Id = dataGridView.CurrentRow.Cells["id"].Value.ToString(); ficha.CurrentRow = dataGridView.CurrentRow; ficha.Operacao = "u"; object currentRow = Utilities.GetRow(String.Format("select * from {0} where id={1}",Table,ficha.Id)); //Setando o text do form de acordo com o Genero. String nome = ficha.Text.Substring(0, 1); if (nome == "a") ficha.Text = "Editando a " + ficha.Text.Substring(2); if (nome == "o") ficha.Text = "Editando o " + ficha.Text.Substring(2); Utilities.OpenMPSForm(ficha); } }
private void btnNovo_Click(object sender, EventArgs e) { ficha = geraNovoForm(); ficha.Operacao = "i"; //Setando o text do form de acordo com o Genero. String nome = ficha.Text.Substring(0,1); if (nome == "a") ficha.Text = "Nova " + ficha.Text.Substring(2); if (nome == "o") ficha.Text = "Novo " + ficha.Text.Substring(2); Utilities.OpenMPSForm(ficha); }
private NewForm geraNovoForm() { Assembly asm = this.Parent.GetType().Assembly; AssemblyName projectName = asm.GetName(); object obj = asm.CreateInstance(projectName.Name + "." + NovoForm); ficha = (NewForm)obj; //o MdiParent dele o Principal ficha.MdiParent = this.ParentForm.ParentForm; ficha.Pai = this.ParentForm; ficha.StartPosition = FormStartPosition.CenterScreen; return ficha; }