private void cboxFilter_SelectedIndexChanged(object sender, EventArgs e) { lblTitle.Text = "Selecione a sala desejada para visualizar a lista de participantes."; listBoxStage1.DataSource = null; listBoxStage2.DataSource = null; lblName.Text = "Nome:"; txtSearch.Visible = true; btnSearch.Visible = true; if (cboxFilter.Text == "Treinamento") { lblStage1.Text = "Participantes da etapa 1:"; lblStage2.Text = "Participantes da etapa 2:"; listBoxStage2.Visible = true; lblStage2.Visible = true; SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); TableResponse r = spaceBLL.GetAllTable(); dataGridView1.DataSource = r.DataTable; dataGridView1.Columns["Nome"].Width = 375; dataGridView1.Columns["LotaçãoMáxima"].Visible = false; } else { lblStage1.Text = "Participantes da etapa 1 e 2:"; listBoxStage2.Visible = false; lblStage2.Visible = false; SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); TableResponse r = spaceBLL.GetAllTable(); dataGridView1.DataSource = r.DataTable; dataGridView1.Columns["Nome"].Width = 375; } }
private void novoEventoToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Criar um novo evento apagará todos os registros de pessoas e salas. Deseja continuar?", "ATENÇÂO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } else { SpaceTrainingBLL spaceTBLL = new SpaceTrainingBLL(); SpaceCoffeeBLL spaceCBLL = new SpaceCoffeeBLL(); PersonBLL personBLL = new PersonBLL(); Response r1 = spaceTBLL.DeleteAll(); Response r2 = personBLL.DeleteAll(); Response r3 = spaceCBLL.DeleteAll(); lblTwo.Visible = false; lblThree.Visible = false; lblFour.Visible = false; btnInsertTrainingSpace.Visible = false; btnInsertCoffeeSpace.Visible = false; btnExecute.Visible = false; btnNext1.Visible = false; btnNext2.Visible = false; btnNext3.Visible = false; consultaToolStripMenuItem.Visible = false; lblTitle.Text = "SIGA O PASSO A PASSO"; lblOne.Visible = true; btnInsertPerson.Visible = true; MessageBox.Show(r1.Message); } }
private void btnNext_Click(object sender, EventArgs e) { space.Name = txtName.Text; SpaceTrainingBLL spaceTrainingBLL = new SpaceTrainingBLL(); Response r = spaceTrainingBLL.Insert(space); MessageBox.Show(r.Message); this.Close(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (cboxFilter.Text == "Treinamento") { //chamar método para pegar o ID da sala: id SpaceTraining space = new SpaceTraining(); space.Name = dataGridView1.Rows[e.RowIndex].Cells["Nome"].Value.ToString(); space.MaxCapacity = int.Parse(dataGridView1.Rows[e.RowIndex].Cells["LotaçãoMáxima"].Value.ToString()); SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); SingleResponse <SpaceTraining> r = spaceBLL.Get(space); SpaceTraining newSpace = r.Data; //chamar método para apresentar participantes da etapa 1 e 2 PersonBLL personBLL = new PersonBLL(); TableResponse r1 = personBLL.GetAllByStage1ID(newSpace); TableResponse r2 = personBLL.GetAllByStage2ID(newSpace); //list1: listBoxStage1.DataSource = null; listBoxStage1.DataSource = r1.DataTable; listBoxStage1.DisplayMember = "Nome"; //list2: listBoxStage2.DataSource = null; listBoxStage2.DataSource = r2.DataTable; listBoxStage2.DisplayMember = "Nome"; lblTitle.Text = "Mostrando participantes da sala de treinamento: " + space.Name; } else { //chamar método para pegar o ID do espaço de café: id SpaceCoffee space = new SpaceCoffee(); space.Name = dataGridView1.Rows[e.RowIndex].Cells["Nome"].Value.ToString(); SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); SingleResponse <SpaceCoffee> r = spaceBLL.Get(space); SpaceCoffee newSpace = r.Data; //chamar método para apresentar participantes do intervalo para café PersonBLL personBLL = new PersonBLL(); TableResponse r1 = personBLL.GetAllByCoffeeID(newSpace); //list1: select * from persons where coffeeid1 = id listBoxStage1.DataSource = null; listBoxStage1.DataSource = r1.DataTable; listBoxStage1.DisplayMember = "Nome"; lblTitle.Text = "Mostrando participantes do espaço para café: " + space.Name; } }
private void btnNext2_Click(object sender, EventArgs e) { SpaceTrainingBLL spaceTBLL = new SpaceTrainingBLL(); QueryResponse <SpaceTraining> response = spaceTBLL.GetAllList(); if (response.Data.Count == 0) { MessageBox.Show("Você deve cadastrar as salas de treinamento antes de ir ao próximo passo."); } else { lblThree.Visible = true; btnInsertCoffeeSpace.Visible = true; btnInsertTrainingSpace.Visible = false; lblTwo.Visible = false; btnNext2.Visible = false; } }
private void btnSearch_Click(object sender, EventArgs e) { listBoxStage1.DataSource = null; listBoxStage2.DataSource = null; if (cboxFilter.Text == "Treinamento") { SpaceTraining space = new SpaceTraining(); space.Name = txtSearch.Text; SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); TableResponse r = spaceBLL.GetByName(space); dataGridView1.DataSource = r.DataTable; } else { SpaceCoffee space = new SpaceCoffee(); space.Name = txtSearch.Text; SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL(); TableResponse r = spaceBLL.GetByName(space); dataGridView1.DataSource = r.DataTable; } txtSearch.Clear(); }
public void TestOrganizeSecondStage() { Person p1 = new Person(); p1.Name = "Pessoa"; p1.Surname = "Ummm"; personBLL.Insert(p1); Person p2 = new Person(); p2.Name = "Pessoa"; p2.Surname = "Doiss"; personBLL.Insert(p2); Person p3 = new Person(); p3.Name = "Pessoa"; p3.Surname = "Trêss"; personBLL.Insert(p3); Person p4 = new Person(); p4.Name = "Pessoa"; p4.Surname = "Quatro"; personBLL.Insert(p4); Person p5 = new Person(); p5.Name = "Pessoa"; p5.Surname = "Cinco"; personBLL.Insert(p5); Person p6 = new Person(); p6.Name = "Pessoa"; p6.Surname = "Seis"; personBLL.Insert(p6); Person p7 = new Person(); p7.Name = "Pessoa"; p7.Surname = "Sete"; personBLL.Insert(p7); Person p8 = new Person(); p8.Name = "Pessoa"; p8.Surname = "Oito"; personBLL.Insert(p8); Person p9 = new Person(); p9.Name = "Pessoa"; p9.Surname = "Nove"; personBLL.Insert(p9); Person p10 = new Person(); p10.Name = "Pessoa"; p10.Surname = "Dezz"; personBLL.Insert(p10); Person p11 = new Person(); p11.Name = "Pessoa"; p11.Surname = "Onze"; personBLL.Insert(p11); Person p12 = new Person(); p12.Name = "Pessoa"; p12.Surname = "Doze"; personBLL.Insert(p12); Person p13 = new Person(); p13.Name = "Pessoa"; p13.Surname = "Treze"; personBLL.Insert(p13); Person p14 = new Person(); p14.Name = "Pessoa"; p14.Surname = "Quatorze"; personBLL.Insert(p14); Person p15 = new Person(); p15.Name = "Pessoa"; p15.Surname = "Quinze"; personBLL.Insert(p15); Person p16 = new Person(); p16.Name = "Pessoa"; p16.Surname = "Dezesseis"; personBLL.Insert(p16); Person p17 = new Person(); p17.Name = "Pessoa"; p17.Surname = "Dezesete"; personBLL.Insert(p17); Person p18 = new Person(); p18.Name = "Pessoa"; p18.Surname = "Dezoito"; personBLL.Insert(p18); SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); SpaceTraining spaceT1 = new SpaceTraining(); spaceT1.Name = "Sala Um"; spaceT1.MaxCapacity = 6; spaceBLL.Insert(spaceT1); SpaceTraining spaceT2 = new SpaceTraining(); spaceT2.Name = "Sala Dois"; spaceT2.MaxCapacity = 6; spaceBLL.Insert(spaceT2); SpaceTraining spaceT3 = new SpaceTraining(); spaceT3.Name = "Sala Três"; spaceT3.MaxCapacity = 6; spaceBLL.Insert(spaceT3); personBLL.OrganizeFirstStage(); Response response = personBLL.OrganizeSecondStage(); Assert.AreEqual(true, response.Success); }
private void btnInsert_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtName.Text) || string.IsNullOrWhiteSpace(txtMaxCapacity.Text)) { MessageBox.Show("Preencha todos os campos."); txtName.Clear(); txtMaxCapacity.Clear(); txtName.Focus(); } else { SpaceTraining space = new SpaceTraining(); space.Name = txtName.Text; space.MaxCapacity = Convert.ToInt32(txtMaxCapacity.Text); SpaceTrainingBLL spaceBLL = new SpaceTrainingBLL(); spaceBLL.Insert(space); SingleResponse <Operator> r0 = spaceBLL.CheckHowToCreate(space); if (r0.Success) { Operator op = r0.Data; if (op.IsAllFull) { int totalSpaces = op.TotalSpaceFull - 1; int maxCapacity = op.PersonsPerFullRoom; if (MessageBox.Show(lblTitle.Text = "Serão cadastradas " + op.TotalSpaceFull + " salas.\n\nCada sala terá uma capacidade para " + op.PersonsPerFullRoom + " pessoas.\n\nSe deseja prosseguir clique em sim, mas se deseja informar outra sala para melhorar a distribuição, clique em não.", "ATENÇÂO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //chamar a tela de cadastro das salas restantes, conforme totalSpaces for (int i = 1; i <= totalSpaces; i++) { frmNewSpaceTraining2 f = new frmNewSpaceTraining2(maxCapacity); f.ShowDialog(); } MessageBox.Show("Salas cadastradas com sucesso, siga para o próximo passo."); this.Close(); } else { spaceBLL.DeleteAll(); txtName.Clear(); txtMaxCapacity.Clear(); txtName.Focus(); return; } } else { if (MessageBox.Show(lblTitle.Text = "Haverá um total de " + (op.TotalSpaceFull + op.TotalSpaceNotFull) + " salas.\n\n" + op.TotalSpaceFull + " salas com capacidade para " + op.PersonsPerFullRoom + " pessoas.\n\n" + op.TotalSpaceNotFull + " salas com capacidade para " + op.PersonsPerNotFullRoom + " pessoas.\n\nSe deseja prosseguir clique em sim, mas se deseja informar outra sala para melhorar a distribuição, clique em não", "ATENÇÂO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int totalSpaceFull = op.TotalSpaceFull; int maxCapacityFull = op.PersonsPerFullRoom; //chamar a tela de cadastro das salas cheias for (int i = 1; i < totalSpaceFull; i++) { frmNewSpaceTraining2 f = new frmNewSpaceTraining2(maxCapacityFull); f.ShowDialog(); } int totalSpaceNotFull = op.TotalSpaceNotFull; int maxCapacityNotFull = op.PersonsPerNotFullRoom; //chamar a tela de cadastro das salas não cheias for (int i = 1; i <= totalSpaceNotFull; i++) { frmNewSpaceTraining2 f = new frmNewSpaceTraining2(maxCapacityNotFull); f.ShowDialog(); } MessageBox.Show("Salas cadastradas com sucesso, siga para o próximo passo."); this.Close(); } else { spaceBLL.DeleteAll(); txtName.Clear(); txtMaxCapacity.Clear(); txtName.Focus(); return; } } } else { MessageBox.Show("Erro, contate o administrador."); } } }