本文整理汇总了C++中Section::GetCapacity方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::GetCapacity方法的具体用法?C++ Section::GetCapacity怎么用?C++ Section::GetCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::GetCapacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSection
// administrator adds a section
bool Administrator::AddSection(const Section &s) const
{
/*insert a record into the section table*/
QSqlQuery query;
query.prepare("insert into Section (courseID, secID, semester, year, capacity, vacancy, building, roomNo, timeSlotID) values (?, ?, ? ,?, ?, ?, ?, ?, ?)");
query.addBindValue(s.GetCourseID());
query.addBindValue(s.GetSecID());
query.addBindValue(s.GetSemester().data());
query.addBindValue(s.GetYear());
query.addBindValue(s.GetCapacity());
query.addBindValue(s.GetVacancy());
query.addBindValue(s.GetBuilding().data());
query.addBindValue(s.GetRoomNo());
query.addBindValue(s.GetTimeSlotID());
if(!query.exec())
return false;
return true;
}
示例2: UpdateSection
bool Administrator::UpdateSection(const Section &s) const
{
/*update the section's capacity*/
QString str;
str = "update Section set capacity = ";
str += QString::number(s.GetCapacity());
str += " where courseID = ";
str += QString::number(s.GetCourseID());
str += " and secID = ";
str += QString::number(s.GetSecID());
str += " and semester = '";
str += s.GetSemester().data();
str += "' and year = ";
str += QString::number(s.GetYear());
QSqlQuery query;
if(!query.exec(str))
return false;
/*update the section's building*/
str = "update Section set building = '";
str += s.GetBuilding().data();
str += "' where courseID = ";
str += QString::number(s.GetCourseID());
str += " and secID = ";
str += QString::number(s.GetSecID());
str += " and semester = '";
str += s.GetSemester().data();
str += "' and year = ";
str += QString::number(s.GetYear());
if(!query.exec(str))
return false;
/*update the section's roomNo*/
str = "update Section set roomNo = ";
str += QString::number(s.GetRoomNo());
str += " where courseID = ";
str += QString::number(s.GetCourseID());
str += " and secID = ";
str += QString::number(s.GetSecID());
str += " and semester = '";
str += s.GetSemester().data();
str += "' and year = ";
str += QString::number(s.GetYear());
if(!query.exec(str))
return false;
/*update the section's timeSlotID*/
str = "update Section set timeSlotID = ";
str += QString::number(s.GetTimeSlotID());
str += " where courseID = ";
str += QString::number(s.GetCourseID());
str += " and secID = ";
str += QString::number(s.GetSecID());
str += " and semester = '";
str += s.GetSemester().data();
str += "' and year = ";
str += QString::number(s.GetYear());
if(!query.exec(str))
return false;
return true;
}