예제 #1
0
        // Risultati Grezzi
        public List <IBLL.DTO.RisultatoDTO> GetRisultatiByEsamAnalId(string id)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            List <IBLL.DTO.RisultatoDTO> riss = null;

            try
            {
                IDAL.VO.RisultatoGrezzoVO dalRes = this.dal.GetRisultatoGrezzoByEsamAnalId(id);
                riss = RisultatoMapper.AnreMapper(dalRes);
                log.Info(string.Format("{0} VOs mapped to {1}", LibString.ItemsNumber(riss), LibString.TypeName(riss)));
            }
            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(riss);
        }
예제 #2
0
        public static IDAL.VO.RisultatoGrezzoVO AnreTrashMapper(DataRow row)
        {
            IDAL.VO.RisultatoGrezzoVO anreT = new IDAL.VO.RisultatoGrezzoVO();

            anreT.esamanlid = row["esamanalid"] != DBNull.Value ? (string)row["esamanalid"] : null;
            anreT.res       = row["res"] != DBNull.Value ? (string)row["res"] : null;

            return(anreT);
        }
예제 #3
0
        public IDAL.VO.RisultatoGrezzoVO GetRisultatoGrezzoById(string id)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IDAL.VO.RisultatoGrezzoVO risG = null;
            try
            {
                string connectionString = this.GRConnectionString;

                long   id_   = long.Parse(id);
                string table = this.RisultatoGrezzoTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "id",
                            Op    = DBSQL.Op.Equal,
                            Value = id_,
                            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)
                    {
                        risG = Mappers.RisultatoMapper.AnreTrashMapper(data.Rows[0]);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(risG), LibString.TypeName(risG)));
                    }
                }
            }
            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(risG);
        }
예제 #4
0
        public static List <IBLL.DTO.RisultatoDTO> AnreMapper(IDAL.VO.RisultatoGrezzoVO raw)
        {
            List <IBLL.DTO.RisultatoDTO> anres = null;

            string rowsSeparator   = "££";
            string fieldsSeparator = "§§";

            try
            {
                string[] tmp  = raw.esamanlid.Split('-');
                string[] rows = raw.res.Split(new string[] { rowsSeparator }, StringSplitOptions.RemoveEmptyEntries);

                string analid = tmp[1].Trim();
                string esamid = tmp[0].Trim();

                long analid_ = 0;
                if (!long.TryParse(analid, out analid_))
                {
                    log.Error(string.Format("Error during Anal ID parsing. {0} is not a long parsable string! Esam ID: {1}", analid, esamid));
                }

                foreach (string row in rows)
                {
                    string[] fields = row.Split(new string[] { fieldsSeparator }, StringSplitOptions.None);

                    IBLL.DTO.RisultatoDTO anre = new IBLL.DTO.RisultatoDTO();

                    anre.anreanal = analid_;

                    int anreprog_ = 0;
                    if (!int.TryParse(fields[0].Trim(), out anreprog_))
                    {
                        log.Info(string.Format("Error during Prog Anal ID parsing. {0} is not an int parsable string! Esam ID: {1} - Anal ID: {2}", fields[0], analid, esamid));
                    }
                    anre.anreprog = anreprog_;

                    anre.anretipo     = fields[1].Trim();
                    anre.anreidmu     = fields[2].Trim();
                    anre.anredsmu     = fields[3].Trim();
                    anre.anreidsn     = fields[4].Trim();
                    anre.anrerisu     = fields[5].Trim();
                    anre.anrerisucomm = fields[6].Trim();
                    anre.anreunim     = fields[7].Trim();
                    anre.anrerife     = fields[8].Trim();
                    anre.anreanom     = fields[9].Trim();
                    anre.anrestat     = fields[10].Trim();

                    DateTime anredata_ = default(DateTime);
                    try
                    {
                        anredata_ = DateTime.ParseExact(fields[11].Trim(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch (Exception)
                    {
                        log.Info(string.Format("Error during Anal Date parsing. {0} is not a DateTime parsable string! Esam ID: {1} - Anal ID: {2}", fields[9], analid, esamid));
                    }
                    anre.anredata = anredata_;

                    if (anres == null)
                    {
                        anres = new List <IBLL.DTO.RisultatoDTO>();
                    }

                    anres.Add(anre);
                }
            }
            catch (Exception ex)
            {
                log.Error(string.Format("Error Occurred!\n{0}", ex.Message));
            }

            return(anres);
        }