Beispiel #1
0
        public CrimeType[] GetAllCrimeTypeByRegist(int idRegist)
        {
            using (var connect = new Connect())
            {
                SqlConnection sqlconn = connect.GetConnection();
                RegistDataMapper registDataMapper = new RegistDataMapper(sqlconn);
                var crimes = registDataMapper.GetCrimeType(idRegist);

                return crimes.ToArray();
            }
        }
Beispiel #2
0
        public CrimeType[] GetAllCrimeTypeByRegist(int idRegist)
        {
            using (var connect = new Connect())
            {
                SqlConnection    sqlconn          = connect.GetConnection();
                RegistDataMapper registDataMapper = new RegistDataMapper(sqlconn);
                var crimes = registDataMapper.GetCrimeType(idRegist);

                return(crimes.ToArray());
            }
        }
Beispiel #3
0
 //
 // Insert a Regist
 //
 public int InsertRegist(Regist val)
 {
     try
     {
         using (var c = new Connect())
         {
             c.BeginTrx();
             var registMapper = new RegistDataMapper(c.GetConnection());
             registMapper.SetTransaction(c.Transaction);
             int result = registMapper.Insert(val);
             c.Commit();
             return(result);
         }
     }
     catch (Exception exception)
     {
         throw new FaultException <ServerError>(new ServerError());
     }
 }
Beispiel #4
0
        public Regist[] GetRegists(int person_id)
        {
            try
            {
                using (var connect = new Connect())
                {
                    SqlConnection sqlconn      = connect.GetConnection();
                    var           registMapper = new RegistDataMapper(sqlconn);

                    IEnumerable <Regist> regist = registMapper.GetRegistsByPerson(person_id);

                    return(regist.ToArray());
                }
            }
            catch (Exception exception)
            {
                throw new FaultException <ServerError>(new ServerError());
            }
        }
Beispiel #5
0
        public Regist[] GetAllRegists()
        {
            try
            {
                using (var connect = new Connect())
                {
                    SqlConnection sqlconn      = connect.GetConnection();
                    var           registMapper = new RegistDataMapper(sqlconn);

                    var regists = registMapper.GetAll();
                    if (regists == null)
                    {
                        return(null);
                    }
                    return(regists.ToArray());
                }
            }
            catch (Exception exception)
            {
                throw new FaultException <ServerError>(new ServerError());
            }
        }
Beispiel #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());
            }
        }
Beispiel #7
0
 //
 // Insert a Regist
 //
 public int InsertRegist(Regist val)
 {
     try
     {
         using (var c = new Connect())
         {
             c.BeginTrx();
             var registMapper = new RegistDataMapper(c.GetConnection());
             registMapper.SetTransaction(c.Transaction);
             int result = registMapper.Insert(val);
             c.Commit();
             return result;
         }
     }
     catch (Exception exception)
     {
         throw new FaultException<ServerError>(new ServerError());
     }
 }
Beispiel #8
0
        public Regist[] GetRegists(int person_id)
        {
            try
            {
                using (var connect = new Connect())
                {
                    SqlConnection sqlconn = connect.GetConnection();
                    var registMapper = new RegistDataMapper(sqlconn);

                    IEnumerable<Regist> regist = registMapper.GetRegistsByPerson(person_id);

                    return regist.ToArray();
                }
            }
            catch (Exception exception)
            {
                throw new FaultException<ServerError>(new ServerError());
            }
        }
Beispiel #9
0
        public Regist[] GetAllRegists()
        {
            try
            {
                using (var connect = new Connect())
                {
                    SqlConnection sqlconn = connect.GetConnection();
                    var registMapper = new RegistDataMapper(sqlconn);

                    var regists = registMapper.GetAll();
                    if (regists == null) return null;
                    return regists.ToArray();
                }
            }
            catch (Exception exception)
            {
                throw new FaultException<ServerError>(new ServerError());
            }
        }
Beispiel #10
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());
            }
        }