Opengl kutubxonasi yordamida Muhammad al-Xorazmiy nomidagi tatu farg‘ona filialini tanishtirish


Download 59 Kb.
Sana16.06.2023
Hajmi59 Kb.
#1510157
Bog'liq
Sodiqova M va Asrayev M


Deponentlanadigan materiallarning titul varag‘i
EHM uchun dastur (Ma’lumotlar bazasi) nomi:
OpenGL kutubxonasi yordamida Muhammad al-Xorazmiy nomidagi TATU Farg‘ona filialini tanishtirish” nomli dasturiy ta’minot

Huquq ega(lar)si :


1. Muhammad al-Xorazmiy nomidagi Toshkent axborot texnologiyalari universiteti Farg’ona filiali
Muallif(lar):
1. Sodiqova Munira Alisherovna
2. Asrayev Muhammadmullo Abdullajon o‘g‘li
1. EHM uchun dasturni identifikatsiya qiluvchi materiallar dastlabki matni (Dastur kodi)
Admin.cs :
using System;
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.SqlClient;
using Project.MainClasses;
using Project.ClassAdapters;

namespace Project


{
public partial class Admin : Form
{
public Admin()
{
InitializeComponent();
StackedHeaderDecorator objREnderer = new StackedHeaderDecorator(dataGridView1);
}
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter adapter;
DataSet ds;
private void Admin_Load(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=.;Initial Catalog=Kanstavar;Integrated Security=True");
adapter = new SqlDataAdapter("select * from Job", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox1.DataSource = ds.Tables[0];
//comboBox1.DataSource = jobAdapter.getList();
showDataB();
//----------------------------combox5---------------//
ds = new DataSet();
adapter.Fill(ds);
comboBox5.DataSource = ds.Tables[0];
//comboBox5.DataSource = jobAdapter.getList();
//------------------------------combox4----------------
adapter = new SqlDataAdapter("select * from PosID", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox4.DataSource = ds.Tables[0];
//comboBox4.DataSource = PosIDAdapter.getList();
//---------------------combox2-------------------------
adapter = new SqlDataAdapter("select * from PosID", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox2.DataSource = ds.Tables[0];
adapter = new SqlDataAdapter("select * from PosID", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox3.DataSource = ds.Tables[0];
adapter = new SqlDataAdapter("select * from PosID", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox6.DataSource = ds.Tables[0];
//comboBox6.DataSource = PosIDAdapter.getList();
adapter = new SqlDataAdapter("select * from user1", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox7.DataSource = ds.Tables[0];
adapter = new SqlDataAdapter("select * from Quality", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox8.DataSource = ds.Tables[0];
//-----------------------comboBox9--------------------
adapter = new SqlDataAdapter("select * from Country", con);
ds = new DataSet();
adapter.Fill(ds);
comboBox9.DataSource = ds.Tables[0];
adapter = new SqlDataAdapter("select fulname from employee where Pid = " + 1, con);
ds = new DataSet();
adapter.Fill(ds);
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].DataPropertyName = "fulname";
dataGridView2.DataSource = GoodesAdapter.getList();
}
private void button1_Click(object sender, EventArgs e)
{
forplace place = new forplace();
place.Show();

}
private void button2_Click(object sender, EventArgs e)


{

Employee sdf = new Employee();


sdf.Fulname = textBox1.Text;
sdf.JId1 = Convert.ToInt32(comboBox1.SelectedValue);
sdf.Time = Convert.ToDateTime(dateTimePicker1.Value);
sdf.Pid1 =Convert.ToInt32(comboBox4.SelectedValue);
sdf.About = richTextBox1.Text;
sdf.Password = textBox3.Text;
sdf.Login1 = textBox4.Text;
sdf.RolId1 = Convert.ToInt32(comboBox7.SelectedValue);
sdf.Save();
textBox1.Clear();
richTextBox1.Clear();
textBox3.Clear();
textBox4.Clear();
showDataB();

}
int[] b = new int[150]; int t1 = 0;


private void showDataB()
{
con = new SqlConnection("Data Source=.;Initial Catalog=Kanstavar;Integrated Security=True");
cmd = new SqlCommand("select EId,fulname from employee", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
listView1.Items.Clear();
ListViewItem val = new ListViewItem();
while (dr.Read())
{
val.Text = (dr["fulname"].ToString());
listView1.Items.Add(val.Text);
listView1.Tag = Convert.ToInt32(dr["EId"].ToString());
b[t1++] = Convert.ToInt32(listView1.Tag);
}
t1 = 0;
con.Close();
}
public int b1 = 0;
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (e.IsSelected)
{
textBox2.Text = listView1.Items[e.ItemIndex].Text;
int s = b[e.ItemIndex];
b1 = s;
cmd = new SqlCommand("select EId,fulname from employee", con);
//MessageBox.Show(Convert.ToString(s));
}
}
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
//Gridga raqam qo'yish.
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Far; //
sf.LineAlignment = StringAlignment.Center; //
if ((e.ColumnIndex == -1) && (e.RowIndex >= 0))
{
int lastDisplyIndex = dataGridView1.Rows.GetLastRow(DataGridViewElementStates.Displayed) + 1;
dataGridView1.RowHeadersWidth = (int)(e.Graphics.MeasureString(lastDisplyIndex.ToString(),
dataGridView1.RowHeadersDefaultCellStyle.Font).Width + 12);
e.Handled = true;
Rectangle rc = e.CellBounds;
e.Paint(rc, DataGridViewPaintParts.All);
rc.Inflate(-3, 0); //

e.Graphics.DrawString((e.RowIndex + 1).ToString(), dataGridView1.RowHeadersDefaultCellStyle.Font,


new SolidBrush(dataGridView1.RowHeadersDefaultCellStyle.ForeColor), rc, sf);
}

}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)


{
adapter = new SqlDataAdapter("select EId,fulname from employee where Pid = " + comboBox3.SelectedValue, con);
ds = new DataSet();
adapter.Fill(ds);
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].DataPropertyName = "fulname";
dataGridView1.Columns[4].DataPropertyName = "EId";

}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{
adapter = new SqlDataAdapter("select EId,fulname from employee where Pid = " + comboBox2.SelectedValue, con);
ds = new DataSet();
adapter.Fill(ds);
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].DataPropertyName = "fulname";
dataGridView1.Columns[4].DataPropertyName = "EId";
}
private void button3_Click(object sender, EventArgs e)
{
EmployeeAdapter.Update(textBox2.Text,Convert.ToInt32(comboBox5.SelectedValue),Convert.ToInt32(comboBox6.SelectedValue),b1);
showDataB();

}
private void button4_Click(object sender, EventArgs e)


{
EmployeeAdapter.Delete(b1);
showDataB();
}

private void button6_Click(object sender, EventArgs e)


{
int k = 0;
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
for (int j = 1; j < dataGridView1.ColumnCount; j++)
{
if (dataGridView1.Rows[i].Cells[j].Value == null)
{
dataGridView1.Rows[i].Cells[j].Value = 0;
k++;
}
}

}


for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
if (Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) < 100000)
{
dataGridView1.Rows[i].Cells[2].Value = 10;
dataGridView1.Rows[i].Cells[3].Value = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value)- Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) * 0.1;
}
if (Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) >= 100000 && Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) <= 250000)
{
dataGridView1.Rows[i].Cells[2].Value = 15;
dataGridView1.Rows[i].Cells[3].Value = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) - Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) * 0.15;
}
if (Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) > 250000)
{
dataGridView1.Rows[i].Cells[2].Value = 25;
dataGridView1.Rows[i].Cells[3].Value = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) - Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value) * 0.25;
}

//--insert ishlayapti---------------------


cmd = new SqlCommand("insert into salarytable (EId,salary,withoutF,data) values ( " +
dataGridView1.Rows[i].Cells[4].Value + " , " + dataGridView1.Rows[i].Cells[1].Value + " , " +
dataGridView1.Rows[i].Cells[3].Value+",'"+Convert.ToDateTime(dateTimePicker4.Value) + "')", con);
con.Open();
int n = cmd.ExecuteNonQuery();
con.Close();
if (n > 0)
{
MessageBox.Show("Malumot bazaga kiritildi");

}
else


MessageBox.Show("Bazaga malumot qo'shishda xatolik");
}
}

private void button5_Click(object sender, EventArgs e)


{
adapter = new SqlDataAdapter("SELECT fulname,salary,withoutF ,Pid FROM employee INNER JOIN salarytable ON employee.EId = salarytable.EId " +
" where Pid = " + comboBox2.SelectedValue + " and (data > = '" + dateTimePicker2.Value + "' and data < = '" + dateTimePicker3.Value + "' )", con);
ds = new DataSet();
adapter.Fill(ds);
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].DataPropertyName = "fulname";
dataGridView1.Columns[1].DataPropertyName = "salary";
dataGridView1.Columns[3].DataPropertyName = "withoutF";
dataGridView1.Columns[4].DataPropertyName = "EId";

}


private void label19_Click(object sender, EventArgs e)
{

}


private void button7_Click(object sender, EventArgs e)
{

Costumar sd = new Costumar();


sd.IsmiFamilyasi1 = textBox5.Text;
sd.Manzili1 = textBox6.Text;
sd.TelNomeri1 = textBox7.Text;
sd.Save();
}

private void button8_Click(object sender, EventArgs e)


{
Goodes df = new Goodes();
df.Goodes_Name1 = textBox7.Text;
df.Narxi = Convert.ToInt32(textBox8.Text);
df.Soni = Convert.ToInt32(textBox9.Text);
df.Umumiy_Narxi1 = Convert.ToInt32(textBox8.Text) * Convert.ToInt32(textBox9.Text);
df.Data = Convert.ToDateTime(dateTimePicker5.Value);
df.CID1 = Convert.ToInt32(comboBox8.SelectedValue);
df.QID = Convert.ToInt32(comboBox9.SelectedValue);
df.Save();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
dataGridView2.DataSource = GoodesAdapter.getList();
}

}
}



Download 59 Kb.

Do'stlaringiz bilan baham:




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