0
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Text;
|
|
4
|
|
5 namespace PetShop.BusinessLogic
|
|
6 {
|
|
7 using DataAccess;
|
|
8 using ObjectModel;
|
|
9
|
|
10 public class ProductManager
|
|
11 {
|
|
12 #region Product
|
|
13
|
|
14 public Product GetProduct(string id)
|
|
15 {
|
|
16 return Accessor.Query.SelectByKey<Product>(id) ?? new Product();
|
|
17 }
|
|
18
|
|
19 public IList<Product> GetProductListByCategoryID(string id)
|
|
20 {
|
|
21 return Accessor.GetProductListByCategoryID(id);
|
|
22 }
|
|
23
|
|
24 public IList<Product> SearchProducts(string[] keyWords)
|
|
25 {
|
|
26 return Accessor.Query.SelectByKeyWords<Product>(keyWords);
|
|
27 }
|
|
28
|
|
29 #endregion
|
|
30
|
|
31 #region Item
|
|
32
|
|
33 public IList<Item> GetItemListByProductID(string id)
|
|
34 {
|
|
35 return Accessor.GetItemListByProductID(id);
|
|
36 }
|
|
37
|
|
38 public Item GetItem(string itemId)
|
|
39 {
|
|
40 return Accessor.GetItem(itemId);
|
|
41 }
|
|
42
|
|
43 public List<Item> GetAllItemList()
|
|
44 {
|
|
45 return Accessor.GetAllItemList();
|
|
46 }
|
|
47
|
|
48 #endregion
|
|
49
|
|
50 #region Category
|
|
51
|
|
52 public IList<Category> GetCategoryList()
|
|
53 {
|
|
54 return Accessor.Query.SelectAll<Category>();
|
|
55 }
|
|
56
|
|
57 public Category GetCategory(string id)
|
|
58 {
|
|
59 return Accessor.GetCategory(id);
|
|
60 }
|
|
61
|
|
62 public List<Category> SearchCategories(string[] keyWords)
|
|
63 {
|
|
64 return Accessor.Query.SelectByKeyWords<Category>(keyWords);
|
|
65 }
|
|
66
|
|
67 #endregion
|
|
68
|
|
69 #region Accessor
|
|
70
|
|
71 ProductAccessor Accessor
|
|
72 {
|
|
73 [System.Diagnostics.DebuggerStepThrough]
|
|
74 get { return ProductAccessor.CreateInstance(); }
|
|
75 }
|
|
76
|
|
77 #endregion
|
|
78 }
|
|
79 }
|