Esempio n. 1
0
        private void btnSair_Click(object sender, EventArgs e)
        {
            ConsultaAgendamento cons = new ConsultaAgendamento();

            cons.Show();
            this.Close();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Variaveis recebendo os valores dos campos
            String NomeLembrete = txtVendedor.Text;
            String Lembrete     = txtLembrete.Text;
            String Importancia  = null;
            String vendedor     = txtVendedor.Text.Trim();
            string Data         = Convert.ToDateTime(txtData.Text).ToString("yyyy/MM/dd");
            string Hora         = txtHora.Text;
            String Obs          = txtObs.Text;

            /*Laço de repetição para definir qual das opções a variavel vai
             * armazenar*/
            if (rbEu.Checked)
            {
                Importancia = rbEu.Text;
            }
            if (rbTodos.Checked)
            {
                Importancia = rbTodos.Text;
            }
            if (radioButton1.Checked)
            {
                Importancia = radioButton1.Text;
            }
            if (radioButton2.Checked)
            {
                Importancia = radioButton2.Text;
            }

            if (txtVendedor.Text == "" || txtLembrete.Text == "")
            {
                MessageBox.Show("Por favor, preencha adequadamente os campos referentes ao nome do funcionário a qual o alarme será atribuido e ao nome do alarme !");
            }
            else
            {
                string Config = "server=127.0.0.1;userid=root;database=bd_commanager";

                MySqlConnection conex = new MySqlConnection(Config);
                conex.Open();
                MySqlCommand Query = new MySqlCommand("UPDATE agenda SET Lembrete='" + Lembrete + "', Nome='" + NomeLembrete + "', Importancia='" + Importancia + "', Data='" + Data + "', Hora='" + Hora + "', Observacoes='" + Obs + "' WHERE Id=" + ClassInfo.IdAgendaGlobal + ";", conex);
                Query.ExecuteNonQuery();
                Query.Connection = conex;
                if (conex.State == ConnectionState.Open)
                {
                    MessageBox.Show("Alterado com sucesso!");
                    this.Close();
                    ConsultaAgendamento sub = new ConsultaAgendamento();
                    sub.Show();
                }

                else
                {
                    MessageBox.Show("Erro ao alterar!");
                }
                conex.Close();
            }
        }