// Creating a single PODetails entry
        public static bool CreateSinglePODetails(ReorderRecord r)
        {
            using (SA45Team12AD context = new SA45Team12AD())
            {
                try
                {
                    // Finding the newly created PO record
                    PORecord pr = context.PORecords.OrderByDescending(x => x.PONumber).First();

                    // Req to populate the values for the new entry
                    InventoryCatalogue iv = context.InventoryCatalogues.Where(x => x.ItemID.Equals(r.ItemID)).First();                                              // To retrieve UOM
                    SupplierCatalogue  sc = context.SupplierCatalogues.Where(x => x.ItemID.Equals(r.ItemID)).Where(y => y.SupplierID.Equals(r.SupplierID)).First(); // TO retrieve price

                    // Creating our new entry...
                    PORecordDetail pd = new PORecordDetail();
                    pd.PONumber  = pr.PONumber;
                    pd.ItemID    = r.ItemID;
                    pd.Quantity  = r.OrderedQuantity;
                    pd.UOM       = iv.UOM;
                    pd.UnitPrice = sc.Price;

                    context.PORecordDetails.Add(pd);
                    context.SaveChanges();

                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
        // Creating a single PO entry
        public static bool CreateSinglePO(ReorderRecord r)
        {
            using (SA45Team12AD context = new SA45Team12AD())
            {
                try
                {
                    SupplierList s = context.SupplierLists.Where(x => x.SupplierID.Equals(r.SupplierID)).First();

                    PORecord p = new PORecord();
                    p.DateRequested    = DateTime.Now;
                    p.RecipientName    = "System-generated";
                    p.DeliveryAddress  = "21 Lower Kent Ridge Rd, Singapore 119077"; // Default address
                    p.SupplierID       = r.SupplierID;
                    p.CreatedBy        = "Logic University Stationery Store";
                    p.ExpectedDelivery = DateTime.Now.AddDays(Convert.ToDouble(s.OrderLeadTime));
                    p.Status           = "Pending";

                    context.PORecords.Add(p);
                    context.SaveChanges();

                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }