Order class example

Order class:

public class Order {
    public int OrderID;
    public string CustomerID;
    public int EmployeeID;
    public DateTime OrderDate;
    public DateTime RequiredDate;
    public DateTime ShippedDate;
    public int ShipVia;
    public decimal Freight;
    public string ShipName;
    public string ShipCity;
    public string ShipRegion;
    public string ShipCountry;
    public List <Order_Detail> Order_Details;
    public Customer Customer;
    public Employee Employee;
    public Shipper Shipper;
}

Function to create order list:

public List <Order> CreateOrderList() {
    List <Order> OrderList = new List <Order> {
        new Order {OrderID = 10248, CustomerID = “TATA”, EmployeeID = 5,
            OrderDate = DateTime.Parse(“7/4/1996”,
            CultureInfo.CreateSpecificCulture(“en-US”))),
            RequiredDate = DateTime.Parse(“8/1/1996”,
            CultureInfo.CreateSpecificCulture(“en-US”))),
            ShippedDate = DateTime.Parse(“7/16/1996”,
            CultureInfo.CreateSpecificCulture(“en-US”))), ShipVia = 3,
            Freight = 32.3800M, ShipName = “DHL USA”,
            ShipCountry = “Bangladesh”, Order_Details = new List <Order_Detail> (),
            Customer = new Customer(), Employee = new Employee(),
        Shipper = new Shipper()},
        new Order {OrderID = 10249, CustomerID = “BIRLA”, EmployeeID = 6,
            OrderDate = DateTime.Parse(“7/5/1996,
            CultureInfo.CreateSpecificCulture(“en-US”))”),
            RequiredDate = DateTime.Parse(“8/16/1996,
            CultureInfo.CreateSpecificCulture(“en-US”))”),
            ShippedDate = DateTime.Parse(“7/10/1996”,
            CultureInfo.CreateSpecificCulture(“en-US”))), ShipVia = 1,
            Freight = 11.6100M, ShipName = “DHL USA”,
            ShipCountry = “India”, Order_Details = new List <Order_Detail> (),
            Customer = new Customer(), Employee = new Employee(),
        Shipper = new Shipper()}
};
return OrderList;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.