public void Read() { foreach (var item in _db.Anesthetists.ToList()) { Anesthetist.Add(item); } foreach (var item in _db.Hospitals.ToList()) { Hospital.Add(item); } foreach (var item in _db.OperatingRooms.ToList()) { OperatingRoom.Add(item); } foreach (var item in OperatingRoom) { foreach (var x in Hospital) { if (item.HospitalId == x.HospitalId) { item.HospitalName = x.Name; } } } }
public async Task <IActionResult> Create([Bind("ClinicasID,NomeClinica,Estrelas,DepartamentoID")] Clinicas clinicas) { if (ModelState.IsValid) { _context.Add(clinicas); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartamentoID"] = new SelectList(_context.Departamentos, "DepartamentoID", "DepartamentoID", clinicas.DepartamentoID); return(View(clinicas)); }
public void Read(int id) { pId = id; foreach (var item in _db.Surgeons.ToList()) { if (item.LoginId == LoginController.LoggedInUser) { SiD = item.SurgeonId; } } foreach (var item in _db.Anesthetists.ToList()) { Anesthetist.Add(item); } foreach (var item in _db.Hospitals.ToList()) { Hospital.Add(item); } foreach (var item in _db.OperatingRooms.ToList()) { OperatingRoom.Add(item); } foreach (var item in OperatingRoom) { foreach (var x in Hospital) { if (item.HospitalId == x.HospitalId) { item.HospitalName = x.Name; } } } foreach (var item in _db.Procedures.ToList()) { if (id == item.ProcedureId) { Procedure.ProcedureName = item.ProcedureName; Procedure.EstimatedProcedureLength = item.EstimatedProcedureLength; Procedure.ActualStart = item.ActualStart; Procedure.ActualFinish = item.ActualFinish; Procedure.Status = item.Status; } } }
public async Task <IActionResult> Create( [Bind("PrimeiroNome,Sobrenome,ColecaoDate")] Medicos medicos) { try { if (ModelState.IsValid) { _context.Add(medicos); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException /* ex */) { ModelState.AddModelError("", "Pronto para salvar as alteraçoes. " + "Tente de novo e se o problema persistir. " + "Verifique o seu sistema de administrador. "); } return(View(medicos)); }
static void Main(string[] args) { Hospital hs = new Hospital("WSBAsylum"); hs.Add(new Administrator("admin", "admin", "admin", "admin", "admin")); Employee emp; Console.WriteLine($"Welcome to hospital : {hs.HospitalName}"); while (true) { try { Console.Write("Enter Username : "******"Enter Password : "******"Is admin"); emp.ShowMenu(); int n; n = int.Parse(Console.ReadLine()); switch (n) { case 1: Console.WriteLine("Users : "); hs.PrintEmployees(); break; case 2: Console.WriteLine("Editing : "); while (true) { try { Console.WriteLine("Provide speciality : "); string[] specialities = new string[] { "administrator" }; string speciality = Console.ReadLine().ToLower(); if (!specialities.Contains(speciality)) { throw new Exception("There is no such speciality"); } Console.Write("Enter first name : "); string firstname = Console.ReadLine(); Console.Write("Enter last name : "); string lastname = Console.ReadLine(); Console.Write("Enter ID : "); string idNumber = Console.ReadLine(); Console.Write("Enter Username : "******"Enter Password : "******"administrator") { Console.Write("Enter new first name : "); string newfirstname = Console.ReadLine(); emp.ChangeName(newfirstname); Console.Write("Enter new last name : "); string newlastname = Console.ReadLine(); emp.ChangeSurname(newlastname); Console.Write("Enter new ID : "); string newidNumber = Console.ReadLine(); emp.ChangeIdNumber(newidNumber); Console.Write("Enter new Username : "******"Enter new Password : "******"There is no such speciality 1111111111111"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } break; case 3: Console.WriteLine("Adding : "); while (true) { try { Console.WriteLine("Provide speciality : "); string[] specialities = new string[] { "adminstrator", "doctor", "nurse", "urologist", "cardiologist", "laryngologist", "neuorologist" }; string speciality = Console.ReadLine().ToLower(); if (!specialities.Contains(speciality)) { throw new Exception("There is no such speciality"); } Console.Write("Enter first name : "); string firstname = Console.ReadLine(); Console.Write("Enter last name : "); string lastname = Console.ReadLine(); Console.Write("Enter ID : "); string idNumber = Console.ReadLine(); Console.Write("Enter Username : "******"Enter Password : "******"nurse") { hs.Add(new Nurse(firstname, lastname, idNumber, username, password)); break; } else if (speciality == "administrator") { hs.Add(new Administrator(firstname, lastname, idNumber, username, password)); break; } else if (speciality == "urologist" || speciality == "cardiologist" || speciality == "laryngologist" || speciality == "neurologist") { Console.Write("Provide GMC : "); string GMC = Console.ReadLine(); switch (speciality) { case "urologist": hs.Add(new Urologist(GMC, firstname, lastname, idNumber, username, password)); break; case "cardiologist": hs.Add(new Cardiologist(GMC, firstname, lastname, idNumber, username, password)); break; case "laryngologist": hs.Add(new Laryngologist(GMC, firstname, lastname, idNumber, username, password)); break; case "neurologist": hs.Add(new Neurologist(GMC, firstname, lastname, idNumber, username, password)); break; default: break; } } else { throw new Exception("There is no such speciality"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } break; case 4: Console.WriteLine("Exit"); break; } //hs.Choose(); break; case false: Console.WriteLine("Is not admin"); emp.ShowMenu(); //hs.PrintEmployees(); break; } /*switch(IsAdministrator) * { * case 1: * * }*/ }