Notes
Notes - notes.io |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.OleDb;
namespace ConsoleApplication1
{
class Menu
{
int sec=1, x=0, y=1;
public Menu(int sut, int sat)
{
x = sut; y = sat;
}
public int Secenek
{
get {
ConsoleKeyInfo tus;
Console.Clear();
do
{
Console.SetCursorPosition(x + 2, y);
Console.Write("İŞLEMLER");
Console.SetCursorPosition(x + 2, y + 1);
Console.Write("---------------");
Console.SetCursorPosition(x + 2, y + 2);
Console.Write("Kayıt Girişi");
Console.SetCursorPosition(x + 2, y + 3);
Console.Write("Kayıt Listele");
Console.SetCursorPosition(x + 2, y + 4);
Console.Write("Kayıt Arama");
Console.SetCursorPosition(x + 2, y + 5);
Console.Write("Kayıt Güncelleme");
Console.SetCursorPosition(x + 2, y + 6);
Console.Write("Kayıt Silme");
Console.SetCursorPosition(x + 2, y + 7);
Console.Write("ÇIKIŞ");
Console.SetCursorPosition(x, y + sec + 1);
Console.Write("->");
tus = Console.ReadKey();
if (tus.Key == ConsoleKey.UpArrow)
{
Console.SetCursorPosition(x, y + sec + 1);
Console.Write(" ");
sec--;
if (sec < 1) sec = 6;
}
if (tus.Key == ConsoleKey.DownArrow)
{
Console.SetCursorPosition(x, y + sec + 1);
Console.Write(" ");
sec++;
if (sec > 6) sec = 1;
}
} while (tus.Key != ConsoleKey.Enter);
return sec;
}
}
}
class Kayitİslemleri
{
OleDbConnection bag = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source=kayitlar.mdb");
public void KayitListele(string an)
{
string kc="SELECT KAYIT.NUMARA,AD,ORTALAMA,DURUM FROM KAYIT,NOTLAR WHERE KAYIT.NUMARA=NOTLAR.NUMARA";
if (an != "") kc += " AND KAYIT.NUMARA=@an";
OleDbCommand komut = new OleDbCommand(kc,bag);
if (an != "") komut.Parameters.AddWithValue("@an", an);
OleDbDataAdapter adp = new OleDbDataAdapter(komut);
DataTable tablo = new DataTable();
adp.Fill(tablo);
Console.Clear();
Console.SetCursorPosition(1, 1); Console.Write("NUMARA");
Console.SetCursorPosition(10, 1); Console.Write("AD");
Console.SetCursorPosition(30, 1); Console.Write("ORTALAMA");
Console.SetCursorPosition(45, 1); Console.Write("DURUM");
Console.SetCursorPosition(1, 2);
Console.Write(new string('-',60));
if (tablo.Rows.Count < 1)
Console.Write("n Kayıt Yok!...");
else
{
for (int i = 0; i < tablo.Rows.Count; i++)
{
Console.SetCursorPosition(1, i + 3);
Console.Write(tablo.Rows[i][0]);
Console.SetCursorPosition(10, i + 3);
Console.Write(tablo.Rows[i][1]);
Console.SetCursorPosition(30, i + 3);
Console.Write(tablo.Rows[i][2]);
Console.SetCursorPosition(45, i + 3);
Console.Write(tablo.Rows[i][3]);
}
}
Console.ReadKey();
}
string num, ad, bol, durum;
int ara, f, d, b, ort;
public void VeriGiris()
{
Console.Write("Öğrencininn");
Console.Write("Numarası: ");
num = Console.ReadLine();
Console.Write("Adı: ");
ad = Console.ReadLine();
Console.Write("Bölümü: ");
bol = Console.ReadLine();
Console.Write("Arasınav Notu: ");
ara = int.Parse(Console.ReadLine());
Console.Write("Devamsızlığı: ");
d = int.Parse(Console.ReadLine());
f = 0; b = 0; ort = 0;
durum = "BAŞARISIZ";
if (d < 5)
{
Console.Write("Final Notu: ");
f = int.Parse(Console.ReadLine());
ort = Convert.ToInt32(Math.Round(ara * 0.3 + f * 0.7));
if (ort < 60 || f < 50)
{
Console.Write("Bütünleme Notu: ");
b = int.Parse(Console.ReadLine());
ort = Convert.ToInt32(Math.Round(ara * 0.3 + b * 0.7));
if (ort < 60 || b < 50) durum = "BAŞARISIZ";
else durum = "BAŞARILI";
}
else durum = "BAŞARILI";
}
}
public void KayitGirisi()
{
Console.Clear();
Console.Write("KAYIT GİRİŞİn-----------------------n");
VeriGiris();
Console.Write("Kaydedilsin mi?(e/h): ");
ConsoleKeyInfo cevap = Console.ReadKey();
if (char.ToLower(cevap.KeyChar) == 'e')
{
string kc = "INSERT INTO KAYIT VALUES(@n,@ad,@bol)";
OleDbCommand komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@n", num);
komut.Parameters.AddWithValue("@ad", ad);
komut.Parameters.AddWithValue("@bol", bol);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
kc = "INSERT INTO NOTLAR VALUES(@n,@a,@d,@f,@b,@ort,@durum)";
komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@n", num);
komut.Parameters.AddWithValue("@a", ara);
komut.Parameters.AddWithValue("@d", d);
komut.Parameters.AddWithValue("@f", f);
komut.Parameters.AddWithValue("@b", b);
komut.Parameters.AddWithValue("@ort", ort);
komut.Parameters.AddWithValue("@durum", durum);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
Console.Write("nKaydedildi!...");
}
else Console.Write("nKaydedilmedi!...");
Console.ReadKey();
}
public void KayitGuncelle(string gn)
{
KayitListele(gn);
Console.Write("n Güncellenecek Kayıt bu mu?(e/h): ");
ConsoleKeyInfo cevap = Console.ReadKey();
if (char.ToLower(cevap.KeyChar) == 'e')
{
VeriGiris();
Console.Write("n Güncellensin mi?(e/h): ");
cevap = Console.ReadKey();
if (char.ToLower(cevap.KeyChar) == 'e')
{
string kc = "UPDATE KAYIT SET NUMARA=@n,AD=@ad,BÖLÜM=@bol WHERE NUMARA=@gn";
OleDbCommand komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@n", num);
komut.Parameters.AddWithValue("@ad", ad);
komut.Parameters.AddWithValue("@bol", bol);
komut.Parameters.AddWithValue("@gn", gn);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
kc = "UPDATE NOTLAR SET NUMARA=@n,ARASINAV=@a,DEVAMSIZLIK=@d,FİNAL=@f,BÜTÜNLEME=@b,ORTALAMA=@ort,DURUM=@durum WHERE NUMARA=@gn";
komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@n", num);
komut.Parameters.AddWithValue("@a", ara);
komut.Parameters.AddWithValue("@d", d);
komut.Parameters.AddWithValue("@f", f);
komut.Parameters.AddWithValue("@b", b);
komut.Parameters.AddWithValue("@ort", ort);
komut.Parameters.AddWithValue("@durum", durum);
komut.Parameters.AddWithValue("@gn", gn);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
Console.Write("nGüncellendi!...");
}
else Console.Write("nGüncellenmedi!...");
Console.ReadKey();
}
}
public void KayitSil(string sn)
{
KayitListele(sn);
Console.Write("n Kayıt Silinsin mi?(e/h): ");
ConsoleKeyInfo cevap = Console.ReadKey();
if (char.ToLower(cevap.KeyChar) == 'e')
{
string kc = "DELETE FROM KAYIT WHERE NUMARA=@sn";
OleDbCommand komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@sn", sn);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
kc = "DELETE FROM NOTLAR WHERE NUMARA=@sn";
komut = new OleDbCommand(kc, bag);
komut.Parameters.AddWithValue("@sn", sn);
bag.Open(); komut.ExecuteNonQuery(); bag.Close();
Console.Write("nKayıt Silindi!...");
}
Console.ReadKey();
}
}
class Program
{
static void Main(string[] args)
{
Menu menu = new Menu(1,1);
Kayitİslemleri ki = new Kayitİslemleri();
int s;
do
{
s = menu.Secenek;
switch (s)
{
case 1: ki.KayitGirisi(); break;
case 2: ki.KayitListele(""); break;
case 3:
Console.Clear();
Console.Write("Aradığınız kaydın numarası:");
string an = Console.ReadLine();
ki.KayitListele(an);
break;
case 4:
Console.Clear();
Console.Write("Güncellenecek kaydın numarası:");
string gn = Console.ReadLine();
ki.KayitGuncelle(gn);
break;
case 5:
Console.Clear();
Console.Write("Silinecek kaydın numarası:");
string sn = Console.ReadLine();
ki.KayitSil(sn);
break;
}
} while (s != 6);
}
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team