Beispiel #1
0
        public int SingleOrderPlausibility(int order_id)
        {
            OrderMgmtReference.OrderMgmtClient omc = new OrderMgmtReference.OrderMgmtClient();
            MedMgmtReference.MedMgmtClient mmc = new MedMgmtReference.MedMgmtClient();
            int plausible = 1;
            List<OrderMgmtReference.meds> medList = omc.GetOrdMed(order_id).ToList();
            foreach (var med in medList)
            {
                if (med.amount > mmc.GetMedicineQuantity(med.med_id))
                {
                    plausible = 0;
                }
            }

            return plausible;
        }
Beispiel #2
0
        public Dictionary<int, string> OrderConfirmation(int order_id)
        {
            Dictionary<int, string> confirm = new Dictionary<int, string>();
            if (SingleOrderPlausibility(order_id).Equals(1))
            {
                OrderMgmtReference.OrderMgmtClient omc = new OrderMgmtReference.OrderMgmtClient();
                MedMgmtReference.MedMgmtClient mmc = new MedMgmtReference.MedMgmtClient();
                
                List<OrderMgmtReference.meds> medList = omc.GetOrdMed(order_id).ToList();
                foreach (var med in medList)
                {
                    mmc.SetMedicineQuantity(med.med_id, mmc.GetMedicineQuantity(med.med_id) - med.amount);
                }

                confirm.Add(omc.CompleteOrder(order_id),"Order confirmed");

                return confirm;
            }
            else
            {
                confirm.Add(0, "Order confirmed");

                return confirm;
            }
        }