Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Пояснювальна.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
1.34 Mб
Скачать

Додаток а

Form1.h

#pragma once

#include <iostream>

#include <fstream>

#include "Form2.h"

#include "Rozklad.h"

#include "Auditor.h"

using namespace System::IO;

namespace kur5 {

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

/// <summary>

/// Сводка для Form1

///

/// Внимание! При изменении имени этого класса необходимо также изменить

/// свойство имени файла ресурсов ("Resource File Name") для средства компиляции управляемого ресурса,

/// связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,

/// конструкторы не смогут правильно работать с локализованными

/// ресурсами, сопоставленными данной форме.

/// </summary>

public ref class Form1 : public System::Windows::Forms::Form

{

public:

Form1(void)

{

InitializeComponent();

//

//TODO: добавьте код конструктора

//

}

protected:

/// <summary>

/// Освободить все используемые ресурсы.

/// </summary>

~Form1()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::ListBox^ listBox1;

protected:

private: System::Windows::Forms::ListBox^ listBox2;

private: System::Windows::Forms::Button^ button3;

private: System::Windows::Forms::DataGridView^ dataGridView1;

private: System::Windows::Forms::ComboBox^ comboBox1;

private: System::Windows::Forms::PictureBox^ pictureBox1;

private: System::Windows::Forms::TextBox^ textBox1;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::PictureBox^ pictureBox3;

private: System::ComponentModel::IContainer^ components;

//private: Rozklad^ Roz=gcnew Rozklad();

//private: static Dictionary<String^,String^>^ info;

private: static Auditor^ Inform;

private:static Rozklad^ x;

private: System::Windows::Forms::Label^ label1;

private: System::Windows::Forms::Panel^ panel2;

private: System::Windows::Forms::Panel^ panel3;

private: System::Windows::Forms::Panel^ panel4;

private:static int imgNum;

private: System::Windows::Forms::DataGridViewTextBoxColumn^ н;

private: System::Windows::Forms::DataGridViewComboBoxColumn^ Викладач;

private:static int write=0;

//private:

/// <summary>

/// Требуется переменная конструктора.

/// </summary>

#pragma region Windows Form Designer generated code

/// <summary>

/// Обязательный метод для поддержки конструктора - не изменяйте

/// содержимое данного метода при помощи редактора кода.

/// </summary>

void InitializeComponent(void)

{

System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));

this->listBox1 = (gcnew System::Windows::Forms::ListBox());

this->listBox2 = (gcnew System::Windows::Forms::ListBox());

this->button3 = (gcnew System::Windows::Forms::Button());

this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());

this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());

this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());

this->textBox1 = (gcnew System::Windows::Forms::TextBox());

this->button1 = (gcnew System::Windows::Forms::Button());

this->pictureBox3 = (gcnew System::Windows::Forms::PictureBox());

this->label1 = (gcnew System::Windows::Forms::Label());

this->panel2 = (gcnew System::Windows::Forms::Panel());

this->panel4 = (gcnew System::Windows::Forms::Panel());

this->panel3 = (gcnew System::Windows::Forms::Panel());

this->н = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());

this->Викладач = (gcnew System::Windows::Forms::DataGridViewComboBoxColumn());

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataGridView1))->BeginInit();

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox3))->BeginInit();

this->panel2->SuspendLayout();

this->SuspendLayout();

//

// listBox1

//

this->listBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;

this->listBox1->FormattingEnabled = true;

this->listBox1->Location = System::Drawing::Point(15, 89);

this->listBox1->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->listBox1->Name = L"listBox1";

this->listBox1->Size = System::Drawing::Size(120, 93);

this->listBox1->Sorted = true;

this->listBox1->TabIndex = 0;

this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);

this->listBox1->Click += gcnew System::EventHandler(this, &Form1::listBox1_Click);

//

// listBox2

//

this->listBox2->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;

this->listBox2->FormattingEnabled = true;

this->listBox2->Items->AddRange(gcnew cli::array< System::Object^ >(13) {L"231", L"231а", L"232", L"233", L"235", L"235а",

L"241", L"243", L"243а", L"243б", L"244", L"244а", L"247а"});

this->listBox2->Location = System::Drawing::Point(149, 11);

this->listBox2->Margin = System::Windows::Forms::Padding(1, 2, 1, 1);

this->listBox2->Name = L"listBox2";

this->listBox2->Size = System::Drawing::Size(39, 171);

this->listBox2->Sorted = true;

this->listBox2->TabIndex = 1;

this->listBox2->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox2_SelectedIndexChanged);

//

// button3

//

this->button3->Location = System::Drawing::Point(14, 394);

this->button3->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->button3->Name = L"button3";

this->button3->Size = System::Drawing::Size(174, 24);

this->button3->TabIndex = 7;

this->button3->Text = L"Зберегти";

this->button3->UseVisualStyleBackColor = true;

this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);

//

// dataGridView1

//

this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;

this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(2) {this->н, this->Викладач});

this->dataGridView1->Location = System::Drawing::Point(17, 264);

this->dataGridView1->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->dataGridView1->Name = L"dataGridView1";

this->dataGridView1->Size = System::Drawing::Size(174, 124);

this->dataGridView1->StandardTab = true;

this->dataGridView1->TabIndex = 5;

//

// comboBox1

//

this->comboBox1->FormattingEnabled = true;

this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(5) {L"Понеділок", L"Вівторок", L"Середа", L"Четверг",

L"Пятниця"});

this->comboBox1->Location = System::Drawing::Point(14, 35);

this->comboBox1->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->comboBox1->Name = L"comboBox1";

this->comboBox1->Size = System::Drawing::Size(121, 21);

this->comboBox1->TabIndex = 11;

this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);

//

// pictureBox1

//

this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));

this->pictureBox1->Location = System::Drawing::Point(0, -2);

this->pictureBox1->Margin = System::Windows::Forms::Padding(0);

this->pictureBox1->Name = L"pictureBox1";

this->pictureBox1->Size = System::Drawing::Size(218, 462);

this->pictureBox1->TabIndex = 12;

this->pictureBox1->TabStop = false;

this->pictureBox1->Click += gcnew System::EventHandler(this, &Form1::pictureBox1_Click);

//

// textBox1

//

this->textBox1->Location = System::Drawing::Point(15, 207);

this->textBox1->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->textBox1->Name = L"textBox1";

this->textBox1->Size = System::Drawing::Size(120, 20);

this->textBox1->TabIndex = 2;

//

// button1

//

this->button1->Font = (gcnew System::Drawing::Font(L"Arial", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(204)));

this->button1->Location = System::Drawing::Point(143, 206);

this->button1->Margin = System::Windows::Forms::Padding(5, 3, 3, 3);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(48, 20);

this->button1->TabIndex = 4;

this->button1->Text = L"Add";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

//

// pictureBox3

//

this->pictureBox3->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox3.Image")));

this->pictureBox3->Location = System::Drawing::Point(-1, 420);

this->pictureBox3->Name = L"pictureBox3";

this->pictureBox3->Size = System::Drawing::Size(210, 40);

this->pictureBox3->TabIndex = 14;

this->pictureBox3->TabStop = false;

//

// label1

//

this->label1->AutoSize = true;

this->label1->BackColor = System::Drawing::Color::Transparent;

this->label1->Font = (gcnew System::Drawing::Font(L"Arial", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(204)));

this->label1->ForeColor = System::Drawing::Color::White;

this->label1->Location = System::Drawing::Point(3, 348);

this->label1->Name = L"label1";

this->label1->Size = System::Drawing::Size(49, 19);

this->label1->TabIndex = 2;

this->label1->Text = L"bbbb";

//

// panel2

//

this->panel2->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"panel2.BackgroundImage")));

this->panel2->Controls->Add(this->label1);

this->panel2->Controls->Add(this->panel4);

this->panel2->Controls->Add(this->panel3);

this->panel2->Location = System::Drawing::Point(218, 0);

this->panel2->Margin = System::Windows::Forms::Padding(0);

this->panel2->Name = L"panel2";

this->panel2->Size = System::Drawing::Size(641, 460);

this->panel2->TabIndex = 3;

this->panel2->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::panel2_Paint);

//

// panel4

//

this->panel4->BackColor = System::Drawing::Color::Transparent;

this->panel4->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"panel4.BackgroundImage")));

this->panel4->Location = System::Drawing::Point(569, 223);

this->panel4->Name = L"panel4";

this->panel4->Size = System::Drawing::Size(70, 81);

this->panel4->TabIndex = 5;

this->panel4->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::panel4_Paint);

this->panel4->Click += gcnew System::EventHandler(this, &Form1::panel4_Click);

//

// panel3

//

this->panel3->BackColor = System::Drawing::Color::Transparent;

this->panel3->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"panel3.BackgroundImage")));

this->panel3->ForeColor = System::Drawing::Color::Transparent;

this->panel3->Location = System::Drawing::Point(0, 223);

this->panel3->Name = L"panel3";

this->panel3->Size = System::Drawing::Size(70, 81);

this->panel3->TabIndex = 4;

this->panel3->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::panel3_Paint);

this->panel3->Click += gcnew System::EventHandler(this, &Form1::panel3_Click);

//

// н

//

this->н->HeaderText = L"№ п";

this->н->Name = L"н";

this->н->Width = 30;

//

// Викладач

//

this->Викладач->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::Fill;

this->Викладач->HeaderText = L"Аудиторія";

this->Викладач->Items->AddRange(gcnew cli::array< System::Object^ >(1) {L""});

this->Викладач->Name = L"Викладач";

this->Викладач->Resizable = System::Windows::Forms::DataGridViewTriState::True;

this->Викладач->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);

this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

this->BackColor = System::Drawing::SystemColors::Control;

this->ClientSize = System::Drawing::Size(858, 460);

this->Controls->Add(this->pictureBox3);

this->Controls->Add(this->comboBox1);

this->Controls->Add(this->dataGridView1);

this->Controls->Add(this->button3);

this->Controls->Add(this->button1);

this->Controls->Add(this->textBox1);

this->Controls->Add(this->listBox2);

this->Controls->Add(this->listBox1);

this->Controls->Add(this->pictureBox1);

this->Controls->Add(this->panel2);

this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;

this->Name = L"Form1";

this->Text = L"Завантаженість аудиторій V.5.0";

this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);

this->Activated += gcnew System::EventHandler(this, &Form1::Form1_Activated);

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataGridView1))->EndInit();

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();

(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox3))->EndInit();

this->panel2->ResumeLayout(false);

this->panel2->PerformLayout();

this->ResumeLayout(false);

this->PerformLayout();

}

#pragma endregion

private: System::Void pictureBox5_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void pictureBox6_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

this->listBox1->Items->Add(this->textBox1->Text::get());

if(write==1){

DataGridViewComboBoxColumn^ dgvc;

dgvc=(DataGridViewComboBoxColumn^)dataGridView1->Columns[1];

dgvc->Items->Add(textBox1->Text);

}

FileStream^ fs =gcnew FileStream(System::Windows::Forms::Application::StartupPath+"\\fam_p.txt",FileMode::Append);

StreamWriter^ file=gcnew StreamWriter(fs);

file->WriteLine("&"+this->textBox1->Text::get());

file->Close();

this->textBox1->Text="";

}

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void listBox1_Click(System::Object^ sender, System::EventArgs^ e) {

/* if()

{

BinaryReader^ r = gcnew BinaryReader(File::Open("..\\..\\kur5\\file\\zvg.txt",FileMode::Open));

String^ s;*/

// s=r->ReadString();

//richTextBox1->Text=s;

//r->Close();

}

private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {

dataGridView1->Columns[1]->HeaderText="Аудиторія";

DataGridViewComboBoxColumn^ dgvc;

dgvc=(DataGridViewComboBoxColumn^)dataGridView1->Columns[1];

dgvc->Items->Clear();

dgvc->Items->Add("");

for(int i=0;i<listBox2->Items->Count;i++)

dgvc->Items->Add(listBox2->Items[i]);

write=0;

for( int i=0;i<dataGridView1->RowCount;i++)

{

dataGridView1[0,i]->Value=(i+1).ToString();

dataGridView1[1,i]->Value="";

}

x->ShowDay(Convert::ToString(listBox1->SelectedItem), Convert::ToInt32(comboBox1->SelectedIndex)+1);

}

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {

if(write==0)

x->ChangeDay(Convert::ToString(listBox1->SelectedItem), Convert::ToInt32(comboBox1->SelectedIndex)+1);

else

x->ChangeAudit(Convert::ToString(listBox2->SelectedItem), Convert::ToInt32(comboBox1->SelectedIndex)+1);

x->Write();

}

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {

array<String^>^ a = File::ReadAllLines(System::Windows::Forms::Application::StartupPath+"\\fam_p.txt");

String^ v;

for(int i=0;i<a->Length;i++)

if(a[i][0]=='&'){

v =a[i]->Remove(0,1);

this->listBox1->Items->Add(v);

}

Inform= gcnew Auditor(label1,panel2);

Inform->read();

dataGridView1->RowCount=4;

x= gcnew Rozklad(dataGridView1);

x->read();

//x->ShowDay(Convert::ToString(listBox1->SelectedItem), Convert::ToInt32(comboBox1->SelectedIndex)+1);

//---------------------------------------------------------------------------------------------------------

//listBox1->SelectedIndex=0;

comboBox1->SelectedIndex=0;

dataGridView1->RowCount=4;

}

private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {

int num=Convert::ToInt32(comboBox1->SelectedIndex)+1;

}

private: System::Void listBox2_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {

dataGridView1->Columns[1]->HeaderText="Викладач";

write=1;

DataGridViewComboBoxColumn^ dgvc;

dgvc=(DataGridViewComboBoxColumn^)dataGridView1->Columns[1];

dgvc->Items->Clear();

dgvc->Items->Add("");

for(int i=0;i<listBox1->Items->Count;i++)

dgvc->Items->Add(listBox1->Items[i]);

for( int j=0;j<dataGridView1->ColumnCount;j++)

for( int i=0;i<dataGridView1->RowCount;i++)

{dataGridView1->Rows[i]->Cells[j]->Value="";

}

// Rozklad ^x= gcnew Rozklad(dataGridView1);

// x->read();

x->ShowPara(Convert::ToString(listBox2->SelectedItem), Convert::ToInt32(comboBox1->SelectedIndex)+1);

Inform->Show_Info(Convert::ToString(listBox2->SelectedItem),1);

imgNum=1;

}

private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void button2_Click_2(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void pictureBox2_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void pictureBox3_Click(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void panel3_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

}

private: System::Void panel4_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

}

private: System::Void panel3_Click(System::Object^ sender, System::EventArgs^ e) {

if (imgNum==1){

Inform->Show_Info(Convert::ToString(listBox2->SelectedItem),2);

imgNum=2;

}else{

Inform->Show_Info(Convert::ToString(listBox2->SelectedItem),1);

imgNum=1;

}

}

private: System::Void panel4_Click(System::Object^ sender, System::EventArgs^ e) {

if (imgNum==1){

Inform->Show_Info(Convert::ToString(listBox2->SelectedItem),2);

imgNum=2;

}else{

Inform->Show_Info(Convert::ToString(listBox2->SelectedItem),1);

imgNum=1;

}

}

private: System::Void panel2_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {

}

private: System::Void Form1_Activated(System::Object^ sender, System::EventArgs^ e) {

listBox1->SelectedIndex = 0;

listBox2->SelectedIndex = 0;

}

};

}

Rozklad.срр

#include "StdAfx.h"

#include "Rozklad.h"

Rozklad::Rozklad(void)

{

}

P::P(int number, System::String ^Auditoriya){

this->Auditoriya=Auditoriya;

this->number=number;

}

P::P(void)

{

}

Rozklad::Rozklad(DataGridView^ grid){

this->grid=grid;

}

void Rozklad::Write(){

FileStream^ fs =gcnew FileStream(System::Windows::Forms::Application::StartupPath+"\\fam_p.txt",FileMode::Create);

StreamWriter^ file=gcnew StreamWriter(fs);

IDictionaryEnumerator ^enumerator1 = Rz->GetEnumerator();

while (enumerator1->MoveNext()){

file->WriteLine("&"+enumerator1->Key->ToString());

IDictionaryEnumerator ^enumerator2= ((Dictionary<int,List<P^>^>^)enumerator1->Value)->GetEnumerator();

while (enumerator2->MoveNext()){

file->WriteLine("#"+enumerator2->Key->ToString());

for(int i=0;i<((List<P^>^)enumerator2->Value)->Count;i++){

file->WriteLine("*"+((List<P^>^)enumerator2->Value)[i]->number.ToString()+"."+((List<P^>^)enumerator2->Value)[i]->Auditoriya);

}

}

}

file->Close();

}

void Rozklad::ChangeDay(System::String ^v, int num){

bool zan=false;

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

if(grid[0,i]->Value!=""&&grid[1,i]->Value!="")

{

IDictionaryEnumerator ^enumerator1 = Rz->GetEnumerator();

while (enumerator1->MoveNext())

{

if(((Dictionary<int,List<P^>^>^)enumerator1->Value)->ContainsKey(num))

{

if(enumerator1->Key->ToString()==v)continue;

for(int j=0;j<((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])->Count;j++)

if(((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])[j]->Auditoriya==grid[1,i]->Value->ToString()&&((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])[j]->number==Convert::ToInt32(grid[0,i]->Value->ToString()))

{

zan=true;

MessageBox::Show("Аудиторію "+grid[1,i]->Value->ToString()+" зайняв "+enumerator1->Key->ToString());

break;

}

}

}

if(zan)break;

}

if(!zan){

List <P^>^ z=gcnew List<P^>;

for(int i=0;i<4;i++)if(grid[0,i]->Value!=""&&grid[1,i]->Value!=""){

P^ pr=gcnew P(Convert::ToInt32( grid[0,i]->Value),grid[1,i]->Value->ToString());

z->Add(pr);

}

if(Rz->ContainsKey(v)){

if(Rz[v]->ContainsKey(num)){

Rz[v]->Remove(num);

}

Rz[v]->Add(num,z);

}else{

Dictionary<int,List<P^>^> ^x=gcnew Dictionary<int,List<P^>^>;

x->Add(num,z);

Rz->Add(v,x);

}

}

}

void Rozklad::ChangeAudit(System::String ^A, int num)

{

IDictionaryEnumerator ^enumerator1 = Rz->GetEnumerator();

while (enumerator1->MoveNext())

{

if(((Dictionary<int,List<P^>^>^)enumerator1->Value)->ContainsKey(num))

{

for(int i=0;i<((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])->Count;i++)

if(((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])[i]->Auditoriya==A)

{

((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])->RemoveAt(i);

break;

}

}

}

int i=0;

while(i!=4&&grid[0,i]->Value!="")

{

P^ pr=gcnew P(Convert::ToInt32(grid[0,i]->Value->ToString()),A);

if(Rz[grid[1,i]->Value->ToString()]->ContainsKey(num))

Rz[grid[1,i]->Value->ToString()][num]->Add(pr);

else

{

Dictionary<int,List<P^>^> ^x=gcnew Dictionary<int,List<P^>^>;

List <P^>^ z=gcnew List<P^>;

z->Add(pr);

x->Add(num,z);

Rz->Add(grid[1,i]->Value->ToString(),x);

}

i++;

}

}

void Rozklad::ShowDay(String^ v,int num){

//DataGridViewComboBoxCell

// ((DataGridViewComboBoxCell)grid[1,0])->

if(Rz->ContainsKey(v)){

if(Rz[v]->ContainsKey(num)){

for(int i=0;i<Rz[v][num]->Count;i++){

grid[0,Rz[v][num][i]->number-1]->Value=Rz[v][num][i]->number.ToString();

grid[1,Rz[v][num][i]->number-1]->Value =Rz[v][num][i]->Auditoriya;

}

}

}

}

void Rozklad::ShowPara(String^ A,int num){

int k=0;

//String ^temp=A;

IDictionaryEnumerator ^enumerator1 = Rz->GetEnumerator();

while (enumerator1->MoveNext()){

if(((Dictionary<int,List<P^>^>^)enumerator1->Value)->ContainsKey(num))

{

for(int i=0;i<((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])->Count;i++)

if(((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])[i]->Auditoriya==A){

grid[0,k]->Value=((List<P^>^)((Dictionary<int,List<P^>^>^)enumerator1->Value)[num])[i]->number.ToString();

grid[1,k++]->Value=enumerator1->Key->ToString();

}

}

}

}

void Rozklad::read(){

Rz=gcnew Dictionary<String^,Dictionary<int,List<P^>^>^>;

array<String^>^ a = File::ReadAllLines(System::Windows::Forms::Application::StartupPath+"\\fam_p.txt");

String^ v;

int num;

for(int i=0;i<a->Length;i++)

{

if(a[i][0]=='&'){

v =a[i]->Remove(0,1);

}

if(a[i][0]=='#')

{

num=Convert::ToInt32( a[i][1])-48;

}

if(a[i][0]=='*')

{

P^ pr=gcnew P(Convert::ToInt32( a[i][1])-48,a[i]->Substring(3));

if(!Rz->ContainsKey(v)){

Dictionary<int,List<P^>^> ^x=gcnew Dictionary<int,List<P^>^>;

List <P^>^ z=gcnew List<P^>;

z->Add(pr);

x->Add(num,z);

Rz->Add(v,x);

}else{

if(Rz[v]->ContainsKey(num))

Rz[v][num]->Add(pr);

else{

List <P^>^ z=gcnew List<P^>;

z->Add(pr);

Rz[v]->Add(num,z);

}

}

}

}

Rozklad.h

#pragma once

#include "classss.h"

#include "vukl.h"

#include "para.h"

using namespace System;

using namespace System::IO;

using namespace System::Collections;

using namespace System::Collections::Generic;

using namespace System::ComponentModel;

using namespace System::Windows::Forms;

ref class P{

public:

int number;

String ^Auditoriya;

P(int number,String ^Auditoriya);

P(void);

};

ref class Rozklad

{

List<para^> ^pary;

public:

Dictionary<String^,Dictionary<int,List<P^>^>^> ^Rz;

DataGridView^ grid;

Rozklad(void);

Rozklad(DataGridView^ grid);

void read();

void ShowDay(String^ v,int num);

void ShowPara(String^ A,int num);

void Write();

void ChangeDay(String^ v,int num);

void ChangeAudit(String ^A,int num);

}

докум.

Підпис

Дата

Арк.

37

КР 4.2 5.05010301 34 ПЗ

Зм.

Арк.