Exemple #1
0
        public static IDAL.VO.RepartoVO RepaMapper(DataRow row)
        {
            IDAL.VO.RepartoVO repa = new IDAL.VO.RepartoVO();

            repa.repaidid       = row["repaidid"] != DBNull.Value ? (int?)row["repaidid"] : null;
            repa.repaazie       = row["repaazie"] != DBNull.Value ? (int?)row["repaazie"] : null;
            repa.repanome       = row["repanome"] != DBNull.Value ? (string)row["repanome"] : null;
            repa.repapsps       = row["repapsps"] != DBNull.Value ? (string)row["repapsps"] : null;
            repa.repatipo       = row["repatipo"] != DBNull.Value ? (string)row["repatipo"] : null;
            repa.repamenu       = row["repamenu"] != DBNull.Value ? (int?)row["repamenu"] : null;
            repa.repapreo       = row["repapreo"] != DBNull.Value ? (int?)row["repapreo"] : null;
            repa.repadisu       = row["repadisu"] != DBNull.Value ? (int?)row["repadisu"] : null;
            repa.repadisd       = row["repadisd"] != DBNull.Value ? (int?)row["repadisd"] : null;
            repa.repapeag       = row["repapeag"] != DBNull.Value ? (int?)row["repapeag"] : null;
            repa.repadtag       = row["repadtag"] != DBNull.Value ? (DateTime?)row["repadtag"] : null;
            repa.repacod1       = row["repacod1"] != DBNull.Value ? (string)row["repacod1"] : null;
            repa.repacod2       = row["repacod2"] != DBNull.Value ? (string)row["repacod2"] : null;
            repa.repanlet       = row["repanlet"] != DBNull.Value ? (int?)row["repanlet"] : null;
            repa.repadest       = row["repadest"] != DBNull.Value ? (string)row["repadest"] : null;
            repa.repaanrp       = row["repaanrp"] != DBNull.Value ? (string)row["repaanrp"] : null;
            repa.reparela       = row["reparela"] != DBNull.Value ? (int?)row["reparela"] : null;
            repa.repaceco       = row["repaceco"] != DBNull.Value ? (string)row["repaceco"] : null;
            repa.repaserv       = row["repaserv"] != DBNull.Value ? (bool?)row["repaserv"] : null;
            repa.repaescs       = row["repaescs"] != DBNull.Value ? (bool?)row["repaescs"] : null;
            repa.repacdc        = row["repacdc"] != DBNull.Value ? (string)row["repacdc"] : null;
            repa.repacdc2       = row["repacdc2"] != DBNull.Value ? (string)row["repacdc2"] : null;
            repa.repauocc       = row["repauocc"] != DBNull.Value ? (string)row["repauocc"] : null;
            repa.repaceconp     = row["repaceconp"] != DBNull.Value ? (string)row["repaceconp"] : null;
            repa.repaturn       = row["repaturn"] != DBNull.Value ? (bool?)row["repaturn"] : null;
            repa.repacecoold    = row["repacecoold"] != DBNull.Value ? (string)row["repacecoold"] : null;
            repa.repacecooldata = row["repacecooldata"] != DBNull.Value ? (DateTime?)row["repacecooldata"] : null;

            return(repa);
        }
Exemple #2
0
        public IBLL.DTO.RepartoDTO GetRepartoById(string id)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

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

            IBLL.DTO.RepartoDTO repa = null;

            try
            {
                IDAL.VO.RepartoVO repa_ = this.dal.GetRepartoById(id);
                repa = RepartoMapper.RepaMapper(repa_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(repa), LibString.TypeName(repa_), LibString.TypeName(repa)));
            }
            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(repa);
        }
Exemple #3
0
        public static IBLL.DTO.RepartoDTO RepaMapper(IDAL.VO.RepartoVO raw)
        {
            IBLL.DTO.RepartoDTO repa = null;
            try
            {
                Mapper.Initialize(cfg => cfg.CreateMap <IDAL.VO.RepartoVO, IBLL.DTO.RepartoDTO>());
                Mapper.AssertConfigurationIsValid();
                repa = Mapper.Map <IBLL.DTO.RepartoDTO>(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(repa);
        }