private void grid_DoubleClick(object sender, EventArgs e) { Rele obj = bll.get(Convert.ToInt32(grid.Rows[grid.SelectedCells[0].RowIndex].Cells[0].Value.ToString())); TipoRele objtiporele = blltiporele.get(obj.tipo); mostrar(obj, objtiporele); }
private void btnConfirmar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNome.Text)) { MessageBox.Show("Informe o nome do Tipo do Rele!"); return; } TipoRele obj = new TipoRele(); if (string.IsNullOrEmpty(txtCodigo.Text)) { obj.nome = txtNome.Text; obj.dateinsert = DateTime.Now; bll.insert(obj); MessageBox.Show("Tipo do Rele cadastrado com sucesso!"); } else { obj.id = Convert.ToInt32(txtCodigo.Text); obj.nome = txtNome.Text; obj.dateupdate = DateTime.Now; obj.dateinsert = this.obj.dateinsert; bll.update(obj); MessageBox.Show("Tipo do Rele atualizado com sucesso!"); } tabControl1.SelectedIndex = 0; atualiza(""); }
public void mostrar(TipoRele obj) { this.obj = obj; txtCodigo.Text = obj.id.ToString(); txtNome.Text = obj.nome; tabControl1.SelectedIndex = 1; }
public void cadastros() { if (blltiporele.getAll("", "nome") == null) { TipoRele tiporele = new TipoRele(); tiporele.nome = "PRODUTO"; tiporele.dateinsert = DateTime.Now; blltiporele.insert(tiporele); tiporele = new TipoRele(); tiporele.nome = "FUNCAO"; tiporele.dateinsert = DateTime.Now; blltiporele.insert(tiporele); } }
public void mostrar(Rele obj, TipoRele objTipoRele) { this.obj = obj; txtCodigo.Text = obj.id.ToString(); txtCodigoRele.Text = obj.codigo; txtNome.Text = obj.nome; if (objTipoRele == null) { cboTipo.SelectedIndex = -1; } else { cboTipo.SelectedItem = objTipoRele.id + "-" + objTipoRele.nome; } tabControl1.SelectedIndex = 1; }