public int GetNumberOfParticipants(int idRegist) { try { using (var connect = new Connect()) { SqlConnection sqlconn = connect.GetConnection(); var partiMapper = new ParticipantDataMapper(sqlconn); return(partiMapper.GetCountParticipants(idRegist)); } } catch (Exception exception) { throw new FaultException <ServerError>(new ServerError()); } }
public void InsertParticipant(Participant val) { try { using (var c = new Connect()) { c.BeginTrx(); var partiMapper = new ParticipantDataMapper(c.GetConnection()); partiMapper.SetTransaction(c.Transaction); partiMapper.Insert(val); c.Commit(); } } catch (Exception exception) { throw new FaultException <ServerError>(new ServerError()); } }
// // Get an array of Regist associated with a person id // public Regist[] GetRegists(int person_id) { try { using (var connect = new Connect()) { SqlConnection sqlconn = connect.GetConnection(); var registMapper = new RegistDataMapper(sqlconn); var crimeTypeMapper = new CrimeTypeDataMapper(sqlconn); var partiMapper = new ParticipantDataMapper(sqlconn); IEnumerable <Participant> participants = partiMapper.GetAll().Where(p => p.Person.Id == person_id); var regists = new List <Regist>(); foreach (Participant part in participants) { regists.Add(registMapper.GetById(part.Regist.Id)); } foreach (Regist r in regists) { foreach (Participant p in partiMapper.GetAll().Where(part => part.Regist.Id == r.Id)) { r.AddParticipant(p); } r.SetParticipants(); } return(regists.ToArray()); } } catch (Exception exception) { throw new FaultException <ServerError>(new ServerError()); } }
public int InsertParticipant(Participant val) { try { using (var c = new Connect()) { c.BeginTrx(); var partiMapper = new ParticipantDataMapper(c.GetConnection()); partiMapper.SetTransaction(c.Transaction); int ret = partiMapper.Insert(val); c.Commit(); return ret; } } catch (Exception exception) { throw new FaultException<ServerError>(new ServerError()); } }
public int GetNumberOfParticipants(int idRegist) { try { using (var connect = new Connect()) { SqlConnection sqlconn = connect.GetConnection(); var partiMapper = new ParticipantDataMapper(sqlconn); return partiMapper.GetCountParticipants(idRegist); } } catch (Exception exception) { throw new FaultException<ServerError>(new ServerError()); } }
// // Get an array of Regist associated with a person id // public Regist[] GetRegists(int person_id) { try { using (var connect = new Connect()) { SqlConnection sqlconn = connect.GetConnection(); var registMapper = new RegistDataMapper(sqlconn); var crimeTypeMapper = new CrimeTypeDataMapper(sqlconn); var partiMapper = new ParticipantDataMapper(sqlconn); IEnumerable<Participant> participants = partiMapper.GetAll().Where(p => p.Person.Id == person_id); var regists = new List<Regist>(); foreach (Participant part in participants) { regists.Add(registMapper.GetById(part.Regist.Id)); } foreach (Regist r in regists) { foreach (Participant p in partiMapper.GetAll().Where(part => part.Regist.Id == r.Id)) { r.AddParticipant(p); } r.SetParticipants(); } return regists.ToArray(); } } catch (Exception exception) { throw new FaultException<ServerError>(new ServerError()); } }