«Transportda axborot tizimlari va texnologiyalari» kafedrasi


Foydalanilgan adabiyotlar


Download 1.76 Mb.
bet7/7
Sana31.12.2022
Hajmi1.76 Mb.
#1073710
1   2   3   4   5   6   7
Bog'liq
KURS ISHI XUDOYOROV

Foydalanilgan adabiyotlar

1). Биллиг В. А . Аснови программирования на C# Издво <<Интенет – университет информационних технологий ИНТУИТ.ру>>,2006.-488 с.
2). Павловская Т. А. С/С++. Программ уровня: Учебник для вузов.- СПБ: Петер,2001.- 464 с.
3). Робисон У. C# без лишних слов. М.: ДМК Пресс, 2002.- 352 с.
4). Гуннерсон Э. Введение в С#. Библотека программиста – СПБ.Ж . Питер, 2001.- 304 с.
5). Секунов Н. Самоучител С#. Серия Самоучител. Петербург, 2001. -576 с.
6). Фролов А. В. Фролов Г.В. Язик С# Самоучител. – М. Диалог- МИФИ,2003.- 560 с.
7) O.I. Jalolov, Sh.M. Sharipov C# dasturlash tilida fayllar bilan ishlash (uslubiy qo’llanma) BUXORO 2014


ILOVA
Form1 oynasi (login page)
namespace kursavoy
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{

}


private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "admin" && textBox2.Text == "123")
{
form2 form2 = new form2();
form2.Show();

this.Hide();


}
else
{
MessageBox.Show("login yoki parol notogri");
}
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)


{
Application.Exit();
}
}
}

Form2 oynasi(home page)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Npgsql;

namespace kursavoy


{
public partial class form2 : Form
{ NpgsqlConnection con;
public form2()
{
InitializeComponent();
con = new NpgsqlConnection("Server=localhost;Port=5432;Database=kurs_ishi;User Id=postgres;Password=123") ;
}
void show()
{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "Select * from guruh";
NpgsqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
dataGridView1.DataSource = dt;
}
com.Dispose();

}
catch (Exception ex) { MessageBox.Show(ex.Message); }


finally { con.Close(); }
}
void show1()
{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "Select * from qoshiq";
NpgsqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
dataGridView2.DataSource = dt;
}
com.Dispose();
con.Close();
}
catch (Exception ex) { }
}
void show2()
{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "Select * from safar";
NpgsqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
dataGridView3.DataSource = dt;
}
com.Dispose();
con.Close();
}
catch (Exception ex) { }
}

private void home_page_FormClosing(object sender, FormClosingEventArgs e)


{
Application.Exit();
}

private void panel1_Paint(object sender, PaintEventArgs e)


{

}


private void pictureBox1_Click(object sender, EventArgs e)
{

}


private void pictureBox1_Click_1(object sender, EventArgs e)
{

}


private void label1_Click(object sender, EventArgs e)
{

}


private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{

}


private void label2_Click(object sender, EventArgs e)
{

}


private void home_page_Load(object sender, EventArgs e)
{
show2();
show1();
show();
}

private void label15_Click(object sender, EventArgs e)


{

}


private void tabControl4_SelectedIndexChanged(object sender, EventArgs e)
{

}


private void tabPage11_Click(object sender, EventArgs e)
{

}


private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}


private void button5_Click(object sender, EventArgs e)
{
show();
}

private void tabPage3_Click(object sender, EventArgs e)


{

}


private void button1_Click(object sender, EventArgs e)
{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"insert into guruh(ism,familiyasi,sanatkorligi) values ('{textBox2.Text}','{textBox3.Text}','{textBox4.Text}');";
object dr = com.ExecuteScalar();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
MessageBox.Show("Ma'lumot kiritildi;");
com.Dispose();
con.Close();
}
catch (Exception ex) { }
}

private void button2_Click(object sender, EventArgs e)


{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"Delete from guruh where id='{textBox5.Text}';";
object dr = com.ExecuteScalar();
textBox5.Clear();
MessageBox.Show("Ma'lumot o'chirildi;");
com.Dispose();
con.Close();
show();
}
catch (Exception ex) { }
}

private void label6_Click(object sender, EventArgs e)


{

}


private void button6_Click(object sender, EventArgs e)
{
show1();
}

private void tabPage7_Click(object sender, EventArgs e)


{

}


private void button7_Click(object sender, EventArgs e)
{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"insert into qoshiq(qoshiq_nomi,qoshiq_avtori) values ('{textBox14.Text}','{textBox1.Text}');";
object dr = com.ExecuteScalar();
textBox14.Clear();
textBox1.Clear();
MessageBox.Show("Ma'lumot kiritildi;");
com.Dispose();
con.Close();
}
catch (Exception ex) { }
}

private void button8_Click(object sender, EventArgs e)


{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"Delete from qoshiq where id='{textBox15.Text}';";
object dr = com.ExecuteScalar();
textBox15.Clear();
MessageBox.Show("Ma'lumot o'chirildi;");
com.Dispose();
con.Close();
}
catch (Exception ex) { }
}

private void button9_Click(object sender, EventArgs e)


{
show2();
}

private void button3_Click(object sender, EventArgs e)


{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"insert into safar(davlat,viloyat,tuman,davomiyligi,masul_ism,masul_tel) values ('{textBox6.Text}','{textBox7.Text}','{textBox8.Text}','{textBox9.Text}','{textBox10.Text}','{textBox11.Text}');";
object dr = com.ExecuteScalar();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
textBox10.Clear();
textBox11.Clear();
MessageBox.Show("Ma'lumot kiritildi;");
com.Dispose();
show2();
show1();
show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally {
con.Close();
}
}

private void button4_Click(object sender, EventArgs e)


{
try
{
con.Open();
NpgsqlCommand com = new NpgsqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = $"Delete from safar where id='{textBox13.Text}';";
object dr = com.ExecuteScalar();
textBox13.Clear();
MessageBox.Show("Ma'lumot o'chirildi;");
com.Dispose();

}
catch (Exception ex) { MessageBox.Show(ex.Message); }


finally { con.Close(); }
}
}
}


Download 1.76 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




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