Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/boek_transactions.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/members_transactions.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/time_transactions.cpython-313.pyc
Binary file not shown.
157 changes: 157 additions & 0 deletions boek_transactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import pandas
import json

def mesaj_yaz(mesaj=False):
if not mesaj:
print("-"* 100)
else:
print("-"* 100)
print(mesaj)
print("-"* 100)

def write_boek(boeklist):
try:
with open("boeks.json", "w", encoding="utf-8") as f:
json.dump(boeklist, f, ensure_ascii=False, indent=4)
mesaj_yaz("Veriler başarıyla JSON dosyasına kaydedildi.")
return True
except Exception as e:
mesaj_yaz("Bir hata oldu : ", e)
return False

def read_boek_file():
try:
with open('boeks.json', 'r', encoding='utf-8') as f:
boek_list = json.load(f)
return boek_list
except (FileNotFoundError, json.JSONDecodeError):
mesaj_yaz("Kitap verileri bulunamadı veya dosya boş.")
return False
def boek_list():
boek_listesi = read_boek_file()
df = pandas.DataFrame(boek_listesi)
print("Sıralama Türü : 1-Kitap Adı 2-Yayıncı 3-Yazar 4-Dil")
siralama = input("Sıralam Türü : ")
if siralama == "1":
df = df.sort_values(by="kitap_adi")
elif siralama == "2":
df = df.sort_values(by="yayinci")
elif siralama == "3":
df = df.sort_values(by="yazar")
else:
df = df.sort_values(by="dil")
print("-" * 80)
print(df.to_string(index=False))
print("-" * 80)
def boek_add():
boek_listesi = read_boek_file()

try:
boek_name = input("Kitap Adı :")
boek_barcode = input("Barkod No :")
boek_publish = input("Yayıncı :")
boek_year = input("Yayın Yılı :")
boek_author = input("Yazar :")
boek_lang = input("Dil :")
boek_price = input("Fiyat :")

if not boek_listesi :
new_id = 1
boek_listesi=[]
else:
new_id = len(boek_listesi) + 1

boek_data = {
"kitap_id": new_id,
"kitap_adi": boek_name.capitalize(),
"barkod_no": boek_barcode,
"yayinci": boek_publish.capitalize(),
"yayin_yili": boek_year,
"yazar": boek_author.capitalize(),
"dil": boek_lang.capitalize(),
"fiyat": boek_price,
"status": "Rafta"
}
boek_listesi.append(boek_data)
write_boek(boek_listesi)
except Exception as e:
print(e)
def boek_search():
while True:
mesaj_yaz("KİTAP ARAMA")
try:
secim = int(input("1-Kitap Adına Göre 2-Yazara Göre 3-Yayıncıya Göre 0-Kitap İşlemleri : "))
if secim == 1:
nearanacak = input("Kitap Adı Giriniz : ")
boek_find("kitap_adi", nearanacak)

elif secim == 2:
nearanacak = input("Kitap Yazarı Giriniz : ")
boek_find("yazar", nearanacak)

elif secim == 3:
nearanacak = input("Kitap Yayıncısı Giriniz : ")
boek_find("yayinci", nearanacak)

elif secim == 0:
return
except ValueError as e:
print("Lütfen 1-2-3 veya 0 Seçiniz ")

def boek_find(nerede,ne):
listemiz = read_boek_file()
found = [boek for boek in listemiz if ne.lower() in boek[nerede].lower()]
if not found:
mesaj_yaz(f"'{nerede}' İçinde geçen '{ne}' bulunamadı ")
return
else:
df = pandas.DataFrame(found)
df = df.sort_values(by="kitap_adi")
mesaj_yaz(f"'{nerede}' Alanı İçinde '{ne}' Geçen Kitaplar ")
print(df.to_string(index=False))
return
def boek_delete():
boek_list = read_boek_file()
while True:
mesaj_yaz("KİTAP DURUM AKTİF/PASİF OLARAK DEĞİŞTİRME")
try:

print("Çıkış İçin 0 ")
delete_id = int(input("Durumu Değişecek Kitap ID : "))
if delete_id == 0:
return
else:
varmi = False
for boek in boek_list:
if boek["kitap_id"] == delete_id:
df = pandas.DataFrame(boek, index=[0])
print("-"*80)
print(df.to_string(index=False))
print("-"*80)
if boek["status"] == "Rafta":
boek["status"] = "Pasif"
neyazilacak = "Pasif"
varmi = True
break
elif boek["status"] == "Pasif":
boek["status"] = "Rafta"
neyazilacak="Rafta"
varmi = True
break
else:
mesaj_yaz("Bu Kitap Emanette Olduğu İçin Değiştiremezsin")
return
if varmi:
yesno = input(f"Bu Kitabın Durumunu {neyazilacak} olarak değiştirmek İstiyormusunuz y/n : ")
if yesno == "y" or yesno == "Y":

write_boek(boek_list)
break
else:
break
else:
return

except ValueError as e:
print("Bu Kitap İle İlgili Hata : ", e)

24 changes: 24 additions & 0 deletions boeks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"kitap_id": 1,
"kitap_adi": "Denemeler",
"barkod_no": "12312313",
"yayinci": "Adalar",
"yayin_yili": "2005",
"yazar": "Caner cancan",
"dil": "Türkçe",
"fiyat": "21",
"status": "Rafta"
},
{
"kitap_id": 2,
"kitap_adi": "Alivelioğlunun hikayeleri",
"barkod_no": "2313213",
"yayinci": "Zehra abla yayınları",
"yayin_yili": "1900",
"yazar": "Zehra abla",
"dil": "Türkçe",
"fiyat": "21",
"status": "Emanette"
}
]
18 changes: 18 additions & 0 deletions lend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"lend_id": 1,
"boek_id": 1,
"member_id": 1,
"verilme_tarihi": "15.01.2025",
"iade_tarihi": "29.01.2025",
"iade_oldugu_tarih": "16.01.2025"
},
{
"lend_id": 2,
"boek_id": 2,
"member_id": 3,
"verilme_tarihi": "16.01.2025",
"iade_tarihi": "30.01.2025",
"iade_oldugu_tarih": ""
}
]
13 changes: 13 additions & 0 deletions lend_transactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import json
import time_transactions


def write_lend_file(veriler):
pass
def read_lend_file():
try:
with open ("lend.json", "r", encoding="utf-8") as f:
lend_listesi = json.dumps(f)
return lend_listesi
except (FileNotFoundError, json.JSONDecodeError):
print("Emanet verileri bulunamadı veya dosya boş.")
114 changes: 114 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import json

import boek_transactions as bt
import members_transactions as mt



def cikis():
print("Çıkış Yapılıyor...")
exit()
def members_menu():
menu = "-----------------------------------------------------------------\n"
menu += "| ÜYELİK İŞLEMLERİ |\n"
menu +="| |\n"
menu +="| 1 - Üye Listesi 6 - Kitap Ödünç Ver |\n"
menu +="| 2 - Üye Kaydet 7 - Kitap İade Al |\n"
menu +="| 3 - Üye Bul 8 - Üyenin Aldığı Kitaplar |\n"
menu +="| 4 - Üye Aktif/Pasif Yap |\n"
menu +="| 5 - Silinmiş Üyeler 0 - Ana Menüye Dön |\n"
menu +="| |\n"
menu +="-----------------------------------------------------------------\n"
print(menu)
while True:
try:
print("Üye Menüsü İçim 9 ")
choice = input("Üye İşlemleri Seçiniz : ")

if choice == "1":
mt.members_list()
elif choice == "2":
mt.members_add()
elif choice == "3":
mt.members_search()
elif choice == "4":
mt.members_delete()
elif choice == "5":
mt.members_deleted()
elif choice == "6":
mt.members_boek_give()
elif choice == "7":
mt.members_boek_refund()
elif choice == "8":
mt.member_boek_list()
elif choice == "9":
members_menu()
elif choice == "0":
main_menu()
else:
print("0-9 arası bir seçim yapınız....")
except Exception as error:
print("Bir hata oldu.:",error)

def boek_menu():
print ("-----------------------------------------------------------------")
print ("| KİTAP İŞLEMLERİ |")
print ("| |")
print ("| 1 - Kitap Listesi 5- Emanetteki Kitaplar |")
print ("| 2 - Kitap Kaydet |")
print ("| 3 - Kitap Ara |")
print ("| 4 - Kitap Sil 0 - Ana Menuye Dön |")
print ("| |")
print ("-----------------------------------------------------------------")

while True:
try:
print("Kitap Menüsü İçim 9 - Ana Menü İçin 0")
choice = input("Bir İşlem Seçiniz : ")
if choice == "1":
bt.boek_list()
elif choice == "2":
bt.boek_add()
elif choice == "3":
bt.boek_search()
elif choice == "4":
bt.boek_delete()
elif choice == "5":
mt.members_boek_list()
elif choice == "9":
boek_menu()
elif choice == "0":
main_menu()
else:
print("1-2-3-4-9-0 arası bir seçim yapınız....")
except Exception as error:
print("Kitap Menüsünde Bir hata oldu...: ", error)


def main_menu ():
while True:
try:
print ("-----------------------------------------------------------------")
print ("| HALK KÜTÜPHANESİNE HOŞGELDİNİZ |")
print ("| |")
print ("| 1 - Üyelik İşelmleri |")
print ("| 2 - Kitap İşlemleri |")
print ("| 0 - Çıkış |")
print ("| |")
print ("-----------------------------------------------------------------")
choice = input("Seçim Yapınız : ")
if choice == "1":
members_menu()
elif choice == "2":
boek_menu()
elif choice == "0":
cikis()
else:
print("Lütfen 1-2-3 Giriniz......")
print("\n")
except Exception as error:
print("Hata :", error)



main_menu()
35 changes: 35 additions & 0 deletions members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"üye_id": 1,
"üye_adi": "Ali",
"üye_soyadi": "Velioğlu",
"üye_telefon": "012345678",
"üye_adres": "Muhabbet sokak 90",
"üye_şehir": "Adana",
"üye_doğum_tarihi": "01.01.1981",
"date": "15.01.2025",
"üye_durum": "Aktif"
},
{
"üye_id": 2,
"üye_adi": "Yeliz",
"üye_soyadi": "Fatmakızı",
"üye_telefon": "987654321",
"üye_adres": "Kerkstraat 21",
"üye_şehir": "Delf",
"üye_doğum_tarihi": "01.02.1983",
"date": "15.01.2025",
"üye_durum": "Aktif"
},
{
"üye_id": 3,
"üye_adi": "Necmi",
"üye_soyadi": "Mert",
"üye_telefon": "3231231231",
"üye_adres": "Deneme",
"üye_şehir": "Batman",
"üye_doğum_tarihi": "01.01.1985",
"date": "16.01.2025",
"üye_durum": "Aktif"
}
]
Loading