public static DrugStateChangeRepository GetInstance()
 {
     if (instance == null)
     {
         instance = new DrugStateChangeRepository();
     }
     return(instance);
 }
示例#2
0
        public Drug Read(uint id)
        {
            List <string[]> temp  = Persistence.ReadEntryByPrimaryKey(path, id.ToString());
            string          name  = temp[0][1];
            bool            inUse = bool.Parse(temp[0][2]);
            DrugStateChange dsc   = DrugStateChangeRepository.GetInstance().Read(uint.Parse(temp[0][6]));

            string[]         dbids = temp[0][3].Split(' ');
            List <DrugBatch> dbs   = new List <DrugBatch>();

            foreach (string dbid in dbids)
            {
                if (!dbid.Equals(""))
                {
                    dbs.Add(DrugBatchRepository.GetInstance().Read(uint.Parse(dbid)));
                }
            }
            string[] irids             = temp[0][4].Split(' ');
            List <IngridientRatio> irs = new List <IngridientRatio>();

            foreach (string irid in irids)
            {
                if (!irid.Equals(""))
                {
                    irs.Add(IngridientRatioRepository.GetInstance().Read(uint.Parse(irid)));
                }
            }
            string[] sefids = temp[0][5].Split(' ');
            List <SideEffectFrequency> sefs = new List <SideEffectFrequency>();

            foreach (string sefid in sefids)
            {
                if (!sefid.Equals(""))
                {
                    sefs.Add(SideEffectFrequencyRepository.GetInstance().Read(uint.Parse(sefid)));
                }
            }
            return(new Drug(id, name, inUse, dbs, irs, sefs, dsc));
        }