コード例 #1
0
ファイル: Reguli.cs プロジェクト: MihaiDragutescu/BrioBac
        private void pictureBox8_Click(object sender, EventArgs e)
        {
            this.Close();
            Meniu x = new Meniu();

            x.Show();
        }
コード例 #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            this.Close();
            Meniu x = new Meniu();

            x.Show();
        }
コード例 #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Meniu f = new Meniu();

            f.Show();
            this.Close();
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string location = System.Reflection.Assembly.GetEntryAssembly().Location; //Scoatem locatia proiectului (inclusiv /bin/debug)

            string[] paths = location.Split('\\');                                    /* Impartim calea in mai multe siruri de caractere in functie de caracterul '\'.De exemplu, location = "C:\My Documents\Proiect\..."
                                                                                       * Atunci, paths[0] = "C:";
                                                                                       * paths[1] = "My Documents";
                                                                                       * paths[2] = "Proiect" etc.
                                                                                       */

            string path = "";                                                         // Initializam sirul de caractere in care vom memora calea catre baza de date

            for (int index = 0; index < paths.Length - 3; index++)                    // Parcurgem fiecare sir de caractere in afara de "bin" si "Debug"
            {
                path += paths[index] + '\\';                                          // Completam calea catre baza de date
            }

            path += "Bac.mdf"; // La calea catre fiserul unde se afla baza de date adaugam si denumirea acesteia
            using (SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + path + ";Integrated Security=True;User Instance=True"))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand(@"select * from conturi where utilizator = @utilizator and parola=@parola", con);

                cmd.Parameters.AddWithValue("@utilizator", textBoxUtilizator.Text);
                cmd.Parameters.AddWithValue("@parola", textBoxParola.Text);

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    iq          = int.Parse(reader["TestIQ"].ToString());
                    timp        = reader["Timp"].ToString();
                    timp_studiu = reader["TimpTotalStudiu"].ToString();

                    cmd.Parameters.Clear();
                    reader.Dispose();

                    cmd.CommandText = "update  conturi set Conectat=@Conectat where Utilizator=@utilizator";

                    cmd.Parameters.AddWithValue("@Conectat", 1);
                    cmd.Parameters.AddWithValue("@utilizator", textBoxUtilizator.Text);

                    cmd.ExecuteNonQuery();

                    conectare = DateTime.Now;

                    this.Hide();
                    Meniu f = new Meniu();
                    f.Show();
                    soundplayer.Play();
                }
                else
                {
                    MessageBox.Show("Utilizatorul nu exista");
                }
            }
        }
コード例 #5
0
 private void timer3_Tick(object sender, EventArgs e)
 {
     progressBar2.Show();
     this.progressBar2.Increment(11);
     if (Convert.ToInt32(progressBar2.Value) > 99)
     {
         timer3.Enabled = false;
         if (button1WasClicked)
         {
             this.Close();
             Informatii x = new Informatii();
             x.Show();
         }
         else
         {
             this.Close();
             Meniu x = new Meniu();
             x.Show();
         }
     }
 }