public FrmUnitateTestare(UnitateTestare unitate, int idproblema)
 {
     InitializeComponent();
     UnitateTestare = unitate;
     IdProblema = idproblema;
     SetUnitateTestareInformation();
 }
        private void lblCreeaza_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (txtNumeUnitate.Text.Length == 0 || txtDateIntrare.Text.Length == 0 ||
                txtDateIesire.Text.Length == 0)
            {
                return;
            }

            UnitateTestare = new UnitateTestare(ResourcesHandler.Instance.GetNextAvailableUnitateTestareId(),
                0, txtNumeUnitate.Text, txtDateIntrare.Text, txtDateIesire.Text);
            DialogResult = DialogResult.OK;
            Close();
        }
 private void radButton2_Click(object sender, System.EventArgs e)
 {
     UnitateTestare = GetUnitateTestare();
     DialogResult = System.Windows.Forms.DialogResult.OK;
     Close();
 }
 public FrmDetaliiUnitateTestare(UnitateTestare unitate)
 {
     InitializeComponent();
     UnitateTestare = unitate;
     SetUnitateInformation();
 }
Beispiel #5
0
        /// <summary>
        /// Verifica datele de iesire daca corespund cu cele corecte
        /// <param name="unitate">Unitatea de testare</param>
        /// <param name="rowIndex">Indexul liniei unitatii testare</param>
        /// </summary>
        private void VerificaDateIesire(UnitateTestare unitate, int rowIndex)
        {
            if (unitate == null)
                return;

            txtDateIntrareProgram.Text = unitate.DateIntrare;
            ExecuteCompiledFile();

            // si pentru mai multe fisiere?
            string rezultat = txtRezultatProgram.Text; // cout
            unitate.DateUtilizator = rezultat;
            bool ok = unitate.CheckOutput(rezultat);

            Image imgRezultat = Properties.Resources.imgWrong16;
            if (ok)
                imgRezultat = Properties.Resources.imgOk16;

            gridVerificare.Rows[rowIndex].Cells[3].Value = imgRezultat;
        }
Beispiel #6
0
        /// <summary>
        /// Incarca baza de date
        /// </summary>
        private void LoadDatabase()
        {
            EventsHandler.Instance.AddEvent("LoadDatabase started", true);

            Splasher.Status = Messages.LOADING_DB;
            DatabaseHandler.Instance.InitializeDBAcess(Config.DbConString);
            OleDbDataReader reader;

            #region Tipuri
            ResourcesHandler.Instance.ListaTipuri.Clear();
            using (reader = DatabaseHandler.Instance.DoStoredProcReader(DBStrings.SELECT_TIPURI, null))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);
                        ResourcesHandler.Instance.IdsTipuri.Add(id);
                        ResourcesHandler.Instance.ListaTipuri.Add(new Tip(id, reader.GetString(1)));
                    }

                    reader.Close();
                }
                else
                    EventsHandler.Instance.AddEvent("Nu am incarcat nici un tip", false);
            }
            #endregion
            #region Probleme
            ResourcesHandler.Instance.ListaCuvinteCheie.Clear();
            ResourcesHandler.Instance.ListaProbleme.Clear();
            using (reader = DatabaseHandler.Instance.DoStoredProcReader(DBStrings.SELECT_PROBLEME, null))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);
                        ResourcesHandler.Instance.IdsProbleme.Add(id);
                        // id 0, tip 1, titlu 2, cerinta 3, dificultate 4, cuvinte cheie 5
                        ResourcesHandler.Instance.ListaProbleme.Add(new Problema(id, reader.GetString(1), reader.GetString(2),
                            reader.GetString(3), reader.GetInt32(4), reader.GetString(5), Config.ProblemePath));

                        ResourcesHandler.Instance.ListaCuvinteCheie.Add(new CuvantCheie(id, reader.GetString(5)));
                    }

                    reader.Close();
                }
                else
                    EventsHandler.Instance.AddEvent("Nu am incarcat nici o problema", false);
            }
            #endregion
            #region Teste
            ResourcesHandler.Instance.ListaTeste.Clear();
            using (reader = DatabaseHandler.Instance.DoStoredProcReader(DBStrings.SELECT_TESTE, null))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        int idTest = reader.GetInt32(0);
                        ResourcesHandler.Instance.IdsTeste.Add(idTest);

                        Test test = new Test(idTest, reader.GetString(1), reader.GetString(2), reader.GetInt32(3),
                            (float)reader.GetDouble(4), null);

                        // intrebari grila
                        OleDbDataReader reader2 = DatabaseHandler.Instance.DoStoredProcReader(
                            DBStrings.SELECT_TESTE_INTREBARIGRILA_BY_TEST,
                            new[] { new OleDbParameter("id", test.Id) });

                        if (reader2 != null)
                        {
                            while (reader2.Read())
                            {
                                int idIntrebare = reader2.GetInt32(0);
                                ResourcesHandler.Instance.IdsIntrebariGrila.Add(idIntrebare);

                                // decodeaza raspunsul corect
                                int raspunsCorect = reader2.GetInt32(3);
                                raspunsCorect = (char)(raspunsCorect - idIntrebare);

                                // id 0, idtest 1,intrebare 2, raspCorect 3, r1 r2 r3 r4 (4-7), puncte
                                test.Intrebari.Add(new IntrebareGrila(idIntrebare, idTest,
                                    reader2.GetString(2), raspunsCorect, reader2.GetString(4),
                                    reader2.GetString(5), reader2.GetString(6), reader2.GetString(7),
                                    (float)reader2.GetDouble(8)));
                            }
                        }
                        else
                            EventsHandler.Instance.AddEvent("Nu am incarcat nici o intrebare grila pentru Testul" + test.Id, false);

                        // intrebari
                        reader2 = DatabaseHandler.Instance.DoStoredProcReader(
                            DBStrings.SELECT_TESTE_INTREBARI_BY_TEST,
                            new[] { new OleDbParameter("id", test.Id) });

                        if (reader2 != null)
                        {
                            while (reader2.Read())
                            {
                                int idIntrebare = reader2.GetInt32(0);
                                ResourcesHandler.Instance.IdsIntrebari.Add(idIntrebare);

                                // id 0, idtest 1,intrebare 2, raspCorect 3,puncte 4
                                test.Intrebari.Add(new IntrebareTest(idIntrebare, idTest,
                                    reader2.GetString(2), EncodingUtil.DecodeBase64(reader2.GetString(3),true),
                                    (float)reader2.GetDouble(4)));
                            }

                            reader2.Close();
                        }
                        else
                            EventsHandler.Instance.AddEvent("Nu am incarcat nici o intrebare pentru Testul" + test.Id, false);

                        ResourcesHandler.Instance.ListaTeste.Add(test);
                    }

                    reader.Close();
                }
                else
                    EventsHandler.Instance.AddEvent("Nu am incarcat nici un test", false);
            }
            #endregion
            #region Teste probleme
            ResourcesHandler.Instance.ListaUnitatiTestare.Clear();
            using (reader = DatabaseHandler.Instance.DoStoredProcReader(DBStrings.SELECT_UNITATI_TESTARE, null))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        // id ,idproblema,nume,dateintrare,dateiesire
                        int id = reader.GetInt32(0);
                        int idProblema = reader.GetInt32(1);
                        ResourcesHandler.Instance.IdsUnitatiTestare.Add(id);

                        var unitate = new UnitateTestare(id, idProblema, reader.GetString(2),
                            reader.GetString(3), reader.GetString(4));
                        ResourcesHandler.Instance.ListaUnitatiTestare.Add(unitate);
                    }

                    reader.Close();
                }
                else
                    EventsHandler.Instance.AddEvent("Nu am incarcat nici un test problema", false);
            }
            #endregion
            #region Continut Accesat
            ResourcesHandler.Instance.ListaContinutAccesat.Clear();
            using (reader = DatabaseHandler.Instance.DoStoredProcReader(DBStrings.SELECT_CONTINUT_ACCESAT, null))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        // id, idcontinut, tip continut
                        string tip = reader.GetString(2);
                        int idContinut = reader.GetInt32(1);
                        if (tip.Equals("test"))
                        {
                            ResourcesHandler.Instance.ListaContinutAccesat.Add(ResourcesHandler.Instance.GetTestById(idContinut));
                        }
                        else if (tip.Equals("problema"))
                        {
                            ResourcesHandler.Instance.ListaContinutAccesat.Add(ResourcesHandler.Instance.GetProblemaById(idContinut));
                        }
                        else if (tip.Equals("lectie"))
                        {
                            ResourcesHandler.Instance.ListaContinutAccesat.Add(ResourcesHandler.Instance.GetLectieById(idContinut));
                        }
                    }
                }
                else
                    EventsHandler.Instance.AddEvent("Nu am incarcat nici un continut accesat", false);
            }
            #endregion
            DatabaseHandler.Instance.CloseDBAcess();
            EventsHandler.Instance.AddEvent("LoadDatabase ended", true);
        }