Пример #1
0
        public static void CreateIctusDataTMPCollection()
        {
            List <ictusData> ictusDataList = IctusDBManager.GetAllictusData();

            if (ictusDataList != null && ictusDataList.Count() > 0)
            {
                ncLog.Message("Nº rows ictusDataList:" + ictusDataList.Count());
                int cont = 0;

                foreach (ictusData iter in ictusDataList)
                {
                    ictusDataTMP newIctusDataTMP = new ictusDataTMP(iter);

                    if (!newIctusDataTMP.IsOk())
                    {
                        ncLog.Error("Unable to create newIctusDataTMP for pacienteID:" + iter.pacienteID);
                    }
                    else
                    {
                        if (!IctusDBManager.NewIctusDataTMP(newIctusDataTMP))
                        {
                            ncLog.Error("Unable to insert newIctusDataTMP for pacienteID:" + newIctusDataTMP.pacienteID);
                        }
                        else
                        {
                            ++cont;
                            ncLog.Message("Inserted ictusDataTMP nº:" + cont);
                        }
                    }
                }
            }
        }
Пример #2
0
        private void btUpdateDB_Click(object sender, EventArgs e)
        {
            IctusDBManager.DropIctusData();

            ncLog.Message("ClearDB::Ictus data collection has been deleted");

            List <ictusData> ictusDataColletion = IctusDBManager.GetAllictusData();

            if (ictusDataColletion != null && ictusDataColletion.Count() > 0)
            {
                ncLog.Warning("LoadDB::ictusData collections is not empty. You must remove it!! Nº documents:" + ictusDataColletion.Count());
                return;
            }

            ictusDataColletion.Clear();

            foreach (KeyValuePair <long, List <umeDataTMP> > iter in Util.ictusDataMap)
            {
                ictusData newIctusdata = new ictusData(iter.Key, iter.Value);
                if (newIctusdata.IsOk())
                {
                    ictusDataColletion.Add(newIctusdata);
                }
            }

            ncLog.Message("LoadDB::Nº rows ictusDataColletion:[" + ictusDataColletion.Count() + "]");


            foreach (ictusData iter in ictusDataColletion)
            {
                if (!IctusDBManager.NewIctusData(iter))
                {
                    ncLog.Error("LoadDB::Unable to insert new ictusData for pacienteID:" + iter.pacienteID);
                }
            }

            List <ictusData> ictusDataInDB = IctusDBManager.GetAllictusData();

            ncLog.Message("LoadDB::Nº rows inserted:[" + ictusDataInDB.Count() + "]");
        }