Example #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);
            }
        }
Example #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);
            }
Example #3
0
 public IList find(QueryObject qo)
 {
     return Registry.Instance.getMapper(typeof(Employee)).find(qo);
 }
Example #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);
            }
Example #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);
            }
Example #6
0
 public IList find(QueryObject qo)
 {
     return Registry.Instance.getMapper(typeof(OrderDetail)).find(qo);
 }
Example #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);
            }
Example #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);
            }