Exemplo n.º 1
0
        public IBLL.DTO.AnalisiDTO UpdateAnalisi(IBLL.DTO.AnalisiDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            int stored = 0;

            IBLL.DTO.AnalisiDTO toReturn = null;

            try
            {
                IDAL.VO.AnalisiVO data_ = AnalisiMapper.AnalMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                stored   = dal.SetAnalisi(data_);
                toReturn = GetAnalisiById(data.analidid.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);
        }
Exemplo n.º 2
0
        public List <IBLL.DTO.AnalisiDTO> GetAnalisisByIds(List <string> analidids)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

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

            try
            {
                List <IDAL.VO.AnalisiVO> anals_ = dal.GetAnalisisByIds(analidids);
                anals = AnalisiMapper.AnalMapper(anals_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(anals), LibString.TypeName(anals_), 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);
        }
Exemplo n.º 3
0
        public IBLL.DTO.AnalisiDTO GetAnalisiById(string analidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.AnalisiDTO anal = null;

            try
            {
                IDAL.VO.AnalisiVO dalRes = this.dal.GetAnalisiById(analidid);
                anal = AnalisiMapper.AnalMapper(dalRes);
                log.Info(string.Format("{0} VOs mapped to {1}", LibString.ItemsNumber(anal), LibString.TypeName(anal)));
            }
            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(anal);
        }
Exemplo n.º 4
0
        public List <IBLL.DTO.AnalisiDTO> AddAnalisis(List <IBLL.DTO.AnalisiDTO> data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

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

            try
            {
                data.ForEach(p => p.analidid = null);
                List <IDAL.VO.AnalisiVO> data_ = AnalisiMapper.AnalMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                List <IDAL.VO.AnalisiVO> stored = dal.NewAnalisi(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = AnalisiMapper.AnalMapper(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);
        }
Exemplo n.º 5
0
        public List <IDAL.VO.AnalisiVO> GetAnalisisByIds(List <string> analidids)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IDAL.VO.AnalisiVO> anals = null;

            try
            {
                string connectionString = this.GRConnectionString;

                string table = this.AnalisiTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>();
                int i = 0;
                foreach (string analidid in analidids)
                {
                    long esamidid_           = long.Parse(analidid);
                    DBSQL.QueryCondition tmp = new DBSQL.QueryCondition()
                    {
                        Key   = "analidid",
                        Op    = DBSQL.Op.Equal,
                        Value = esamidid_,
                        Conj  = i < analidids.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)
                    {
                        anals = AnalisiMapper.AnalMapper(data);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(anals), LibString.TypeName(anals)));
                    }
                }
            }
            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(anals);
        }
Exemplo n.º 6
0
        /*
         * public List<IDAL.VO.AnalisiVO> GetAnalisisByIdRichiesta(string richidid)
         * {
         *  Stopwatch tw = new Stopwatch();
         *  tw.Start();
         *
         *  log.Info(string.Format("Starting ..."));
         *
         *  List<IDAL.VO.AnalisiVO> anals = null;
         *  try
         *  {
         *      string connectionString = this.GRConnectionString;
         *
         *      long esamidid_ = long.Parse(richidid);
         *      string table = this.AnalisiTabName;
         *
         *      Dictionary<string, DBSQL.QueryCondition> conditions = new Dictionary<string, DBSQL.QueryCondition>()
         *      {
         *          {
         *              "id",
         *              new DBSQL.QueryCondition() {
         *                  Key = "analesam",
         *                  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)
         *      {
         *          anals = AnalisiMapper.AnalMapper(data);
         *          log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(anals), LibString.TypeName(anals)));
         *      }
         *  }
         *  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 anals;
         * }
         */
        public List <IDAL.VO.AnalisiVO> GetAnalisisByIdRichiestaExt(string richididExt)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IDAL.VO.AnalisiVO> anals = null;

            try
            {
                string connectionString = this.GRConnectionString;

                string table = this.AnalisiTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "analrich",
                            Op    = DBSQL.Op.Equal,
                            Value = richididExt,
                            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)
                {
                    anals = AnalisiMapper.AnalMapper(data);
                    log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(anals), LibString.TypeName(anals)));
                }
            }
            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(anals);
        }
Exemplo n.º 7
0
        public IDAL.VO.AnalisiVO NewAnalisi(IDAL.VO.AnalisiVO data)
        {
            IDAL.VO.AnalisiVO 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>()
                {
                    "ANALIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "aNalIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = AnalisiMapper.AnalMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.analidid));
                    }
                }
            }
            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);
        }
Exemplo n.º 8
0
        public List <IDAL.VO.AnalisiVO> NewAnalisi(List <IDAL.VO.AnalisiVO> data)
        {
            List <IDAL.VO.AnalisiVO> results = 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>()
                {
                    "ANALIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "aNalIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.MultiInsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null && res.Rows.Count > 0)
                {
                    results = AnalisiMapper.AnalMapper(res);
                }
                if (results != null)
                {
                    if (results.Count > 0)
                    {
                        string tmp = "";
                        int    o   = 0;
                        foreach (IDAL.VO.AnalisiVO tmp_ in results)
                        {
                            tmp += tmp_.analidid.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);
        }