public void CanSearchDoctords() { // Организация (arrange) PatientAppointmentController controller = new PatientAppointmentController(mock.Object); // Действие (act) List <PatientAppointmentDoctor> patientAppointmentDoctors = controller.DoctorListViewModel.GetPatientAppointmentDoctorsSearch("С", "Психолог"); // Утверждение (assert) Assert.AreEqual(patientAppointmentDoctors.Count, 1); }
static void CreateStaff() { for (int i = 1; i < 10; i++) { Qualification q = new Qualification(); q.DateOfQualification = new DateTime(1995, 10, i); q.NameOfInstitution = "John doe instidution" + i; q.QualificationID = i; q.Type = "Teacher" + i; WorkExperience WE = new WorkExperience(); WE.FinishDate = new DateTime(1999, i, 10); WE.NameOfOrganisation = "John doe organisation" + i; WE.PreviousPosition = "Head of Office" + i; WE.StartDate = new DateTime(1996, i, 10); WE.WorkExperienceID = i; Patient p = new Patient(); p.Address = "John doe vej" + i; p.DateOfBirth = new DateTime(1994, 10, i); p.FirstName = "John" + i; p.Gender = "male"; p.LastName = "dooe" + i; p.MartialStatus = "married"; p.PatientNumber = i; p.Telephone = "+452342311" + i; PatientAppointment pa = new PatientAppointment(); pa.AppointmentNumber = i; pa.AppointmentRoom = "D" + i; pa.DateOfAppointment = new DateTime(1991, i, 10); pa.PatientNumber = i; Staff staff = new Staff(); staff.CurrentPosition = "Chief officer"; staff.AppointmentNumber = i; staff.CurrentSalary = 2.2 + i; staff.DateOfBirth = new DateTime(1999, i, 12); staff.FirstName = "John" + i; staff.FullAddress = "den nye vej 9" + i; staff.Gender = "male"; staff.InsuranceNumber = i; staff.LastName = "Doee" + i; staff.NumberOfHoursPerWeek = i; staff.PermenentOrTemporary = "temp"; staff.QualificationID = i; staff.SalaryPayment = "week"; staff.SalaryScale = "c" + i; staff.StaffNumber = i; staff.WorkExperienceID = i; QualificationController qc = new QualificationController(); WorkExperienceController wec = new WorkExperienceController(); PatientController pc = new PatientController(); PatientAppointmentController pac = new PatientAppointmentController(); StaffController sc = new StaffController(); SqlException qcec = qc.Create(q); SqlException wecec = wec.Create(WE); SqlException pecc = pc.Create(p); SqlException pacec = pac.Create(pa); SqlException errorCode = sc.Create(staff); } }
protected void onBtn_Click(object sender, CommandEventArgs e) { if (PermissionManager.HasPermission("AddPatient")) { bool validDates = this.ValidateApptDateTime(); if (validDates) { // load the hashtable with values Hashtable apptParams = new Hashtable(); apptParams["ApptMRN"] = PtMRN.Value; apptParams["ApptFirstName"] = PtFirstName.Value; apptParams["ApptLastName"] = PtLastName.Value; apptParams["ApptPhysician"] = ApptPhysician.Value;// Request.Form[ApptPhysician.ID]; apptParams["ApptDept"] = Request.Form[ApptDept.ID]; apptParams["ApptVisitType"] = Request.Form[ApptVisitType.ID]; apptParams["ApptNotes"] = ApptNotes.Value; apptParams["ApptClinicDate"] = DateTime.Parse(AppointmentDate.Value); apptParams["ApptTime"] = DateTime.Parse(AppointmentDate.Value + " " + AppointmentTime.Value); PatientDa pda = new PatientDa(); DataTable pdt = pda.GetPatientByMRN(PtMRN.Value); PatientAppointmentController apct = new PatientAppointmentController(); // verify new MRN /* if (pdt.Rows.Count == 0) * { * // insert new patient record and the appointment * BusinessObject bz = GetParams(); * DataSet ds = apct.InsertPatientAndAppointmentRecord(bz, (int) Session[SessionKey.DatasetId], apptParams); * UpdateSession(ds.Tables[0].Rows[0]); * * // reload page - can we pass a confirmation message to the page? * Response.Redirect("AddNewPatientAndAppt.aspx?confirm=addnew"); * * } */ // verify new MRN if (pdt.Rows.Count == 0) { // insert new patient record and the appointment Patient bz = GetParams(); DataSet ds = apct.InsertNewPatientRecord(bz, (int)Session[SessionKey.DatasetId]); apct.InsertAppointmentRecord(apptParams, int.Parse(bz[Patient.PatientId].ToString())); // UpdateSession(ds.Tables[0].Rows[0]); // reload page - can we pass a confirmation message to the page? Response.Redirect("AddNewPatientAndAppt.aspx?confirm=addnew"); } else // mrn is already in database { // mrn already exists.. is the last name a match? if (PtLastName.Value != "" && pdt.Rows[0][Patient.PtLastName].ToString().ToUpper().Equals(PtLastName.Value.ToUpper())) { int pid = Convert.ToInt32(pdt.Rows[0][Patient.PatientId]); // use first name from database if it was not provided if (PtFirstName.Value.Equals("")) { apptParams["ApptFirstName"] = pdt.Rows[0][Patient.PtFirstName].ToString(); } // last name and MRN are a match, add patient to appointments table apct.InsertAppointmentRecord(apptParams, pid); UpdateSession(pid); // reload page and display confirmation message Response.Redirect("AddNewPatientAndAppt.aspx?confirm=addold"); } else if (PtLastName.Value == "") { // last name was blanks so lets find out if this is the right patient errMsg.Message = "Please enter the patients last name and MRN."; } else // tell user they can't use this combination of last name and mrn { errMsg.Message = "This MRN is already in use by patient " + pdt.Rows[0][Patient.PtFirstName].ToString() + " " + pdt.Rows[0][Patient.PtLastName].ToString() + "."; } } } } }