Exemplo n.º 1
0
        public List <EsameDTO> ChangeHL7StatusAndMessageEsami(List <string> esamids, string hl7_stato, string hl7_msg = null)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <EsameDTO> updateds = null;

            log.Info(string.Format("Starting ..."));

            string msg_ = "Status updating with 'hl7_stato'-> " + hl7_stato;

            if (hl7_msg != null)
            {
                msg_ += " and 'hl7_msg'-> " + hl7_msg;
            }
            log.Info(string.Format(msg_));

            log.Info(string.Format("Updating RADIO ..."));
            List <EsameDTO> gots = GetEsamiByIds(esamids);

            gots.ForEach(p => { p.hl7_stato = hl7_stato; p.hl7_msg = hl7_msg != null ? hl7_msg : p.hl7_msg; });
            int analsres = 0;

            foreach (EsameDTO got_ in gots)
            {
                EsameDTO updt_ = UpdateEsame(got_);
                if (updt_ != null)
                {
                    if (updateds == null)
                    {
                        updateds = new List <EsameDTO>();
                    }
                    updateds.Add(updt_);
                    analsres++;
                }
                else
                {
                    log.Info(string.Format("An Error occurred. Record not updated!RADIOIDID: {0}", got_.radioidid));
                }
            }
            log.Info(string.Format("Updated {0}/{1} record!", analsres, gots.Count));

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(updateds);
        }
Exemplo n.º 2
0
        public int ChangeHL7StatusAndMessageAll(string richidid, string hl7_stato, string hl7_msg = null)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            int res = 0;

            log.Info(string.Format("Starting ..."));

            string msg_ = "Status updating with 'hl7_stato'-> " + hl7_stato;

            if (hl7_msg != null)
            {
                msg_ += " and 'hl7_msg'-> " + hl7_msg;
            }
            log.Info(string.Format(msg_));
            log.Info(string.Format("Updating PRES ..."));

            RichiestaRISDTO got = GetRichiestaRISById(richidid);

            got.hl7_stato = hl7_stato;
            got.hl7_msg   = hl7_msg != null ? hl7_msg : got.hl7_msg;
            RichiestaRISDTO updt = UpdateRichiestaRIS(got);

            int esamres = 0;

            if (updt != null)
            {
                esamres++;
            }
            else
            {
                log.Info(string.Format("An Error occurred. Record not updated! ESAMIDID: {0}", got.presidid));
            }
            res = esamres;

            log.Info(string.Format("Updated {0}/{1} record!", esamres, 1));

            log.Info(string.Format("Updating ANAL ..."));
            List <EsameDTO> gots = GetEsamiByRichiesta(richidid);

            gots.ForEach(p => { p.hl7_stato = hl7_stato; p.hl7_msg = hl7_msg != null ? hl7_msg : p.hl7_msg; });
            int analsres = 0;

            foreach (EsameDTO got_ in gots)
            {
                EsameDTO updt_ = UpdateEsame(got_);
                if (updt_ != null)
                {
                    analsres++;
                }
                else
                {
                    log.Info(string.Format("An Error occurred. Record not updated! RADIOIDID: {0}", got_.radioidid));
                }
            }
            res += analsres;
            log.Info(string.Format("Updated {0}/{1} record!", analsres, gots.Count));

            log.Info(string.Format("Updated {0} record overall!", res));

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(res);
        }