Пример #1
0
        private void BT_back_Click(object sender, EventArgs e)
        {
            Rendszergazdavalasztofelulet chwindow = new Rendszergazdavalasztofelulet();

            this.Hide();
            chwindow.Closed += (s, args) => this.Close();
            chwindow.Show();
        }
Пример #2
0
 private void BT_start_Click(object sender, EventArgs e)
 {
     if (RB_showmessage.Checked == true)
     {
         for (int i = 0; i < ids.Count; i++)
         {
             if (Convert.ToString(ids[i]) == TB_id.Text)
             {
                 TB_longreporttext.Text = Convert.ToString(longreports[i]);
                 break;
             }
             else if (i == (ids.Count - 1))
             {
                 MessageBox.Show("Nincs ilyen azonosítójú jelentés!");
             }
         }
     }
     else if (RB_closereport.Checked == true)
     {
         for (int i = 0; i < ids.Count; i++)
         {
             if (Convert.ToString(ids[i]) == TB_id.Text)
             {
                 try
                 {
                     string          myConnection = "datasource=127.0.0.1;port=3306;username=root;password=root;database=hibanaplo;";
                     MySqlConnection myConn       = new MySqlConnection(myConnection);
                     myConn.Open();
                     MySqlCommand sqlcmd = myConn.CreateCommand();
                     sqlcmd.CommandType = CommandType.Text;
                     string command = "INSERT INTO closedreports (typeofreport,nameofreporter,emailofreporter,phonenumberofreporter,dateofperception,timeofperception,longreport) VALUES ('" + Convert.ToString(typeofreports[i]) + "','" + Convert.ToString(nameofreporters[i]) + "','" + Convert.ToString(emailofreporters[i]) + "','" + Convert.ToString(phonenumberofreporters[i]) + "','" + Convert.ToString(dateofperceptions[i]) + "','" + Convert.ToString(timeofperceptions[i]) + "','" + Convert.ToString(longreports[i]) + "')";
                     sqlcmd.CommandText = command;
                     sqlcmd.ExecuteNonQuery();
                     command            = "DELETE FROM reports WHERE ID='" + Convert.ToString(ids[i]) + "'";
                     sqlcmd.CommandText = command;
                     sqlcmd.ExecuteNonQuery();
                     myConn.Close();
                     MessageBox.Show("A művelet végre lett hajtva!");
                     Rendszergazdavalasztofelulet chwindow = new Rendszergazdavalasztofelulet();
                     this.Hide();
                     chwindow.Closed += (s, args) => this.Close();
                     chwindow.Show();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message);
                 }
                 TB_longreporttext.Text = Convert.ToString(longreports[i]);
                 break;
             }
             else if (i == (ids.Count - 1))
             {
                 MessageBox.Show("Nincs ilyen azonosítójú jelentés!");
             }
         }
     }
 }
Пример #3
0
 private void BT_change_Click(object sender, EventArgs e)
 {
     try
     {
         string          myConnection = "datasource=127.0.0.1;port=3306;username=root;password=root;database=hibanaplo;";
         MySqlConnection myConn       = new MySqlConnection(myConnection);
         myConn.Open();
         MySqlCommand sqlcmd = myConn.CreateCommand();
         sqlcmd.CommandType = CommandType.Text;
         string command = "UPDATE email SET sysadminsemail = '" + TB_newsysemail.Text + "', senderemail = '" + TB_newsenderemail.Text + "', senderpassword = '******' WHERE senderemail = '" + TB_actualsenderemail.Text + "'";
         sqlcmd.CommandText = command;
         sqlcmd.ExecuteNonQuery();
         myConn.Close();
         MessageBox.Show("Az adatok sikeresen meg lettek változtatva!");
         Rendszergazdavalasztofelulet chwindow = new Rendszergazdavalasztofelulet();
         this.Hide();
         chwindow.Closed += (s, args) => this.Close();
         chwindow.Show();
     }
     catch (Exception)
     {
         MessageBox.Show("Nem sikerült kapcsolódni az adatbázishoz!");
     }
 }
Пример #4
0
        private void BT_login_Click(object sender, EventArgs e)
        {
            if (LBL_message.Text == "Ön a felhasználói belépést választotta!")
            {
                try
                {
                    string          myConnection = "datasource=127.0.0.1;port=3306;username=root;password=root;database=hibanaplo;";
                    MySqlConnection myConn       = new MySqlConnection(myConnection);
                    myConn.Open();
                    MySqlCommand sqlcmd = myConn.CreateCommand();
                    sqlcmd.CommandType = CommandType.Text;
                    string command = "SELECT * FROM users WHERE username='******' and password ='******'";;
                    sqlcmd.CommandText = command;
                    DataTable        datatable   = new DataTable();
                    MySqlDataAdapter dataadapter = new MySqlDataAdapter(sqlcmd);
                    sqlcmd.ExecuteNonQuery();
                    dataadapter.Fill(datatable);

                    int i = datatable.Rows.Count;
                    if (i == 0)
                    {
                        MessageBox.Show("Hibás felhasználónév vagy jelszó!");
                    }
                    else
                    {
                        MessageBox.Show("A belépés sikeres! ");
                        felhasznaloibejelento userreporter = new felhasznaloibejelento();
                        this.Hide();
                        userreporter.Closed += (s, args) => this.Close();
                        userreporter.Show();
                    }
                    myConn.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Nem sikerült kapcsolódni az adatbázishoz!");
                }
            }
            else
            {
                try
                {
                    string          myConnection = "datasource=127.0.0.1;port=3306;username=root;password=root;database=hibanaplo;";
                    MySqlConnection myConn       = new MySqlConnection(myConnection);
                    myConn.Open();
                    MySqlCommand sqlcmd = myConn.CreateCommand();
                    sqlcmd.CommandType = CommandType.Text;
                    string command = "SELECT * FROM sysadmins WHERE username='******' and password ='******'";;
                    sqlcmd.CommandText = command;
                    DataTable        datatable   = new DataTable();
                    MySqlDataAdapter dataadapter = new MySqlDataAdapter(sqlcmd);
                    sqlcmd.ExecuteNonQuery();
                    dataadapter.Fill(datatable);

                    int i = datatable.Rows.Count;
                    if (i == 0)
                    {
                        MessageBox.Show("Hibás felhasználónév vagy jelszó!");
                    }
                    else
                    {
                        MessageBox.Show("A belépés sikeres!");
                        Rendszergazdavalasztofelulet sysadminchoise = new Rendszergazdavalasztofelulet();
                        this.Hide();
                        sysadminchoise.Closed += (s, args) => this.Close();
                        sysadminchoise.Show();
                    }
                    myConn.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Nem sikerült kapcsolódni az adatbázishoz!");
                }
            }
        }