예제 #1
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);
        }
예제 #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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
        public static IDAL.VO.RichiestaRISVO RichMapper(DataRow row)
        {
            IDAL.VO.RichiestaRISVO esam = new IDAL.VO.RichiestaRISVO();

            esam.data                 = row["data"] != DBNull.Value ? (string)row["data"].ToString() : null;
            esam.data_creazione       = row["data_creazione"] != DBNull.Value ? (string)row["data_creazione"].ToString() : null;
            esam.data_modifica        = row["data_modifica"] != DBNull.Value ? (string)row["data_modifica"].ToString() : null;
            esam.dimprotetta          = row["dimprotetta"] != DBNull.Value ? (bool)row["dimprotetta"] : false;
            esam.esami                = row["esami"] != DBNull.Value ? (string)row["esami"] : null;
            esam.idepisodio           = row["idepisodio"] != DBNull.Value ? (string)row["idepisodio"] : null;
            esam.locker               = row["locker"] != DBNull.Value ? (string)row["locker"] : null;
            esam.motivo               = row["motivo"] != DBNull.Value ? (string)row["motivo"] : null;
            esam.nomeesami            = row["nomeesami"] != DBNull.Value ? (string)row["nomeesami"] : null;
            esam.nomeutente_creazione = row["nomeutente_creazione"] != DBNull.Value ? (string)row["nomeutente_creazione"] : null;
            esam.nomeutente_modifica  = row["nomeutente_modifica"] != DBNull.Value ? (string)row["nomeutente_modifica"] : null;
            esam.objectid             = row["objectid"] != DBNull.Value ? (string)row["objectid"] : null;
            esam.ora            = row["ora"] != DBNull.Value ? (string)row["ora"] : null;
            esam.pdfcreato      = row["pdfcreato"] != DBNull.Value ? (string)row["pdfcreato"] : null;
            esam.quesitoclinico = row["quesitoclinico"] != DBNull.Value ? (string)row["quesitoclinico"] : null;
            esam.seriale        = row["seriale"] != DBNull.Value ? (long)row["seriale"] : 0;
            esam.statopaziente  = row["statopaziente"] != DBNull.Value ? (string)row["statopaziente"] : null;
            esam.urgente        = row["urgente"] != DBNull.Value ? (bool)row["urgente"] : false;
            esam.versione       = row["versione"] != DBNull.Value ? (string)row["versione"] : null;

            return(esam);;
        }
예제 #6
0
        public IDAL.VO.RichiestaRISVO GetRichiestaById(string presidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

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

                string table = this.RichiestaRISTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "presidid",
                            Op    = DBSQL.Op.Equal,
                            Value = presidid,
                            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 = RichiestaRISMapper.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);
        }
예제 #7
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);
        }
예제 #8
0
        public static IBLL.DTO.RichiestaRISDTO RichMapper(IDAL.VO.RichiestaRISVO raw)
        {
            IBLL.DTO.RichiestaRISDTO rich = null;
            try
            {
                Mapper.Initialize(cfg => cfg.CreateMap <IDAL.VO.RichiestaRISVO, IBLL.DTO.RichiestaRISDTO>());
                Mapper.AssertConfigurationIsValid();
                rich = Mapper.Map <IBLL.DTO.RichiestaRISDTO>(raw);
            }
            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);
        }
예제 #9
0
        public static IDAL.VO.RichiestaRISVO RichMapper(hlt_ricradiologica data)
        {
            IDAL.VO.RichiestaRISVO rich = null;
            try
            {
                Mapper.Initialize(cfg => cfg.CreateMap <hlt_ricradiologica, IDAL.VO.RichiestaRISVO>());
                Mapper.AssertConfigurationIsValid();
                rich = Mapper.Map <IDAL.VO.RichiestaRISVO>(data);
            }
            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);
        }
예제 #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);
        }
예제 #11
0
        public static IDAL.VO.RichiestaRISVO RichMapper(DataRow row)
        {
            IDAL.VO.RichiestaRISVO rich = new IDAL.VO.RichiestaRISVO();

            rich.presidid       = row["presidid"] != DBNull.Value ? (int)row["presidid"] : (int?)null;
            rich.preseven       = row["preseven"] != DBNull.Value ? (int)row["preseven"] : (int?)null;
            rich.presques       = row["presques"] != DBNull.Value ? (string)row["presques"] : null;
            rich.prescons       = row["prescons"] != DBNull.Value ? (string)row["prescons"] : null;
            rich.presstat       = row["presstat"] != DBNull.Value ? (short)row["presstat"] : (short?)null;
            rich.prestipo       = row["prestipo"] != DBNull.Value ? (int)row["prestipo"] : (int?)null;
            rich.presurge       = row["presurge"] != DBNull.Value ? (bool)row["presurge"] : (bool?)null;
            rich.prespren       = row["prespren"] != DBNull.Value ? (DateTime)row["prespren"] : (DateTime?)null;
            rich.presrico       = row["presrico"] != DBNull.Value ? (int)row["presrico"] : (int?)null;
            rich.presesec       = row["presesec"] != DBNull.Value ? (DateTime)row["presesec"] : (DateTime?)null;
            rich.presflcc       = row["presflcc"] != DBNull.Value ? (int)row["presflcc"] : (int?)null;
            rich.presconf       = row["presconf"] != DBNull.Value ? (int)row["presconf"] : (int?)null;
            rich.presdmod       = row["presdmod"] != DBNull.Value ? (string)row["presdmod"] : null;
            rich.presnote       = row["presnote"] != DBNull.Value ? (string)row["presnote"] : null;
            rich.presdtri       = row["presdtri"] != DBNull.Value ? (DateTime)row["presdtri"] : (DateTime?)null;
            rich.presdtco       = row["presdtco"] != DBNull.Value ? (DateTime)row["presdtco"] : (DateTime?)null;
            rich.prespers       = row["prespers"] != DBNull.Value ? (string)row["prespers"] : null;
            rich.preserog       = row["preserog"] != DBNull.Value ? (short)row["preserog"] : (short?)null;
            rich.prespren2      = row["prespren2"] != DBNull.Value ? (DateTime)row["prespren2"] : (DateTime?)null;
            rich.presdimi       = row["presdimi"] != DBNull.Value ? (int)row["presdimi"] : (int?)null;
            rich.presecocardio  = row["presecocardio"] != DBNull.Value ? (int)row["presecocardio"] : (int?)null;
            rich.presvisicardio = row["presvisicardio"] != DBNull.Value ? (int)row["presvisicardio"] : (int?)null;
            rich.presappu       = row["presappu"] != DBNull.Value ? (long)row["presappu"] : (long?)null;
            rich.presannu       = row["presannu"] != DBNull.Value ? (int)row["presannu"] : (int?)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.prespadre      = row["prespadre"] != DBNull.Value ? (int)row["prespadre"] : (int?)null;
            rich.presconscardio = row["presconscardio"] != DBNull.Value ? (int)row["presconscardio"] : (int?)null;
            rich.prespagatipo   = row["prespagatipo"] != DBNull.Value ? (int)row["prespagatipo"] : (int?)null;
            rich.prespagastat   = row["prespagastat"] != DBNull.Value ? (int)row["prespagastat"] : (int?)null;
            rich.prespagadata   = row["prespagadata"] != DBNull.Value ? (DateTime)row["prespagadata"] : (DateTime?)null;
            rich.prespagauser   = row["prespagauser"] != DBNull.Value ? (int)row["prespagauser"] : (int?)null;
            rich.prescdc        = row["prescdc"] != DBNull.Value ? (string)row["prescdc"] : null;

            return(rich);
        }
예제 #12
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);
        }
예제 #13
0
        public int SetRichiesta(IDAL.VO.RichiestaRISVO data)
        {
            int result = 0;

            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaRISTabName;

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

                if (presidid == 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   = "presidid",
                              Value = presidid,
                              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);
        }