SHOW:
|
|
- or go back to the newest paste.
| 1 | - | class DAO |
| 1 | + | public class DAO |
| 2 | - | { |
| 2 | + | {
|
| 3 | - | static void Main() |
| 3 | + | static void Main() |
| 4 | - | { |
| 4 | + | {
|
| 5 | - | int year = 1997; |
| 5 | + | int year = 1997; |
| 6 | - | Edit("ALFKI", "Plamen"); |
| 6 | + | FindAllCustomers(year, "Canada"); |
| 7 | - | //Add("NAKOVICA", "T233I"); |
| 7 | + | } |
| 8 | - | FindAllCustomers(year, "Canada"); |
| 8 | + | |
| 9 | - | } |
| 9 | + | static void FindAllCustomers(int orderDate, string shipDestination) |
| 10 | - | |
| 10 | + | {
|
| 11 | - | static void Add(string name, string id) |
| 11 | + | using (NORTHWNDEntities db = new NORTHWNDEntities()) |
| 12 | - | { |
| 12 | + | {
|
| 13 | - | Customer newCustomer = new Customer() |
| 13 | + | var orders = from order in db.Orders |
| 14 | - | { |
| 14 | + | where order.OrderDate.Value.Year == orderDate && order.ShipCountry == shipDestination |
| 15 | - | CompanyName = name, |
| 15 | + | select order; |
| 16 | - | CustomerID = id |
| 16 | + | |
| 17 | - | }; |
| 17 | + | foreach (var item in orders) |
| 18 | - | |
| 18 | + | {
|
| 19 | - | using (NORTHWNDEntities db = new NORTHWNDEntities()) |
| 19 | + | Console.WriteLine("Order made by: {0} with CustomerId: {1}", item.Customer.ContactName, item.Customer.CustomerID);
|
| 20 | - | { |
| 20 | + | } |
| 21 | - | bool isInDB = IsInDataBase(db, id); |
| 21 | + | } |
| 22 | - | |
| 22 | + | } |
| 23 | - | if (!isInDB) |
| 23 | + |