public static orderDeliveryManager GetManager() { if (_ref == null) { _ref = new orderDeliveryManager(); return(_ref); } else { return(_ref); } }
public static void Main(string[] args) { orderDeliveryManager mgr2 = orderDeliveryManager.GetManager(); DateTime ordDate = DateTime.Now; Job job1 = new Job { ID = 1, Title = "Collect Parcel from Amazon Stores", Description = "Collect all todays parcels to be delivered from Mumbai warehouse", Duration = 3, Status = "Not started" }; Job job2 = new Job { ID = 2, Title = "Deliver Parcel to Customers", Description = "All Parcels collected to be delivered to mentioed locations", Duration = 4, Status = "Not started" }; Job job3 = new Job { ID = 3, Title = "Report the status of Delivery", Description = "Collect all todays parcels to be delivered from Mumbai warehouse", Duration = 3, Status = "Not started" }; Job job4 = new Job { ID = 1, Title = "Update WorkOrder statsus", Description = "Access Online Amazon system to update status of delivery of product", Duration = 3, Status = "Not started" }; List <Job> jobs = new List <Job>(); jobs.Add(job1); jobs.Add(job2); jobs.Add(job3); jobs.Add(job4); Order theOrder = new workOrder { OrderID = 1001, Vendor = "DHL Group", Description = "Parcel Delivery of Amazon Customers", OrderDate = DateTime.Now, StartDate = new DateTime(2020, 10, 30), EndDate = new DateTime(2020, 11, 3), Jobs = jobs, Priority = 4, Status = "Not Started" }; IorderService service = new workOrderService(); service.create(theOrder); List <Order> allOrders = service.getOrders(); Console.WriteLine("WorkOrder Details "); Console.WriteLine("-----------------------------------------------------------------------"); foreach (workOrder order in allOrders) { Console.WriteLine("Vendor : {0}", order.Vendor); Console.WriteLine("Order Date : {0}", order.OrderDate); Console.WriteLine("Start Date :{0} ", order.StartDate); Console.WriteLine("End Date :{0} ", order.EndDate); Console.WriteLine("Status : {0}", order.Status); Console.WriteLine(" Job Description"); foreach (Job job in order.Jobs) { Console.WriteLine(job.ID + " " + job.Title + " " + job.Status); } } Console.ReadLine(); }