Example #1
0
        private void OnPatientDeleted(int id)
        {
            double deletedRevenue  = 0;
            double deletedProfit   = 0;
            double time            = 0;
            int    interventionsNb = 0;

            foreach (var localIntervention in SelectedPatient.Interventions)
            {
                deletedRevenue += localIntervention.Revenue;
                deletedProfit  += localIntervention.Percent;
                interventionsNb++;
                time += localIntervention.DateHourDetail.Duration.TotalMinutes;
            }
            Parent.OnChangeTotalInfo(new TotalsIfo
            {
                TotalHours         = new TimeSpan(-(long)time),
                TotalInverventions = -interventionsNb,
                TotalRevenue       = -deletedRevenue,
                TotalProfit        = -deletedProfit,
                TotalPatients      = -1
            });
            PatientsList.Remove(SelectedPatient);
            SelectedPatient = PatientsList.FirstOrDefault();
        }
Example #2
0
        public void SetInterventionToEdit()
        {
            TotalInfoSelectedEl = new TotalsIfo()
            {
                TotalHours         = -SelectedInterventionDetails.LocalIntervention.DateHourDetail.Duration,
                TotalInverventions = -1,
                TotalRevenue       = -SelectedInterventionDetails.LocalIntervention.Revenue,
                TotalProfit        = -SelectedInterventionDetails.LocalIntervention.Percent
            };
            SelectedArea = SelectedInterventionDetails.LocalIntervention.Area != null?Areas.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Area.Id) : null;

            if (SelectedInterventionDetails.LocalIntervention.Location != null)
            {
                SelectedLocation = LocalLocations.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Location.Id);
            }
            if (SelectedInterventionDetails.LocalIntervention.Material != null && Materials != null)
            {
                SelectedMaterial = Materials.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Material.Id);
            }
            SelectedPatient = PatientsList.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.PatientId);
            SelectedWork    = SelectedInterventionDetails.LocalIntervention.Lucrare != null?Works.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Lucrare.Id) : new LocalWork();

            Durata             = SelectedInterventionDetails.Durata.TotalMinutes.ToString();
            Date               = SelectedInterventionDetails.LocalIntervention.DateHourDetail.Date;
            StartingHour       = SelectedInterventionDetails.LocalIntervention.DateHourDetail.StartHour;
            Revenue            = SelectedInterventionDetails.LocalIntervention.Revenue;
            Id                 = SelectedInterventionDetails.LocalIntervention.Id;
            LocalIntervention  = SelectedInterventionDetails.LocalIntervention;
            Observation        = SelectedInterventionDetails.Observations;
            IsInEditMode       = true;
            WasPayedByDental   = SelectedInterventionDetails.WasPayedByDental;
            SelectedTechnician =
                Technicians.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.TechnicianId);
            MaterialCost = SelectedInterventionDetails.MaterialCost;
        }
Example #3
0
        private void OnPatientNameChanged(object patient)
        {
            var patientToEdit = (LocalPatient)patient;
            var editedPatient = PatientsList.FirstOrDefault(item => item.Id == patientToEdit.Id);

            editedPatient.AllName = patientToEdit.AllName;
            var currentDate = DateTime.Now;
            //            if (currentDate.Day == ((LocalPatient)patient).BirthDate.Day && currentDate.Month == ((LocalPatient)patient).BirthDate.Month)
            {
                var poEdit =
                    LocalCache.Instance.PatientsRepository.Patients.FirstOrDefault(item => item.Id == editedPatient.Id);
                poEdit = patientToEdit;
                // LocalCache.Instance.PatientsRepository.BirthDays.Add(ed);
                LocalCache.Instance.PatientsRepository.SetBirthDays();
                Parent.InterventionsGeneralDetailsViewModel.InitNames();
            }

            //PatientsList.Add(editedPatient);
        }
Example #4
0
        public TimeSpan TimeStuck(Patient patient)
        {
            var p     = PatientsList.FirstOrDefault(x => x.Id == patient.Id);
            var index = PatientsList.IndexOf(p);

            if (index == -1)
            {
                return(TimeSpan.Zero);
            }
            if (index == 0)
            {
                return(TimeSpan.Zero);
            }

            TimeSpan duration;

            for (var i = 0; i < index; i++)
            {
                duration += PatientsList[i].Duration;
            }

            return(duration); //patient.VisitTime.Subtract(DateTime.Now) <= duration;
        }