public LinhaDeBaseCrud(long idLinhaDeBase = 0) { InitializeComponent(); if (idLinhaDeBase == 0) { linhaDeBase = new LinhaDeBase(); Text = "Criando nova Linha de Base"; return; } else { linhaDeBase = LinhaDeBaseService.GetById(idLinhaDeBase); } Text = "Editando Linha de Base: " + linhaDeBase.Nome; textNome.Text = linhaDeBase.Nome; numericTempo.Value = linhaDeBase.TempoApresentacao; numericPontos.Value = linhaDeBase.PontosTotais; panelCorBorda.BackColor = linhaDeBase.ColorBorda; panelCorFundo.BackColor = linhaDeBase.ColorFundo; panelCorQuadrado1.BackColor = linhaDeBase.ColorQuadrado1; panelCorQuadrado2.BackColor = linhaDeBase.ColorQuadrado2; panelCorQuadrado3.BackColor = linhaDeBase.ColorQuadrado3; }
private void btnSelecionarLinhaDeBase_Click(object sender, EventArgs e) { if (listViewLinhaDeBase.SelectedItems.Count == 0) { MessageBox.Show("Nenhuma Linha De Base selecionada!", "Advertência"); return; } experimento.LinhaDeBase = LinhaDeBaseService.GetById(ViewHelper.GetIdSelecionadoInListView(listViewLinhaDeBase)); textLinhaDeBase.Text = experimento.LinhaDeBase.Nome; }
private void btnSelecionarLinhaDeBase_Click(object sender, EventArgs e) { if (listViewLinhaDeBase.SelectedItems.Count == 0) { MessageBox.Show("Nenhuma Linha de Base selecionada!", "Advertência"); return; } long id = long.Parse(listViewLinhaDeBase.SelectedItems[0].SubItems[1].Text); LinhaDeBase linhaDeBase = LinhaDeBaseService.GetById(id); CopiarCores(linhaDeBase); Close(); }
private void btnDeletarLinhaDeBase_Click(object sender, EventArgs e) { if (listViewLinhaDeBase.SelectedItems.Count == 0) { MessageBox.Show("Nenhuma Linha de Base selecionada!", "Advertência"); return; } long id = long.Parse(listViewLinhaDeBase.SelectedItems[0].SubItems[1].Text); LinhaDeBase linhaDeBase = LinhaDeBaseService.GetById(id); LinhaDeBaseService.Deletar(linhaDeBase); CarregarListaLinhaDeBase(); MessageBox.Show("Linha de Base deletada com sucesso!", "Sucesso"); }