Ishlab chiqaruvchilar ekrani
bet 7/8 Sana 04.03.2022 Hajmi 269,5 Kb. #482298
Bog'liq
Yodgorova Madinaxon
Ishlab chiqaruvchilar ekrani
Ishlab chiqaruvchilar ekranida avtomobil ishlab chiqaruvchilari haqidagi barcha ma'lumotlar mavjud. Ushbu ma'lumot TDBGrid va TImage ob'ektlari yordamida taqdim etiladi. TDBGrid ishlab chiqaruvchi nomlarini o'z ichiga oladi. Ushbu ob'ekt yordamida siz ishlab chiqaruvchilar o'rtasida harakat qilishingiz mumkin. Ko'chirilganda ishlab chiqaruvchining logotipi BMP faylidan olingan TImage ob'ektida ko'rsatiladi. Agar rasm fayli bo'lmasa, logotip standart tasvir bilan almashtiriladi.
5-rasm - Eran "Prodyuserlar"
Shakl 6 - logotip yo'qligida Eran "Ishlab chiqaruvchilar"
Mijozlar ekrani
Mijozlar ekranida mijozlar haqidagi ma'lumotlar mavjud. Barcha ma'lumotlar TDBGrid tipidagi ob'ektda joylashgan.
7-rasm - "Mijozlar" ekrani
3.2.5 Rangli ekran
Ranglar ekranida ranglar haqidagi ma'lumotlar mavjud. Barcha ma'lumotlar TDBGrid tipidagi ob'ektda joylashgan.
8-rasm - "Ranglar" ekrani
Ekran namunasi
Model ekranida mijozlar haqidagi ma'lumotlar mavjud. Barcha ma'lumotlar TDBGrid tipidagi ob'ektda joylashgan.
9-rasm - "Model" ekrani
Ishlatilgan dasturiy ta'minot
1) MSAccess;
2) Borland C # Builder 6.0;
3) MSWord matn protsessori.
Ilova A
Dastur ro'yxati
1) Loyiha moduli
//---------------------------------------------------------------------------
#include
#pragma hdrstop
//---------------------------------------------------------------------------("MainUnit.cpp", MainForm);("DataBaseDataModuleUnit.cpp", DataBaseDataModule); /* TDataModule: File Type */("DialogsDataModuleUnit.cpp", DialogsDataModule); /* TDataModule: File Type */("PreviewUnit.cpp", PreviewForm);
//---------------------------------------------------------------------------WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
{
Application->Initialize();
Application->CreateForm(__classid(TMainForm), &MainForm);
Application->CreateForm(__classid(TDataBaseDataModule), &DataBaseDataModule);
Application->CreateForm(__classid(TDialogsDataModule), &DialogsDataModule);
Application->CreateForm(__classid(TPreviewForm), &PreviewForm);
Application->Run();
}(Exception &exception)
{
Application->ShowException(&exception);
}(...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}0;
}
//---------------------------------------------------------------------------
2) Asosiy shakl moduli
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "MainUnit.h"
#include "DataBaseDataModuleUnit.h"
#include "DialogsDataModuleUnit.h"
#include "FunctionsUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*MainForm;
//---------------------------------------------------------------------------DoubleSlash (AnsiString str);DataBaseConnection (AnsiString Path);ManufacturerButtonVisibleFalseAddEditDeleteTruePostCancel(TButton * ManufacturerAddButton, TButton * ManufacturerEditButton, TButton * ManufacturerDeleteButton, TButton * ManufacturerPostButton, TButton * ManufacturerCancelButton);ManufacturerButtonVisibleTrueAddEditDeleteFalsePostCancel(TButton * ManufacturerAddButton, TButton * ManufacturerEditButton, TButton * ManufacturerDeleteButton, TButton * ManufacturerPostButton, TButton * ManufacturerCancelButton);
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------__fastcall TMainForm::FormCreate(TObject *Sender)
{>Position = poDesktopCenter;>ActivePage = MainTabSheet;(!(DirectoryExists("Files")))
{("Files");
}(!(DirectoryExists("Files\\DataBase")))
{("Files\\DataBase");
}
}
//---------------------------------------------------------------------------
//-----Закрытие программы:__fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose)
{(Application->MessageBox("Вы действительно хотите закрыть программу?","Выход",MB_YESNO + MB_ICONSTOP)==IDYES)
{= True;
}
{= False;
}
}
//---------------------------------------------------------------------------__fastcall TMainForm::DataBaseFilePathOpenDialogExecuteButtonClick(*Sender)
{(DialogsDataModule->DataBaseFilePathOpenDialog->Execute())
{>Text = DialogsDataModule->DataBaseFilePathOpenDialog->FileName;
}
}
//---------------------------------------------------------------------------__fastcall TMainForm::FormShow(TObject *Sender)
{("D:\\Projects\\BuilderProjects\\CarShop\\Files\\DataBase\\CarShopDataBase.mdb");>DataSource = DataBaseDataModule->ManufacturerDataSource;>Options = TDBGridOptions(ManufacturerDBGrid->Options) >> dgEditing >> dgIndicator >> dgColumnResize;
//ManufacturerDBGrid->Columns->Add();
//ManufacturerDBGrid->Columns->Add();
//ManufacturerDBGrid->Columns->Add();
//ManufacturerDBGrid->Columns->Items[0]->FieldName = "Title_Manufacturer";
//ManufacturerDBGrid->Columns->Items[0]->Title->Caption = "Название";
//ManufacturerDBGrid->Columns->Items[1]->Title->Caption = "Количество моделей";
//ManufacturerDBGrid->Columns->Items[2]->Title->Caption = "Количество автомобилей";>Columns->Items[0]->Width = (ManufacturerDBGrid->Width - 40)/3;>Columns->Items[1]->Visible = False;
//ManufacturerDBGrid->Columns->Items[1]->Width = (ManufacturerDBGrid->Width - 40)/3;
//ManufacturerDBGrid->Columns->Items[2]->Width = (ManufacturerDBGrid->Width - 40)/3;
//DataBaseDataModule->ManufacturerADOTable->Sort = "Title_Manufacturer ASC";>DataSource = DataBaseDataModule->ModelDataSource;>Options = TDBGridOptions(ModelDBGrid->Options) >> dgEditing >> dgIndicator >> dgColumnResize;>Columns->Items[0]->Width = (ModelDBGrid->Width - 40)/2;>Columns->Items[1]->Width = (ModelDBGrid->Width - 40)/2;>DataSource = DataBaseDataModule->ColorDataSource;>Options = TDBGridOptions(ColorDBGrid->Options) >> dgEditing >> dgIndicator >> dgColumnResize;>Columns->Add();>Columns->Add();>Columns->Items[0]->FieldName = "Type_of_Color";>Columns->Items[1]->FieldName = "Title_Color";>Columns->Items[0]->Title->Caption = "Тип";>Columns->Items[1]->Title->Caption = "Название";>Columns->Items[0]->Width = (ColorDBGrid->Width - 40)/2;>Columns->Items[1]->Width = (ColorDBGrid->Width - 40)/2;>DataSource = DataBaseDataModule->ClientDataSource;>Options = TDBGridOptions(ClientDBGrid->Options) >> dgEditing >> dgIndicator >> dgColumnResize;>Columns->Add();>Columns->Add();>Columns->Add();>Columns->Add();>Columns->Items[0]->FieldName = "Forename";>Columns->Items[1]->FieldName = "Surname";>Columns->Items[2]->FieldName = "Patronymic";>Columns->Items[3]->FieldName = "Telephone_number";>Columns->Items[0]->Title->Caption = "Фамилия";>Columns->Items[1]->Title->Caption = "Имя";>Columns->Items[2]->Title->Caption = "Отчество";>Columns->Items[3]->Title->Caption = "Телефон";>Columns->Items[0]->Width = (ClientDBGrid->Width - 40)/4;>Columns->Items[1]->Width = (ClientDBGrid->Width - 40)/4;>Columns->Items[2]->Width = (ClientDBGrid->Width - 40)/4;>Columns->Items[3]->Width = (ClientDBGrid->Width - 40)/4;
}
//---------------------------------------------------------------------------__fastcall TMainForm::DataBaseConnectButtonClick(TObject *Sender)
{(DoubleSlash(FilePathEdit->Text));
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerEditButtonClick(TObject *Sender)
{(ManufacturerAddButton, ManufacturerEditButton, ManufacturerDeleteButton, ManufacturerPostBitBtn, ManufacturerCancelBitBtn);
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerDeleteButtonClick(TObject *Sender)
{(ManufacturerAddButton, ManufacturerEditButton, ManufacturerDeleteButton, ManufacturerPostBitBtn, ManufacturerCancelBitBtn);
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerDBGridTitleClick(TColumn *Column)
{ /*(Column->FieldName == "Название")
{>ManufacturerADOQuery->Active = False;>ManufacturerADOQuery->SQL->Clear();(Edit1->Text != "SELECT Title_Manufacturer AS Название , Logo FROM Manufacturer ORDER BY Title_Manufacturer ASC")
{>ManufacturerADOQuery->SQL->Add("SELECT Title_Manufacturer AS Название, Logo FROM Manufacturer ORDER BY Title_Manufacturer DESC");
}
{>ManufacturerADOQuery->SQL->Add("SELECT Title_Manufacturer AS Название, Logo FROM Manufacturer ORDER BY Title_Manufacturer ASC");
}>ManufacturerADOQuery->Open();>ManufacturerADOQuery->Active = True;>Columns->Items[0]->Width = (ManufacturerDBGrid->Width - 40)/3;
} */
/*if(AnsiString(DataBaseDataModule->ManufacturerADOTable->Sort) == "Title_Manufacturer ASC")
{>ManufacturerADOTable->Sort = "Title_Manufacturer DESC";
}
{>ManufacturerADOTable->Sort = "Title_Manufacturer ASC";
}
*/
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerPostBitBtnClick(TObject *Sender)
{(ManufacturerAddButton, ManufacturerEditButton, ManufacturerDeleteButton, ManufacturerPostBitBtn, ManufacturerCancelBitBtn);
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerCancelBitBtnClick(TObject *Sender)
{(ManufacturerAddButton, ManufacturerEditButton, ManufacturerDeleteButton, ManufacturerPostBitBtn, ManufacturerCancelBitBtn);
}
//---------------------------------------------------------------------------__fastcall TMainForm::ManufacturerButtonClick(TObject *Sender)
{>ActivePage = ManufacturerTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::ModelButtonClick(TObject *Sender)
{>ActivePage = ModelTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::ClientButtonClick(TObject *Sender)
{>ActivePage = ClientTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::CarButtonClick(TObject *Sender)
{>ActivePage = CarTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::GradeButtonClick(TObject *Sender)
{>ActivePage = GradeTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::AccessoryButtonClick(TObject *Sender)
{>ActivePage = AccessoryTabSheet;
}
//---------------------------------------------------------------------------__fastcall TMainForm::ColorButtonClick(TObject *Sender)
{>ActivePage = ColorTabSheet;
}
//---------------------------------------------------------------------------
3) Ma'lumotlar bazasi ma'lumotlar moduli
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "DataBaseDataModuleUnit.h"
#include "MainUnit.h"
#include "FunctionsUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*DataBaseDataModule;
//---------------------------------------------------------------------------DoubleSlash (AnsiString str);
//---------------------------------------------------------------------------
__fastcall TDataBaseDataModule::TDataBaseDataModule(TComponent* Owner)
: TDataModule(Owner)
{
}
//---------------------------------------------------------------------------__fastcall TDataBaseDataModule::ManufacturerADOTableAfterScroll(*DataSet)
{
/*if(DataSet->FieldByName("Logo")->AsString != "")
{>ManufacturerLogoImage->Picture->LoadFromFile(DoubleSlash(ExtractFilePath(Application->ExeName))+"Files"+String(Char(92))+String(Char(92))+"Pictures"+String(Char(92))+String(Char(92))+"ManufacturerLogos"+String(Char(92))+String(Char(92))+DoubleSlash(DataSet->FieldByName("Logo")->AsString));
}
{>ManufacturerLogoImage->Picture->LoadFromFile(DoubleSlash(ExtractFilePath(Application->ExeName))+"Files"+String(Char(92))+String(Char(92))+"Pictures"+String(Char(92))+String(Char(92))+"ManufacturerLogos"+String(Char(92))+String(Char(92))+"nologo.bmp");
} */
}
//---------------------------------------------------------------------------__fastcall TDataBaseDataModule::ManufacturerADOQueryAfterScroll(*DataSet)
{(ManufacturerADOQuery->Active == True) {(DataSet->FieldByName("Logo")->AsString != "")
{>ManufacturerLogoImage->Picture->LoadFromFile(DoubleSlash(ExtractFilePath(Application->ExeName))+"Files"+String(Char(92))+String(Char(92))+"Pictures"+String(Char(92))+String(Char(92))+"ManufacturerLogos"+String(Char(92))+String(Char(92))+DoubleSlash(DataSet->FieldByName("Logo")->AsString));
}
{>ManufacturerLogoImage->Picture->LoadFromFile(DoubleSlash(ExtractFilePath(Application->ExeName))+"Files"+String(Char(92))+String(Char(92))+"Pictures"+String(Char(92))+String(Char(92))+"ManufacturerLogos"+String(Char(92))+String(Char(92))+"nologo.bmp");
} }
}
//---------------------------------------------------------------------------
4) Dialog ma'lumotlar moduli
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "DialogsDataModuleUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"*DialogsDataModule;
//---------------------------------------------------------------------------
__fastcall TDialogsDataModule::TDialogsDataModule(TComponent* Owner)
: TDataModule(Owner)
{
}
//---------------------------------------------------------------------------
5) Funktsiya moduli
//---------------------------------------------------------------------------
#pragma hdrstop
#include "FunctionsUnit.h"
#include "DataBaseDataModuleUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------DoubleSlash (AnsiString str)
{StringReplace(str, String(Char(92)), String(Char(92))+String(Char(92)), TReplaceFlags()< }
//---------------------------------------------------------------------------DataBaseConnection (AnsiString Path)
{>ADOConnection->Connected = False;>ADOConnection->ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Path+";Persist Security Info=False";>ADOConnection->LoginPrompt = False;>ADOConnection->Connected = True;
//DataBaseDataModule->ManufacturerADOTable->Connection = DataBaseDataModule->ADOConnection;
//DataBaseDataModule->ManufacturerADOTable->TableName = "Manufacturer";
//DataBaseDataModule->ManufacturerADOTable->Active = True;
//DataBaseDataModule->ManufacturerDataSource->DataSet = DataBaseDataModule->ManufacturerADOTable;>ManufacturerADOQuery->Connection = DataBaseDataModule->ADOConnection;>ManufacturerADOQuery->Active = False;>ManufacturerADOQuery->SQL->Clear();>ManufacturerADOQuery->SQL->Add("SELECT Title_Manufacturer As Название, Logo FROM Manufacturer ORDER BY Title_Manufacturer");>ManufacturerADOQuery->Open();>ManufacturerADOQuery->Active = True;>ManufacturerDataSource->DataSet = DataBaseDataModule->ManufacturerADOQuery;>ModelADOQuery->Connection = DataBaseDataModule->ADOConnection;>ModelADOQuery->Active = False;>ModelADOQuery->SQL->Clear();>ModelADOQuery->SQL->Add("SELECT Manufacturer.Title_Manufacturer As [Название производителя], Model.Title_Model AS [Название модели] FROM Manufacturer, Model WHERE Manufacturer.Code_Manufacturer = Model.FK_Code_Manufacturer");>ModelADOQuery->Open();>ModelADOQuery->Active = True;>ModelDataSource->DataSet = DataBaseDataModule->ModelADOQuery;>ColorADOTable->Active = False;>ColorADOTable->Connection = DataBaseDataModule->ADOConnection;>ColorADOTable->TableName = "Color";>ColorADOTable->Active = True;>ColorDataSource->DataSet = DataBaseDataModule->ColorADOTable;>ClientADOTable->Active = False;>ClientADOTable->Connection = DataBaseDataModule->ADOConnection;>ClientADOTable->TableName = "Client";>ClientADOTable->Active = True;>ClientDataSource->DataSet = DataBaseDataModule->ClientADOTable;
}
//---------------------------------------------------------------------------ManufacturerButtonVisibleFalseAddEditDeleteTruePostCancel(TButton * ManufacturerAddButton, TButton * ManufacturerEditButton, TButton * ManufacturerDeleteButton, TButton * ManufacturerPostButton, TButton * ManufacturerCancelButton)
{>Visible = False;>Visible = False;>Visible = False;>Visible = True;>Visible = True;
}
//---------------------------------------------------------------------------ManufacturerButtonVisibleTrueAddEditDeleteFalsePostCancel(TButton * ManufacturerAddButton, TButton * ManufacturerEditButton, TButton * ManufacturerDeleteButton, TButton * ManufacturerPostButton, TButton * ManufacturerCancelButton)
{>Visible = True;>Visible = True;>Visible = True;>Visible = False;
ManufacturerCancelButton->Visible = False;
}
//---------------------------------------------------------------------------
XULOSA
Men ushbu kurs ishimda katalog va disklar bilan ishlaydigan sinflarni o’rgandim. Ulardan qanday foydalanish kerakligini va ularning metodlari bilan ishlashni ko’rib chiqdim. Har bir metod uchun namunaviy misollar keltirib o’tdim. Misol qilib ko’rsatgan dasturimlarni SharpDevelop_5.1.0.5216_Setup da bajardim. C# da dastur tuzishda katalog va disklar bilan ishlaydigan sinflarning vazifalarini va ulardan samarali foydalanishni o’rgandim. Shuni xulosa qilamanki , turli dasturlar tuzishda ushbu sinflardan foydalanish mumkin.Hozirgi kunda C# dasturlash tili yuqori bosqichli dasturlash tillari ichida eng samarali dasturlash tillaridan hisoblanadi. C# dasturlash tilida dastur tuzish uchun Visual Studio .NET muhitidan foydalanamiz. C# dasturlash tili obektga mo’ljallangan dasturlash tili hisoblanadi. BMIning birinchi bobida C# dasturlash tili va uning operatorlari haqida ma’lumotlar keltirilgan. Ma’lumotlarni kiritish va chiqarish turli xil oqimlar orqali amalga oshiriladi. Bu bobda konsol rejimda ma’lumotlarni ekran orqali kiritish va chiqarish amallari ko’rib chiqilgan. Birinchi bob 3 ta bo’limdan iborat. Birinchi bo’limda C# tilining sintaksisi, ma’lumotlar tiplari haqida ma’lumotlar keltirilgan. Har bir operatorning funksional imkoniyatlari misollar orqali tushuntirib berilgan. Ikkinchi bo’limda C# tilida ifoda, intruksiya va operatorlar haqida ma’lumotlar keltirilgan. Bu bo’limda tarmoqlash, takrorlash operatorlari va ularni har xil variantlari misollar orqali tushuntirib berilgan. Bundan tashqari har bir operatorning funksional imkoniyatlari misollar orqali tushuntirib berilgan. Uchinchi bo’limda sinflar, metodlar, xususiyatlar haqida ma’lumotlar keltirilgan. Bu bo’limda C# dasturlash tilida sinf qanday yaratiladi va obyektga mo’ljallangan dasturlash tilining asosiy xususiyatlari keltrilgan. Har bir operatorning funksional imkoniyatlari misollar orqali tushuntirib berilgan.
Do'stlaringiz bilan baham: