def start(): try: # Khởi tạo đối tượng model model = sinhvien_model.SinhVienModel("localhost", "root", "llăêđ̉âđăê", "qlsv") #model = sinhvien_model.SinhVienModel("localhost", "root", ""123456789", "python_mvc") # Khởi tạo đối tượng view view = sinhvien_view.SinhVienView() # Khởi tạo controller controller = sinhvien_controller.SinhvienController(model, view) # Hiển thị tất cả dữ liệu của bảng sinhvien #controller.show_all_sinhvien1() controller.them_sinhvien("linh") # Hiển thị tất cả dữ liệu của bảng sinh #controller.show_all_sinhvien() except db_exceptions.DatabaseConnection as err: print(err)
def start(): model = sinhvien_model.SinhVienModel("localhost", "root", "123456", "ql") view = sinhvien_view.SinhVienView() controller = sinhvien_controller.SinhvienController(model, view) item = menu() while item in ["1", "2", "3", "4"]: if item == "1": controller.show_all_sinhvien() elif item == "2": hoten = input("Nhập họ tên: ") controller.them_sinhvien(hoten) elif item == "3": hoten = input("Nhập họ tên: ") id = input("Nhập Id:") controller.update_sinhvien(hoten, id) elif item == "4": id = input("Nhập Id: ") controller.delete_sinhvien(id) item = menu()
def start(): try: # Khởi tạo đối tượng model model = sinhvien_model.SinhvienModel("localhost", "root", "123456", "qlsinhvien") # Khởi tạo đối tượng view view = sinhvien_view.SinhvienView() # Khởi tạo controller controller = sinhvien_controller.SinhvienController(model, view) item = menu() while item in ["1", "2", "3", "4"]: if item == "1": controller.show_all_sinhvien() elif item == "2": hoten = input("Nhập họ tên: ") tuoi = int(input("Nhập tuổi: ")) sdt = int(input("Nhập số điện thoại: ")) address = input("Nhập địa chỉ: ") controller.them_sinhvien(hoten, tuoi, sdt, address) elif item == "3": idsv = int(input("Nhập id sinh viên: ")) hoten = input("Nhập họ tên: ") tuoi = int(input("Nhập tuổi: ")) sdt = int(input("Nhập số điện thoại: ")) address = input("Nhập địa chỉ: ") controller.update_sinhvien(idsv, hoten, tuoi, sdt, address) elif item == "4": idsv = int(input("Nhập id sinh viên cần xóa: ")) controller.xoa_sinhvien(idsv) item = menu() except db_exceptions.DatabaseConnection as err: print(err)