Пример #1
0
        private void btn_confirmaAbertura_Click(object sender, EventArgs e)
        {
            LogAbertura logabertura = new LogAbertura();

            try
            {
                if ((txt_num.Text == "") || (txt_motivo.Text == "") || (txt_selecioneAbertura.Text == "") || (txt_nomeebox.Text == ""))
                {
                    MessageBox.Show("ERRO AO CADASTRAR! TODOS OS CAMPOS DEVEM SER PREENCHIDOS.", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (txt_selecioneAbertura.Text == "Abrir todos")
                    {
                        abrir_ebox = "b";

                        logabertura.id_login = id_login;
                        logabertura.ebox     = "Todos";
                        logabertura.motivo   = txt_motivo.Text;
                        logabertura.data_log = "current_dat";
                        logabertura.hora_log = "current_time";


                        var ret = repo.InserLogAbertura(logabertura);

                        //mod.sql = "insert into tbl_log_abertura (id_login,ebox,motivo,data_log,hora_log)Values('" + id_login + "','Todos','"+txt_motivo.Text
                        //          + "',current_date,current_time)";
                    }
                    else
                    {
                        abrir_ebox           = comandSerial[int.Parse(txt_num.Text)];
                        logabertura          = new LogAbertura();
                        logabertura.id_login = id_login;
                        logabertura.ebox     = txt_nomeebox.Text;
                        logabertura.motivo   = txt_motivo.Text;
                        logabertura.data_log = "current_dat";
                        logabertura.hora_log = "current_time";


                        //mod.sql = "insert into tbl_log_abertura (id_login,ebox,motivo,data_log,hora_log)Values('" + id_login + "','"+txt_nomeebox.Text+"','" +
                        //            txt_motivo.Text + "',current_date,current_time)";
                    }
                    if (serialPort1.IsOpen)
                    {
                        serialPort1.Write(abrir_ebox);
                        var ret = repo.InserLogAbertura(logabertura);

                        MessageBox.Show("O COMPARTIMENTO SELECIONADO FOI ABERTO COM SUCESSO!", "SUCESSO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        limpar();
                        //Lista_LogAbertura();
                    }
                    else
                    {
                        MessageBox.Show("A CONEXÃO COM O ARDUINO FOI PERDIDA.", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("ERRO AO CADSTRAR.  " + ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
 internal bool InserLogAbertura(LogAbertura logabertura)
 {
     return(_CondoDatabase.InserLogAbertura(logabertura));
 }
Пример #3
0
 internal bool InserLogAbertura(LogAbertura logabertura)
 {
     throw new NotImplementedException();
 }