Разработка подсистемы подготовки адаптивного тестирования в открытой системе дистанционного образования

Выявление требований к информационной системе. Диаграмма вариантов использования. Проектирование информационного обеспечения с использованием семантических моделей. Проектирование пользовательского интерфейса. Реализация программы на Visual Studio.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 28.08.2012
Размер файла 590,2 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

cmd4. Parameters. AddWithValue («@id_vopr», id_vopr);

cmd4. Parameters. AddWithValue («id_otv», LI. ToString());

cmd4. Parameters. AddWithValue («@id_test», id_test);

cmd4. ExecuteNonQuery();

}

thisConnection. Close();

num = 0;

DeletControls();

}

catch

{

}

check = false;

ck = false;

}

else

{

label1. Text = «Вы заполнили не все поля!!!»;

}

}

private void DeletControls()

{

textBox1. Text = «»;

int kv = groupBox1. Controls. Count - 1;

while (groupBox1. Controls. Count > count)

{groupBox1. Controls. RemoveAt(kv);

kv -;

}

k = 0;

X = 10;

Y = 225;

for (int i = 0; i < 2; i++)

{AddControls();}}

public void AddControls()

{if (Y + 100 <= this. Size. Height)

{tx = new TextBox();

tx. Width = 930;

tx. Multiline = true;

tx. Height = 50;

tx. Location = new Point (X, Y);

tx. Name = «tx» + this.groupBox1. Controls. Count. ToString();

tx. MaxLength = 255;

cb = new CheckBox();

cb. Location = new Point (X + 960, Y + 10);

cb. Name = «cb» + this.groupBox1. Controls. Count. ToString();

this.groupBox1. Controls. Add(tx);

this.groupBox1. Controls. Add(cb);

Y += 60;

k++;}}

private void button3_Click (object sender, EventArgs e)

{AddControls();}

private void button4_Click (object sender, EventArgs e)

{if (count + 4 <= this.groupBox1. Controls. Count - 1)

{this.groupBox1. Controls. RemoveAt (this.groupBox1. Controls. Count - 1);

this.groupBox1. Controls. RemoveAt (this.groupBox1. Controls. Count - 1);

Y -= 60;

k- ;}}

private void Form1_Load (object sender, EventArgs e)

{

comboBox5. SelectedIndex = 0;

count = this.groupBox1. Controls. Count;

BindTests();

if (comboBox2. Items. Count > 0)

{textBox2. Text = comboBox2. SelectedItem. ToString();}

for (int i = 0; i < 2; i++)

{AddControls();}

DGVBinding();}

private void BindTests()

{comboBox2. Items. Clear();

comboBox3. Items. Clear();

textBox3. Text = «»;

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string query = «Select test From Test»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

OleDbDataReader thisReader = cmd. ExecuteReader();

while (thisReader. Read())

{comboBox2. Items. Add (thisReader. GetValue(0).ToString());

comboBox3. Items. Add (thisReader. GetValue(0).ToString());}

thisReader. Close();

thisConnection. Close();

if (comboBox2. Items. Count > 0)

{try

{comboBox2. SelectedIndex = lastindx;}

catch

{

}

}

}

private void groupBox1_Enter (object sender, EventArgs e)

{

}

private void button5_Click (object sender, EventArgs e)

{

click = false;

AddValue();

BindTests();

DGVBinding();

}

private void dataGridView1_UserDeletingRow (object sender, DataGridViewRowCancelEventArgs e)

{try

{

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string query = «Delete From Vopros Where (id_vopr = @id_vopr)»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

cmd. Parameters. AddWithValue («@id_vopr», dataGridView1. Rows[index].Cells[0].Value. ToString());

cmd. ExecuteNonQuery();

thisConnection. Close();

}

catch

{

}

}

private void dataGridView1_RowEnter (object sender, DataGridViewCellEventArgs e)

{index = e. RowIndex;}

private void dataGridView1_ColumnAdded (object sender, DataGridViewColumnEventArgs e)

{if (e. Column. Name == «id_vopr»)

{e. Column. Visible = false;}

if (e. Column. Name == «vopr»)

{e. Column. HeaderText = «ВОПРОСЫ:»;

e. Column. MinimumWidth = 850;}

if (e. Column. Name == «lev»)

{e. Column. HeaderText = «СЛОЖНОСТЬ:»;}}

private void comboBox2_SelectedIndexChanged (object sender, EventArgs e)

{textBox2. Text = comboBox2. SelectedItem. ToString();

lastindx = comboBox2. SelectedIndex;

DGVBinding();}

private void button1_Click (object sender, EventArgs e)

{try

{

if (click == false && comboBox2. Text!= «»)

{MessageBox. Show («Повторное нажатие клавиши приведет к удалению выбранного вами теста!!!»);

click = true;

}

else

{

if (click == true)

{OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string query = «Delete From Test Where (test = @test)»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

cmd. Parameters. AddWithValue («@test», comboBox2. SelectedItem. ToString());

cmd. ExecuteNonQuery();

thisConnection. Close();

comboBox2. Text = «»;

DGVBinding();

BindTests();

click = false;

}

}

}

catch

{

}

}

private void StartTest()

{

try

{

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string qr1 = «Select id_test From Test Where (test = @test)»;

OleDbCommand com1 = new OleDbCommand (qr1, thisConnection);

com1. Parameters. AddWithValue («@test», comboBox3. SelectedItem. ToString());

OleDbDataReader thisRed1 = com1. ExecuteReader();

while (thisRed1. Read())

{id_test = thisRed1. GetValue(0).ToString();}

thisRed1. Close();

string query = «Select id_vopr, vopr From Vopros Where (id_test = @id_test)»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

cmd. Parameters. AddWithValue («@id_test», id_test);

OleDbDataAdapter AdapterForVopros = new OleDbDataAdapter(cmd);

DSVopros = new DataSet();

AdapterForVopros. Fill (DSVopros, «Vopros»);

thisConnection. Close();

MaxPosition = 0;

foreach (DataRow rw in DSVopros. Tables [«Vopros»].Rows)

{MaxPosition++;}

Rand = new Random().Next(MaxPosition);

Random rn = new Random();

array = new int[MaxPosition];

for (int i = 0; i < MaxPosition; i++)

{Rand = rn. Next(MaxPosition);

array[i] = Rand;

if (i >= 1)

{for (int j = 0; j < i; j++)

{if (Rand == array[j])

{i - ;}

}

}

}

for (int i = 0; i < MaxPosition; i++)

{textBox3. Text += array[i].ToString() + «»;}

if (MaxPosition > 0)

{row = DSVopros. Tables [«Vopros»].Rows [array[position]];

id_vopr = row[0].ToString();

textBox3. Text = row[1].ToString();}

}

catch

{

}

}

private void AddControlsForQuestions()

{try

{X = 10;

Y = 225;

kk = 0;

kkk = 0;

CntrlsCnt = groupBox2. Controls. Count;

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string query = «Select id_rez From Rez Where (id_test = @id_test AND id_vopr = @id_vopr)»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

cmd. Parameters. AddWithValue («@id_test», id_test);

cmd. Parameters. AddWithValue («@id_vopr», id_vopr);

OleDbDataReader thisReader = cmd. ExecuteReader();

while (thisReader. Read())

{kk++;

}

array5 = new int[kk];

thisReader. Close();

string query1 = «Select id_otv From Otvet Where (id_test = @id_test AND id_vopr = @id_vopr)»;

OleDbCommand cmd1 = new OleDbCommand (query1, thisConnection);

cmd1. Parameters. AddWithValue («@id_test», id_test);

cmd1. Parameters. AddWithValue («@id_vopr», id_vopr);

OleDbDataReader thisReader1 = cmd1. ExecuteReader();

while (thisReader1. Read())

{

kkk++;

}

thisReader1. Close();

thisConnection. Close();

if (kk > 1)

{

for (int i = 0; i < kkk; i++)

{

lb = new Label();

lb. Width = 930;

lb. Height = 50;

lb. Font = new Font («Microsoft Sans Serif», 12);

lb. Location = new Point (X, Y);

lb. Name = «lb» + this.groupBox2. Controls. Count. ToString();

cb = new CheckBox();

cb. Location = new Point (X + 960, Y + 10);

cb. Name = «cb» + this.groupBox2. Controls. Count. ToString();

this.groupBox2. Controls. Add(lb);

textBox4. Text = groupBox2. Controls. Count. ToString();

this.groupBox2. Controls. Add(cb);

textBox5. Text = groupBox2. Controls. Count. ToString();

Y += 60;

}

}

else

{

for (int i = 0; i < kkk; i++)

{

lb = new Label();

lb. Width = 930;

lb. Height = 50;

lb. Font = new Font («Microsoft Sans Serif», 12);

lb. Location = new Point (X, Y);

lb. Name = «lb» + this.groupBox2. Controls. Count. ToString();

rb = new RadioButton();

rb. Location = new Point (X + 960, Y + 10);

rb. Name = «rb» + this.groupBox2. Controls. Count. ToString();

this.groupBox2. Controls. Add(lb);

textBox4. Text = groupBox2. Controls. Count. ToString();

this.groupBox2. Controls. Add(rb);

textBox5. Text = groupBox2. Controls. Count. ToString();

Y += 60;

}

}}

catch

{}

}

private void BindQuestion()

{try

{

Random rn = new Random();

int[] array1 = new int [groupBox2. Controls. Count - CntrlsCnt];

int[] array2 = new int[(groupBox2. Controls. Count - CntrlsCnt) / 2];

array3 = new int[(groupBox2. Controls. Count - CntrlsCnt) / 2];

int g = 1;

for (int z = 0; z < (groupBox2. Controls. Count - CntrlsCnt) / 2; z++)

{array3 [z] = groupBox2. Controls [CntrlsCnt + g].TabIndex;

g += 2;

}

for (int j = 0; j < groupBox2. Controls. Count - CntrlsCnt; j++)

{

Rand = rn. Next (CntrlsCnt, groupBox2. Controls. Count);

array1 [j] = groupBox2. Controls[Rand].TabIndex;

if (j >= 1)

{for (int p = 0; p < j; p++)

{if (Rand == array1 [p])

{

j -;

}

}

}

}

int f = 0;

for (int r = 0; r < array1. Length; r++)

{

if (array1 [r]% 2 == 0)

{

array2 [f] = array1 [r];

f++;

}

}

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

string query1 = «Select id_otv, otv From Otvet Where (id_test = @id_test AND id_vopr = @id_vopr)»;

OleDbCommand cmd = new OleDbCommand (query1, thisConnection);

cmd. Parameters. AddWithValue («@id_test», id_test);

cmd. Parameters. AddWithValue («@id_vopr», id_vopr);

OleDbDataReader thisReader = cmd. ExecuteReader();

int i = 0;

while (thisReader. Read())

{

(groupBox2. Controls [array2 [i]] as Label).Text = thisReader. GetValue(1).ToString();

i++;

}

thisReader. Close();

thisConnection. Close();

}

catch

{

}

}

private void DelControlsFromGrupBox2 ()

{

if (groupBox2. Controls. Count > CntrlsCnt && CntrlsCnt!= 0)

{

for (int i = groupBox2. Controls. Count; i > CntrlsCnt; i-)

{

groupBox2. Controls. RemoveAt (i - 1);

}

}

}

private void comboBox3_SelectedIndexChanged (object sender, EventArgs e)

{

toolStripMenuItem1. Enabled = false;

toolStripMenuItem2. Enabled = false;

End = 0;

position = 0;

textBox3. Text = «»;

StartTest();

DelControlsFromGrupBox2 ();

AddControlsForQuestions();

BindQuestion();

}

private void button6_Click (object sender, EventArgs e)

{

RightAnsw();

if (position < MaxPosition - 1)

{

position++;

row = DSVopros. Tables [«Vopros»].Rows [array[position]];

textBox3. Text = row[1].ToString();

id_vopr = row[0].ToString();

DelControlsFromGrupBox2 ();

AddControlsForQuestions();

BindQuestion();

}

}

private void button2_Click (object sender, EventArgs e)

private void RightAnsw()

{try

{

if (End!= MaxPosition)

{

comboBox3. Enabled = false;

OleDbConnection thisConnection = new OleDbConnection (ConStr. GetConString());

thisConnection. Open();

comboBox4. Items. Clear();

int length = 0;

if (kk > 1)

{foreach (int t in array3)

{

comboBox4. Items. Add((groupBox2. Controls [t - 1] as Label).Text);

length++;

}

}

}

else

{

foreach (int t in array3)

{

if ((groupBox2. Controls[t] as RadioButton).Checked)

{

comboBox4. Items. Add((groupBox2. Controls [t - 1] as Label).Text);

length++;

break;

}

}

}

array4 = new int[length];

int l = 0;

foreach (string str in comboBox4. Items)

{

string query = «Select id_otv From Otvet Where (id_test = @id_test AND id_vopr = @id_vopr AND otv = @otv)»;

OleDbCommand cmd = new OleDbCommand (query, thisConnection);

cmd. Parameters. AddWithValue («@id_test», id_test);

cmd. Parameters. AddWithValue («@id_vopr», id_vopr);

cmd. Parameters. AddWithValue («@otv», str);

OleDbDataReader thisReader = cmd. ExecuteReader();

while (thisReader. Read())

{

array4 [l] = thisReader. GetInt32 (0);

l++;

}

thisReader. Close();

}

string query1 = «Select id_otv From Rez Where (id_test = @id_test AND id_vopr = @id_vopr)»;

OleDbCommand cmd1 = new OleDbCommand (query1, thisConnection);

cmd1. Parameters. AddWithValue («@id_test», id_test);

cmd1. Parameters. AddWithValue («@id_vopr», id_vopr);

OleDbDataReader thisReader1 = cmd1. ExecuteReader();

int u = 0;

while (thisReader1. Read())

{

array5 [u] = thisReader1. GetInt32 (0);

u++;

}

thisConnection. Close();

int right = 0;

if (array4. Length == array5. Length)

{

foreach (int x in array4)

{

foreach (int y in array5)

{

if (x == y)

{

right++;

}

}

}

}

if (right == array5. Length)

{

schet++;

}

if (End + 1 == MaxPosition)

{

MessageBox. Show («Тест: «+» «+comboBox3. SelectedItem. ToString()+»\n\n»+«Количество вопросов в тесте: «+» «+MaxPosition. ToString()+»\n\n»+«Вы ответили верно на: «+» «+schet. ToString());

comboBox3. Enabled = true;

toolStripMenuItem1. Enabled = true;

toolStripMenuItem2. Enabled = true;

textBox3. Text = «»;

DelControlsFromGrupBox2 ();

comboBox3. Text = «»;

comboBox3. SelectedValue = «»;

schet = 0;

}

End++;

}

}

catch

{

}

}

}

}

программа семантический visual тестирование

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.