public Patient GetPatientById(Guid id) { PatientEntity patientEntity = _patientDal.GetPatientById(id); var patient = Mapper.Map <Patient>(patientEntity); return(patient); }
private void DeleteUserButton_Click(object sender, RoutedEventArgs e) { var selectedItem = this.lvPatient.SelectedItem; if (selectedItem != null) { PatientEntity patient = selectedItem as PatientEntity; PatientService service = new PatientService(); if (MessageBox.Show("Sei sicuro di voler eliminare \"" + patient.FiscalCode + " \" ?", "Elimina Paziente", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (service.Delete(patient) == 0) { MessageBox.Show("cancellato!"); this.RefreshData(); } else { MessageBox.Show("NON cancellato!"); } } else { MessageBox.Show("NON cancellato!"); } } }
public string addHIVEDucation(int patientId, string visitdate, int councellingTypeId, string councellingType, int councellingTopicId, string councellingTopic, string comments, string other) { try { PatientManager patientManager = new PatientManager(); LookupLogic lookupLogic = new LookupLogic(); PatientEntity patient = patientManager.GetPatientEntity(patientId); int ptn_pk = patient.ptn_pk.HasValue ? patient.ptn_pk.Value : 0; int posID = Convert.ToInt32(Session["AppPosID"]); var facility = lookupLogic.GetFacility(posID.ToString()); int facilityId = 0; if (facility != null) { facilityId = facility.FacilityID; } var mstPatientLogic = new MstPatientLogic(); int userId = Convert.ToInt32(Session["AppUserId"]); int visit_Pk = mstPatientLogic.AddOrdVisit(ptn_pk, facilityId, DateTime.Parse(visitdate), 10, userId, DateTime.Now, 203); var HEF = new HIVEducationLogic(); Result = HEF.AddPatientHIVEducation(ptn_pk, facilityId, userId, visit_Pk, DateTime.Parse(visitdate), councellingTypeId, councellingType, councellingTopicId, councellingTopic, comments, other); if (Result > 0) { Msg = "Notes Added"; } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public void savePatient(PatientEntity obj) { try { using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer()) { EDMX.tblPatient pat = new EDMX.tblPatient { Id = obj.PatientId, LastName = obj.LastName, FirstName = obj.FirstName, MiddleName = obj.MiddleName, FacilityID = obj.FacilityId, Active = obj.Active, DateCreated = obj.DateCreated, DateUpdated = obj.DateUpdated }; db.tblPatients.Add(pat); db.SaveChanges(); } } catch (Exception ex) { ErrorLogging.Log(ex, this.Name, "Method Save Patient"); MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void Update_Test() { PatientEntity obj = new PatientEntity { Id = 21, Name = "Alan Turing", FamilyName = "alpha", Gender = Gender.Male, HealthStatus = (int)HealthStatus.Good, MaritalStatus = (int)MaritalStatus.Married, DateOfBirth = DateTime.Now.AddDays(-7500), Comments = "na", CreatedAt = DateTimeOffset.Now, LastModifiedAt = DateTimeOffset.Now }; this.testPatientService.Create(obj); PatientEntity objd = new PatientEntity { Id = 21, Name = "Alan", FamilyName = "Fot", Gender = Gender.Male, HealthStatus = (int)HealthStatus.Good, MaritalStatus = (int)MaritalStatus.Married, DateOfBirth = DateTime.Now.AddDays(-7500), Comments = "testupdate", CreatedAt = DateTimeOffset.Now, LastModifiedAt = DateTimeOffset.Now }; Assert.AreEqual(true, this.testPatientService.Update(objd)); }
public PrintPreview(PatientEntity patient, PatientPrintEntity print) { InitializeComponent(); this.patient = patient; this.print = print; }
public void Add(Patient item) { PatientEntity entity = new PatientEntity(); mapper.MapToEntity(item, entity); repository.Create(entity); }
private void Initialize() { LogOffCommand = new DelegateCommand(OnLogOffCommand); CameraIcon = Program.BaseDir() + "\\Resources\\camera.png"; PatientEntity = new PatientEntity(); PatientEntity.Profile = Program.BaseDir() + "\\Resources\\profile.gif"; PatientEntity.IfResidentOfM = "Yes"; PatientEntity.LaserTreatment = "No"; PatientEntity.Cataract = "No"; PatientEntity.Diabetic = "No"; PatientEntity.Hypertension = "No"; PatientEntity.AllergyDrugs = "No"; PatientEntity.CurrentMedications = "No"; OtherIDCollection.Add(new IdName() { Id = 1, Name = "Passport" }); OtherIDCollection.Add(new IdName() { Id = 2, Name = "Driving License" }); OtherIDCollection.Add(new IdName() { Id = 3, Name = "Others" }); PatientEntity.OtherOption = "Passport"; SaveCommand = new DelegateCommand(OnSaveCommand); UpdateCommand = new DelegateCommand(OnUpdateCommand); ResidentChangeCommand = new DelegateCommand(OnResidentChangeCommand); AlergyChangeCommand = new DelegateCommand(OnAlergyChangeCommand); AddPhotoCommand = new DelegateCommand(OnAddPhotoCommand); }
public static void AddPatientToDatabase(string firstName, string lastName, params DateTime[] appointmentDate) { PatientEntity patient = new PatientEntity { FirstName = firstName, LastName = lastName }; foreach (DateTime item in appointmentDate) { var appointment = new AppointmentEntity { Date = item }; patient.AddAppointment(appointment); } ISessionFactory sessionForTests = NHibernateConfig.CreateSessionFactory(Database.TEST_DB_NAME); using (ISession session = sessionForTests.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(patient); transaction.Commit(); } } }
public void Integrated_add_appointment_to_patient() { // Arrange DateTime appointmentDate = DateTime.Now; string interview = "The patient is as fit as it can be!"; var appointment = new Appointment { Date = appointmentDate, Interview = interview }; string firstName = "Foo"; string lastName = "Fighters"; DatabaseTools.AddPatientToDatabase(firstName, lastName, appointmentDate); PatientEntity patientEntity = DatabaseTools.GetPatientFromDatabase(firstName, lastName).First(); Assert.AreEqual(patientEntity.Appointments.Count, 1); // Act _patientService.AddAppointmentToPatient(patientEntity.Id, appointment); // Assert PatientEntity updatedPatientEntity = DatabaseTools.GetPatientFromDatabase(firstName, lastName).First(); Assert.AreEqual(updatedPatientEntity.Appointments.Count, 2); Assert.AreEqual(updatedPatientEntity.Appointments.First().Date.Date, appointmentDate.Date); Assert.AreEqual(updatedPatientEntity.Appointments.Last().Date.Date, appointmentDate.Date); StringAssert.Contains(updatedPatientEntity.Appointments.First().Interview, interview); }
public PatientViewModel(PatientEntity model) { Initialize(); PatientEntity = model; if (PatientEntity.IfResidentOfM == "No") { this.HideOthers = true; if (PatientEntity.OtherOption != "Passport" && PatientEntity.OtherOption != "Driving License") { ShowOtherOption = true; } } if (PatientEntity.AllergyDrugs == "Yes") { ShowAllergyOption = true; } string path = Path.Combine(Program.BaseDir(), "Uploads", model.UniqueID.ToString()); string file = Path.Combine(path, model.UniqueID.ToString() + ".png"); if (File.Exists(file)) { model.Profile = file; } else { model.Profile = Program.BaseDir() + "\\Resources\\profile.gif"; } }
public void Integrated_add_new_patient() { // Arrange string firstName = "Dave"; string lastName = "Grohl"; Patient patient = new Patient { FirstName = firstName, LastName = lastName }; // Act _patientService.AddNewPatient(patient); // Assert ISessionFactory sessionForTests = NHibernateConfig.CreateSessionFactory(Database.TEST_DB_NAME); IList <PatientEntity> patients; using (ISession session = sessionForTests.OpenSession()) { patients = session.QueryOver <PatientEntity>().Fetch(x => x.Appointments).Eager.List(); } Assert.IsNotNull(patients); Assert.IsNotEmpty(patients); Assert.IsTrue(patients.Count == 1); PatientEntity result = patients.First(); StringAssert.Contains(result.FirstName, firstName); StringAssert.Contains(result.LastName, lastName); }
public void UpdateAppointment(Appointment appointment) { PatientEntity patientEntity = _patientDal.GetPatientById(appointment.Patient.Id); Mapper.Map(appointment, patientEntity.Appointments.First(x => x.Id == appointment.Id)); SaveOrUpdatePatientEntity(patientEntity); }
public void UpdatePatient(Patient patient) { PatientEntity patientEntity = _patientDal.GetPatientById(patient.Id); Mapper.Map(patient, patientEntity); SaveOrUpdatePatientEntity(patientEntity); }
public IHttpActionResult PutPatientEntity(int id, PatientEntity patientEntity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != patientEntity.PatientID) { return(BadRequest()); } try { db.Change(patientEntity); } catch (DbUpdateConcurrencyException) { return(NotFound()); } return(StatusCode(HttpStatusCode.NoContent)); }
public void Add(Patient item) { var entity = new PatientEntity(); patientMapper.MapToEntity(item, entity); patientRepository.Create(entity); }
internal PatientEntity Add(PatientEntity obje) { PatientEntity Patient = db.PatientEntities.Add(obje); db.SaveChanges(); return(Patient); }
public void Remove(Patient item) { var entity = new PatientEntity(); patientMapper.MapToEntity(item, entity); patientRepository.Delete(entity); }
/*public DataTable ToCheckSearchCredentials(PatientEntity tempObject) * { * string checkCommand = "SELECT * FROM patient WHERE pName = @pName OR pID = @pID"; * * SqlCommand command = new SqlCommand(checkCommand); * * SqlParameter PatientNameParameter = new SqlParameter("@pName", SqlDbType.NVarChar, 100); * PatientNameParameter.Value = tempObject.patientName; * SqlParameter PatientIDdParameter = new SqlParameter("@pID", SqlDbType.Int); * PatientIDdParameter.Value = tempObject.patiendID; * * //Adding command * command.Parameters.Add(PatientNameParameter); * command.Parameters.Add(PatientIDdParameter); * * var d = ObjectOfDataAccess.Query(command); * if (d.Rows.Count > 0) * { * //Login Success * string userName = d.Rows[0][2].ToString(); * //return userName; * return d; * } * else * { * return null; * } * }*/ public List <PatientEntity> SearchPatient(string key) { string checkCommand = "SELECT * FROM patient WHERE pName like @pName"; SqlCommand command = new SqlCommand(checkCommand); SqlParameter PatientNameParameter = new SqlParameter("@pName", SqlDbType.NVarChar, 100); PatientNameParameter.Value = "%" + key + "%"; //Adding command command.Parameters.Add(PatientNameParameter); var d = ObjectOfDataAccess.Query(command); List <PatientEntity> pel = new List <PatientEntity>(); for (int i = 0; i < d.Rows.Count; i++) { PatientEntity pe = new PatientEntity(); pe.patiendID = Convert.ToInt32(d.Rows[i][0]); pe.patientName = d.Rows[i][1].ToString(); pe.patientAge = Convert.ToInt32(d.Rows[i][2]); pe.patientGender = d.Rows[i][3].ToString(); pe.patientAddress = d.Rows[i][4].ToString(); pel.Add(pe); } return(pel); }
public void Update(Patient item) { var patientEntity = new PatientEntity(); patientMapper.MapToEntity(item, patientEntity); patientRepository.Update(patientEntity); }
public void Remove(Patient item) { PatientEntity entity = new PatientEntity(); mapper.MapToEntity(item, entity); repository.Delete(entity); }
/// <summary> /// Delete patient detils by changing status to inactive. /// </summary> /// <param name="e"></param> private void DeletePatient(int id) { IObservable <PatientEntity> patientEntity = Observable.Start <PatientEntity>( () => { PatientEntity patientEntiy = BLFactory.CreateInstance(CallingContext.ContextTypeA).DeletePatient(new PatientEntity() { Id = id }); return(patientEntiy); }); patientEntity.SubscribeOn(NewThreadScheduler.Default) .ObserveOn(SynchronizationContext.Current) .Subscribe(loadedPatient => { BindPatientsGrid(); if (loadedPatient.Id > 0) { MessageBox.Show("Patient details deleted successfully."); ClearFields(); } else { MessageBox.Show("OOPs!! Something went wrong. Please contact administrator."); } }); }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (hasInvalidInput(txtLastName.Text, txtFirstName.Text) == false) { PatientEntity pat = new PatientEntity(); pat.PatientId = Convert.ToInt32(lblPatientId.Text); pat.FacilityId = _FacilityIDHolder[cboFacility.SelectedIndex]; pat.LastName = txtLastName.Text; pat.FirstName = txtFirstName.Text; pat.MiddleName = txtMiddleName.Text; if (chkActive.Checked) { pat.Active = "Y"; } else { pat.Active = "N"; } pat.DateCreated = lblCreated.Text; pat.DateUpdated = DateTime.Now.ToString(); updatePatient(pat); getAllPatient(); resetSettings(); lblStatus.Text = "Status : Successfully Updated!"; } } catch (Exception ex) { ErrorLogging.Log(ex, this.Name, "Button Update"); MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Convert FHIR response object to custom enity PatientEntity /// </summary> /// <param name="deserializedJsonResponse"></param> /// <returns></returns> private static IEnumerable <PatientEntity> ConvertFHIRResponseToCustom(dynamic deserializedJsonResponse) { List <PatientEntity> patients = new List <PatientEntity>(); if (deserializedJsonResponse != null && deserializedJsonResponse.entry != null) { foreach (var item in deserializedJsonResponse.entry) { PatientEntity patient = new PatientEntity(); patient.BirthDate = Convert.ToDateTime(item.content.birthDate); patient.IsActive = Convert.ToBoolean(item.content.active); patient.Name = item.content.name[0].family; patient.ContactNumber = item.content.telecom[0].value; patient.Address = item.content.address[0].text; if (item.content.gender.coding[0].code == "male") { patient.Gender = EnumGender.Male.ToString(); } else if (item.content.gender.coding[0].code == "female") { patient.Gender = EnumGender.Female.ToString(); } patients.Add(patient); } } return(patients); }
//public PatientEntityIdentifier GetPatientByCardSerialNumber(string cardSerialNumber) //{ // return _mgr.GetPatientByCardSerialNumber(cardSerialNumber); //} public PatientEntity GetPatientEntityByIdentifier(string identifierCode, string identifierValue) { IIdentifiersManager _idMgr = (IIdentifiersManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.Enrollment.BIdentifier, BusinessProcess.CCC"); IPersonIdentifierManager _personmgr = (IPersonIdentifierManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.Enrollment.BPersonIdentifier, BusinessProcess.CCC"); PatientEntity patient = null; IPatientManager _patMgr = (IPatientManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.Patient.BPatient, BusinessProcess.CCC"); var identifier = _idMgr.GetIdentifierByCode(identifierCode); if (identifier == null) { return(patient); } if ((IdentifierType)identifier.IdentifierType == IdentifierType.Patient) { var retVal = CheckIfIdentifierNumberIsUsed(identifierValue, identifier.Id); if (retVal != null && retVal.Count > 0) { patient = PatientEntityHelper.MapFromPatientPersonView(_patMgr.GetPatient(retVal[0].PatientId)); } } else if ((IdentifierType)identifier.IdentifierType == IdentifierType.Person) { var retVal = _personmgr.CheckIfPersonIdentifierExists(identifierValue, identifier.Id); if (retVal != null && retVal.Count > 0) { patient = PatientEntityHelper.MapFromPatientPersonView(_patMgr.GetPatientEntityByPersonId(retVal[0].PersonId)); } } return(patient); }
//private readonly IMapper _map; public PatientRepositoryfake(HealthCareMainDBContext dbContext) { // _entityDBContext = dbContext; //_map = mapper; _patientEntity = new PatientEntity(); _ListpatientEntity = new List <PatientEntity>(); }
public void SaveEntity(string keyValue, PatientEntity patientEntity) { try { if (string.IsNullOrEmpty(keyValue)) { patientEntity.PATIENTID = GetKey(); this.BaseRepository().Insert(patientEntity); } else { this.BaseRepository().Update(patientEntity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,Email,Password")] PatientEntity patientEntity) { if (id != patientEntity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(patientEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PatientEntityExists(patientEntity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(patientEntity)); }
public int AddPatient(PatientEntity patient) { int patientId = 0; ClsObject obj = new ClsObject(); ClsUtility.Init_Hashtable(); ClsUtility.AddExtendedParameters("@PersonId", SqlDbType.Int, patient.PersonId); ClsUtility.AddExtendedParameters("@ptn_pk", SqlDbType.Int, patient.ptn_pk); ClsUtility.AddExtendedParameters("@PatientIndex", SqlDbType.VarChar, patient.PatientIndex); ClsUtility.AddExtendedParameters("@DateOfBirth", SqlDbType.DateTime, patient.DateOfBirth); ClsUtility.AddExtendedParameters("@NationalId", SqlDbType.VarChar, patient.NationalId); ClsUtility.AddExtendedParameters("@FacilityId", SqlDbType.Int, patient.FacilityId); ClsUtility.AddExtendedParameters("@UserId", SqlDbType.Int, patient.CreatedBy); ClsUtility.AddExtendedParameters("@Active", SqlDbType.Bit, patient.Active); ClsUtility.AddExtendedParameters("@PatientType", SqlDbType.Int, patient.PatientType); ClsUtility.AddExtendedParameters("@DobPrecision", SqlDbType.Bit, patient.DobPrecision); DataTable dt = (DataTable)obj.ReturnObject(ClsUtility.theParams, "Patient_Insert", ClsUtility.ObjectEnum.DataTable); if (dt != null && dt.Rows.Count > 0) { patientId = Convert.ToInt32(dt.Rows[0]["Id"]); } return(patientId); /*_unitOfWork.PatientRepository.Add(patient); * Result = _unitOfWork.Complete(); * return patient.Id;*/ }
public IActionResult SignIn([FromQuery] string userName, string password) { Patient patient = new Patient(); PatientEntity patientEntity = patient.SignIn(userName, password); return(Ok(patientEntity)); }