1-) C# - 136
properties - startposition - CenterScreen = ekranın ortasında başlasın
properties - FormBorderStyle - None = büyültme küçülmeyi kapatma.
properties- Cursor - Hand = mouseyi üzerine getirince el işareti çıkması.
SQL KOMUT
SELECT DERSAD,SINAV1,SINAV2,SINAV3,PROJE,ORTALAMA,DURUM FROM TBLNOTLAR
INNER JOIN TBLDERSLER ON TBLNOTLAR.DERSID=TBLDERSLER.DERSID WHERE OGRID=1
FrmGiris.cs
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 EntityProjeUygulama
{
public partial class FrmGiris : Form
{
public FrmGiris()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DbEntityUrunEntities db = new DbEntityUrunEntities();
var sorgu = from x in db.TBLADMIN where x.KULLANICI == textBox1.Text && x.SIFRE == textBox2.Text select x;
if (sorgu.Any())
{
FrmAnaForm fr = new FrmAnaForm();
fr.Show();
this.Hide();
}
else
{
MessageBox.Show("HATALI GİRİŞ");
}
}
}
}
FrmAnaForm.cs
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 EntityProjeUygulama
{
public partial class FrmAnaForm : Form
{
public FrmAnaForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 fr = new Form1();
fr.Show();
}
private void button2_Click(object sender, EventArgs e)
{
FrmUrun fr = new FrmUrun();
fr.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Frmİstatistik fr = new Frmİstatistik();
fr.Show();
}
}
}
Form1.cs 'katagori işlemleri'
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 EntityProjeUygulama
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
DbEntityUrunEntities db = new DbEntityUrunEntities();
private void BtnListele_Click(object sender, EventArgs e)
{
var kategoriler = db.TBLKATEGORI.ToList();
dataGridView1.DataSource = kategoriler;
}
private void BtnEkle_Click(object sender, EventArgs e)
{
TBLKATEGORI t = new TBLKATEGORI();
t.AD = textBox2.Text;
db.TBLKATEGORI.Add(t);
db.SaveChanges();
MessageBox.Show("Kategori Eklendi");
}
private void BtnSil_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(textBox1.Text);
var ktgr = db.TBLKATEGORI.Find(x);
db.TBLKATEGORI.Remove(ktgr);
db.SaveChanges();
MessageBox.Show("Kategori Silindi");
}
private void BtnGuncelle_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(textBox1.Text);
var ktgr = db.TBLKATEGORI.Find(x);
ktgr.AD = textBox2.Text;
db.SaveChanges();
MessageBox.Show("Güncelleme Yapıldı");
}
}
}
frmistatistik.cs
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 EntityProjeUygulama
{
public partial class Frmİstatistik : Form
{
public Frmİstatistik()
{
InitializeComponent();
}
private void panel9_Paint(object sender, PaintEventArgs e)
{
}
DbEntityUrunEntities db = new DbEntityUrunEntities();
private void Frmİstatistik_Load(object sender, EventArgs e)
{
label2.Text = db.TBLKATEGORI.Count().ToString();
label3.Text = db.TBLURUN.Count().ToString();
label5.Text = db.TBLMUSTERI.Count(x => x.DURUM == true).ToString();
label7.Text = db.TBLMUSTERI.Count(x => x.DURUM == false).ToString();
label13.Text = db.TBLURUN.Sum(y => y.STOK).ToString();
label21.Text = db.TBLSATIS.Sum(z => z.FIYAT).ToString() + "TL";
label11.Text = (from x in db.TBLURUN orderby x.FIYAT descending select x.URUNAD).FirstOrDefault();// en yüksek fiyatlı ürün
label9.Text = (from x in db.TBLURUN orderby x.FIYAT ascending select x.URUNAD).FirstOrDefault();// en düşük fiyatlı ürün
label15.Text = db.TBLURUN.Count(x => x.KATEGORI == 1).ToString();
label17.Text = db.TBLURUN.Count(x => x.URUNAD == "BUZDOLABI").ToString();
label23.Text = (from x in db.TBLMUSTERI select x.SEHIR).Distinct().Count().ToString();
label19.Text = db.MARKAGETIR().FirstOrDefault();
}
}
}
FrmUrun.cs
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 EntityProjeUygulama
{
public partial class FrmUrun : Form
{
public FrmUrun()
{
InitializeComponent();
}
DbEntityUrunEntities db = new DbEntityUrunEntities();
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = (from x in db.TBLURUN
select new
{
x.URUNID,
x.URUNAD,
x.MARKA,
x.STOK,
x.FIYAT,
x.TBLKATEGORI.AD,
x.DURUM
}).ToList();
}
private void BtnEkle_Click(object sender, EventArgs e)
{
TBLURUN t = new TBLURUN();
t.URUNAD = TxtUrunAd.Text;
t.MARKA = TxtMarka.Text;
t.STOK = short.Parse(TxtStok.Text);
t.KATEGORI = int.Parse(comboBox1.SelectedValue.ToString());
t.FIYAT = decimal.Parse(TxtFiyat.Text);
t.DURUM = true;
db.TBLURUN.Add(t);
db.SaveChanges();
MessageBox.Show("Ürün Kaydedildi");
}
private void BtnSil_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(Txtid.Text);
var urun = db.TBLURUN.Find(x);
db.TBLURUN.Remove(urun);
db.SaveChanges();
MessageBox.Show("Ürün silindi");
}
private void BtnGuncelle_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(Txtid.Text);
var urun = db.TBLURUN.Find(x);
urun.URUNAD = TxtUrunAd.Text;
urun.STOK = short.Parse(TxtStok.Text);
urun.MARKA = TxtMarka.Text;
db.SaveChanges();
MessageBox.Show("Ürün Güncelledi");
}
private void FrmUrun_Load(object sender, EventArgs e)
{
var kategoriler = (from x in db.TBLKATEGORI
select new
{
x.ID,
x.AD
}
).ToList();
comboBox1.ValueMember = "ID";
comboBox1.DisplayMember = "AD";
comboBox1.DataSource = kategoriler;
}
private void BtnTemizle_Click(object sender, EventArgs e)
{
}
}
}
model1.edmx[Diagram1]
SQL
Diagram
TBLADMIN
TBLKATEGORI
TBLMUSTERI
TBLSATIS
TBLURUN
NOT PROSEDÜR OLUŞTURMA 178. video ''MARKAGETIR''.