using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
int fb = 0;
int gs = 0;
int bjk = 0;
int ts = 0;
int a = 15;
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = true;
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection emir = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=e.mdb");
emir.Open();
OleDbDataAdapter emir3 = new OleDbDataAdapter("select*from emir2", emir);
DataSet emir4 = new DataSet();
emir3.Fill(emir4, "kitap");
label3.Text = emir4.Tables[0].Rows[i][0].ToString();
radioButton1.Text = emir4.Tables[0].Rows[i][1].ToString();
radioButton2.Text = emir4.Tables[0].Rows[i][2].ToString();
radioButton3.Text = emir4.Tables[0].Rows[i][3].ToString();
radioButton4.Text = emir4.Tables[0].Rows[i][4].ToString();
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
textBox3.Text = "FB";
}
if (radioButton2.Checked)
{
textBox3.Text = "GS";
}
if (radioButton3.Checked)
{
textBox3.Text = "BJK";
}
if (radioButton4.Checked)
{
textBox3.Text = "TS";
}
OleDbConnection emir = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=e.mdb");
emir.Open();
OleDbCommand emir2 = new OleDbCommand("insert into emir([no],[ad],[takım]) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "')", emir);
emir2.ExecuteNonQuery();
textBox1.Clear();
textBox2.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
listBox2.Items.Clear();
int m = 0;
listBox1.Visible = true;
listBox2.Visible = true;
OleDbConnection emir = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=e.mdb");
emir.Open();
OleDbDataAdapter emir3 = new OleDbDataAdapter("select*from emir", emir);
DataSet emir4 = new DataSet();
emir3.Fill(emir4, "kitap");
int a = emir4.Tables[0].Rows.Count;
for (int k = 0; k < a; k++)
{
if (emir4.Tables[0].Rows[k][2].ToString() == "FB")
{
fb += 1;
listBox1.Items.Add(++m + ")" + emir4.Tables[0].Rows[k][0] + " " + emir4.Tables[0].Rows[k][1] + " " + emir4.Tables[0].Rows[k][2]);
}
}
for (int k = 0; k < a; k++)
{
if (emir4.Tables[0].Rows[k][2].ToString() == "GS")
{
gs += 1;
listBox1.Items.Add(++m + ")" + emir4.Tables[0].Rows[k][0] + " " + emir4.Tables[0].Rows[k][1] + " " + emir4.Tables[0].Rows[k][2]);
}
}
for (int k = 0; k < a; k++)
{
if (emir4.Tables[0].Rows[k][2].ToString() == "BJK")
{
bjk += 1;
listBox1.Items.Add(++m + ")" + emir4.Tables[0].Rows[k][0] + " " + emir4.Tables[0].Rows[k][1] + " " + emir4.Tables[0].Rows[k][2]);
}
}
for (int k = 0; k < a; k++)
{
if (emir4.Tables[0].Rows[k][2].ToString() == "TS")
{
ts += 1;
listBox1.Items.Add(++m + ")" + emir4.Tables[0].Rows[k][0] + " " + emir4.Tables[0].Rows[k][1] + " " + emir4.Tables[0].Rows[k][2]);
}
}
int s = 0;
int bol = (100/ 6)*fb;
int bol1 = (100 /6)*gs;
int bol2 = (100 /6)*bjk;
int bol3 = (100 /6)*ts;
listBox2.Items.Add(++s+")"+"FB Oranı" + " " + bol);
listBox2.Items.Add(++s+")"+"GS Oranı" + " " + bol1);
listBox2.Items.Add(++s+")"+"BJK Oranı" + " " + bol2);
listBox2.Items.Add(++s+")"+"TS Oranı" + " " + bol3);
}
private void timer1_Tick(object sender, EventArgs e)
{
a = a - 1;
label4.Text = a.ToString();
if (a == 0)
{
timer1.Stop();
panel1.Enabled = false;
panel2.Enabled = false;
}
}
}
}
Hiç yorum yok:
Yorum Gönder