Exemplo n.º 1
0
void CourseCreator::drawPreview(wxPaintEvent&){
  Course course = Course();
  course.name = course_name->GetValue();
  course.line = determineLine();
  course.number = course_number->GetValue();
  course.ects = wxAtoi(ects->GetValue());
  course.affiliation = courses->getAffiliationColour(affiliation->GetValue());
  course.type = courses->getTypeColour(course_type->GetValue());
  preview = DrawingHelper::drawCourse(&course);
  wxPaintDC dc(this);
  dc.DrawBitmap(preview, 130, 310);
}//updatePreview
Exemplo n.º 2
0
QList<Course> LoginManager::getCourses()
{
    QList<Course> list;
    if(db.open())
    {
        QString queryString("SELECT * FROM courses");
        QSqlQuery query = db.exec(queryString);
        while(query.next())
        {
            list.append(Course(query.value(0).toString(), query.value(1).toInt()));
        }
        db.close();
        return list;
    }
}
Exemplo n.º 3
0
void InsertCourse::go()
{
    string code = getCodeFromInput();
    if(!db.doInsertCourse(Course(code)))
    {
        cout << "Course already exist" << endl << endl;
        return;
    }

    string name = getCourseNameFromInput();
    unsigned int credit = getCourseCreditFromInput();

    if(db.doModifyCourse(code, name, credit))
        cout << "Creation of course record successful" << endl << endl;
    else
        db.doDeleteCourse(code);

    return;
}