Visual Studio dasturining Visual C++ dasturlash tilida kichik loyihalar yaratish Loyiha bu


Download 0.98 Mb.
bet3/4
Sana18.06.2023
Hajmi0.98 Mb.
#1591805
1   2   3   4
Bog'liq
5-mustaqil ish

Autentifikatsiya.h
#pragma once
#include
#include
#include
#include"Asosiy_oyna.h";
//#include"Form1.h";
#include"TTJ_sinf.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;

///


/// Summary for Audentifikatsiya
///

public ref class Audentifikatsiya : public System::Windows::Forms::Form
{
public: TTJ_sinf^ TTJ;
public:
Audentifikatsiya(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:


///
/// Clean up any resources being used.
///

~Audentifikatsiya()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Label^ password;
private: System::Windows::Forms::DataGridView^ dataGridView1;
private: System::Windows::Forms::Label^ Login;
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)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->password = (gcnew System::Windows::Forms::Label());
this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
this->Login = (gcnew System::Windows::Forms::Label());
(cli::safe_cast(this->dataGridView1))->BeginInit();
this->SuspendLayout();
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->button1->Location = System::Drawing::Point(23, 116);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(250, 47);
this->button1->TabIndex = 2;
this->button1->Text = L"Ok";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Audentifikatsiya::button1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label1->Location = System::Drawing::Point(19, 65);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(63, 24);
this->label1->TabIndex = 4;
this->label1->Text = L"Parol :";
//
// textBox1
//
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox1->Location = System::Drawing::Point(88, 62);
this->textBox1->Multiline = true;
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(185, 35);
this->textBox1->TabIndex = 1;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label2->Location = System::Drawing::Point(19, 24);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(62, 24);
this->label2->TabIndex = 7;
this->label2->Text = L"Login:";
//
// textBox2
//
this->textBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox2->Location = System::Drawing::Point(88, 21);
this->textBox2->Multiline = true;
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(185, 35);
this->textBox2->TabIndex = 0;
//
// password
//
this->password->AutoSize = true;
this->password->Location = System::Drawing::Point(303, 183);
this->password->Name = L"password";
this->password->Size = System::Drawing::Size(0, 13);
this->password->TabIndex = 8;
this->password->Visible = false;
//
// dataGridView1
//
this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dataGridView1->Location = System::Drawing::Point(178, 95);
this->dataGridView1->Name = L"dataGridView1";
this->dataGridView1->Size = System::Drawing::Size(65, 20);
this->dataGridView1->TabIndex = 9;
this->dataGridView1->Visible = false;
//
// Login
//
this->Login->AutoSize = true;
this->Login->Location = System::Drawing::Point(319, 32);
this->Login->Name = L"Login";
this->Login->Size = System::Drawing::Size(0, 13);
this->Login->TabIndex = 10;
this->Login->Visible = false;
//
// Audentifikatsiya
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(294, 169);
this->Controls->Add(this->Login);
this->Controls->Add(this->dataGridView1);
this->Controls->Add(this->password);
this->Controls->Add(this->label2);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Controls->Add(this->textBox1);
this->Name = L"Audentifikatsiya";
this->Text = L"Audentifikatsiya";
this->Load += gcnew System::EventHandler(this, &Audentifikatsiya::Audentifikatsiya_Load);
(cli::safe_cast(this->dataGridView1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion


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

Asosiy_oyna^ ob = gcnew Asosiy_oyna(this);


TTJ = gcnew TTJ_sinf(); bool s;
TTJ->ShowRecord(dataGridView1,"Select * From Login Where(login ='"+textBox2->Text+"' AND password ='"+textBox1->Text+"')");
delete TTJ;
password->Text = Convert::ToString(dataGridView1->Rows[0]->Cells["password"]->Value);
Login->Text = Convert::ToString(dataGridView1->Rows[0]->Cells["login"]->Value);

if(textBox1->Text==password->Text && textBox2->Text==Login->Text){


ob->Show();
this->Hide();
}
else {MessageBox::Show("Parol xato kiritildi");k++;}
if(k>3){this->Close();}
}
private: System::Void Audentifikatsiya_Load(System::Object^ sender, System::EventArgs^ e) {
TTJ = gcnew TTJ_sinf(); bool s;
TTJ->ShowRecord(dataGridView1,"Select * From Login");
delete TTJ;
password->Text = Convert::ToString(dataGridView1->Rows[0]->Cells["password"]->Value);
Login->Text = Convert::ToString(dataGridView1->Rows[0]->Cells["login"]->Value);

if(password->Text=="" && Login->Text==""){


label1->Visible=false;
label2->Visible=false;
textBox1->Visible=false;
textBox2->Visible=false;
button1->Text="Parol yoq. Marhamat";
}
else {
//password->Text= gcnew String(parol);
//label1->Text="Eski parolni yozing";
label1->Visible=true;
label2->Visible=true;
textBox1->Visible=true;
textBox2->Visible=true;
button1->Text="Parolni kiritig";
}
}
};
}


Download 0.98 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling