public int UpdateEsameById(IBLL.DTO.EsameDTO data, string esamidid) { Stopwatch tw = new Stopwatch(); tw.Start(); int result = 0; try { IDAL.VO.EsameVO data_ = EsameMapper.EsamMapper(data); log.Info(string.Format("1 {0} mapped to {1}", data.GetType().ToString(), data_.GetType().ToString())); result = dal.UpdateEsameByPk(data_, 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); }
public IBLL.DTO.EsameDTO UpdateEsame(IBLL.DTO.EsameDTO data) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); int stored = 0; IBLL.DTO.EsameDTO toReturn = null; try { IDAL.VO.EsameVO data_ = EsameMapper.EsamMapper(data); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_))); stored = dal.SetEsame(data_); toReturn = GetEsameById(data.radioidid.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); }
public IBLL.DTO.EsameDTO GetEsameById(string esamidid) { Stopwatch tw = new Stopwatch(); tw.Start(); IBLL.DTO.EsameDTO esam = null; try { IDAL.VO.EsameVO dalRes = this.dal.GetEsameById(esamidid); esam = EsameMapper.EsamMapper(dalRes); log.Info(string.Format("1 VO mapped to {0}", esam.GetType().ToString())); } 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(esam); }
public static IDAL.VO.EsameVO EsamMapper(IBLL.DTO.EsameDTO data) { IDAL.VO.EsameVO esam = null; try { Mapper.Initialize(cfg => cfg.CreateMap <IBLL.DTO.EsameDTO, IDAL.VO.EsameVO>()); Mapper.AssertConfigurationIsValid(); esam = Mapper.Map <IDAL.VO.EsameVO>(data); } 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(esam); }