Vazirlar mahkamasining 2013 yil 31 dekabrdagi 355-son qarori
O’zbekiston respublikasi prezidentining 2012 yil 21 martdagi «Zamonaviy axborot -kommunikasiya texnologiyalarini yanada joriy etish va rivojlan irish chora- adbirlari o’g’risida»
L.Beck “System Software”. Addison-Wesley, 2006 y. 40-75 pages
С.А.Орлов “Теория и практика языков программирования” Питер 2013 г. 70-145 стр.
Е.В.Пышкин “Теория и технология программирования”. БХВ-Петербург, 2005 г
Grady Booch, James Rumbaugh, Ivar Jacobson.”The unified modeling language user guide” Addison-Wesley, 2005 y. 100-175 pages.
O.D.Rahimov ” Hayot faoliyati va havfsizligi” fanidan o’quv uslubiy majmua qarshi 2012 y.
Internet saytlar va manzillar
https://csharp.com.com
https://sqlitetutorial.com
http://githudb.com
http://stackoverflow.com
http://codeproject.com
www.ziyonet .uz
www.google.com
http://db. Informika.ru/
Ilovalar
Asosiy oynaning dastur kodi
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.SQLite;
namespace supermarket
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dt = new DataTable();
dt2 = new DataTable();
}
Form2 mainform=null;
public Form1(Form2 frm)
{
mainform = frm;
InitializeComponent();
dt = new DataTable();
dt2 = new DataTable();
}
public DataTable dt,dt2;
public SQLiteCommand cmd;
public SQLiteDataAdapter DataAdapter;
public SQLiteConnection con;
mahsulot[] mahsulotn = new mahsulot[100];
int mn = 0;
Korzinka[] karzinka=new Korzinka[50];
int k_count = 0;
bool add = false, edit = false, sale = false, admin = false;
string sotuvchi = "admin";
private void Form1_Load(object sender, EventArgs e)
{
con = new SQLiteConnection("Data Source = magazinbaza.db;");
dt.Clear();
con.Open();
cmd = new SQLiteCommand(con);
cmd.CommandText = " SELECT *FROM hisobot;";
DataAdapter = new SQLiteDataAdapter(cmd);
DataAdapter.Fill(dt2);
cmd.CommandText = " SELECT *FROM mahsulotlar ;";
DataAdapter = new SQLiteDataAdapter(cmd);
DataAdapter.Fill(dt); //fill the datasource
dataGridView1.DataSource = dt;
dataGridView2.DataSource = dt2;
dataGridView1.Columns[0].Visible = false;
resizegrid(dataGridView1);
// dataGridView1.Columns[2].ValueType=ValueType.
foreach (DataRow s in dt.Rows)
{
mahsulotn[mn] = new mahsulot();
mahsulotn[mn].name = s["nomi"].ToString();
mahsulotn[mn].id = Int32.Parse(s["id"].ToString());
mahsulotn[mn].price = Int32.Parse(s["narxi"].ToString());
mahsulotn[mn].Count = Int32.Parse(s["miqdori"].ToString());
mahsulotn[mn].type = s["turi"].ToString();
mahsulotn[mn].singular = s["birlik"].ToString();
mahsulotn[mn].images = @"images\prolldukt.jpg";
mahsulotn[mn].cmd = this.cmd;
mahsulotn[mn].deleteyes.Name = mn.ToString();
mahsulotn[mn].deleteyes.Click += del_Click;
mahsulotn[mn].Add.Click += Add_Click;
mahsulotn[mn].sale.Name = mn.ToString();
mahsulotn[mn].sale.Click += sale_Click;
mahsulotn[mn].goediting = edit;
mahsulotn[mn].gosale = sale;
flowLayoutPanel1.Controls.Add(mahsulotn[mn]);
mn++;
}
if (add)
{
mahsulotn[mn] = new mahsulot();
mahsulotn[mn].style("add");
mahsulotn[mn].id = mahsulotn[mn - 1].id + 1;
mahsulotn[mn].cmd = this.cmd;
mahsulotn[mn].deleteyes.Name = mn.ToString();
mahsulotn[mn].deleteyes.Click += del_Click;
mahsulotn[mn].Add.Click += Add_Click;
mahsulotn[mn].sale.Name = mn.ToString();
mahsulotn[mn].sale.Click += sale_Click;
flowLayoutPanel1.Controls.Add(mahsulotn[mn]);
}
}
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (dataGridView1.CurrentCell.ColumnIndex == 2|| dataGridView1.CurrentCell.ColumnIndex == 4 )
{
e.Control.KeyPress += new KeyPressEventHandler(Column1_KeyPress);
}
else
{
e.Control.KeyPress -= new KeyPressEventHandler(Column1_KeyPress);
}
if (dataGridView1.CurrentCell.ColumnIndex == 5)
{
// e.Control.KeyPress += new KeyPressEventHandler(Column1_KeyPress);
}
}
private void Column1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
e.Handled = true;
}
if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
{
e.Handled = true;
}
}
void update(bool b)
{
if (b)
{
dt = (DataTable)dataGridView1.DataSource;
foreach (DataRow s in dt.Rows)
{
cmd.CommandText = " update mahsulotlar " +
"set nomi = '" + s["nomi"].ToString() +
"',narxi=" + s["narxi"] +
" , miqdori=" + s["miqdori"] +
", birlik= '" + s["birlik"] +
"' where id = " + s["id"].ToString();
// +
cmd.ExecuteNonQuery();
cmd.CommandText = " update mahsulotlar " +
"set turi = '" + fixerror(s["turi"].ToString()) +
"' where id = " + s["id"].ToString();
cmd.ExecuteNonQuery();
}
}
string fixerror(string s)
{
string x = "";
for (int i = 0; i < s.Length; i++)
{
if (s[i] == '\'')
{
x = x + s[i] + "\'";
}
else { x = x + s[i]; }
}
return x;
}
}
private void Tabcontrol_SelectedIndexChanged(object sender, EventArgs e)
{
if(Tabcontrol1.SelectedIndex == 1)
{
dt.Clear();
cmd.CommandText = " SELECT *FROM mahsulotlar ;";
DataAdapter = new SQLiteDataAdapter(cmd);
DataAdapter.Fill(dt);
resizegrid(dataGridView1);
}
if (Tabcontrol1.SelectedIndex==2)
{
dt2.Clear();
cmd.CommandText = " SELECT *FROM hisobot;";
DataAdapter = new SQLiteDataAdapter(cmd);
DataAdapter.Fill(dt2);
resizegrid(dataGridView2);
}
//fill the datasource
}
private void Add_Click(object sender, EventArgs e)
{
if (mahsulotn[mn].addfilled())
{
mn++;
mahsulotn[mn] = new mahsulot();
mahsulotn[mn].style("add");
mahsulotn[mn].id = mahsulotn[mn - 1].id + 1;
mahsulotn[mn].cmd = this.cmd;
mahsulotn[mn].Add.Click += Add_Click;
mahsulotn[mn].deleteyes.Name = mn.ToString();
mahsulotn[mn].deleteyes.Click += del_Click;
mahsulotn[mn].sale.Name = mn.ToString();
mahsulotn[mn].sale.Click += sale_Click;
mahsulotn[mn].goediting = edit;
mahsulotn[mn].gosale = sale;
flowLayoutPanel1.Controls.Add(mahsulotn[mn]);
}
}
private void sale_Click(object sender, EventArgs e)
{
checkpanel.Visible = true;
Button btn = sender as Button;
int ind = Int32.Parse(btn.Name);
// Tovarlist.Text += "\r\n" + count.ToString() + " ta " + nomi + " \r\n Narxi\t" + (narx * count).ToString();
bool isid = false;
int isindex = 0;
for (int i = 0; i < k_count; i++)
{
if (karzinka[i].id == mahsulotn[ind].id)
{
isid = true;
isindex = i;
}
}
if (isid)
{
karzinka[isindex].count = (int)mahsulotn[ind].count.Value+ karzinka[isindex].count;
}
else
{
karzinka[k_count].id = mahsulotn[ind].id;
karzinka[k_count].count = (int)mahsulotn[ind].count.Value;
karzinka[k_count].narx = mahsulotn[ind].price;
karzinka[k_count].single = mahsulotn[ind].singular;
karzinka[k_count].name = mahsulotn[ind].name;
karzinka[k_count].miqdor = mahsulotn[ind].Count;
k_count++;
}
mahsulotn[ind].count.Maximum = mahsulotn[ind].staticcount;
Tovarlist.Clear();
float total = 0;
for (int i = 0; i < k_count; i++)
{
Tovarlist.Text += "\r\n" + karzinka[i].count.ToString() + " "+ karzinka[i].single+" " + karzinka[i].name + " \r\n Narxi\t" + (karzinka[i].count * karzinka[i].narx).ToString()+" So'm";
total += karzinka[i].count * karzinka[i].narx;
}
Tovarlist.Text += "\r\n--------------------------";
Tovarlist.Text += "\r\nUmumiy narx -----" + total.ToString() + " So'm ----";
}
private void del_Click(object sender, EventArgs e)
{
Button btn = sender as Button;
int ind = Int32.Parse(btn.Name);
flowLayoutPanel1.Controls.Remove(mahsulotn[ind]);
mn--;
}
private void findbutton_Click(object sender, EventArgs e)
{
for (int i = 0; i < mn; i++)
{
string sm = mahsulotn[i].name;
string ss1 = mahsulotn[i].type;
string ss = searchtext.Text;
if (sm.Contains(ss)|| ss1.Contains(ss))
flowLayoutPanel1.Controls[i].Show();
else
flowLayoutPanel1.Controls[i].Hide();
}
}
public struct Korzinka
{
public int id;
public float count;
public float narx;
}
}
}
}
Do'stlaringiz bilan baham: |