Пример #1
0
        public bool EditDrug(Drug drug)
        {
            Drug ret = DrugRepository.GetInstance().Update(drug);

            if (ret != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public bool DisableDrugUse(Drug drug)
        {
            drug.InUse = false;
            Drug ret = DrugRepository.GetInstance().Update(drug);

            if (ret != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        public Prescription Read(uint id)
        {
            List <string[]> data = Persistence.ReadEntryByPrimaryKey(path, id.ToString());

            if (data.Count == 1)
            {
                uint         presID = uint.Parse(data[0][0]);
                uint         drugID = uint.Parse(data[0][1]);
                Drug         d      = DrugRepository.GetInstance().Read(drugID);
                uint         num    = uint.Parse(data[0][2]);
                string       usage  = data[0][3];
                Prescription ret    = new Prescription(num, usage, d);
                ret.SetId(presID);
                return(ret);
            }
            return(null);
        }
Пример #4
0
        public List <Drug> SearchDrugs(string query)
        {
            List <Drug> list = DrugRepository.GetInstance().GetAll();

            if (query.Equals(""))
            {
                return(list);
            }
            List <Drug> ret = new List <Drug>();

            foreach (Drug d in list)
            {
                if (d.InUse && d.Name.Contains(query))
                {
                    ret.Add(d);
                }
            }
            return(ret);
        }
Пример #5
0
        public Examination AppendExamination(Examination examination, MedicalRecord medicalRecord)
        {
            foreach (Prescription p in examination.Prescription)
            {
                DrugStateChange oldState = p.drug.drugStateChange;
                DrugStateChange newState = new DrugStateChange(DateTime.Now, oldState.TotalNumber - (int)p.Number, oldState.Threshold, oldState.DrugId);
                DrugStateChangeRepository.GetInstance().Create(newState);
                p.drug.drugStateChange = newState;
                DrugRepository.GetInstance().Update(p.drug);
                PrescriptionRepository.GetInstance().Create(p);
            }

            foreach (Referral r in examination.Referral)
            {
                ReferralRepository.GetInstance().Create(r);
            }
            examination = ExaminationRepository.GetInstance().Create(examination);

            medicalRecord.AddExamination(examination);
            MedicalRecordRepository.GetInstance().Update(medicalRecord);
            return(examination);
        }
Пример #6
0
 public Drug AddDrug(Drug drug)
 {
     return(DrugRepository.GetInstance().Create(drug));
 }
Пример #7
0
 public List <Drug> GetAllDrugs()
 {
     return(DrugRepository.GetInstance().GetAll());
 }