예제 #1
0
        public IBLL.DTO.PazienteDTO GetPazienteById(string id)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.PazienteDTO pazi = null;

            try
            {
                IDAL.VO.PazienteVO pazi_ = this.dal.GetPazienteById(id);
                pazi = PazienteMapper.PaziMapper(pazi_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(pazi), LibString.TypeName(pazi_), LibString.TypeName(pazi)));
            }
            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(pazi);
        }
예제 #2
0
        public IBLL.DTO.PazienteDTO AddPaziente(IBLL.DTO.PazienteDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.PazienteDTO toReturn = null;

            try
            {
                data.paziidid = null;
                IDAL.VO.PazienteVO data_ = PazienteMapper.PaziMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                IDAL.VO.PazienteVO stored = dal.NewPaziente(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = PazienteMapper.PaziMapper(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);
        }
예제 #3
0
        public List <IBLL.DTO.PazienteDTO> GetPazienteBy5IdentityFields(string pazicogn, string pazinome, string pazisess, DateTime pazidata, string pazicofi)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.PazienteDTO> pazis = null;

            try
            {
                List <IDAL.VO.PazienteVO> pazis_ = this.dal.GetPazienteBy5IdentityFields(pazicogn, pazinome, pazisess, pazidata, pazicofi);
                pazis = PazienteMapper.PaziMapper(pazis_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(pazis), LibString.TypeName(pazis_), LibString.TypeName(pazis)));
            }
            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(pazis);
        }
예제 #4
0
        public IDAL.VO.PazienteVO GetPazienteById(string pazidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IDAL.VO.PazienteVO pazi = null;

            try
            {
                string connectionString = this.GRConnectionString;
                string table            = this.PazienteTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZIIDID",
                            Op    = DBSQL.Op.Equal,
                            Value = pazidid,
                            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)
                    {
                        pazi = PazienteMapper.PaziMapper(data.Rows[0]);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(pazi), LibString.TypeName(pazi)));
                    }
                }
            }
            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(pazi);
        }
예제 #5
0
        public IDAL.VO.PazienteVO NewPaziente(IDAL.VO.PazienteVO data)
        {
            IDAL.VO.PazienteVO result = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.AnalisiTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "PAZIIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "PaZiIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = PazienteMapper.PaziMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.paziidid));
                    }
                }
            }
            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);
        }
예제 #6
0
        public IDAL.VO.PazienteVO GetPazienteById(string pazidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            IDAL.VO.PazienteVO pazi = null;

            try
            {
                string connectionString = this.HLTDesktopConnectionString;

                string query = "SELECT * FROM AnagraficaPazienti WHERE seriale = @seriale";
                Dictionary <string, object> pars = new Dictionary <string, object>();
                pars["seriale"] = pazidid;

                log.Info(string.Format("Query: {0}", query));
                log.Info(string.Format("Params: {0}", string.Join(";", pars.Select(x => x.Key + "=" + x.Value).ToArray())));

                DataTable data = DAL.DBSQL.ExecuteQueryWithParams(connectionString, query, pars);

                log.Info(string.Format("Query Executed! Retrieved {0} records!", data.Rows.Count));

                if (data != null && data.Rows.Count == 1)
                {
                    DataRow row = data.Rows[0];

                    pazi = PazienteMapper.PaziMapper(row);

                    log.Info(string.Format("Record mapped to {0}", pazi.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(pazi);
        }
예제 #7
0
 public IBLL.DTO.PazienteDTO GetPazienteById(string id)
 {
     IDAL.VO.PazienteVO dalRes = this.dal.GetPazienteById(id);
     return(PazienteMapper.PaziMapper(dalRes));
 }
예제 #8
0
        public List <IDAL.VO.PazienteVO> GetPazienteBy5IdentityFields(string pazicogn, string pazinome, string pazisess, DateTime pazidata, string pazicofi)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IDAL.VO.PazienteVO> pazis = null;

            try
            {
                string connectionString = this.GRConnectionString;
                string table            = this.PazienteTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "cognome",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZICOGN",
                            Op    = DBSQL.Op.Equal,
                            Value = pazicogn,
                            Conj  = DBSQL.Conj.And
                        }
                    },
                    {
                        "nome",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZINOME",
                            Op    = DBSQL.Op.Equal,
                            Value = pazinome,
                            Conj  = DBSQL.Conj.And
                        }
                    },
                    {
                        "dataNascita",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZIDATA",
                            Op    = DBSQL.Op.Equal,
                            Value = pazidata,
                            Conj  = DBSQL.Conj.And
                        }
                    },
                    {
                        "codFiscale",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZICOFI",
                            Op    = DBSQL.Op.Equal,
                            Value = pazicofi,
                            Conj  = DBSQL.Conj.And
                        }
                    },
                    {
                        "sesso",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "PAZISESS",
                            Op    = DBSQL.Op.Equal,
                            Value = pazisess,
                            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)
                {
                    pazis = PazienteMapper.PaziMapper(data);
                    log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(pazis), LibString.TypeName(pazis)));
                }
            }
            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(pazis);
        }