Example #1
0
        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());
            }
        }
Example #2
0
        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());
            }
        }
Example #3
0
        //
        // 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());
            }
        }
Example #4
0
        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());
            }
        }
Example #5
0
        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());
            }
        }
Example #6
0
        //
        // 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());
            }
        }