Foydalanilgan adabiyotlar - I-bob. Talabalar reyting ballarini to‘plash va gpa ballarini hisoblash avtomatlashtirilgan...

Foydalanilgan adabiyotlar.
"C# Programming in easy steps" - Mike McGrath
"C# 9.0 in a Nutshell: The Definitive Reference" - Joseph Albahari va Ben Albahari
"Windows Forms Programming in C#" - Chris Sells, Michael Weinhardt, Brad Merrill
"Pro C# 7: With .NET and .NET Core" - Andrew Troelsen va Philip Japikse
"Professional C# 6 and .NET Core 1.0" - Christian Nagel, Morgan Skinner, Jay Glynn, Karli Watson, Bill Evjen
Internet manbalar.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview?view=windowsdesktop-8.0
https://www.c-sharpcorner.com/UploadFile/raj1979/datagridview-control-in-C-Sharp/
https://hemis.uz/yoriqnoma/gpa.php
https://lex.uz/uz/docs/-1497646?ONDATE=25.07.2022
https://grantgo.uz/blog/gpa-nima-qanday-hisoblanadi
https://uzbekdevs.uz/darsliklar/csharp/csharp-da-shart-operatorlari-if-if-else
Ilovalar
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;
namespace GPA_hisoblash
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
this.Hide();
Kurish t2 = new Kurish();
t2.ShowDialog();
t2 = null;
this.Show();
}
private void button2_Click_1(object sender, EventArgs e)
{
this.Hide();
Kurish t2 = new Kurish();
t2.ShowDialog();
t2 = null;
this.Show();
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
Form5 t2 = new Form5();
t2.ShowDialog();
t2 = null;
this.Show();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}
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;
namespace GPA_hisoblash
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox11_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
double fan1, fan2, fan3, fan4, fan5, fan6, kr1, kr2, kr3, kr4, kr5, kr6,tot,qol,bal1;
fan1 = int.Parse(txtFan1.Text);
fan2 = int.Parse(txtFan2.Text);
fan3 = int.Parse(txtFan3.Text);
fan4 = int.Parse(txtFan4.Text);
fan5 = int.Parse(txtFan5.Text);
fan6 = int.Parse(txtFan6.Text);
kr1 = int.Parse(txtKr1.Text);
kr2 = int.Parse(txtKr2.Text);
kr3 = int.Parse(txtKr3.Text);
kr4 = int.Parse(txtKr1.Text);
kr5 = int.Parse(txtKr2.Text);
kr6 = int.Parse(txtKr3.Text);
tot = (fan1 * kr1 + fan2 * kr2 + fan3 * kr3 + fan4 * kr4 + fan5 * kr5 + fan6 * kr6);
qol = (kr1 + kr2 + kr3 + kr4 + kr5 + kr6);
bal1 = (tot / qol);
label8.Text = bal1.ToString("F3");
txtFan1.Text = "";
txtFan2.Text = "";
txtFan3.Text = "";
txtFan4.Text = "";
txtFan5.Text = "";
txtFan6.Text = "";
txtKr1.Text = "";
txtKr2.Text = "";
txtKr3.Text = "";
txtKr4.Text = "";
txtKr5.Text = "";
txtKr6.Text = "";
}
private void label9_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void gradePointToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Kurish f2 = new Kurish();
f2.ShowDialog();
f2 = null;
this.Show();
}
private void chiqishToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Form4 f2 = new Form4();
f2.ShowDialog();
f2 = null;
this.Show();
}
private void chiqishToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
Kurish f2 = new Kurish();
f2.ShowDialog();
f2 = null;
this.Show();
}
private void button4_Click(object sender, EventArgs e)
{
this.Hide();
Form4 f2 = new Form4();
f2.ShowDialog();
f2 = null;
this.Show();
}
}
}
using MySql.Data.MySqlClient;
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 System.Data.SqlClient;
using MySql.Data.MySqlClient;
namespace GPA_hisoblash
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void gPAToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void gPABalniHisoblashToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void chiqishToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
double maths, science, english, tot;
maths = int.Parse(textBox1.Text);
science = int.Parse(textBox2.Text);
english = int.Parse(textBox3.Text);
tot = maths + science + english;
textBox4.Text=tot.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
string connectionString = "Server=localhost; user=root; password=; database=gpa";
DataTable dataTable = new DataTable();
try
{
using (MySqlConnection connect = new MySqlConnection(connectionString))
{
connect.Open();
// INSERT so'rovini o'tkazamiz
string Surov = $"INSERT INTO reyting (FISH, Fan_nomi,Reyting) VALUES('{textBox5.Text}', '{textBox6.Text}','{textBox4.Text}')";
using (MySqlCommand command = new MySqlCommand(Surov, connect))
{
// INSERT so'rovini bajarib ko'rsatamiz
command.ExecuteNonQuery();
}
// Ma'lumotlarni olish uchun SELECT so'rovini o'tkazamiz
string kursat = "SELECT * FROM reyting";
using (MySqlCommand command = new MySqlCommand(kursat, connect))
{
using (MySqlDataAdapter adapter = new MySqlDataAdapter(command))
{
// DataTable ni to'ldiramiz
dataTable.Clear();
adapter.Fill(dataTable);
}
}
}
// DataTable ni dataGridView ga bog'laymiz
dataGridView1.DataSource = dataTable;
textBox5.Text = "";
textBox6.Text = "";
textBox4.Text = "";
}
catch (Exception ex)
{
MessageBox.Show($"Xatolik yuz berdi: {ex.Message}");
}
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void Form3_Load(object sender, EventArgs e)
{
}
}
}
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;
namespace GPA_hisoblash
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double maths, science, english, tot, avg;
string grade;
maths = int.Parse(textBox2.Text);
science = int.Parse(textBox3.Text);
english = int.Parse(textBox4.Text);
tot = maths + science + english;
textBox5.Text = tot.ToString();
avg = tot / 3;
textBox6.Text = avg.ToString();
if (avg >= 86)
{
grade = "A";
}
else if (avg >= 71)
{
grade = "B";
}
else if (avg >= 56)
{
grade = "C";
}
else
{
grade = "D";
}
textBox7.Text = grade;
}
private void gPABalniHisoblashToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Form2 f2 = new Form2();
f2.ShowDialog();
f2 = null;
this.Show();
}
private void reytingBalniKorishToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
Kurish f2 = new Kurish();
f2.ShowDialog();
f2 = null;
this.Show();
}
private void chiqishToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
private void Form4_Load(object sender, EventArgs e)
{
}
}
}
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;
namespace GPA_hisoblash
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string user, pass;
user = txtUser.Text;
pass = txtPass.Text;
if (user == "1" && pass == "1")
{
this.Hide();
Form2 t2 = new Form2();
t2.ShowDialog();
t2 = null;
this.Show();
}
else
{
MessageBox.Show("Login yoki parol xato");
}
}
private void button2_Click(object sender, EventArgs e)
{
string user, pass;
user = txtUser.Text;
pass = txtPass.Text;
if (user == "1" && pass == "1")
{
this.Hide();
Form3 t2 = new Form3();
t2.ShowDialog();
t2 = null;
this.Show();
}
else
{
MessageBox.Show("Login yoki parol xato");
}
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}
using MySql.Data.MySqlClient;
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 System.Data.SqlClient;
using MySql.Data.MySqlClient;
namespace GPA_hisoblash
{
public partial class Kurish : Form
{
public Kurish()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("Iltimos, FIShni kiriting.");
return; // Metoddan chiqish
}
string connectionString = "Server=localhost; user=root; password=; database=gpa";
try
{
using (MySqlConnection connect = new MySqlConnection(connectionString))
{
connect.Open();
string malumotlarSurovi = "SELECT FISh,Reyting FROM reyting WHERE CONCAT_WS(' ', FISh) LIKE @search";
using (MySqlCommand command = new MySqlCommand(malumotlarSurovi, connect))
{
command.Parameters.AddWithValue("@search", "%" + textBox1.Text + "%");
using (MySqlDataReader reader = command.ExecuteReader())
{
DataTable dataTable = new DataTable();
dataTable.Load(reader);
if (dataTable.Rows.Count == 0)
{
MessageBox.Show("Bu talaba bali yo'q");
}
else
{
dataGridView1.DataSource = dataTable;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show($"Xatolik yuz berdi: {ex.Message}");
}
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
Form2 t2 = new Form2();
t2.ShowDialog();
t2 = null;
this.Show();
}
private void button4_Click(object sender, EventArgs e)
{
this.Hide();
Form4 t2 = new Form4();
t2.ShowDialog();
t2 = null;
this.Show();
}
private void Kurish_Load(object sender, EventArgs e)
{
}
}
}
|