public IBLL.DTO.RichiestaLISDTO AddRichiestaLIS(IBLL.DTO.RichiestaLISDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.RichiestaLISDTO toReturn = null;

            try
            {
                data.id = null;
                IDAL.VO.RichiestaLISVO data_ = RichiestaLISMapper.RichMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                IDAL.VO.RichiestaLISVO stored = dal.NewRichiesta(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = RichiestaLISMapper.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);
        }
        public IBLL.DTO.RichiestaLISDTO GetRichiestaLISById(string id)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.RichiestaLISDTO rich = null;

            try
            {
                IDAL.VO.RichiestaLISVO rich_ = this.dal.GetRichiestaById(id);
                rich = RichiestaLISMapper.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);
        }
Exemple #3
0
        public IDAL.VO.RichiestaLISVO GetRichiestaById(string esamidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IDAL.VO.RichiestaLISVO rich = null;
            try
            {
                string connectionString = this.GRConnectionString;

                string table = this.RichiestaLISTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "esamidid",
                            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)
                    {
                        rich = RichiestaLISMapper.RichMapper(data.Rows[0]);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(rich), LibString.TypeName(rich)));
                    }
                }
            }
            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(rich);
        }
Exemple #4
0
        public IDAL.VO.RichiestaLISVO NewRichiesta(IDAL.VO.RichiestaLISVO data)
        {
            IDAL.VO.RichiestaLISVO result = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaLISTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "ESAMIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "eSamIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = RichiestaLISMapper.RichMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.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);
        }
        public static IDAL.VO.RichiestaLISVO RichMapper(IBLL.DTO.RichiestaLISDTO dto)
        {
            IDAL.VO.RichiestaLISVO rich = null;
            try
            {
                Mapper.Initialize(cfg => cfg.CreateMap <IBLL.DTO.RichiestaLISDTO, IDAL.VO.RichiestaLISVO>());
                Mapper.AssertConfigurationIsValid();
                rich = Mapper.Map <IDAL.VO.RichiestaLISVO>(dto);
            }
            catch (AutoMapperConfigurationException ex)
            {
                log.Error(string.Format("AutoMapper Configuration Error!\n{0}", ex.Message));
            }
            catch (AutoMapperMappingException ex)
            {
                log.Error(string.Format("AutoMapper Mapping Error!\n{0}", ex.Message));
            }

            return(rich);
        }
Exemple #6
0
        public static IDAL.VO.RichiestaLISVO RichMapper(DataRow row)
        {
            IDAL.VO.RichiestaLISVO esam = new IDAL.VO.RichiestaLISVO();

            esam.esamidid  = row["esamidid"] != DBNull.Value ? (int)row["esamidid"] : (int?)null;
            esam.esameven  = row["esameven"] != DBNull.Value ? (int)row["esameven"] : (int?)null;
            esam.esamdapr  = row["esamdapr"] != DBNull.Value ? (DateTime)row["esamdapr"] : (DateTime?)null;
            esam.esamorpr  = row["esamorpr"] != DBNull.Value ? (DateTime)row["esamorpr"] : (DateTime?)null;
            esam.esamurge  = row["esamurge"] != DBNull.Value ? (short)row["esamurge"] : (short?)null;
            esam.esamrout  = row["esamrout"] != DBNull.Value ? (string)row["esamrout"] : null;
            esam.esamesec  = row["esamesec"] != DBNull.Value ? (string)row["esamesec"] : null;
            esam.esamtipo  = row["esamtipo"] != DBNull.Value ? (int)row["esamtipo"] : (int?)null;
            esam.esampren  = row["esampren"] != DBNull.Value ? (DateTime)row["esampren"] : (DateTime?)null;
            esam.esamrico  = row["esamrico"] != DBNull.Value ? (int)row["esamrico"] : (int?)null;
            esam.esamconf  = row["esamconf"] != DBNull.Value ? (int)row["esamconf"] : (int?)null;
            esam.esamdmod  = row["esamdmod"] != DBNull.Value ? (string)row["esamdmod"] : null;
            esam.hl7_stato = row["hl7_stato"] != DBNull.Value ? (string)row["hl7_stato"] : null;
            esam.hl7_msg   = row["hl7_msg"] != DBNull.Value ? (string)row["hl7_msg"] : null;

            return(esam);;
        }
        public IBLL.DTO.RichiestaLISDTO UpdateRichiestaLIS(IBLL.DTO.RichiestaLISDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            int stored = 0;

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

            try
            {
                if (id == null || GetRichiestaLISById(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.RichiestaLISVO data_ = RichiestaLISMapper.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 = GetRichiestaLISById(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);
        }
Exemple #8
0
        public int SetRichiesta(IDAL.VO.RichiestaLISVO data)
        {
            int result = 0;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaLISTabName;

            try
            {
                string        connectionString = this.GRConnectionString;
                string        esamidid         = data.esamidid.HasValue ? data.esamidid.Value.ToString() : null;
                List <string> autoincrement    = new List <string>()
                {
                    "esamidid"
                };

                if (esamidid == null)
                {
                    // INSERT NUOVA
                    result = DBSQL.InsertOperation(connectionString, table, data, autoincrement);
                    log.Info(string.Format("Inserted {0} new records!", result));
                }
                else
                {
                    // UPDATE
                    Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                    {
                        { "id",
                          new DBSQL.QueryCondition()
                          {
                              Key   = "esamidid",
                              Value = esamidid,
                              Op    = DBSQL.Op.Equal,
                              Conj  = DBSQL.Conj.None,
                          } },
                    };
                    result = DBSQL.UpdateOperation(connectionString, table, data, conditions, new List <string>()
                    {
                        "esamidid"
                    });
                    log.Info(string.Format("Updated {0} records!", result));
                }
            }
            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);
        }
        public static IDAL.VO.RichiestaLISVO RichMapper(DataRow row)
        {
            IDAL.VO.RichiestaLISVO rich = new IDAL.VO.RichiestaLISVO();

            rich.id           = row["id"] != DBNull.Value ? (long)row["id"] : (long?)null;
            rich.richidid     = row["richidid"] != DBNull.Value ? (string)row["richidid"] : null;
            rich.evendata     = row["evendata"] != DBNull.Value ? (DateTime)row["evendata"] : (DateTime?)null;
            rich.prendata     = row["prendata"] != DBNull.Value ? (DateTime)row["prendata"] : (DateTime?)null;
            rich.hl7_stato    = row["hl7_stato"] != DBNull.Value ? (string)row["hl7_stato"] : null;
            rich.hl7_msg      = row["hl7_msg"] != DBNull.Value ? (string)row["hl7_msg"] : null;
            rich.quesmed      = row["quesmed"] != DBNull.Value ? (string)row["quesmed"] : null;
            rich.urgente      = row["urgente"] != DBNull.Value ? (int)row["urgente"] : (int?)null;
            rich.paziidunico  = row["paziidunico"] != DBNull.Value ? (long)row["paziidunico"] : (long?)null;
            rich.paziid       = row["paziid"] != DBNull.Value ? (string)row["paziid"] : null;
            rich.pazinome     = row["pazinome"] != DBNull.Value ? (string)row["pazinome"] : null;
            rich.pazicogn     = row["pazicogn"] != DBNull.Value ? (string)row["pazicogn"] : null;
            rich.pazidata     = row["pazidata"] != DBNull.Value ? (DateTime)row["pazidata"] : (DateTime?)null;
            rich.pazicofi     = row["pazicofi"] != DBNull.Value ? (string)row["pazicofi"] : null;
            rich.pazisess     = row["pazisess"] != DBNull.Value ? (string)row["pazisess"] : null;
            rich.paziNaNa_cod = row["paziNaNa_cod"] != DBNull.Value ? (string)row["paziNaNa_cod"] : null;
            rich.paziPrNa_cod = row["paziPrNa_cod"] != DBNull.Value ? (string)row["paziPrNa_cod"] : null;
            rich.paziCoNa_cod = row["paziCoNa_cod"] != DBNull.Value ? (string)row["paziCoNa_cod"] : null;
            rich.paziNaNa_txt = row["paziNaNa_txt"] != DBNull.Value ? (string)row["paziNaNa_txt"] : null;
            rich.paziPrNa_txt = row["paziPrNa_txt"] != DBNull.Value ? (string)row["paziPrNa_txt"] : null;
            rich.paziCoNa_txt = row["paziCoNa_txt"] != DBNull.Value ? (string)row["paziCoNa_txt"] : null;
            rich.paziCoNa_cap = row["paziCoNa_cap"] != DBNull.Value ? (string)row["paziCoNa_cap"] : null;
            rich.paziNaRe_cod = row["paziNaRe_cod"] != DBNull.Value ? (string)row["paziNaRe_cod"] : null;
            rich.paziPrRe_cod = row["paziPrRe_cod"] != DBNull.Value ? (string)row["paziPrRe_cod"] : null;
            rich.paziCoRe_cod = row["paziCoRe_cod"] != DBNull.Value ? (string)row["paziCoRe_cod"] : null;
            rich.paziNaRe_txt = row["paziNaRe_txt"] != DBNull.Value ? (string)row["paziNaRe_txt"] : null;
            rich.paziPrRe_txt = row["paziPrRe_txt"] != DBNull.Value ? (string)row["paziPrRe_txt"] : null;
            rich.paziCoRe_txt = row["paziCoRe_txt"] != DBNull.Value ? (string)row["paziCoRe_txt"] : null;
            rich.paziCoRe_cap = row["paziCoRe_cap"] != DBNull.Value ? (string)row["paziCoRe_cap"] : null;
            rich.paziNaDo_cod = row["paziNaDo_cod"] != DBNull.Value ? (string)row["paziNaDo_cod"] : null;
            rich.paziPrDo_cod = row["paziPrDo_cod"] != DBNull.Value ? (string)row["paziPrDo_cod"] : null;
            rich.paziCoDo_cod = row["paziCoDo_cod"] != DBNull.Value ? (string)row["paziCoDo_cod"] : null;
            rich.paziNaDo_txt = row["paziNaDo_txt"] != DBNull.Value ? (string)row["paziNaDo_txt"] : null;
            rich.paziPrDo_txt = row["paziPrDo_txt"] != DBNull.Value ? (string)row["paziPrDo_txt"] : null;
            rich.paziCoDo_txt = row["paziCoDo_txt"] != DBNull.Value ? (string)row["paziCoDo_txt"] : null;
            rich.paziCoDo_cap = row["paziCoDo_cap"] != DBNull.Value ? (string)row["paziCoDo_cap"] : null;
            rich.paziNaRf_cod = row["paziNaRf_cod"] != DBNull.Value ? (string)row["paziNaRf_cod"] : null;
            rich.paziPrRf_cod = row["paziPrRf_cod"] != DBNull.Value ? (string)row["paziPrRf_cod"] : null;
            rich.paziCoRf_cod = row["paziCoRf_cod"] != DBNull.Value ? (string)row["paziCoRf_cod"] : null;
            rich.paziNaRf_txt = row["paziNaRf_txt"] != DBNull.Value ? (string)row["paziNaRf_txt"] : null;
            rich.paziPrRf_txt = row["paziPrRf_txt"] != DBNull.Value ? (string)row["paziPrRf_txt"] : null;
            rich.paziCoRf_txt = row["paziCoRf_txt"] != DBNull.Value ? (string)row["paziCoRf_txt"] : null;
            rich.paziCoRf_cap = row["paziCoRf_cap"] != DBNull.Value ? (string)row["paziCoRf_cap"] : null;
            rich.paziCoRe_via = row["paziCoRe_via"] != DBNull.Value ? (string)row["paziCoRe_via"] : null;
            rich.paziCoDo_via = row["paziCoDo_via"] != DBNull.Value ? (string)row["paziCoDo_via"] : null;
            rich.paziCoRf_via = row["paziCoRf_via"] != DBNull.Value ? (string)row["paziCoRf_via"] : null;
            rich.pazitele     = row["pazitele"] != DBNull.Value ? (string)row["pazitele"] : null;
            rich.paziAsl_cod  = row["paziAsl_cod"] != DBNull.Value ? (string)row["paziAsl_cod"] : null;
            rich.paziAsl_txt  = row["paziAsl_txt"] != DBNull.Value ? (string)row["paziAsl_txt"] : null;
            rich.paziteam     = row["paziteam"] != DBNull.Value ? (string)row["paziteam"] : null;
            rich.mediid       = row["mediid"] != DBNull.Value ? (string)row["mediid"] : null;
            rich.medinome     = row["medinome"] != DBNull.Value ? (string)row["medinome"] : null;
            rich.medicogn     = row["medicogn"] != DBNull.Value ? (string)row["medicogn"] : null;
            rich.medicofi     = row["medicofi"] != DBNull.Value ? (string)row["medicofi"] : null;
            rich.repaid       = row["repaid"] != DBNull.Value ? (string)row["repaid"] : null;
            rich.repanome     = row["repanome"] != DBNull.Value ? (string)row["repanome"] : null;
            rich.accedatetime = row["accedatetime"] != DBNull.Value ? (DateTime)row["accedatetime"] : (DateTime?)null;
            rich.tiporicovero = row["tiporicovero"] != DBNull.Value ? (string)row["tiporicovero"] : null;
            rich.episodioid   = row["episodioid"] != DBNull.Value ? (long)row["episodioid"] : (long?)null;

            return(rich);;
        }