コード例 #1
0
ファイル: AnalisiBLL.cs プロジェクト: GitMAGI/LISPlugin
        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);
        }
コード例 #2
0
ファイル: AnalisiBLL.cs プロジェクト: GitMAGI/LISPlugin
        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);
        }
コード例 #3
0
ファイル: AnalisiBLL.cs プロジェクト: GitMAGI/LISPlugin
        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);
        }
コード例 #4
0
ファイル: AnalisiBLL.cs プロジェクト: GitMAGI/LISPlugin
        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);
        }
コード例 #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);
        }
コード例 #6
0
ファイル: AnalisiDAO.cs プロジェクト: GitMAGI/LISPluginGen
        /*
         * 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);
        }
コード例 #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);
        }
コード例 #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);
        }