Ejemplo n.º 1
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            try
            {
                string strHorario   = cbbHorario.Text;
                string strProfessor = cbbProfessor.Text;
                string strTurma     = cbbTurma.Text.Split('/')[0];
                string strBloco     = cbbTurma.Text.Split('/')[1];
                string strConteudo  = rtbConteudo.Text;
                string strNovaData  = mtcCalendario.SelectionStart.ToString("yyyy-MM-dd H:mm:ss");

                ConexaoMySQL conn = new ConexaoMySQL();

                bool result = conn.InsertAula(strHorario, strProfessor, strTurma, strBloco, strConteudo, strNovaData);

                if (!result)
                {
                    MessageBox.Show("Erro ao inserir.");
                }
                else
                {
                    MessageBox.Show("Inserido com sucesso.");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.Name + " - Error: " + ex.Message);
            }
        }