|
|
səhifə | 5/6 | tarix | 13.04.2023 | ölçüsü | 1,31 Mb. | | #97226 |
| bobur
Qidirish.h
#pragma once
#include"TTJ_sinf.h"
//#include"Asosiy_oyna.h";
namespace TTJ_New {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
///
/// Summary for Qidirish
///
public ref class Qidirish : public System::Windows::Forms::Form
{
private: Object^ As;
public:
Qidirish(Object^ o)
{
As = o;
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
private: System::Windows::Forms::ComboBox^ comboBox1;
private: System::Windows::Forms::DataGridView^ dataGridView2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::PictureBox^ pictureBox2;
private: System::Windows::Forms::DataGridView^ dataGridView3;
private: System::Windows::Forms::CheckedListBox^ checkedListBox1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::CheckBox^ checkBox1;
public:
public: TTJ_sinf^ TTJ_3;
protected:
///
/// Clean up any resources being used.
///
~Qidirish()
{
if (components)
{
delete components;
}
}
public: System::Windows::Forms::PictureBox^ pictureBox1;
public:
private:
public:
private:
public: System::Windows::Forms::TabControl^ tabControl2;
public: System::Windows::Forms::TabPage^ tabPage4;
private: System::Windows::Forms::DataGridView^ dataGridView1;
public:
private: System::Windows::Forms::TabPage^ tabPage5;
private: System::Windows::Forms::TextBox^ textBox18;
protected:
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Qidirish::typeid));
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle2 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->tabControl2 = (gcnew System::Windows::Forms::TabControl());
this->tabPage4 = (gcnew System::Windows::Forms::TabPage());
this->dataGridView3 = (gcnew System::Windows::Forms::DataGridView());
this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox());
this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
this->tabPage5 = (gcnew System::Windows::Forms::TabPage());
this->dataGridView2 = (gcnew System::Windows::Forms::DataGridView());
this->textBox18 = (gcnew System::Windows::Forms::TextBox());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->checkedListBox1 = (gcnew System::Windows::Forms::CheckedListBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
(cli::safe_cast(this->pictureBox1))->BeginInit();
this->tabControl2->SuspendLayout();
this->tabPage4->SuspendLayout();
(cli::safe_cast(this->dataGridView3))->BeginInit();
(cli::safe_cast(this->pictureBox2))->BeginInit();
(cli::safe_cast(this->dataGridView1))->BeginInit();
this->tabPage5->SuspendLayout();
(cli::safe_cast(this->dataGridView2))->BeginInit();
this->SuspendLayout();
//
// pictureBox1
//
this->pictureBox1->Image = (cli::safe_cast(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(185, 5);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(161, 163);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox1->TabIndex = 4;
this->pictureBox1->TabStop = false;
this->pictureBox1->WaitOnLoad = true;
//
// tabControl2
//
this->tabControl2->Controls->Add(this->tabPage4);
this->tabControl2->Controls->Add(this->tabPage5);
this->tabControl2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->tabControl2->Location = System::Drawing::Point(181, 174);
this->tabControl2->Name = L"tabControl2";
this->tabControl2->SelectedIndex = 0;
this->tabControl2->Size = System::Drawing::Size(774, 258);
this->tabControl2->TabIndex = 2;
//
// tabPage4
//
this->tabPage4->BackColor = System::Drawing::Color::WhiteSmoke;
this->tabPage4->Controls->Add(this->dataGridView3);
this->tabPage4->Controls->Add(this->pictureBox2);
this->tabPage4->Controls->Add(this->dataGridView1);
this->tabPage4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->tabPage4->Location = System::Drawing::Point(4, 26);
this->tabPage4->Name = L"tabPage4";
this->tabPage4->Padding = System::Windows::Forms::Padding(3);
this->tabPage4->Size = System::Drawing::Size(766, 228);
this->tabPage4->TabIndex = 0;
this->tabPage4->Text = L"Talabalar jadvali";
//
// dataGridView3
//
this->dataGridView3->AllowDrop = true;
this->dataGridView3->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
this->dataGridView3->ColumnHeadersBorderStyle = System::Windows::Forms::DataGridViewHeaderBorderStyle::Sunken;
dataGridViewCellStyle1->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle1->BackColor = System::Drawing::Color::Blue;
dataGridViewCellStyle1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular,
System::Drawing::GraphicsUnit::Point, static_cast(204)));
dataGridViewCellStyle1->ForeColor = System::Drawing::SystemColors::WindowText;
dataGridViewCellStyle1->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle1->SelectionForeColor = System::Drawing::Color::Blue;
dataGridViewCellStyle1->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->dataGridView3->ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this->dataGridView3->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView3->GridColor = System::Drawing::SystemColors::ActiveCaption;
this->dataGridView3->ImeMode = System::Windows::Forms::ImeMode::AlphaFull;
this->dataGridView3->Location = System::Drawing::Point(460, 138);
this->dataGridView3->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->dataGridView3->Name = L"dataGridView3";
dataGridViewCellStyle2->BackColor = System::Drawing::SystemColors::ButtonHighlight;
this->dataGridView3->RowsDefaultCellStyle = dataGridViewCellStyle2;
this->dataGridView3->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
this->dataGridView3->Size = System::Drawing::Size(168, 59);
this->dataGridView3->TabIndex = 9;
this->dataGridView3->Visible = false;
//
// pictureBox2
//
this->pictureBox2->Image = (cli::safe_cast(resources->GetObject(L"pictureBox2.Image")));
this->pictureBox2->Location = System::Drawing::Point(601, 92);
this->pictureBox2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
this->pictureBox2->Name = L"pictureBox2";
this->pictureBox2->Size = System::Drawing::Size(133, 121);
this->pictureBox2->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox2->TabIndex = 9;
this->pictureBox2->TabStop = false;
this->pictureBox2->Visible = false;
this->pictureBox2->WaitOnLoad = true;
//
// dataGridView1
//
this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView1->Location = System::Drawing::Point(5, 10);
this->dataGridView1->Name = L"dataGridView1";
this->dataGridView1->Size = System::Drawing::Size(755, 215);
this->dataGridView1->TabIndex = 0;
this->dataGridView1->SelectionChanged += gcnew System::EventHandler(this, &Qidirish::dataGridView1_SelectionChanged);
this->dataGridView1->Click += gcnew System::EventHandler(this, &Qidirish::dataGridView1_Click);
//
// tabPage5
//
this->tabPage5->BackColor = System::Drawing::Color::WhiteSmoke;
this->tabPage5->Controls->Add(this->dataGridView2);
this->tabPage5->Location = System::Drawing::Point(4, 26);
this->tabPage5->Name = L"tabPage5";
this->tabPage5->Padding = System::Windows::Forms::Padding(3);
this->tabPage5->Size = System::Drawing::Size(766, 228);
this->tabPage5->TabIndex = 1;
this->tabPage5->Text = L"Qarindoshlar jadvali";
//
// dataGridView2
//
this->dataGridView2->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView2->Location = System::Drawing::Point(6, 12);
this->dataGridView2->Name = L"dataGridView2";
this->dataGridView2->Size = System::Drawing::Size(755, 129);
this->dataGridView2->TabIndex = 1;
this->dataGridView2->SelectionChanged += gcnew System::EventHandler(this, &Qidirish::dataGridView2_SelectionChanged);
this->dataGridView2->Click += gcnew System::EventHandler(this, &Qidirish::dataGridView2_Click);
//
// textBox18
//
this->textBox18->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 16.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox18->Location = System::Drawing::Point(352, 5);
this->textBox18->Multiline = true;
this->textBox18->Name = L"textBox18";
this->textBox18->Size = System::Drawing::Size(229, 41);
this->textBox18->TabIndex = 1;
this->textBox18->TextChanged += gcnew System::EventHandler(this, &Qidirish::textBox18_TextChanged);
//
// comboBox1
//
this->comboBox1->AutoCompleteMode = System::Windows::Forms::AutoCompleteMode::Suggest;
this->comboBox1->AutoCompleteSource = System::Windows::Forms::AutoCompleteSource::ListItems;
this->comboBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->comboBox1->ForeColor = System::Drawing::SystemColors::InactiveCaptionText;
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(22) {L"Fam", L"Ism", L"Sharf", L"Guruh", L"Bosqich",
L"Tugilgan_viloyati", L"Pasport_seriasi", L"Tugilgan_Sana", L"Pasport_nomeri", L"Xona_nomeri", L"Blok_nomi", L"Qavat_nomeri",
L"Lavozim", L"Telefoni", L"Tugilgan_yili", L"Tugilgan_oyi", L"Tugilgan_kuni", L"Jinsi", L"Fakulteti", L"Yonalishi", L"Tugilgan_tumani",
L"Yashash_manzili"});
this->comboBox1->Location = System::Drawing::Point(352, 52);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System::Drawing::Size(229, 28);
this->comboBox1->TabIndex = 0;
this->comboBox1->Text = L"Qidirish turi";
this->comboBox1->Click += gcnew System::EventHandler(this, &Qidirish::comboBox1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(187, 459);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(35, 13);
this->label1->TabIndex = 7;
this->label1->Text = L"label1";
this->label1->Visible = false;
//
// checkedListBox1
//
this->checkedListBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10.25F, System::Drawing::FontStyle::Regular,
System::Drawing::GraphicsUnit::Point, static_cast(204)));
this->checkedListBox1->FormattingEnabled = true;
this->checkedListBox1->Items->AddRange(gcnew cli::array< System::Object^ >(23) {L"Fam", L"Ism", L"Sharf", L"Guruh", L"Bosqich",
L"Tugilgan_viloyati", L"Pasport_seriasi", L"Tugilgan_Sana", L"Pasport_nomeri", L"Xona_nomeri", L"Blok_nomi", L"Qavat_nomeri",
L"Lavozim", L"Telefoni", L"Tugilgan_yili", L"Tugilgan_oyi", L"Tugilgan_kuni", L"Jinsi", L"Fakulteti", L"Yonalishi", L"Tugilgan_tumani",
L"Yashash_manzili", L"Rasm"});
this->checkedListBox1->Location = System::Drawing::Point(1, 28);
this->checkedListBox1->Name = L"checkedListBox1";
this->checkedListBox1->Size = System::Drawing::Size(178, 418);
this->checkedListBox1->TabIndex = 8;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label2->Location = System::Drawing::Point(12, 5);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(142, 20);
this->label2->TabIndex = 9;
this->label2->Text = L"Zaruriy maydonlar";
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->checkBox1->Location = System::Drawing::Point(1, 453);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(180, 24);
this->checkBox1->TabIndex = 10;
this->checkBox1->Text = L"Hammasni belgilash";
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Qidirish::checkBox1_CheckedChanged);
//
// Qidirish
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(956, 487);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->checkedListBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->comboBox1);
this->Controls->Add(this->textBox18);
this->Controls->Add(this->tabControl2);
this->Controls->Add(this->pictureBox1);
this->Name = L"Qidirish";
this->Text = L"Qidirish";
this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &Qidirish::Qidirish_FormClosed);
this->FontChanged += gcnew System::EventHandler(this, &Qidirish::Qidirish_FontChanged);
(cli::safe_cast(this->pictureBox1))->EndInit();
this->tabControl2->ResumeLayout(false);
this->tabPage4->ResumeLayout(false);
(cli::safe_cast(this->dataGridView3))->EndInit();
(cli::safe_cast(this->pictureBox2))->EndInit();
(cli::safe_cast(this->dataGridView1))->EndInit();
this->tabPage5->ResumeLayout(false);
(cli::safe_cast(this->dataGridView2))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
int po;String^ maydon; bool st;
void index(int indexChecked[]){ int i=0;
IEnumerator^ myEnum1 = checkedListBox1->CheckedIndices->GetEnumerator();
while( myEnum1->MoveNext()){
indexChecked[i] = *safe_cast(myEnum1->Current); i++; }
if(i>=0){st=1;}
po=i; }
private: System::Void textBox18_TextChanged(System::Object^ sender, System::EventArgs^ e) {
TTJ_3 = gcnew TTJ_sinf();
maydon="";
String ^ q_2, ^qidirish = "Select * From [Talabalar]", ^qidirish_2 = "Select * From [Talabalar]";
int indexChecked[100];
index(indexChecked); //int tt=indexChecked[0];
if(po>=0){
for(int i=0; i
if (i==po-1){
//if(indexChecked[i+1] == indexChecked[i+1]){
maydon+=checkedListBox1->Items[indexChecked[i]]->ToString()+" ";
}
else{maydon+=checkedListBox1->Items[indexChecked[i]]->ToString()+", ";}
//}
}
//label1->Text = maydon; //po.ToString();
if(po<=0){po=23; qidirish_2 = "Select * From [Talabalar] Where ("+comboBox1->Text+" LIKE '"+textBox18->Text+"%')";}
else { qidirish_2 = "Select id,"+maydon+" From [Talabalar] Where ("+comboBox1->Text+" LIKE '"+textBox18->Text+"%')";}
try{ TTJ_3->ShowRecord(dataGridView1, qidirish_2); delete TTJ_3;}
catch(Exception^ v){MessageBox::Show("Data 4 xatolik");}
}
else{po=23; label1->Text = po.ToString();}
int row_soni = dataGridView1->Rows->Count;// (DataGridViewElementStates::Selected);
int id_nomeri[100];
int i=0;
// id_nomeri[0] =Convert::ToInt32( dataGridView1->Rows[i]->Cells[0]->Value );
// label1->Text=id_nomeri[0].ToString();
String ^ Satr="SELECT * FROM [Qarindoshlar] Where Id_nomeri IN(";
String^ satr="";
for(int i=0; i
id_nomeri[i] =Convert::ToInt32( dataGridView1->Rows[i]->Cells[0]->Value );
if(i
else if(i==row_soni-2) satr +=Convert::ToString(id_nomeri[i])+" ";
} Satr+=satr; Satr+=")";
//Satr="SELECT * FROM [Qarindoshlar] Where Id_nomeri IN(1, 2, 3)";
//label1->Text=Satr;
try{ TTJ_3->ShowRecord(dataGridView2,Satr); delete TTJ_3;}
catch(Exception^ v){}// MessageBox::Show("Topilmadi(xatoli)"); textBox18->Text="";}
}
private: System::Void comboBox1_Click(System::Object^ sender, System::EventArgs^ e) {
comboBox1->Text = "";
}
public: Image^ loadFoto(array^ Rasm){
MemoryStream^ ms=gcnew MemoryStream(Rasm);
return Image::FromStream(ms);
}
private: System::Void dataGridView1_Click(System::Object^ sender, System::EventArgs^ e) {
int id_2 = dataGridView1->Rows->GetFirstRow(DataGridViewElementStates::Selected);
try{ pictureBox1->Image =loadFoto((array^) dataGridView1->Rows[id_2]->Cells[po]->Value);}
catch(Exception^ vaziyat){pictureBox1->Image = pictureBox2->Image; //MessageBox::Show("xato");
}
}
private: System::Void dataGridView1_SelectionChanged(System::Object^ sender, System::EventArgs^ e) {
int id_2 = dataGridView1->Rows->GetFirstRow(DataGridViewElementStates::Selected);
try{ pictureBox1->Image =loadFoto((array^) dataGridView1->Rows[id_2]->Cells[po]->Value);}
catch(Exception^ vaziyat){pictureBox1->Image = pictureBox2->Image; //MessageBox::Show("xato");
}
}
private: System::Void dataGridView2_Click(System::Object^ sender, System::EventArgs^ e) {
try{ int rowToUpdate_3 = dataGridView2->Rows->GetFirstRow (DataGridViewElementStates::Selected);
int id_3 = Convert::ToInt32(dataGridView2->Rows[rowToUpdate_3]->Cells["id"]->Value);
String ^ Id_nomeri = dataGridView2->Rows[id_3-1]->Cells[7]->Value->ToString();
//label1->Text = Id_nomeri;
String ^satr="SELECT * FROM [Talabalar] Where (id = "+Id_nomeri+")";
//qidirish(satr);
TTJ_3 = gcnew TTJ_sinf();
try{ TTJ_3->ShowRecord(dataGridView3,satr); delete TTJ_3;}
catch(Exception^ v){MessageBox::Show("Xatolik bor");}
try{ pictureBox1->Image =loadFoto((array^) dataGridView3->Rows[-0]->Cells["Rasm"]->Value);
int rowToUpdate_2 = dataGridView2->Rows->GetFirstRow(DataGridViewElementStates::Selected);
int id_2 = Convert::ToInt32(dataGridView2->Rows[rowToUpdate_2]->Cells["id"]->Value); }
catch(Exception^ vaziyat){pictureBox1->Image = pictureBox2->Image; }
}
catch(Exception^ vaziyat){}
}
private: System::Void dataGridView2_SelectionChanged(System::Object^ sender, System::EventArgs^ e) {
try{ int rowToUpdate_3 = dataGridView2->Rows->GetFirstRow (DataGridViewElementStates::Selected);
int id_3 = Convert::ToInt32(dataGridView2->Rows[rowToUpdate_3]->Cells["id"]->Value);
String ^ Id_nomeri = dataGridView2->Rows[id_3-1]->Cells[7]->Value->ToString();
//label1->Text = Id_nomeri;
String ^satr="SELECT * FROM [Talabalar] Where (id = "+Id_nomeri+")";
//qidirish(satr);
TTJ_3 = gcnew TTJ_sinf();
try{ TTJ_3->ShowRecord(dataGridView3,satr); delete TTJ_3;}
catch(Exception^ v){MessageBox::Show("Xatolik bor");}
try{ pictureBox1->Image =loadFoto((array^) dataGridView3->Rows[-0]->Cells["Rasm"]->Value);
int rowToUpdate_2 = dataGridView2->Rows->GetFirstRow(DataGridViewElementStates::Selected);
int id_2 = Convert::ToInt32(dataGridView2->Rows[rowToUpdate_2]->Cells["id"]->Value); }
catch(Exception^ vaziyat){pictureBox1->Image = pictureBox2->Image; }
}
catch(Exception^ vaziyat){}
}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if(checkBox1->Checked){
//MessageBox::Show(checkedListBox1->Items[0]->ToString());
for(int i=0;i<23;i++)
checkedListBox1->SetItemChecked(i,true); // GetEnumerator();
}
else { for(int i=0;i<23;i++)
checkedListBox1->SetItemChecked(i,false); }
}
private: System::Void dataGridView4_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
}
private: System::Void Qidirish_FontChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Qidirish_FormClosed(System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e) {
safe_cast
Dostları ilə paylaş: |
|
|