private void SavePatient()
        {
            //var user = (Patient)FindUserByCid(_hyPrDevice.CurrentRfid);
            var user = (Patient)FindUserByCid(SelectedUser.Cid);

            if (user != null)
            {
                user.UpdateAllProperties(SelectedUser.Patient);
                SelectedUser = new PatientViewModel(user);
                _wardNode.UpdatePatient(user);
            }
            else
            {
                user = new Patient
                {
                    Name  = SelectedUser.Name,
                    Color = SelectedUser.Color,
                    Cid   = SelectedUser.Cid,
                    Tag   = SelectedUser.Tag
                };

                _wardNode.AddPatient(user);

                SelectedUser.UpdateAllProperties(user);
            }
        }
Пример #2
0
        public void ReorganizeDragAndDroppedPatients(object droppedData, object targetData)
        {
            var droppedPatientView = ((IDataObject)droppedData).GetData(typeof(PatientViewModel)) as PatientViewModel;
            var targetPatientView  = targetData as PatientViewModel;

            if (droppedPatientView == null)
            {
                return;
            }
            if (targetPatientView == null)
            {
                return;
            }

            var removedIdx = Patients.IndexOf(droppedPatientView);
            var targetIdx  = Patients.IndexOf(targetPatientView);

            if (removedIdx < targetIdx)
            {
                Patients.Insert(targetIdx + 1, droppedPatientView);
                Patients.RemoveAt(removedIdx);
            }
            else
            {
                var remIdx = removedIdx + 1;
                if (Patients.Count + 1 <= remIdx)
                {
                    return;
                }
                Patients.Insert(targetIdx, droppedPatientView);
                Patients.RemoveAt(remIdx);
            }

            Task.Factory.StartNew(() =>
            {
                _roomNumber = 1;
                Patients.ToList().ForEach(
                    p =>
                {
                    p.RoomNumber = _roomNumber++;
                    WardNode.UpdatePatient(p.Patient);
                });
            });
        }
Пример #3
0
 void PatientUpdated(object sender, EventArgs e)
 {
     WardNode.UpdatePatient((Patient)sender);
 }