public IBLL.DTO.LabelDTO GetLabelById(string labeidid) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); IBLL.DTO.LabelDTO labe = null; try { IDAL.VO.LabelVO labe_ = this.dal.GetLabelById(labeidid); labe = LabelMapper.LabeMapper(labe_); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(labe), LibString.TypeName(labe_), LibString.TypeName(labe))); } 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(labe); }
public List <IBLL.DTO.LabelDTO> AddLabels(List <IBLL.DTO.LabelDTO> data) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); List <IBLL.DTO.LabelDTO> toReturn = null; try { data.ForEach(p => p.labeidid = null); List <IDAL.VO.LabelVO> data_ = LabelMapper.LabeMapper(data); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_))); List <IDAL.VO.LabelVO> stored = dal.NewLabels(data_); log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored))); toReturn = LabelMapper.LabeMapper(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 List <IBLL.DTO.LabelDTO> GetLabelsByRichiesta(string richidid) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); List <IBLL.DTO.LabelDTO> labes = null; try { List <IDAL.VO.LabelVO> labes_ = this.dal.GetLabelsByRichiesta(richidid); labes = LabelMapper.LabeMapper(labes_); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(labes), LibString.TypeName(labes_), LibString.TypeName(labes))); } 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(labes); }
// NO ENTITYFRAMEWORK public IDAL.VO.LabelVO GetLabelById(string labeidid) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); IDAL.VO.LabelVO labe = null; try { string connectionString = this.GRConnectionString; long labelidid_ = long.Parse(labeidid); string table = this.LabelTabName; Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>() { { "id", new DBSQL.QueryCondition() { Key = "labeidid", Op = DBSQL.Op.Equal, Value = labelidid_, 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) { labe = LabelMapper.LabeMapper(data.Rows[0]); log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(labe), LibString.TypeName(labe))); } } } 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(labe); }
public IDAL.VO.LabelVO NewLabel(IDAL.VO.LabelVO data) { IDAL.VO.LabelVO result = null; Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); string table = this.LabelTabName; try { string connectionString = this.GRConnectionString; List <string> pk = new List <string>() { "LABEIDID" }; List <string> autoincrement = new List <string>() { "labeIdiD" }; // INSERT NUOVA DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement); if (res != null) { if (res.Rows.Count > 0) { result = LabelMapper.LabeMapper(res.Rows[0]); log.Info(string.Format("Inserted new record with ID: {0}!", result.labeidid)); } } } 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.LabelDTO UpdatLabel(IBLL.DTO.LabelDTO data) { Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); int stored = 0; IBLL.DTO.LabelDTO toReturn = null; string id = data.labeidid.ToString(); try { if (id == null || GetLabelById(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.LabelVO data_ = LabelMapper.LabeMapper(data); log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_))); stored = dal.SetLabel(data_); toReturn = GetLabelById(data.labeidid.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 List <IDAL.VO.LabelVO> NewLabels(List <IDAL.VO.LabelVO> data) { List <IDAL.VO.LabelVO> results = null; Stopwatch tw = new Stopwatch(); tw.Start(); log.Info(string.Format("Starting ...")); string table = this.LabelTabName; try { string connectionString = this.GRConnectionString; List <string> pk = new List <string>() { "LABEIDID" }; List <string> autoincrement = new List <string>() { "lAbeIdiD" }; // INSERT NUOVA DataTable res = DBSQL.MultiInsertBackOperation(connectionString, table, data, pk, autoincrement); if (res != null && res.Rows.Count > 0) { results = LabelMapper.LabeMapper(res); } if (results != null) { if (results.Count > 0) { string tmp = ""; int o = 0; foreach (IDAL.VO.LabelVO tmp_ in results) { tmp += tmp_.labeidid.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); }