public virtual void RemovePerson(Person person) { if (person == nurse) { nurse = null; } else if (person == patient) { patient = null; } }
private void button2_Click(object sender, EventArgs e) { string[] string_array = textBoxAdminNName.Text.Split(' '); string all = ""; bool exsists = false; int n = 0; Random random = new Random(); foreach (string s in string_array) { string first = String.IsNullOrEmpty(s) ? "" : s; all += first; } for (int i = 0; i < _nurseRepository.Count(); i++) { Nurse nurse = _nurseRepository.GetNurseFromList(i); if (nurse.Username == all.ToLower()) { n++; exsists = true; } else if (exsists) { exsists = false; } } if (!exsists) { textBoxAdminNUsername.Text = all.ToLower(); } else { all += n; textBoxAdminNUsername.Text = all.ToLower(); } textBoxAdminNPass.Text = random.Next(1, 10000).ToString(); }
public static Nurse Login_nurse(string username, string password) { string query = String.Format("select COUNT(*) from Employees WHERE username = '******'", username); command.CommandText = query; try { conn.Open(); int NurseCount = (int)command.ExecuteScalar(); if (NurseCount == 1) { query = String.Format("SELECT password FROM Employees WHERE username = '******'", username); command.CommandText = query; string dbpassword = command.ExecuteScalar().ToString(); if (dbpassword == password) { query = String.Format("SELECT name FROM Employees WHERE username = '******'", username); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string Nurse_Name = reader.GetString(0); Nurse N = new Nurse(Nurse_Name, username, password); return(N); } return(null); } return(null); } else { return(null); } } finally { conn.Close(); } return(null); }
// // GET: /Admin/ public ActionResult NurseAssignToWard() { ViewBag.NurseAssignToWard = "active"; List <Ward> wards; List <Nurse> nurses = new List <Nurse>(); using (var db = new MedicalContext()) { var a = db.Nurses.Where(c => c.Wardassign == 0).Select(c => new { c.Name, c.Id }).ToList(); foreach (var b in a) { Nurse n = new Nurse(); n.Id = b.Id; n.Name = privacy.Decrypt(b.Name); nurses.Add(n); } ViewBag.Nurse = nurses; wards = db.Wards.ToList(); } return(View(wards)); }
public void Nurse_constructor_should_Use_employee_base_constructor_and_then_overwrite_via_class_constructor() { //arange Hospital hospital = new Hospital("Univeristy Clinic Hospital"); string name = "jonna smith"; int employeeNumber = 001; int numberOfPatients = 5; //act Nurse sut = new Nurse(name, employeeNumber, numberOfPatients, hospital); //assert Assert.Equal("jonna smith", sut.Name); Assert.Equal(001, sut.EmployeeNumber); Assert.Equal("Nurse", sut.EmployeeType); Assert.Equal(50000, sut.Salary); Assert.False(sut.BeenPaid); Assert.Equal(5, sut.NumberOfPatients); }
public NurseConfigurationWindow(string username) { InitializeComponent(); // Initialise nurse _nurse = new Nurse(username); _rooms = _nurse.GetRooms(); // Get rooms in hospital and add to combobox cbRooms.Items.Clear(); _rooms.ForEach(room => { cbRooms.Items.Add(new ComboboxItem <Room>(room, item => { return(item.RoomName); })); }); cbRooms.SelectedIndex = 0; // Passively listen for available caretakers and update the list _ = Task.Run(() => UpdateCaretakerList()); }
public ActionResult AssignNurse() { ViewBag.AssignNurse = "active"; List <Ward> wards; List <Nurse> nurse = new List <Nurse>(); using (var ctx = new HospitalContext()) { var nur = ctx.Nurse.Where(c => c.WardId == 0).Select(c => new { c.Name, c.Id }).ToList(); foreach (var nn in nur) { Nurse n = new Nurse(); n.Name = baseController.Decrypt(nn.Name); n.Id = nn.Id; nurse.Add(n); } ViewBag.Nurse = nurse; wards = ctx.Ward.ToList(); } return(View(wards)); }
public User GetUser() { EmployeeBase employee = null; Role role = (Role)Role.SelectedItem; if (role == Szpital.Role.Administrator) { employee = new Administrator(new PersonalData(Firstname.Text, Lastname.Text, Address.Text)); } else if (role == Szpital.Role.Pielegniarka) { employee = new Nurse(new PersonalData(Firstname.Text, Lastname.Text, Address.Text)); } else if (role == Szpital.Role.Lekarz) { employee = new Doctor(new PersonalData(Firstname.Text, Lastname.Text, Address.Text), PWZ.Text, (Szpital.Speciality)Speciality.SelectedItem); } return(new User(Username.Text, Password.Password, employee)); }
public void Spawn(int spawnNum) { if (GameApp.GetInstance().GetGameScene() == null || disable) { return; } //Debug.Log("spawn "+enemyType); GameObject enemyPrefab = GameApp.GetInstance().GetResourceConfig().enemy[(int)enemyType]; for (int i = 0; i < spawnNum; i++) { GameObject currentEnemy = (GameObject)Instantiate(enemyPrefab, transform.position, Quaternion.Euler(0, 0, 0)); int enemyID = GameApp.GetInstance().GetGameScene().GetNextEnemyID(); currentEnemy.name = ConstData.ENEMY_NAME + enemyID.ToString(); Enemy enemy = null; switch ((int)enemyType) { case 0: enemy = new Zombie(); break; case 1: enemy = new Nurse(); break; case 2: enemy = new Tank(); break; } enemy.Init(currentEnemy); enemy.EnemyType = enemyType; enemy.Spawn = this; enemy.Name = currentEnemy.name; GameApp.GetInstance().GetGameScene().GetEnemies().Add(currentEnemy.name, enemy); // currentEnemy.transform.parent = enemyFolder.transform; } lastSpawnTime = Time.time; }
public async static void InsertNurse(Nurse nurse) { MySqlConnection con = InitConnection(); try { con.Open(); String query = $"INSERT INTO nurse VALUES('{nurse.ID}', '{nurse.Name}', " + $"'{nurse.BirthDate.ToString("yyyy-MM-dd")}', '{nurse.Address}', '{nurse.EmploymentDate.ToString("yyyy-MM-dd")}', '{nurse.Department.ID}'," + $"{nurse.Salary})"; MySqlCommand command = new MySqlCommand(query, con); await command.ExecuteNonQueryAsync(); } catch { Console.WriteLine("Error Inserting Nurse."); } finally { con.Close(); } }
public async Task <IActionResult> Create([Bind(",LastName,FirstName,PESEL,HireDate,HospitalID")] Nurse nurse) { try { if (ModelState.IsValid) { _context.Add(nurse); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HospitalID"] = new SelectList(_context.Hospitals, "HospitalID", "Name", nurse.HospitalID); } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", "Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(nurse)); }
// GET: Nurses/Details/5 public ActionResult Details(int?id) { ViewBag.user = Session["uns"]; ViewBag.role = Session["rol"]; if ((Session["uns"] == null) || (Session["rol"].ToString() == "Secretary") || (Session["rol"].ToString() == "Nurse") || (Session["rol"].ToString() == "Consultant")) { return(RedirectToAction("LoginPage", "LogClass1")); } else { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Nurse nurse = db.Nurses.Find(id); if (nurse == null) { return(HttpNotFound()); } return(View(nurse)); } }
public async Task <ICommandResult> Handler(CreateNurseCommand command) { command.Validate(); if (!command.Valid) { return(new GenericCommandResult(false, "Ops, parece que algo está errado!", command.Notifications)); } var isDocument = await _nurseRepository.DocumentExists(command.CPF); if (isDocument) { return(new GenericCommandResult(false, "Ops, já temos um enfermeio cadastrado com esse CPF", command.Notifications)); } var document = new Document(command.CPF, EDocumentType.CPF); var nurse = new Nurse(command.Name, document, command.Coren, command.DateBirth, command.HospitalId); await _nurseRepository.Create(nurse); return(new GenericCommandResult(true, "Enfermeiro cadastrado", nurse)); }
public static IRestResponse SendEmail(Nurse newNurse) { byte[] bytes = System.Convert.FromBase64String(newNurse.TestDataPdf.Substring(51)); var apiKey = Environment.GetEnvironmentVariable("MAIL_GUN"); RestClient client = new RestClient(); client.BaseUrl = new Uri("https://api.mailgun.net/v3"); client.Authenticator = new HttpBasicAuthenticator("api", apiKey); RestRequest request = new RestRequest(); request.AddParameter("domain", "nurse2nurse.travel", ParameterType.UrlSegment); request.Resource = "{domain}/messages"; request.AddParameter("from", "<*****@*****.**>"); request.AddParameter("to", $"{newNurse.RecruiterEmail}"); request.AddParameter("subject", "New Skills Assessment Test"); request.AddParameter("text", $"First Name: {newNurse.FirstName} Last Name: {newNurse.LastName} Email: {newNurse.NurseEmail} Phone Number: {newNurse.PhoneNumber}"); request.AddFileBytes("attachment", bytes, $"{newNurse.FirstName} {newNurse.LastName} - {newNurse.SkillsTestName} - {newNurse.TimeSubmitted.ToString("yyyy-MM-dd")}", "application/pdf"); request.Method = Method.POST; return(client.Execute(request)); }
public ActionResult Edit([Bind(Include = "Id,Name,Email,Password,Designation")] Nurse nurse, HttpPostedFileBase Image, string pastImage) { if (ModelState.IsValid) { if (Image != null && Image.ContentLength > 0) { string fullPath = Request.MapPath("~/" + pastImage); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } try { string fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(Image.FileName); string uploadUrl = Server.MapPath("~/Photos/Nurse"); Image.SaveAs(Path.Combine(uploadUrl, fileName)); nurse.Image = "Photos/Nurse/" + fileName; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { nurse.Image = pastImage; } nurse.Name = baseController.Encrypt(nurse.Name); nurse.Email = baseController.Encrypt(nurse.Email); nurse.Password = baseController.EncodePasswordMd5(nurse.Password); nurse.Designation = baseController.Encrypt(nurse.Designation); db.Entry(nurse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nurse)); }
public HttpResponseMessage Show(long id) { HttpResponseMessage response = null; try { Nurse mNurse = nurseService.GetNurseById(id); if (mNurse == null) { response = Request.CreateResponse(HttpStatusCode.NotFound, "Requested entity was not found in database."); } else { response = Request.CreateResponse(HttpStatusCode.OK, mNurse); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public async Task <ActionResult> AddNurse(NurseCollection model) { var user = new ApplicationUser { UserName = model.ApplicationUser.UserName, Email = model.ApplicationUser.Email, UserRole = "Nurse", RegisteredDate = DateTime.Now.Date }; var result = await UserManager.CreateAsync(user, model.ApplicationUser.Password); if (result.Succeeded) { await UserManager.AddToRoleAsync(user.Id, "Nurse"); var nurse = new Nurse { FirstName = model.Nurse.FirstName, LastName = model.Nurse.LastName, FullName = model.Nurse.FirstName + " " + model.Nurse.LastName, EmailAddress = model.ApplicationUser.Email, //ContactNo = model.Nurse.ContactNo, PhoneNo = model.Nurse.PhoneNo, //Designation = model.Nurse.Designation, Education = model.Nurse.Education, Gender = model.Nurse.Gender, BloodGroup = model.Nurse.BloodGroup, ApplicationUserId = user.Id, DateOfBirth = model.Nurse.DateOfBirth, Address = model.Nurse.Address, Status = model.Nurse.Status }; db.Nurses.Add(nurse); db.SaveChanges(); return(RedirectToAction("ListOfNurses")); } return(HttpNotFound()); }
public Nurse Get(string id) { SqlDataReader reader = null; // The SQL query to be sent to the server string query = "SELECT * FROM Nurse WHERE NurseID = '@id'"; //Replace @id with the requested nurse's ID query = query.Replace("@id", id); // Establish connection with the SQL server SqlConnection connection = new SqlConnection(ConnectionString); connection.Open(); // Open the connection to the server using (SqlCommand command = new SqlCommand(query, connection)) { // Assign the SQL query and connection details to the reader reader = command.ExecuteReader(); // Create a new nurse that will contain data from server Nurse qresult = new Nurse(); // Read the data from the server to qresults while (reader.Read()) { qresult.NurseID = reader["NurseID"].ToString(); qresult.FirstName = reader["FirstName"].ToString(); qresult.LastName = reader["LastName"].ToString(); qresult.Initials = reader["Initials"].ToString(); qresult.Active = Convert.ToBoolean(reader["Active"].ToString()); qresult.Password = reader["NursePassword"].ToString(); } connection.Close(); // Close the connection to the server return(qresult); } }
public async Task DeleteAsync(Guid id, string role) { UserIdentity identity = null; if (role == "NURSE") { Nurse nurse = await applicationContext.Nurses.Include(n => n.UserIdentity).FirstOrDefaultAsync(x => x.Id == id); if (nurse == null) { throw new Exception(localizer["The user with such login doesn`t exist."]); } identity = nurse.UserIdentity; applicationContext.Nurses.Remove(nurse); } if (role == "DOCTOR") { Doctor doctor = await applicationContext.Doctors.Include(d => d.UserIdentity).FirstOrDefaultAsync(x => x.Id == id); if (doctor == null) { throw new Exception(localizer["The user with such login doesn`t exist."]); } identity = doctor.UserIdentity; applicationContext.Doctors.Remove(doctor); } await applicationContext.SaveChangesAsync(); if (identity != null) { applicationContext.UserIdentities.Remove(identity); await applicationContext.SaveChangesAsync(); } }
//Event Handler to handle Login submission private void LogIn_Clicked(object sender, System.EventArgs e) { Task.Run(async() => { // convert entered text to strings String sNurseUserName = this.UserName.Text; String sNursePassword = this.Password.Text; try { // Find the nurse by username MediClipClient client = new MediClipClient(); Nurse currentNurse = await client.GetNurse(sNurseUserName); //If password is correct send to homescreen else display login failed message if (sNursePassword.Equals(currentNurse.Password)) { Device.BeginInvokeOnMainThread(() => { Navigation.PushAsync(new HomePage()); }); } else { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Login Failed", "Username or Password is incorrect", "Okay"); }); } } catch { Device.BeginInvokeOnMainThread(() => { DisplayAlert("Error", "Error retrieving login details", "Okay"); }); } }); }
public async Task EditAsync(Guid id, DetailedRegistrationRequest request, string role) { if (role == "NURSE") { Nurse newNurse = new Nurse(request.Login, request.Password, request.Name, request.Surname); Nurse nurse = await applicationContext.Nurses.Include(n => n.UserIdentity).AsNoTracking().SingleOrDefaultAsync(n => n.Id == id); if (nurse == null) { throw new Exception(localizer["The user with such login doesn`t exist."]); } request.Password = nurse.UserIdentity.Password; request.Login = nurse.UserIdentity.Login; await DeleteAsync(nurse.Id, role); await CreateAsync(request, role); } if (role == "DOCTOR") { Doctor newDoctor = new Doctor(request.Login, request.Password, request.Name, request.Surname); Doctor doctor = await applicationContext.Doctors.Include(d => d.UserIdentity).AsNoTracking().SingleOrDefaultAsync(d => d.Id == id); if (doctor == null) { throw new Exception(localizer["The user with such login doesn`t exist."]); } request.Password = doctor.UserIdentity.Password; request.Login = doctor.UserIdentity.Login; await DeleteAsync(doctor.Id, role); await CreateAsync(request, role); } await applicationContext.SaveChangesAsync(); }
private void setUserViewByType(int userType) { switch (userType) { case (int)UserType.Administrator: adminLoggedInViewController = new AdminLoggedInViewController(this, new frmAdminMenuSelectView()); //currentAdmin = eClinicalsController.GetAdminByID(currentUser.ContactID); CloseCurrentOpenView(currentViewOpened); currentViewOpened = adminLoggedInViewController.thisView; AddToContainer(adminLoggedInViewController, MIDDLE); adminLoggedInViewController.frmAdminMenuSelectView.btnGenerateReport.Click += new EventHandler(btnGenerateReport_Click); setNotification(2000, "Important notice", "eClinicals Login status: Admin", ToolTipIcon.Info, NoticeType.Administrator); Status("Admin View Open", Color.Yellow); break; case (int)UserType.Nurse: currentNurse = eClinicalsController.GetNurseByID(currentUser.ContactID); nurseLoggedInViewController = new NurseLoggedInViewController(this, new frmNurseMenuSelectView()); CloseCurrentOpenView(currentViewOpened); currentViewOpened = nurseLoggedInViewController.thisView; AddToContainer(nurseLoggedInViewController, MIDDLE); nurseLoggedInViewController.frmNurseMenuSelectView.btnFindPatientRecord.Click += new EventHandler(btnFindPatientRecord_Click); nurseLoggedInViewController.frmNurseMenuSelectView.btnRegisterAPatient.Click += new EventHandler(btnRegisterAPatient_Click); setNotification(2000, "Important notice", "eClinicals Login status: Nurse", ToolTipIcon.Info, NoticeType.Nurse); Status("Nurses View Open", Color.Yellow); break; case (int)UserType.Doctor: MessageBox.Show("There is no view for user type : Doctor"); Status("There is no view for user type : Doctor", Color.Red); break; default: break; } }
public Nurse Get(String uname) { string connectionString = DATABASE_CONNECTION; SqlDataReader reader = null; // The SQL query to be sent to the server string query = "SELECT * FROM Nurse WHERE UserName = '******'"; //Replace @UserName with the requested nurses username query = query.Replace("@UserName", Convert.ToString(uname)); // Establish connection with the SQL server SqlConnection connection = new SqlConnection(connectionString); connection.Open(); // Open the connection to the server using (SqlCommand command = new SqlCommand(query, connection)) { // Assign the SQL query and connection details to the reader reader = command.ExecuteReader(); // Create a new nurse that will contain data from server Nurse qresult = new Nurse(); // Read the data from the server to qresult while (reader.Read()) { qresult.NurseID = Convert.ToInt32(reader["NurseID"].ToString()); qresult.UserName = reader["UserName"].ToString(); qresult.FirstName = reader["FirstName"].ToString(); qresult.LastName = reader["LastName"].ToString(); qresult.Password = reader["Password"].ToString(); } connection.Close(); // Close the connection to the server return(qresult); } }
public void Add_MedicalExamination_Nurse() { var waitingRoom = new Mock <WaitingRoom>(); Doctor doctor = new Doctor("Ante", "Antić", "54372816532", DateTime.Now, "ia54372", "1234", waitingRoom.Object); waitingRoom.Setup(x => x.Doctor).Returns(doctor); Nurse nurse = new Nurse("Iva", "Antić", "54343816532", DateTime.Now, "ia54348", "1234", waitingRoom.Object); LoggedIn.Initialize(nurse); var mockPatient = new Mock <Patient>(); var mockExaminationType = new Mock <ExaminationType>(); var examination = new MedicalExamination(); var medicalExaminationRepository = new Mock <IMedicalExaminationRepository>(); medicalExaminationRepository.Setup(x => x.Add(examination)).Returns(examination); MedicalExaminationService medicalExaminationService = new MedicalExaminationService(medicalExaminationRepository.Object); var ex = medicalExaminationService.Add(mockPatient.Object, mockExaminationType.Object, false); medicalExaminationRepository.Verify(x => x.Add(ex), Times.Once()); Assert.AreNotEqual(nurse, ex.Doctor); Assert.AreEqual(doctor, ex.Doctor); }
private void dataGrid_Nurse_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.nurse_btnDelete.IsEnabled = true; this.nurse_btnUpdate.IsEnabled = true; this.indexselected = dataGrid_Nurse.SelectedIndex; if (indexselected == -1 || nurseList.Count < indexselected) { nurselected = null; this.nurse_btnDelete.IsEnabled = false; this.nurse_btnUpdate.IsEnabled = false; return; } nurselected = (Nurse)dataGrid_Nurse.SelectedItem; this.fnametxt_nurseUpdate.Text = nurselected.Employee.emp_firstname; this.lnametxt_nurseUpdate.Text = nurselected.Employee.emp_lastname; this.unametxt_nurseUpdate.Text = nurselected.Employee.User.user_name; this.passtxt_nurseUpdate.Password = nurselected.Employee.User.user_password; this.spectxt_nurseUpdate.Text = nurselected.nurse_experience; this.cellno_nurseUpdate.Text = nurselected.Employee.emp_phone; this.saltxt_nurseUpdate.Text = nurselected.Employee.emp_salary.ToString(); this.datepicker_nurseUpdate.Text = nurselected.Employee.emp_dob.ToString(); }
public async static void UpdateNurse(Nurse nurse) { MySqlConnection con = InitConnection(); try { con.Open(); String query = $"UPDATE nurse SET name = '{nurse.Name}', birth_date = '{nurse.BirthDate.ToString("yyyy-MM-dd")}', " + $"address = '{nurse.Address}', employment_date = '{nurse.EmploymentDate.ToString("yyyy-MM-dd")}', " + $"department_id = '{nurse.Department.ID}', salary = {nurse.Salary} " + $"WHERE nurse_id = '{nurse.ID}'"; MySqlCommand command = new MySqlCommand(query, con); await command.ExecuteNonQueryAsync(); } catch { Console.WriteLine("Error Updating Nurse."); } finally { con.Close(); } }
private void SubmitButton_Click(object sender, EventArgs e) { try { ValidateInputs(); if (errors.Count > 0) { globalError.Text = "Enter all required values and fix errors before saving"; } bool result = false; var gender = (AppointmentHelper)genderComboBox.SelectedItem; var state = (AppointmentHelper)stateComboBox.SelectedItem; nursePerson = new Person(nurse.Id, usernameTextBox.Text, passwordTextBox.Text, firstNameTextBox.Text, lastNameTextBox.Text, dateOfBirthDateTimePicker.Value, ssnTextBox.Text, gender.Value, nurse.AddressId, contactPhoneTextBox.Text); nurseAddress = new Address(nurse.AddressId, streetTextBox.Text, cityTextBox.Text, state.Value, zipTextBox.Text); theNurse = new Nurse(nurse.NurseId, nurse.Id, isActiveCheckbox.Checked); result = nurseController.UpdateNurse(nursePerson, nurseAddress, theNurse); ClearInputs(); MessageBox.Show("Nurse updated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show("An error occured" + Environment.NewLine + "Unable to update nurse. Please contact site administrator", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void Page_Load(object sender, EventArgs e) { np.Id = 5; np = Q.NursePreviews.Where(z => z.Id == np.Id).SingleOrDefault(); Label12.Text = np.Id.ToString(); if (np.TypeOfOperation == 1) { Label2.Text = "Test"; } else { Label2.Text = "Xray"; } Label4.Text = np.DateOfOperation.ToString().Substring(0, 10); Label7.Text = np.Description; Label8.Text = np.Note; Image1.ImageUrl = np.XRayPhotoPath; n = Q.Nurses.Where(z => z.Id == np.NurseId).SingleOrDefault(); p = Q.PersonalInfos.Where(d => d.Id == n.PersonalInfoId).SingleOrDefault(); Label10.Text = p.FirstName + " " + p.LastName; }
public void Nurse_GetHashCode_ReturnsHashCodeUsingUidAndName() { var nurse = new Nurse { name = name, uid = uid }; var sameNurse = new Nurse { name = name, uid = uid }; Assert.Equal(nurse.GetHashCode(), sameNurse.GetHashCode()); var otherNurse = new Nurse { name = name, uid = "20xy8z56" }; Assert.NotEqual(nurse.GetHashCode(), otherNurse.GetHashCode()); var anotherNurse = new Nurse { name = "Bucky Barnes", uid = uid }; Assert.NotEqual(nurse.GetHashCode(), anotherNurse.GetHashCode()); }
protected void Page_Load(object sender, EventArgs e) { // aspnet_User a = new aspnet_User(); // a = (aspnet_User)Session["nu"]; // a = Q.aspnet_Users.Where(d => d.UserId == a.UserId).SingleOrDefault(); // p = Q.PersonalInfos.Where(g => g.UserId == a.UserId).SingleOrDefault(); // x = Q.Nurses.Where(k => k.PersonalInfoId == p.Id).SingleOrDefault(); x = (Nurse)Session["nurse"]; x = Q.Nurses.Where(z => z.Id == x.Id).SingleOrDefault(); //p = Q.PersonalInfos.Where(w => w.Id == x.PersonalInfoId).SingleOrDefault(); Label24.Text = x.Id.ToString(); Label25.Text = x.PersonalInfo.FirstName; Label26.Text = x.PersonalInfo.LastName; Label27.Text = x.PersonalInfo.Gender; DateTime birth = (DateTime)x.PersonalInfo.DateOfBrith; DateTime now = DateTime.Now; int age = now.Year - birth.Year; Label45.Text = age.ToString(); Label28.Text = "" + x.PersonalInfo.DateOfBrith.Value.Year + "/" + x.PersonalInfo.DateOfBrith.Value.Month + "/" + x.PersonalInfo.DateOfBrith.Value.Day; Label29.Text = x.PersonalInfo.BloodType; if (x.PersonalInfo.Address == "") { Label30.Text = "N/A !"; Label30.ForeColor = System.Drawing.Color.Gray; Label30.Font.Underline = true; Label30.Font.Italic = true; } else { Label30.Text = x.PersonalInfo.Address; } if (x.PersonalInfo.Note == "") { Label31.Text = "N/A !"; Label31.ForeColor = System.Drawing.Color.Gray; Label31.Font.Underline = true; Label31.Font.Italic = true; } else { Label31.Text = x.PersonalInfo.Note; } if (x.PersonalInfo.Phone == "") { Label32.Text = "N/A !"; Label32.ForeColor = System.Drawing.Color.Gray; Label32.Font.Underline = true; Label32.Font.Italic = true; } else { Label32.Text = x.PersonalInfo.Phone; } if (x.PersonalInfo.BusinessPhone == "") { Label33.Text = "N/A !"; Label33.ForeColor = System.Drawing.Color.Gray; Label33.Font.Underline = true; Label33.Font.Italic = true; } else { Label33.Text = x.PersonalInfo.BusinessPhone; } if (x.PersonalInfo.Mobile == "") { Label34.Text = "N/A !"; Label34.ForeColor = System.Drawing.Color.Gray; Label34.Font.Underline = true; Label34.Font.Italic = true; } else { Label34.Text = x.PersonalInfo.Mobile; } if (x.PersonalInfo.Fax == "") { Label35.Text = "N/A !"; Label35.ForeColor = System.Drawing.Color.Gray; Label35.Font.Underline = true; Label35.Font.Italic = true; } else { Label35.Text = x.PersonalInfo.Fax; } if (x.PersonalInfo.Email == "") { Label36.Text = "N/A !"; Label36.ForeColor = System.Drawing.Color.Gray; Label36.Font.Underline = true; Label36.Font.Italic = true; } else { Label36.Text = p.Email; } if (x.PersonalInfo.FacebookURL == "") { Label37.Text = "N/A !"; Label37.ForeColor = System.Drawing.Color.Gray; Label37.Font.Underline = true; Label37.Font.Italic = true; } else { Label37.Text = x.PersonalInfo.FacebookURL; } if (x.PersonalInfo.TwitterURL == "") { Label38.Text = "N/A !"; Label38.ForeColor = System.Drawing.Color.Gray; Label38.Font.Underline = true; Label38.Font.Italic = true; } else { Label38.Text = x.PersonalInfo.TwitterURL; } if (x.PersonalInfo.Image == "") { Image1.ImageUrl = "~/pics/default.jpg"; //Label39.Text = "N/A !"; //Label39.ForeColor = System.Drawing.Color.Gray; //Label39.Font.Underline = true; //Label39.Font.Italic = true; } else { //Label39.Text = p.Image; Image1.ImageUrl = x.PersonalInfo.Image; } }
private void showNurseRegisteredMessage(Nurse nurse) { var msg = $"The Nurse {nurse.Bio.FirstName} {nurse.Bio.LastName} has been registerd."; MessageBox.Show(msg, "Nurse Registered", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); }
/// <summary> /// Gets a nurse by their nurse ID. /// </summary> /// <param name="nurseID">The ID of the nurse</param> /// <returns>The nurse with the specified ID</returns> public static Nurse GetNurseByID(int nurseID) { Nurse nurse = new Nurse(); try { using (SqlConnection connection = HealthCareDBConnection.GetConnection()) { string selectStatement = "SELECT * from Person " + "JOIN Nurse ON Person.personID = Nurse.personID " + "WHERE Nurse.personID = @personID"; using (SqlCommand selectCommand = new SqlCommand(selectStatement, connection)) { selectCommand.Parameters.AddWithValue("@personID", nurseID); connection.Open(); using (SqlDataReader reader = selectCommand.ExecuteReader()) { while (reader.Read()) { nurse.PersonId = (int)reader["personID"]; nurse.Ssn = reader["ssn"].ToString(); nurse.FirstName = reader["firstName"].ToString(); nurse.MiddleInitial = !DBNull.Value.Equals(reader["middleInitial"]) ? Convert.ToChar(reader["middleInitial"].ToString()) : Convert.ToChar(" "); nurse.LastName = reader["lastName"].ToString(); nurse.DateOfBirth = (DateTime)reader["dateOfBirth"]; nurse.Gender = Convert.ToChar(reader["gender"].ToString()); nurse.Address = reader["address"].ToString(); nurse.City = reader["city"].ToString(); nurse.State = reader["state"].ToString(); nurse.Zip = reader["zip"].ToString(); nurse.Phone = reader["phone"].ToString(); nurse.UserName = reader["userName"].ToString(); nurse.UserRole = reader["userRole"].ToString(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK); } return nurse; }
/// <summary> /// Set up the manager /// </summary> private void ManagerInitialize() { //Initialize the ABG class and prepare all the diagnoses abg = new ABG("NursingInterventions"); listWaitingChairs = new List<WaitingChair>(); listExamRooms = new List<ExamRoom>(); //listPatients = new List<Patient>(); //Populate the list of waiting chairs. GameObject[] wc = GameObject.FindGameObjectsWithTag("WaitingChair"); foreach (GameObject w in wc) { listWaitingChairs.Add(w.GetComponent<WaitingChair>()); } //Populate the list of exam rooms. GameObject[] er = GameObject.FindGameObjectsWithTag("ExamRoom"); foreach (GameObject e in er) { listExamRooms.Add(e.GetComponent<ExamRoom>()); } //Find the triage triage = GameObject.FindGameObjectWithTag("Triage").GetComponent<Triage>(); //Find the nurse nurse = GameObject.FindGameObjectWithTag("Nurse").GetComponent<Nurse>(); //Find the Sink sink = GameObject.FindGameObjectWithTag("Sink").GetComponent<Sink>(); //prepare the patients. for (int i = 0; i < prefabPatients.Length; i++) { GameObject temp = prefabPatients[i]; int rand = Random.Range(0, prefabPatients.Length); prefabPatients[i] = prefabPatients[rand]; prefabPatients[rand] = temp; } //Reset the score scorePatientsSeen = 0; scoreAngryPatients = 0; scoreCorrectDiagnoses = 0; scoreCorrectInitialAssessment = 0; scoreSatisfaction = 100f; currentPatients = 0; //reset the spawn timer timerSpawnUsed = 0.1f; //set the manager _manager = this; gameplayUI.satisfaction.SatisfactionUpdate(scoreSatisfaction); UpdatePatientsTreated(); }
void Start() { nurse = null; patient = null; }
// GET: Nurse public ActionResult Index() { using (var db = new MainDbContext()) { string firstname = User.Identity.Name; var NurseModel = db.Nurse.FirstOrDefault(u => u.FirstName.Equals(firstname)); // Construct the viewmodel Nurse model = new Nurse(); model.FirstName = NurseModel.FirstName; return View(model); } }