Exemple #1
0
        void AfisIntrebare()
        {
            Intrebare w = Q[nr];

            labelNr.Text    = (nr).ToString();
            labelEnunt.Text = w.enuntIntrebare;

            groupBoxRaspunsuri.Controls.Clear();
            for (int i = 0; i < 6; i++)
            {
                NumericUpDown raspuns = new NumericUpDown();
                raspuns.Minimum       = 1;
                raspuns.Maximum       = 6;
                raspuns.Value         = 1;
                raspuns.Tag           = i;
                raspuns.Size          = new Size(50, 30);
                raspuns.Location      = new Point(5, 25 + i * 25);
                raspuns.ValueChanged += raspuns_ValueChanged;
                groupBoxRaspunsuri.Controls.Add(raspuns);

                Label enuntrasp = new Label();
                enuntrasp.Text     = w.enuntRaspuns[i];
                enuntrasp.AutoSize = true;
                enuntrasp.Location = new Point(70, 25 + i * 25);
                groupBoxRaspunsuri.Controls.Add(enuntrasp);
            }
        }
Exemple #2
0
        void IncarcaIntrebarile()
        {
            raspunsuri = new int[6, 6];
            int i, j;

            for (i = 1; i <= 5; i++)
            {
                for (j = 0; j < 6; j++)
                {
                    raspunsuri[i, j] = 1;
                }
            }

            Q = new Intrebare[6];

            scorinterese = new int[6];

            for (i = 0; i < 6; i++)
            {
                scorinterese[i] = 0;
            }

            interese    = new string[6];
            interese[0] = "Realist";
            interese[1] = "Investigativ";
            interese[2] = "Artistic";
            interese[3] = "Social";
            interese[4] = "Intreprinzator";
            interese[5] = "Conventional";

            nr = 1;
            int n = 0;


            string connString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\madalina\Desktop\ChestionarV\ChestionarV\intrebari.mdf;Integrated Security=True";

            using (SqlConnection conn = new SqlConnection(connString))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select count(*) as nr_intrebari from intrebari";

                using (SqlDataReader r = cmd.ExecuteReader())
                {
                    r.Read();

                    n = (int)r[0];

                    r.Close();
                }

                conn.Close();
            }


            connString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\madalina\Desktop\ChestionarV\ChestionarV\intrebari.mdf;Integrated Security=True";


            using (SqlConnection conn = new SqlConnection(connString))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select *from Intrebari ";
                i = 0;
                j = 0;



                using (SqlDataReader r = cmd.ExecuteReader())
                {
                    while (r.Read() && j <= 5)
                    {
                        Intrebare w = new Intrebare();
                        j++;
                        w.enuntIntrebare  = r[1].ToString();
                        w.enuntRaspuns[0] = r[2].ToString();
                        w.enuntRaspuns[1] = r[3].ToString();
                        w.enuntRaspuns[2] = r[4].ToString();
                        w.enuntRaspuns[3] = r[5].ToString();
                        w.enuntRaspuns[4] = r[6].ToString();
                        w.enuntRaspuns[5] = r[7].ToString();

                        Q[j] = w;
                    }

                    r.Close();
                }

                conn.Close();
            }
        }