Ejemplo n.º 1
0
        public IList find(QueryObject qo)
        {
            try
            {
                ArrayList array = new ArrayList();
                SqlDataReader reader = null;
                SqlConnection connection = UnitOfWork.Instance.Connection;

                connection.Open();

                string sqlStmt =
                    "SELECT * from Persons WHERE " + qo.ToString();
                SqlCommand command = new SqlCommand(sqlStmt, connection);

                reader = command.ExecuteReader();
                while(reader.Read())
                {
                    array.Add(loadFields(reader));
                }
                if(reader != null)
                    reader.Close();
                connection.Close();

                return array;
            }
            catch(SqlException sqle)
            {
                throw new ApplicationException(sqle.Message);
            }
            catch(Exception e)
            {
                throw new ApplicationException(e.Message);
            }
        }
Ejemplo n.º 2
0
            public override IList findByName(String name)
            {
                QueryObject qo = new QueryObject();
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "LastName", name));

                return Registry.Instance.getMapper(typeof(Employee)).find(qo);
            }
Ejemplo n.º 3
0
 public IList find(QueryObject qo)
 {
     return Registry.Instance.getMapper(typeof(Employee)).find(qo);
 }
Ejemplo n.º 4
0
            public override IList findByCategory(String category)
            {
                QueryObject qo = new QueryObject();
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "Category", category));

                return Registry.Instance.getMapper(typeof(Product)).find(qo);
            }
Ejemplo n.º 5
0
            public override IList findByPlz(String name)
            {
                QueryObject qo = new QueryObject();
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "PostalCode", name));

                return Registry.Instance.getMapper(typeof(Address)).find(qo);
            }
Ejemplo n.º 6
0
 public IList find(QueryObject qo)
 {
     return Registry.Instance.getMapper(typeof(OrderDetail)).find(qo);
 }
Ejemplo n.º 7
0
            public override IList findByOrderDate(DateTime orderDate)
            {
                QueryObject qo = new QueryObject();
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "OrderDate", orderDate));

                return Registry.Instance.getMapper(typeof(Order)).find(qo);
            }
Ejemplo n.º 8
0
            public override IList findByNameAndPassword(String name, String password)
            {
                QueryObject qo = new QueryObject();
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "Password", password));
                qo.addCriteria(new Criteria(Criteria.Operator.Equal, "Name", name));

                return Registry.Instance.getMapper(typeof(Person)).find(qo);
            }