コード例 #1
0
ファイル: CourseCreator.cpp プロジェクト: Fleppensteyn/SE
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
コード例 #2
0
ファイル: login.cpp プロジェクト: harshitgupta1337/UDIS
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;
    }
}
コード例 #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;
}