Ejemplo n.º 1
0
        public int UpdateEsameById(IBLL.DTO.EsameDTO data, string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            int result = 0;

            try
            {
                IDAL.VO.EsameVO data_ = EsameMapper.EsamMapper(data);
                log.Info(string.Format("1 {0} mapped to {1}", data.GetType().ToString(), data_.GetType().ToString()));
                result = dal.UpdateEsameByPk(data_, esamidid);
            }
            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);
        }
Ejemplo n.º 2
0
        public List <IBLL.DTO.EsameDTO> GetEsamiByEpis(string episidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <IBLL.DTO.EsameDTO> esams = null;

            try
            {
                List <IDAL.VO.EsameVO> dalRes = this.dal.GetEsamiByEpis(episidid);
                esams = EsameMapper.EsamMapper(dalRes);
                log.Info(string.Format("{0} VO mapped to {1}", esams.Count, esams.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(esams);
        }
Ejemplo n.º 3
0
        public IBLL.DTO.EsameDTO GetEsameById(string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            IBLL.DTO.EsameDTO esam = null;

            try
            {
                IDAL.VO.EsameVO dalRes = this.dal.GetEsameById(esamidid);
                esam = EsameMapper.EsamMapper(dalRes);
                log.Info(string.Format("1 VO mapped to {0}", esam.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(esam);
        }
Ejemplo n.º 4
0
        public List <IBLL.DTO.EsameDTO> GetEsamiByIds(List <string> esamidids)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.EsameDTO> anals = null;

            try
            {
                List <IDAL.VO.EsameVO> esams_ = dal.GetEsamiByIds(esamidids);
                anals = EsameMapper.EsamMapper(esams_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(anals), LibString.TypeName(esams_), LibString.TypeName(anals)));
            }
            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(anals);
        }
Ejemplo n.º 5
0
        public IBLL.DTO.EsameDTO UpdateEsame(IBLL.DTO.EsameDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            int stored = 0;

            IBLL.DTO.EsameDTO toReturn = null;

            try
            {
                IDAL.VO.EsameVO data_ = EsameMapper.EsamMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                stored   = dal.SetEsame(data_);
                toReturn = GetEsameById(data.radioidid.ToString());
                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);
        }
Ejemplo n.º 6
0
        public List <IBLL.DTO.EsameDTO> GetEsamiByRichiesta(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.EsameDTO> esams = null;

            try
            {
                List <IDAL.VO.EsameVO> dalRes = dal.GetEsamiByRichiesta(richidid);
                esams = EsameMapper.EsamMapper(dalRes);
                log.Info(string.Format("{0} VOs mapped to {1}", LibString.ItemsNumber(esams), LibString.TypeName(esams)));
            }
            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(esams);
        }
Ejemplo n.º 7
0
        public List <IBLL.DTO.EsameDTO> AddEsami(List <IBLL.DTO.EsameDTO> data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.EsameDTO> toReturn = null;

            try
            {
                data.ForEach(p => p.radioidid = null);
                List <IDAL.VO.EsameVO> data_ = EsameMapper.EsamMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                List <IDAL.VO.EsameVO> stored = dal.NewEsami(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = EsameMapper.EsamMapper(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);
        }
Ejemplo n.º 8
0
        public IDAL.VO.EsameVO GetEsameById(string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            IDAL.VO.EsameVO esam = null;
            try
            {
                long           esamidid_ = long.Parse(esamidid);
                hlt_esameradio esam_     = hltCC.hlt_esameradio.Single(t => t.esameidid == esamidid_);
                log.Info(string.Format("Entity Framework Query Executed! Retrieved 1 record!"));
                esam = EsameMapper.EsamMapper(esam_);
                log.Info(string.Format("Record mapped to {0}", esam.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(esam);
        }
Ejemplo n.º 9
0
        public List <IDAL.VO.EsameVO> GetEsamiByEpis(string episidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <IDAL.VO.EsameVO> esams = null;

            try
            {
                var L2EQuery = from e in hltCC.hlt_esameradio join r in hltCC.hlt_ricradiologica on e.esamerichid equals r.objectid where r.idepisodio.Equals(episidid) select e;

                List <hlt_esameradio> esams_ = L2EQuery.ToList();
                log.Info(string.Format("Entity Framework Query Executed! Retrieved {0} record!", esams_.Count));
                esams = EsameMapper.EsamMapper(esams_);
                log.Info(string.Format("{0} Records mapped to {1}", esams.Count, esams.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(esams);
        }
Ejemplo n.º 10
0
        public int DeleteEsame(IDAL.VO.EsameVO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            int result = 0;

            try
            {
                hlt_esameradio data_ = EsameMapper.EsamMapper(data);
                hltCC.Entry(data_).State = System.Data.EntityState.Deleted;
                result = hltCC.SaveChanges();
                log.Info(string.Format("Entity Framework Query Executed! Deleted {0} record!", result));
            }
            catch (Exception ex)
            {
                log.Info(string.Format("Entity Framework Query Executed! Deleted 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);
        }
Ejemplo n.º 11
0
        public List <IDAL.VO.EsameVO> GetEsamiByRich(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            List <IDAL.VO.EsameVO> esams = null;

            try
            {
                List <hlt_esameradio> esams_ = hltCC.hlt_esameradio.Where(t => t.esamerichid == richidid).ToList();
                log.Info(string.Format("Entity Framework Query Executed! Retrieved {0} record!", esams_.Count));
                esams = EsameMapper.EsamMapper(esams_);
                log.Info(string.Format("{0} Records mapped to {1}", esams.Count, esams.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(esams);
        }
Ejemplo n.º 12
0
        public List <IDAL.VO.EsameVO> GetEsamiByIds(List <string> esamidids)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IDAL.VO.EsameVO> esams = null;

            try
            {
                string connectionString = this.GRConnectionString;

                string table = this.EsameTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>();
                int i = 0;
                foreach (string esamidid in esamidids)
                {
                    long esamidid_           = long.Parse(esamidid);
                    DBSQL.QueryCondition tmp = new DBSQL.QueryCondition()
                    {
                        Key   = "radioidid",
                        Op    = DBSQL.Op.Equal,
                        Value = esamidid_,
                        Conj  = i < esamidids.Count - 1 ? DBSQL.Conj.Or : DBSQL.Conj.None
                    };
                    conditions.Add("id" + i, tmp);
                    i++;
                }

                DataTable data = DBSQL.SelectOperation(connectionString, table, conditions);
                log.Info(string.Format("DBSQL Query Executed! Retrieved {0} record!", LibString.ItemsNumber(data)));
                if (data != null)
                {
                    if (data.Rows.Count == 1)
                    {
                        esams = EsameMapper.EsamMapper(data);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(esams), LibString.TypeName(esams)));
                    }
                }
            }
            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(esams);
        }
Ejemplo n.º 13
0
        // NO ENTITYFRAMEWORK
        public IDAL.VO.EsameVO GetEsameById(string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IDAL.VO.EsameVO esam = null;
            try
            {
                string connectionString = this.CCConnectionString;

                long   esamidid_ = long.Parse(esamidid);
                string table     = this.EsameTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "esameidid",
                            Op    = DBSQL.Op.Equal,
                            Value = esamidid_,
                            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)
                {
                    if (data.Rows.Count == 1)
                    {
                        esam = EsameMapper.EsamMapper(data.Rows[0]);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(esam), LibString.TypeName(esam)));
                    }
                }
            }
            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(esam);
        }
Ejemplo n.º 14
0
        public IDAL.VO.EsameVO NewEsame(IDAL.VO.EsameVO data)
        {
            IDAL.VO.EsameVO result = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.EsameTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "RADIOIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "RaDiOIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = EsameMapper.EsamMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.radioidid));
                    }
                }
            }
            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);
        }
Ejemplo n.º 15
0
        public int UpdateEsameByPk(IDAL.VO.EsameVO data, string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            int result = 0;

            try
            {
                long           esamidid_ = long.Parse(esamidid);
                hlt_esameradio esam      = hltCC.hlt_esameradio.First(t => t.esameidid == esamidid_);

                hlt_esameradio data_ = EsameMapper.EsamMapper(data);

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

                result = hltCC.SaveChanges();
                log.Info(string.Format("Entity Framework Query Executed! Updated {0} record!", result));
            }
            catch (Exception ex)
            {
                log.Info(string.Format("Entity Framework 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);
        }
Ejemplo n.º 16
0
        public List <IDAL.VO.EsameVO> NewEsami(List <IDAL.VO.EsameVO> data)
        {
            List <IDAL.VO.EsameVO> results = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.EsameTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "RADIOIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "rAdIoIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.MultiInsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null && res.Rows.Count > 0)
                {
                    results = EsameMapper.EsamMapper(res);
                }
                if (results != null)
                {
                    if (results.Count > 0)
                    {
                        string tmp = "";
                        int    o   = 0;
                        foreach (IDAL.VO.EsameVO tmp_ in results)
                        {
                            tmp += tmp_.radioidid.Value.ToString();
                            if (o < results.Count - 1)
                            {
                                tmp += ", ";
                            }
                            o++;
                        }
                        log.Info(string.Format("Inserted {0} new records with IDs: {1}!", LibString.ItemsNumber(results), tmp));
                    }
                }
                else
                {
                    log.Info(string.Format("No records Inserted!"));
                }
            }
            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(results);
        }