public void NewOrder(int userId, int productId, int cityId) { IUserSystem iUserSystem = new UserSystem("为什么"); IStorageSystem iStorageSystem = new StorageSystem(); ILogisticsSystem iLogisticsSystem = new LogisticsSystem(); IOrderSystem iOrderSystem = new OrderSystem(); if (!iUserSystem.CheckUser(userId)) { Console.WriteLine("用户检测失败"); } else if (!iStorageSystem.CheckStorage(productId)) { Console.WriteLine("仓储检测失败"); } else if (!iLogisticsSystem.CheckLogistics(productId, cityId)) { Console.WriteLine("物流检测失败"); //不能直接去物流增加一个检测失败的数据记录 //而是通过物流系统的方法去做 } else if (!iOrderSystem.CheckOrder(userId, productId)) { Console.WriteLine("订单检测失败"); } else { iOrderSystem.NewOrder(userId, productId); iLogisticsSystem.NewLogistics(productId, cityId); } }
public List <烏龜商品> get存貨清單() { OrderSystem mOrder = new OrderSystem(); // 建立對外部供應商系統的參考 List <烏龜商品> aProdList = new List <烏龜商品>(); // 從外部系統取得產品清單 // TODO: 實務應實作如何取得遠端系統的協定, 介面, 參數, 回傳值 string[][] mOrders = mOrder.get產品清單(); // A供應商系統的回傳格式為2維字串陣列,因本系統以 List 為回傳值,故需實作轉型的工作 foreach (string[] product in mOrders) { 烏龜商品 aProd = new 烏龜商品(); aProd.id = product[0]; aProd.name = product[1]; aProd.price = Convert.ToInt32(product[2]); aProd.quantity = Convert.ToInt32(product[3]); // 將轉型後的烏龜商品資訊新增至 List 集合 aProdList.Add(aProd); } return(aProdList); }
/// <summary> /// 门面模式通过是单例的 /// 门面模式不能直接新增一个物流或者仓储检测方法,只能通过调用物流系统或者仓储系统的检测方法,这是门面模式的严格界定 /// 用于分层 /// 门面模式就是为了屏蔽上端知道太多细节 /// </summary> /// <param name="userId"></param> /// <param name="productId"></param> public void NewOrder(int userId, int productId) { IUserSystem iUser = new UserSystem(); ILogisticsSystem iLogistics = new LogisticsSystem(); IStorageSystem iStorage = new StorageSystem(); IOrderSystem iOrder = new OrderSystem(); if (!iUser.CheckUser(userId)) { Console.WriteLine("用户检测失败"); } else if (!iStorage.CheckStorage(productId)) { Console.WriteLine("仓储检测失败"); } else if (!iLogistics.CheckLogistics(userId, productId)) { Console.WriteLine("物流检测失败"); } else if (!iOrder.CheckOrder(userId, productId)) { Console.WriteLine("订单检测失败"); } else { iOrder.NewOrder(userId, productId); iLogistics.NewLogistics(userId, productId); } }
static void Main(string[] args) { OrderSystem os = new OrderSystem(); os.StartWorkDay(); CustomerDTO customer1 = os.GetCustomerDTO("Mordred"); CustomerDTO customer2 = os.GetCustomerDTO("Arthur"); CustomerDTO customer3 = os.GetCustomerDTO("Nimue"); os.SubscribeToPromotion(customer1); os.SubscribeToPromotion(customer3); while (true) { List <PizzaDTO> pizzas1 = new List <PizzaDTO>(); PizzaDTO pizza1 = os.GetPizzaDTO("Krowi placek"); pizzas1.Add(pizza1); os.OrderPizza(pizzas1, customer1); Thread.Sleep(2000); List <PizzaDTO> pizzas2 = new List <PizzaDTO>(); PizzaDTO pizza2 = os.GetPizzaDTO("Krowi placek"); pizzas2.Add(pizza2); os.OrderPizza(pizzas2, customer2); Thread.Sleep(2000); List <PizzaDTO> pizzas3 = new List <PizzaDTO>(); PizzaDTO pizza3 = os.GetPizzaDTO("Krowi placek"); pizzas3.Add(pizza3); os.OrderPizza(pizzas3, customer3); } }
static void Main(string[] args) { OrderSystem os = new OrderSystem(); os.StartWorkDay(); CustomerDTO customer1 = os.GetCustomerDTO("Tosia"); CustomerDTO customer2 = os.GetCustomerDTO("Kuba"); CustomerDTO customer3 = os.GetCustomerDTO("Basia"); os.SubscribeToPromotion(customer1); os.SubscribeToPromotion(customer3); while (true) { List <BurgerDTO> Burgers1 = new List <BurgerDTO>(); BurgerDTO Burger1 = os.GetBurgerDTO("Angry Diablo Bacon King"); Burgers1.Add(Burger1); os.OrderBurger(Burgers1, customer1); Thread.Sleep(2000); List <BurgerDTO> Burgers2 = new List <BurgerDTO>(); BurgerDTO Burger2 = os.GetBurgerDTO("Angry Diablo Bacon King"); Burgers2.Add(Burger2); os.OrderBurger(Burgers2, customer2); Thread.Sleep(2000); List <BurgerDTO> Burgers3 = new List <BurgerDTO>(); BurgerDTO Burger3 = os.GetBurgerDTO("Angry Diablo Bacon King"); Burgers3.Add(Burger3); os.OrderBurger(Burgers3, customer3); } }
private void Start() { orderSystem = OrderSystem.instance; UIManager = UIManager.instance; playerManager = PlayerManager.instance; orderRecipe = new List <string>(); }
public ActionResult EnterOrder(string Pizza, DateTime PickupTime, bool Paid) { ViewBag.Success = OrderSystem.EnterOrder(Models.Menu.Read().Find(p => p.Name == Pizza), PickupTime, Paid); ViewData["Menu"] = new SelectList(Models.Menu.Read(true)); return(View()); }
private void Calcul(object param) { if (CanCalcul(param)) { var array = randomEngine.GenerateArray(NbElement); MillisecondesEcoulees = OrderSystem.ReorderArray(ref array, OrderByFlag, SortFlag); TableauResultat = array; } }
public void GetAllOrders() { Order order = new Order { Pizza = Menu.Read()[50], OrderTime = DateTime.Now, PickupTime = DateTime.Now.AddDays(10), Paid = true }; OrderSystem.EnterOrder(order); Assert.NotEmpty(OrderSystem.GetAllOrders()); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public void RemoveOrder() { Order order = new Order { Pizza = Menu.Read()[50], OrderTime = DateTime.Now, PickupTime = DateTime.Now.AddDays(10), Paid = true }; OrderSystem.EnterOrder(order); OrderSystem.RemoveOrder(order); Assert.DoesNotContain(order, OrderSystem.GetAllOrders()); }
/// <summary> /// Initializes a new instance of the <see cref="OrderController"/> class. /// FeatureFlag logic outside the code /// </summary> public OrderController() { _orderSystem = new OrderSystem(); // let the feature flag determine which calculator to use if (NewPostageCalculationFeature.FeatureEnabled) { _postageCalculator = new AdvancedPostageCalculator(); } else { _postageCalculator = new PostageCalculator(); } }
public void UnitaireNormalOrder() { Random r = new Random(DateTime.Now.Millisecond); int taille = 3000000; var array = new List <double>(); for (int i = 0; i < taille; i++) { array.Add(r.NextDouble()); } OrderSystem.ReorderArray(ref array, true, false); for (int i = 1; i < array.Count; i++) { Assert.IsTrue(array[i - 1] <= array[i]); } }
public void OnPost() { Request.Form.TryGetValue("Purchaser", out StringValues purchaser); Request.Form.TryGetValue("ProductID", out StringValues productIDs); Request.Form.TryGetValue("ProductName", out StringValues productNames); Request.Form.TryGetValue("Quantity", out StringValues quantities); if (purchaser.Count == 0) { Redirect("~/Index"); } if (purchaser[0] != "" && purchaser[0] != null) { Redirect("~/Index"); } ProductsList = new List <CartItem>(); int i = 0; foreach (string s in productIDs) { ProductsList.Add(new CartItem { ProductId = int.Parse(productIDs[i]), ProductName = productNames[i], Count = int.Parse(quantities[i]) }); i++; } if (ProductsList.Count == 0) { Redirect("~/Index"); } Purchaser = purchaser; Response.Cookies.Delete("CartList"); Response.Cookies.Delete("CartItemsCount"); OrderSystem.MakeOrder(purchaser[0], ProductsList); }
public async void Start(string httpListenerPrefix) { HttpListener httpListener = new HttpListener(); httpListener.Prefixes.Add(httpListenerPrefix); httpListener.Start(); Console.WriteLine("[{0}] Server nasłuchuje...", DateTime.Now.ToString("HH:mm:ss.fff")); os = new OrderSystem(); os.StartWorkDay(); while (true) { HttpListenerContext httpListenerContext = await httpListener.GetContextAsync(); if (httpListenerContext.Request.IsWebSocketRequest) { ProcessRequest(httpListenerContext); } } }
public static bool Activate() { OrderSystem orderSystem = GameObject.FindObjectOfType <OrderSystem>(); return(orderSystem.OutsourceTicket()); }
public void ReceiveOrder(Order order) { OrderSystem.ReceiveOrder(this, order); }
public ActionResult RemoveOrder(long ticks) { OrderSystem.RemoveOrder(OrderSystem.GetAllOrders().Find(o => o.OrderTime.Ticks == ticks)); return(RedirectToAction("GetAllOrders", "Pizza")); }
public void CancelOrders(HashSet <int> orderIdsToCancel) { OrderSystem.CancelOrders(this, orderIdsToCancel); }
/* COOROUTINES */ IEnumerator ExecuteImpulseOrder(OrderImpulse order) { // Get origine position Vector3 startPos = transform.position; float startTime = Time.fixedTime; // Create an order transmiter GameObject orderTransmiter = Instantiate(_orderTransmiterPrefab); // Place the order transmiter in the scenne orderTransmiter.transform.position = startPos; // Activate it orderTransmiter.SetActive(true); // Configure order system OrderSystem orderSystem = orderTransmiter.GetComponent <OrderSystem>(); if (_backUnit != null) { orderSystem.Set(_storredOrder as OrderImpulse, this, _backUnit); } else { orderSystem.Set(_storredOrder as OrderImpulse, this, transform.position); } // Execute order _debug_useGravity = true; _physic.AddImpulse(order._impulse); float delayMin = 0.1f; while (delayMin > 0) { delayMin -= Time.deltaTime; yield return(null); } // Wait for the unit to stop to compleate the process _orderCompleated = false; while (!_orderCompleated) { yield return(null); } // End impulse order EndCurrentImpulseOrder(); _currentOrder._travelTime = Time.fixedTime - startTime; /* * // Reconfigure order system * if (_backUnit != null && !orderSystem._integrateUnitFound) { * orderSystem.Set(_storredOrder as OrderImpulse, this, _backUnit); * } */ orderSystem.Initialise(); // Reset current order _storredOrder = _currentOrder; _currentOrder = new Order(); yield return(null); }
public ActionResult GetAllOrders() { return(View(OrderSystem.GetAllOrders())); }
void Start() { inventoryInfo = this.GetComponent <Item2>(); orders = FindObjectOfType <OrderSystem>(); itemName = inventoryInfo.itemName.Substring(9); }
public void RemoveOrderClassic() { Assert.True(OrderSystem.RemoveOrder(OrderSystem.GetAllOrders()[0])); }
public void GetAllOrdersClassic() { OrderSystem.EnterOrder(_staticMenu[0], DateTime.Now.AddHours(1), true); Assert.NotEmpty(OrderSystem.GetAllOrders()); }
public void EnterOrderClassic() { Assert.True(OrderSystem.EnterOrder(_staticMenu[0], DateTime.Now.AddHours(1), true)); }