public RegisteredUsersPresenter(IView view, Model model, IRegisteredUsers registeredUsers) { this.view = view; this.model = model; this.registeredUsers = registeredUsers; this.SetRegistered(); this.registeredUsers.ReturnBtnClicked += BackToMenu; }
public void DeleteDoctor(IDoctor doctor) { int doctorId = doctor.SelectedDoctor; if (doctorId != 0) { using (MySqlConnection conn = DatabaseConnection.Connection()) { try { conn.Open(); using (MySqlCommand command = new MySqlCommand($"DELETE FROM umowienia WHERE umowienia.id_l = {doctorId};", conn)) { command.ExecuteNonQuery(); } using (MySqlCommand command = new MySqlCommand($"DELETE FROM posiadaja WHERE posiadaja.id_l = {doctorId};", conn)) { command.ExecuteNonQuery(); } using (MySqlCommand command = new MySqlCommand($"UPDATE gabinety SET gabinety.id_l = NULL WHERE gabinety.id_l = {doctorId};", conn)) { command.ExecuteNonQuery(); } using (MySqlCommand command = new MySqlCommand($"DELETE FROM lekarze WHERE lekarze.id_l = {doctorId}", conn)) { command.ExecuteNonQuery(); } doctor.Doctors = this.GetDoctors(); doctor.DoctorSpecialisations = this.GetDoctorSpecialisations(doctor.SelectedDoctor); doctor.DoctorRoom = this.GetDoctorRoom(doctor.SelectedDoctor); doctor.Rooms = this.GetRooms(); IRegister register = Register.GetInstance; register.Doctors = this.GetDoctors(); IRegisteredUsers registeredUsers = RegisteredUsers.GetInstance; registeredUsers.Registered = this.GetRegistered(); conn.Close(); } catch (Exception exc) { Console.WriteLine("ERROR: " + exc.Message); } } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Model model = new Model(); IView view = new Form1(); IDisplayMenu displayMenu = DisplayMenu.GetInstance; IUser user = User.GetInstance; IRegister register = Register.GetInstance; IRegisteredUsers registeredUsers = RegisteredUsers.GetInstance; IDoctor doctor = Doctor.GetInstance; Presenter presenter = new Presenter(view, model, displayMenu); RegisterPresenter RegisterPresenter = new RegisterPresenter(view, model, register); UserPresenter UserPresenter = new UserPresenter(view, model, user); RegisteredUsersPresenter RegisteredUsersPresenter = new RegisteredUsersPresenter(view, model, registeredUsers); DoctorPresenter DoctorPresenter = new DoctorPresenter(view, model, doctor); Debug.WriteLine(DateTime.Now); Application.Run((Form1)view); }
public HomeController(MockRegisteredUserRepo mockRegisteredUserRepo, MockFruitBasketRepo mockFruitBasketRepo) { RegisteredUserRepo = mockRegisteredUserRepo; FruitBasketRepo = mockFruitBasketRepo; }
//Constructor for setup public HomeController() { RegisteredUserRepo = new RegisteredUserRepo(); FruitBasketRepo = new FruitBasketRepo(); }
public RegistrationController(IRegisteredUsers registerService) { _regesterService = registerService; }
//overloaded constructor public AdminController(IRegisteredUsers repo) { repository = repo; }