public IBLL.DTO.RichiestaRISDTO GetRichiestaRISById(string richidid) { Stopwatch tw = new Stopwatch(); tw.Start(); IBLL.DTO.RichiestaRISDTO rich = null; try { IDAL.VO.RichiestaRISVO dalRes = this.dal.GetRichiestaById(richidid); rich = RichiestaRISMapper.RichMapper(dalRes); log.Info(string.Format("1 VO mapped to {0}", rich.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(rich); }
public IBLL.DTO.RichiestaRISDTO GetRichiestaRISById(string richidid) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); IBLL.DTO.RichiestaRISDTO rich = null; try { IDAL.VO.RichiestaRISVO rich_ = this.dal.GetRichiestaById(richidid); rich = RichiestaRISMapper.RichMapper(rich_); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(rich), LibString.TypeName(rich_), LibString.TypeName(rich))); } 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(rich); }
public IBLL.DTO.RichiestaRISDTO AddRichiestaRIS(IBLL.DTO.RichiestaRISDTO data) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); IBLL.DTO.RichiestaRISDTO toReturn = null; try { data.presidid = null; IDAL.VO.RichiestaRISVO data_ = RichiestaRISMapper.RichMapper(data); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_))); IDAL.VO.RichiestaRISVO stored = dal.NewRichiesta(data_); log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored))); toReturn = RichiestaRISMapper.RichMapper(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); }
public static IBLL.DTO.RichiestaRISDTO RichMapper(IDAL.VO.RichiestaRISVO raw) { IBLL.DTO.RichiestaRISDTO rich = null; try { Mapper.Initialize(cfg => cfg.CreateMap <IDAL.VO.RichiestaRISVO, IBLL.DTO.RichiestaRISDTO>()); Mapper.AssertConfigurationIsValid(); rich = Mapper.Map <IBLL.DTO.RichiestaRISDTO>(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(rich); }
public IBLL.DTO.RichiestaRISDTO UpdateRichiestaRIS(IBLL.DTO.RichiestaRISDTO data) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); int stored = 0; IBLL.DTO.RichiestaRISDTO toReturn = null; string id = data.presidid.ToString(); try { if (id == null || GetRichiestaRISById(id) == null) { string msg = string.Format("No record found with the id {0}! Updating is impossible!", id); log.Info(msg); log.Error(msg); return(null); } IDAL.VO.RichiestaRISVO data_ = RichiestaRISMapper.RichMapper(data); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_))); stored = dal.SetRichiesta(data_); toReturn = GetRichiestaRISById(id); 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); }