Exemplo n.º 1
0
    public override int getNumberRunningSessions()
    {
        MySqlCommand dbcmd       = getDbCommand();
        var          minDateTime = MenuUIManager.MinDateTime().ToString("yyyy-MM-dd H:mm:ss");

        dbcmd.CommandText = "SELECT * FROM sessions WHERE convert(endtime,datetime) <= convert('" + minDateTime + "',datetime);";
        var reader     = dbcmd.ExecuteReader();
        int numRecords = 0;

        while (reader.Read())
        {
            numRecords++;
        }
        reader.Close();
        return(numRecords);
    }
Exemplo n.º 2
0
    public void startSessions()
    {
        int currTaskId = -1;

        foreach (LabBlock labBlock in labBlocks)
        {
            if (labBlock.toggleButton.IsOn)
            {
                currTaskId = labBlock.taskId;
            }
        }
        ;
        if (currTaskId == -1)
        {
            MenuUIManager.Instance.SendPopup(3, "Необходимо выбрать одну из задач");
            return;
        }
        choosedStudentsForLab.Clear();
        foreach (ChangableButton studentChangableButton in studentChangableButtons)
        {
            if (studentChangableButton.IsActive)
            {
                choosedStudentsForLab.Add(studentChangableButton.studentId);
            }
        }
        DateTime currTime = DateTime.Now;

        choosedStudentsForLab.ForEach(choosedStudentForLab =>
        {
            Session newSession = new Session(MenuUIManager.currTeacherId, choosedStudentForLab, currTaskId,
                                             currTime, MenuUIManager.MinDateTime());
            var sessionsDB = new SessionsDB();
            sessionsDB.addSession(newSession);
            sessionsDB.close();
        });
        OpenTaskPanelMainMenu();
    }