📄 subjectquery.cpp
字号:
#include "StdAfx.h"
#include "SubjectQuery.h"
using namespace ClassRoom;
System::Void SubjectQuery::groupBox1_Enter(System::Object^ sender, System::EventArgs^ e) {
}
System::Void SubjectQuery::groupBox2_Enter(System::Object^ sender, System::EventArgs^ e) {
}
System::Void SubjectQuery::comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
/*读取教室的选择编号*/
SubjectIndex = this->comboBox1->SelectedIndex;
}
System::Void SubjectQuery::comboBox2_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
/*读取教学楼的编号*/
BuildingIndex = this->comboBox2->SelectedIndex;
/*将对应的教学楼的教室输入到盛放教室名字的ComBox中*/
ArrayList^ list = gcnew ArrayList();
int count = 0 ;
while(SubjectArray->GetValue(BuildingIndex,count)!="")
{
list->Add(SubjectArray->GetValue(BuildingIndex,count));
count++;
}
array<String^>^ Temp = gcnew array<String^>(count);
list->CopyTo(Temp);
/*在选择新的教学楼编号时把上次的记录清空*/
this->comboBox1->SelectedIndex = -1;
this->comboBox1->Items->Clear();
this->comboBox1->Items->AddRange(Temp);
}
System::Void SubjectQuery::Button1_Click(System::Object^ sender, System::EventArgs^ e) {
int i = 0;
int j = 0;
if(BuildingIndex == -1)
{
MessageBox::Show("请先选择教学楼!!!","信息提示",MessageBoxButtons::OK,
MessageBoxIcon::Information);
}
else if(SubjectIndex == -1)
{
MessageBox::Show("请选择科目名称!!!","信息提示",MessageBoxButtons::OK,
MessageBoxIcon::Information);
}
else
{
String^ tempString;
Int32^ qq = gcnew Int32();
int date = 0;
int timeSegment = 0;
file->ReadText(FilePath[BuildingIndex],ClassRoomNumber[BuildingIndex]);
DataGridViewRowCollection^ row = this->dataGridView1->Rows;
row->Clear();
subjectList = file->chooseSubject( Convert::ToString(SubjectArray->GetValue(BuildingIndex,SubjectIndex)) );//寻找教室
for( i=0; i<subjectList->Count; i++)
{
tempString = Convert::ToString(subjectList->default::get(i));
row->Add();
dataGridView1->Rows[i]->Cells[0]->Value = BuildingArray[BuildingIndex];
dataGridView1->Rows[i]->Cells[1]->Value = tempString->Substring(0,10);
date = qq->Parse(tempString->Substring(10,10));
dataGridView1->Rows[i]->Cells[2]->Value = DateArray[date];
timeSegment = qq->Parse(tempString->Substring(20,10));
dataGridView1->Rows[i]->Cells[3]->Value = TimeSegmentArray[timeSegment];
}
subjectList->Clear();
}
}
System::Void SubjectQuery::dataGridView1_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
}
System::Void SubjectQuery::SubjectQuery_Load(System::Object^ sender, System::EventArgs^ e) {
}
System::Void SubjectQuery::label2_Click(System::Object^ sender, System::EventArgs^ e) {
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -