private void btnInsert_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                MessageBox.Show("Preencha o nome.");
                txtName.Focus();
            }
            else
            {
                SpaceCoffee    space    = new SpaceCoffee();
                SpaceCoffeeBLL spaceBLL = new SpaceCoffeeBLL();
                space.Name = txtName.Text;
                Response response = spaceBLL.Insert(space);

                TableResponse tableResponse = spaceBLL.GetAllTable();
                dataGridView.DataSource            = tableResponse.DataTable;
                dataGridView.Columns["Nome"].Width = 270;

                MessageBox.Show(response.Message);

                //chamar método que verifica se já tem cadastrado duas salas de café, se já tem, o botão cadastrar ficadesativado
                Response r0 = spaceBLL.ExistTwoSpaces();
                if (r0.Success)
                {
                    btnInsert.Enabled = false;
                    MessageBox.Show("Duas salas de café cadastradas, vá ao próximo passo.");
                    this.Close();
                }

                txtName.Focus();
                txtName.Clear();
            }
        }
        private void frmNewSpaceCoffee_Load(object sender, EventArgs e)
        {
            lblTitleSpace.Text = "Salas de intervalo para café:";

            SpaceCoffeeBLL spaceBLL      = new SpaceCoffeeBLL();
            TableResponse  tableResponse = spaceBLL.GetAllTable();

            if (tableResponse.Success)
            {
                dataGridView.DataSource            = tableResponse.DataTable;
                dataGridView.Columns["Nome"].Width = 270;
            }
            Response r0 = spaceBLL.ExistTwoSpaces();

            if (r0.Success)
            {
                btnInsert.Enabled = false;
                MessageBox.Show(r0.Message);
                this.Close();
            }
            else
            {
                MessageBox.Show("Você deve cadastrar dois espaços de intervalo para café informando o nome. Cada espaço irá alocar pelo menos metade das pessoas que participarão do treinamento.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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;
            }
        }
Esempio n. 6
0
        private void btnNext3_Click(object sender, EventArgs e)
        {
            SpaceCoffeeBLL spaceCBLL             = new SpaceCoffeeBLL();
            QueryResponse <SpaceCoffee> response = spaceCBLL.GetAllList();

            if (response.Data.Count == 0)
            {
                MessageBox.Show("Você deve cadastrar as salas de treinamento antes de ir ao próximo passo.");
            }
            else
            {
                lblFour.Visible              = true;
                btnExecute.Visible           = true;
                btnInsertCoffeeSpace.Visible = false;
                lblThree.Visible             = false;
                btnNext3.Visible             = false;
            }
        }
Esempio n. 7
0
 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();
 }