Esempio n. 1
0
        public List <IBLL.DTO.RichiestaLISDTO> GetRichiesteByEpisodio(string episid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

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

            try
            {
                List <IDAL.VO.RichiestaLISVO> dalRes = this.dal.GetRichiesteByEpisodio(episid);
                richs = RichiestaLISMapper.RichMapper(dalRes);
                log.Info(string.Format("{0} VOs mapped to {1}", LibString.ItemsNumber(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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public List <IDAL.VO.RichiestaLISVO> GetRichiesteByEven(string evenidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            string table = this.RichiestaLISTabName;

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

            try
            {
                string connectionString = this.GRConnectionString;

                long evenidid_ = long.Parse(evenidid);

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "esameven",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "esameven",
                            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 = RichiestaLISMapper.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);
        }
Esempio n. 5
0
        public IDAL.VO.RichiestaLISVO GetRichiestaByIdExt(string richid)
        {
            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   = "richidid",
                            Op    = DBSQL.Op.Equal,
                            Value = richid,
                            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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        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);
        }