Beispiel #1
0
        public List <IBLL.DTO.RichiestaRISDTO> GetRichiesteRISByEpis(string episid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <IBLL.DTO.RichiestaRISDTO> richs = null;

            try
            {
                List <IDAL.VO.RichiestaRISVO> dalRes = this.dal.GetRichiesteByEpis(episid);
                richs = RichiestaRISMapper.RichMapper(dalRes);
                log.Info(string.Format("{0} VO mapped to {1}", richs.Count, richs.First().GetType().ToString()));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(richs);
        }
Beispiel #2
0
        public IBLL.DTO.RichiestaRISDTO GetRichiestaRISById(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            IBLL.DTO.RichiestaRISDTO rich = null;

            try
            {
                IDAL.VO.RichiestaRISVO dalRes = this.dal.GetRichiestaById(richidid);
                rich = RichiestaRISMapper.RichMapper(dalRes);
                log.Info(string.Format("1 VO mapped to {0}", rich.GetType().ToString()));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(rich);
        }
Beispiel #3
0
        public IBLL.DTO.RichiestaRISDTO AddRichiestaRIS(IBLL.DTO.RichiestaRISDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.RichiestaRISDTO toReturn = null;

            try
            {
                data.presidid = null;
                IDAL.VO.RichiestaRISVO data_ = RichiestaRISMapper.RichMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                IDAL.VO.RichiestaRISVO stored = dal.NewRichiesta(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = RichiestaRISMapper.RichMapper(stored);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(toReturn), LibString.TypeName(stored), LibString.TypeName(toReturn)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(toReturn);
        }
Beispiel #4
0
        public IDAL.VO.RichiestaRISVO GetRichiestaById(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            IDAL.VO.RichiestaRISVO rich = null;
            try
            {
                hlt_ricradiologica rich_ = hltCC.hlt_ricradiologica.Single(t => t.objectid == richidid);
                log.Info(string.Format("Entity Framework Query Executed! Retrieved 1 record!"));
                rich = RichiestaRISMapper.RichMapper(rich_);
                log.Info(string.Format("Record mapped to {0}", rich.GetType().ToString()));
            }
            catch (Exception ex)
            {
                log.Info(string.Format("Entity Framework Query Executed! Retrieved 0 record!"));
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

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

            return(rich);
        }
Beispiel #5
0
        public IBLL.DTO.RichiestaRISDTO GetRichiestaRISById(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.RichiestaRISDTO rich = null;

            try
            {
                IDAL.VO.RichiestaRISVO rich_ = this.dal.GetRichiestaById(richidid);
                rich = RichiestaRISMapper.RichMapper(rich_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(rich), LibString.TypeName(rich_), LibString.TypeName(rich)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(rich);
        }
Beispiel #6
0
        public List <IBLL.DTO.RichiestaRISDTO> GetRichiesteRISByEven(string evenid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.RichiestaRISDTO> richs = null;

            try
            {
                List <IDAL.VO.RichiestaRISVO> richs_ = this.dal.GetRichiesteByEven(evenid);
                richs = RichiestaRISMapper.RichMapper(richs_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(richs), LibString.TypeName(richs_), LibString.TypeName(richs)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(richs);
        }
Beispiel #7
0
        public List <IDAL.VO.RichiestaRISVO> GetRichiesteByEven(string evenidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaRISTabName;

            List <IDAL.VO.RichiestaRISVO> richs = null;

            try
            {
                string connectionString = this.GRConnectionString;

                long evenidid_ = long.Parse(evenidid);

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "preseven",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "preseven",
                            Op    = DBSQL.Op.Equal,
                            Value = evenidid_,
                            Conj  = DBSQL.Conj.None
                        }
                    }
                };
                DataTable data = DBSQL.SelectOperation(connectionString, table, conditions);
                log.Info(string.Format("DBSQL Query Executed! Retrieved {0} record!", LibString.ItemsNumber(data)));
                if (data != null)
                {
                    richs = RichiestaRISMapper.RichMapper(data);
                    if (richs != null && richs.Count > 0)
                    {
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(richs), LibString.TypeName(richs)));
                    }
                }
            }
            catch (Exception ex)
            {
                log.Info(string.Format("DBSQL Query Executed! Retrieved 0 record!"));
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

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

            return(richs);
        }
Beispiel #8
0
        public List <IDAL.VO.RichiestaRISVO> GetRichiesteByEpis(string episidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <IDAL.VO.RichiestaRISVO> richs = null;

            try
            {
                /*
                 * var res = hltCC.hlt_ricradiologica.Where(t => t.idepisodio == episidid).Select(
                 *      p => new IDAL.DTO.RichiestaRISDTO()
                 *      {
                 *          data = ((DateTime)p.data).ToShortDateString(),
                 *          idepisodio = p.idepisodio
                 *      }
                 *  );
                 */
                /*
                 * // Ricerca se almeno un record esiste restituendo true o false. Il suo uso evita che il first o il tolist su un null generino eccezione!
                 * if(hltCC.hlt_ricradiologica.Where(t => t.idepisodio == episidid).Any()){
                 *
                 * }
                 */
                richs = new List <IDAL.VO.RichiestaRISVO>();

                List <hlt_ricradiologica> richs_ = hltCC.hlt_ricradiologica.Where(t => t.idepisodio == episidid).ToList();

                log.Info(string.Format("Entity Framework Query Executed! Retrieved {0} record!", richs_.Count));

                foreach (hlt_ricradiologica rich_ in richs_)
                {
                    richs.Add(RichiestaRISMapper.RichMapper(rich_));
                }
                log.Info(string.Format("{0} Records mapped to {1}", richs.Count, richs.First().GetType().ToString()));
            }
            catch (Exception ex)
            {
                log.Info(string.Format("Entity Framework Query Executed! Retrieved 0 record!"));
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

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

            return(richs);
        }
Beispiel #9
0
        public IDAL.VO.RichiestaRISVO NewRichiesta(IDAL.VO.RichiestaRISVO data)
        {
            IDAL.VO.RichiestaRISVO result = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaRISTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "PRESIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "pReSIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = RichiestaRISMapper.RichMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.presidid));
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

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

            return(result);
        }
Beispiel #10
0
        public int UpdateRichiestaByPk(IDAL.VO.RichiestaRISVO data, string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            int result = 0;

            try
            {
                hlt_ricradiologica rich = hltCC.hlt_ricradiologica.First(t => t.objectid == richidid);

                hlt_ricradiologica data_ = RichiestaRISMapper.RichMapper(data);

                foreach (System.Reflection.PropertyInfo prop in data_.GetType().GetProperties())
                {
                    if (rich.GetType().GetProperty(prop.Name) != null)
                    {
                        object val = prop.GetValue(data_, null);
                        rich.GetType().GetProperty(prop.Name).SetValue(rich, Convert.ChangeType(val, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType), null);
                    }
                }

                result = hltCC.SaveChanges();
                log.Info(string.Format("Query Executed! Updated {0} record!", result));
            }
            catch (Exception ex)
            {
                log.Info(string.Format("Query Executed! Updated 0 record!"));
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

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

            return(result);
        }
Beispiel #11
0
        public IBLL.DTO.RichiestaRISDTO UpdateRichiestaRIS(IBLL.DTO.RichiestaRISDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            int stored = 0;

            IBLL.DTO.RichiestaRISDTO toReturn = null;
            string id = data.presidid.ToString();

            try
            {
                if (id == null || GetRichiestaRISById(id) == null)
                {
                    string msg = string.Format("No record found with the id {0}! Updating is impossible!", id);
                    log.Info(msg);
                    log.Error(msg);
                    return(null);
                }
                IDAL.VO.RichiestaRISVO data_ = RichiestaRISMapper.RichMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                stored   = dal.SetRichiesta(data_);
                toReturn = GetRichiestaRISById(id);
                log.Info(string.Format("{0} {1} items added and {2} {3} retrieved back!", stored, LibString.TypeName(data_), LibString.ItemsNumber(toReturn), LibString.TypeName(toReturn)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

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

            return(toReturn);
        }