Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include "class_body.h"
- #include "Erorr.h"
- #pragma once
- namespace BaigiamasisDarbas {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- namespace
- {
- bylos C;
- }
- /// <summary>
- /// Summary for Bylos
- /// </summary>
- public ref class Bylos : public System::Windows::Forms::Form
- {
- public:
- Bylos(void)
- {
- InitializeComponent();
- bylos();
- bylusar();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Bylos()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::Label^ label1;
- protected:
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::DataGridView^ dataGridView1;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ ID;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Pavadinimas;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Tipas;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Sale;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Data;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::Label^ label4;
- private: System::Windows::Forms::Label^ label5;
- private: System::Windows::Forms::Label^ label6;
- private: System::Windows::Forms::TextBox^ textBox1;
- private: System::Windows::Forms::TextBox^ textBox2;
- private: System::Windows::Forms::TextBox^ textBox4;
- private: System::Windows::Forms::Button^ button2;
- private: System::Windows::Forms::ComboBox^ comboBox1;
- private: System::Windows::Forms::DateTimePicker^ dateTimePicker1;
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Bylos::typeid));
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
- this->ID = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Pavadinimas = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Tipas = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Sale = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Data = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->label4 = (gcnew System::Windows::Forms::Label());
- this->label5 = (gcnew System::Windows::Forms::Label());
- this->label6 = (gcnew System::Windows::Forms::Label());
- this->textBox1 = (gcnew System::Windows::Forms::TextBox());
- this->textBox2 = (gcnew System::Windows::Forms::TextBox());
- this->textBox4 = (gcnew System::Windows::Forms::TextBox());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
- this->dateTimePicker1 = (gcnew System::Windows::Forms::DateTimePicker());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView1))->BeginInit();
- this->SuspendLayout();
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 36, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(0)));
- this->label1->Location = System::Drawing::Point(364, 9);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(141, 55);
- this->label1->TabIndex = 0;
- this->label1->Text = L"Bylos";
- //
- // button1
- //
- this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 36, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(0)));
- this->button1->Location = System::Drawing::Point(583, 535);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(185, 66);
- this->button1->TabIndex = 1;
- this->button1->Text = L"Grizti";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Bylos::button1_Click);
- //
- // dataGridView1
- //
- this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
- this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(5) {
- this->ID, this->Pavadinimas,
- this->Tipas, this->Sale, this->Data
- });
- this->dataGridView1->Location = System::Drawing::Point(128, 82);
- this->dataGridView1->Name = L"dataGridView1";
- this->dataGridView1->Size = System::Drawing::Size(640, 242);
- this->dataGridView1->TabIndex = 2;
- this->dataGridView1->CellContentClick += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &Bylos::dataGridView1_CellContentClick);
- //
- // ID
- //
- this->ID->HeaderText = L"ID";
- this->ID->Name = L"ID";
- //
- // Pavadinimas
- //
- this->Pavadinimas->HeaderText = L"Pavadinimas";
- this->Pavadinimas->Name = L"Pavadinimas";
- this->Pavadinimas->Width = 200;
- //
- // Tipas
- //
- this->Tipas->HeaderText = L"Tipas";
- this->Tipas->Name = L"Tipas";
- //
- // Sale
- //
- this->Sale->HeaderText = L"Sale";
- this->Sale->Name = L"Sale";
- //
- // Data
- //
- this->Data->HeaderText = L"Data";
- this->Data->Name = L"Data";
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->label2->Location = System::Drawing::Point(128, 370);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(24, 20);
- this->label2->TabIndex = 3;
- this->label2->Text = L"ID";
- this->label2->Click += gcnew System::EventHandler(this, &Bylos::label2_Click);
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->label3->Location = System::Drawing::Point(58, 402);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(94, 20);
- this->label3->TabIndex = 4;
- this->label3->Text = L"Pavadinimas";
- //
- // label4
- //
- this->label4->AutoSize = true;
- this->label4->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->label4->Location = System::Drawing::Point(106, 433);
- this->label4->Name = L"label4";
- this->label4->Size = System::Drawing::Size(46, 20);
- this->label4->TabIndex = 5;
- this->label4->Text = L"Tipas";
- //
- // label5
- //
- this->label5->AutoSize = true;
- this->label5->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->label5->Location = System::Drawing::Point(496, 369);
- this->label5->Name = L"label5";
- this->label5->Size = System::Drawing::Size(39, 20);
- this->label5->TabIndex = 6;
- this->label5->Text = L"Sale";
- //
- // label6
- //
- this->label6->AutoSize = true;
- this->label6->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
- this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->label6->Location = System::Drawing::Point(496, 402);
- this->label6->Name = L"label6";
- this->label6->Size = System::Drawing::Size(41, 20);
- this->label6->TabIndex = 7;
- this->label6->Text = L"Data";
- this->label6->Click += gcnew System::EventHandler(this, &Bylos::label6_Click);
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point(158, 370);
- this->textBox1->Name = L"textBox1";
- this->textBox1->Size = System::Drawing::Size(227, 20);
- this->textBox1->TabIndex = 8;
- this->textBox1->TextChanged += gcnew System::EventHandler(this, &Bylos::textBox1_TextChanged);
- //
- // textBox2
- //
- this->textBox2->Location = System::Drawing::Point(158, 402);
- this->textBox2->Name = L"textBox2";
- this->textBox2->Size = System::Drawing::Size(227, 20);
- this->textBox2->TabIndex = 9;
- //
- // textBox4
- //
- this->textBox4->Location = System::Drawing::Point(541, 370);
- this->textBox4->Name = L"textBox4";
- this->textBox4->Size = System::Drawing::Size(227, 20);
- this->textBox4->TabIndex = 11;
- //
- // button2
- //
- this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 36, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(186)));
- this->button2->Location = System::Drawing::Point(128, 535);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(185, 66);
- this->button2->TabIndex = 13;
- this->button2->Text = L"Ivesti";
- this->button2->UseVisualStyleBackColor = true;
- this->button2->Click += gcnew System::EventHandler(this, &Bylos::button2_Click);
- //
- // comboBox1
- //
- this->comboBox1->FormattingEnabled = true;
- this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(2) { L"Viesas", L"Uzdaras" });
- this->comboBox1->Location = System::Drawing::Point(158, 434);
- this->comboBox1->Name = L"comboBox1";
- this->comboBox1->Size = System::Drawing::Size(227, 21);
- this->comboBox1->TabIndex = 14;
- this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Bylos::comboBox1_SelectedIndexChanged);
- //
- // dateTimePicker1
- //
- this->dateTimePicker1->Format = System::Windows::Forms::DateTimePickerFormat::Short;
- this->dateTimePicker1->Location = System::Drawing::Point(541, 402);
- this->dateTimePicker1->Name = L"dateTimePicker1";
- this->dateTimePicker1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->dateTimePicker1->Size = System::Drawing::Size(227, 20);
- this->dateTimePicker1->TabIndex = 15;
- //
- // Bylos
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(944, 921);
- this->Controls->Add(this->dateTimePicker1);
- this->Controls->Add(this->comboBox1);
- this->Controls->Add(this->button2);
- this->Controls->Add(this->textBox4);
- this->Controls->Add(this->textBox2);
- this->Controls->Add(this->textBox1);
- this->Controls->Add(this->label6);
- this->Controls->Add(this->label5);
- this->Controls->Add(this->label4);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->dataGridView1);
- this->Controls->Add(this->button1);
- this->Controls->Add(this->label1);
- this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
- this->Name = L"Bylos";
- this->Text = L"Bylos";
- this->Load += gcnew System::EventHandler(this, &Bylos::Bylos_Load);
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView1))->EndInit();
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- void bylusar()
- {
- //spausdinimas i grida
- String^ spausd;
- for (int i = 0; i <= C.b; i++)
- {
- dataGridView1->Rows->Add();
- spausd = gcnew String(C.Byla[i].byla_ID.c_str());
- dataGridView1[0, i]->Value = spausd;
- spausd = gcnew String(C.Byla[i].byla_pavadinimas.c_str());
- dataGridView1[1, i]->Value = spausd;
- spausd = gcnew String(C.Byla[i].byla_tipas.c_str());
- dataGridView1[2, i]->Value = spausd;
- spausd = gcnew String(C.Byla[i].byla_vieta.c_str());
- dataGridView1[3, i]->Value = spausd;
- spausd = gcnew String(C.Byla[i].byla_data.c_str());
- dataGridView1[4, i]->Value = spausd;
- }
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- Close();
- }
- private: System::Void Bylos_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
- String ^ ID, ^ pavadinimas, ^tipas, ^vieta, ^data; //apsauga butinai padaryt
- std::string id, pav, tip, vie, dat;
- if (textBox1->Text == "" || textBox2->Text == "" || textBox4->Text == "")
- {
- Erorr ^err = gcnew Erorr();
- err->Show();
- }
- else {
- //Cia ivedimas
- ID = textBox1->Text;
- pavadinimas = textBox2->Text;
- tipas = comboBox1->SelectedItem->ToString();
- vieta = textBox4->Text;
- data = dateTimePicker1->Value.ToString("yyyy-MM-dd");
- id = C.convert(ID);
- pav = C.convert(pavadinimas);
- tip = C.convert(tipas);
- vie = C.convert(vieta);
- dat = C.convert(data);
- C.naujabyla(id, pav, tip, vie, dat);
- textBox1->Text = "";
- textBox2->Text = "";
- textBox4->Text = "";
- dataGridView1->Rows->Clear();
- bylusar();
- C.duomfb();
- }
- }
- private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void label6_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void dataGridView1_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement