/// This method require more steps to gether information from the OrderItem Bridging table to list the ordered items and apply changes to the order. /// Currently, just listed the orderdate and customer ID /// <summary> /// Add new information of selected order thru the GET method; /// Required to retrieved latest data before updates are available. /// </summary> /// <param name="id">OrderID</param> /// <returns>Retreive the data of selected order and apply the changes and submit thru POST method.</returns> // GET: Order/Edit/5 public ActionResult Edit(int id) { //Sending getupdateorderResponse request to data controller (thru url string), //If request send succeed (status code 200), Please retrieve the customer information in edit view. //If failed, direct to Error action (View) UpdateOrder ViewModel = new UpdateOrder(); string url = "orderdata/findorder/" + id; HttpResponseMessage getupdateorderResponse = client.GetAsync(url).Result; if (getupdateorderResponse.IsSuccessStatusCode) { //If request is OK, place new update data in OrderDto OrderDto SelectedOrder = getupdateorderResponse.Content.ReadAsAsync <OrderDto>().Result; ViewModel.order = SelectedOrder; return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }
public void reject_Order_on_SystemReject_test() { Order order = this.tradingData.AddSignalAndItsOrder(this.signal); UpdateOrder update = new UpdateOrder(order.Portfolio, order.Symbol, StOrder_State.StOrder_State_SystemReject, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Limit, StOrder_Validity.StOrder_Validity_Day, 150000, order.Amount, 0, 0, this.rejectedDate, "100", "200", 1, order.Id); this.rawData.GetData <UpdateOrder>().Add(update); Assert.IsTrue(order.IsRejected); Assert.AreEqual(this.rejectedDate, order.RejectedDate); }
static async Task RunLoop(IEndpointInstance endpointInstance) { var uniqueGuids = new Guid[maxSagas]; Parallel.For(0, maxSagas, i => uniqueGuids[i] = Guid.NewGuid()); while (true) { log.Info($"\nPress 'G' to generate a {maxSagas} sagas\nPress 'U' to update all {maxSagas}\nPress 'Q' to quit."); var key = Console.ReadKey(); Console.WriteLine(); switch (key.Key) { case ConsoleKey.G: Parallel.For(0, maxSagas, async i => { // Instantiate the command var command = new PlaceOrder { OrderId = uniqueGuids[i] }; // Send the command log.Info($"Sending PlaceOrder command, OrderId = { command.OrderId}"); var options = new SendOptions(); options.RequireImmediateDispatch(); await endpointInstance.Send(command, options).ConfigureAwait(false); }); break; case ConsoleKey.U: Parallel.For(0, maxSagas, async i => { // Instantiate the command var command = new UpdateOrder { OrderId = uniqueGuids[i] }; // Send the command log.Info($"Sending UpdateOrder command, OrderId = { command.OrderId}"); var options = new SendOptions(); options.RequireImmediateDispatch(); await endpointInstance.Send(command, options).ConfigureAwait(false); }); break; case ConsoleKey.Q: return; default: log.Info("Unknown input. Please try again."); break; } } }
public void ignore_UpdateOrder_with_wrong_Cookie_test() { Order order = this.tradingData.AddSignalAndItsOrder(this.signal); UpdateOrder update = new UpdateOrder(order.Portfolio, order.Symbol, StOrder_State.StOrder_State_Cancel, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Limit, StOrder_Validity.StOrder_Validity_Day, 150000, order.Amount, 0, 0, cancellationDate, "100", "200", 1, 0); this.rawData.GetData <UpdateOrder>().Add(update); Assert.IsFalse(order.IsCanceled); }
public void cancel_order_on_state_cancel() { Order order = this.tradingData.AddSignalAndItsOrder(this.signal); UpdateOrder update = new UpdateOrder(order.Portfolio, order.Symbol, StOrder_State.StOrder_State_Cancel, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Limit, StOrder_Validity.StOrder_Validity_Day, 150000, order.Amount, 0, 0, cancellationDate, "100", "200", 1, order.Id); this.rawData.GetData <UpdateOrder>().Add(update); Assert.IsTrue(order.IsCanceled); Assert.AreEqual(cancellationDate, order.CancellationDate); Assert.AreEqual("StOrder_State_Cancel", order.CancellationReason); }
public void ignore_state_system_reject() { Order order = this.tradingData.AddSignalAndItsOrder(this.signal); UpdateOrder update = new UpdateOrder(order.Portfolio, order.Symbol, StOrder_State.StOrder_State_SystemReject, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Limit, StOrder_Validity.StOrder_Validity_Day, 150000, order.Amount, 0, 0, this.cancellationDate, "100", "200", 1, order.Id); this.rawData.GetData <UpdateOrder>().Add(update); Assert.IsFalse(order.IsCanceled); }
private void BtnUpdateOrder_Click(object sender, EventArgs e) { UpdateOrder updateOrder = new UpdateOrder(currentUser, customer); this.Hide(); updateOrder.Show(); }
public void WhenIUpdateDataThruPutAsyncAction(Table table) { UpdateOrder request = table.CreateSet <UpdateOrder>().Single(); JsonServiceClient client = GetClient(); client.PutAsync(request).Wait(); }
public void UpdateOrder_SerializeAllValues_PropertyNamesAsExpected() { // Arrange var orderStatus = new UpdateOrder() { Amount = 1, ShippingDate = new DateTime(1990, 1, 1) }; // Act var serializedObject = JsonConvert.SerializeObject(orderStatus); // Assert Assert.AreEqual(@"{ ""invoice_id"": null, ""type"": null, ""amount"": 1, ""currency"": null, ""description"": null, ""tracktrace_code"": null, ""carrier"": null, ""ship_date"": ""1990-01-01T00:00:00"", ""reason"": null }" .RemoveWhiteSpace(), serializedObject.RemoveWhiteSpace()); }
/// <summary> /// Initializes a new behaviour. /// </summary> /// <param name="types">The types this behaviour will accept.</param> protected Behaviour(Type[] types, UpdateOrder updateTime = UpdateOrder.Update) { _types = types; EventManager.OnEntityCreated += EntityCreated; EventManager.OnComponentsAdded += ComponentsAdded; EventManager.OnComponentsRemoved += ComponentsRemoved; switch (updateTime) { case UpdateOrder.PreUpdate: EventManager.OnPreUpdate += Update; break; case UpdateOrder.Update: EventManager.OnUpdate += Update; break; case UpdateOrder.PostUpdate: EventManager.OnPostUpdate += Update; break; default: break; } }
public static void updateOrder(ComboBox customerId_combobox, ComboBox paymentMethod_combobox, TextBox location_Textbox, DateTimePicker orderDatePicker, BindingNavigator bindingNavigatorOrders, UpdateOrder updateOrderForm, int orderId) { if (!validateFields(customerId_combobox, paymentMethod_combobox, location_Textbox)) { return; } try { int currentPage = bindingNavigatorOrders.BindingSource.Position; UpdateOrderDAO.updateOrder(orderDatePicker.Value.Date, Int32.Parse(customerId_combobox.GetItemText(customerId_combobox.SelectedItem)), paymentMethod_combobox.GetItemText(paymentMethod_combobox.SelectedItem), location_Textbox.Text, orderId); foreach (KeyValuePair <string, Label> entry in App.GetOrderLabels()) { entry.Value.DataBindings.Clear(); } db.BindOrderData(App.GetOrderLabels(), bindingNavigatorOrders); bindingNavigatorOrders.BindingSource.Position = currentPage; // Updated! updateOrderForm.Close(); } catch (SqlException e) { ViewMessages.ExceptionOccured(e); } }
public void WhenIUpdateDataThruPutAction(Table table) { UpdateOrder request = table.CreateSet <UpdateOrder>().Single(); SoapServiceClient client = GetClient(); client.Put(request); }
private void RunUpdateOrders() { Logging.Log("Automation:RunUpdateOrders", "UpdateOrders State - Begin", Logging.Debug); List <int> typeIds = new List <int>(); _updateOrderActions.Clear(); foreach (DirectOrder order in _mySellOrders) { UpdateOrder updateOrder = new UpdateOrder(order.OrderId, false); updateOrder.OnUpdateOrderFinished += OnUpdateOrderFinished; updateOrder.OnUpdateOrderFinished += UpdateOrderFinished; _updateOrderActions.Enqueue(updateOrder); } foreach (DirectOrder order in _myBuyOrders) { UpdateOrder updateOrder = new UpdateOrder(order.OrderId, true); updateOrder.OnUpdateOrderFinished += OnUpdateOrderFinished; updateOrder.OnUpdateOrderFinished += UpdateOrderFinished; _updateOrderActions.Enqueue(updateOrder); } if (RunNextUpdateOrderAction() == true) { ChangeState(State.Processing); } else { ChangeState(State.UpdateOrders); } }
public void UpdatesCorrectObjectsTest(UpdateOrder order) { // Arrange var cell = new AreaMapCell((IEnvironment)null); var objects = new List <Mock <IDynamicObject> >(); foreach (var updateOrder in Enum.GetValues(typeof(UpdateOrder)).Cast <UpdateOrder>()) { var objectMock = new Mock <IDynamicObject>(); objectMock.SetupGet(obj => obj.UpdateOrder).Returns(updateOrder); objects.Add(objectMock); cell.ObjectsCollection.Add(objectMock.Object); } var position = new Point(3, 8); // Act cell.Update(position, order); // Assert foreach (var objectMock in objects) { if (objectMock.Object.UpdateOrder == order) { objectMock.Verify(obj => obj.Update(position), Times.Once); } else { objectMock.Verify(obj => obj.Update(position), Times.Never); } } }
public void UpdateOrder_Constructor() { DateTime date = BrokerDateTime.Make(DateTime.Now); UpdateOrder update = new UpdateOrder("ST30151-RF-01", "RTS-12.12_FT", StOrder_State.StOrder_State_Open, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Market, StOrder_Validity.StOrder_Validity_Day, 150000, 1, 0, 0, date, "id", "no", 0, 1); Assert.AreEqual("ST30151-RF-01", update.Portfolio); Assert.AreEqual("RTS-12.12_FT", update.Symbol); Assert.AreEqual(StOrder_State.StOrder_State_Open, update.State); Assert.AreEqual(StOrder_Action.StOrder_Action_Buy, update.Action); Assert.AreEqual(StOrder_Type.StOrder_Type_Market, update.Type); Assert.AreEqual(StOrder_Validity.StOrder_Validity_Day, update.Validity); Assert.AreEqual(150000, update.Price); Assert.IsInstanceOfType(update.Price, typeof(double)); Assert.AreEqual(1, update.OrderAmount); Assert.IsInstanceOfType(update.OrderAmount, typeof(double)); Assert.AreEqual(0, update.Stop); Assert.IsInstanceOfType(update.Stop, typeof(double)); Assert.AreEqual(0, update.OrderUnfilled); Assert.IsInstanceOfType(update.OrderUnfilled, typeof(double)); Assert.AreEqual(date, update.Datetime); Assert.AreEqual("id", update.OrderId); Assert.AreEqual("no", update.OrderNo); Assert.AreEqual(0, update.StatusMask); Assert.IsInstanceOfType(update.StatusMask, typeof(int)); Assert.AreEqual(1, update.Cookie); Assert.IsInstanceOfType(update.Cookie, typeof(int)); }
public void cancel_order_on_state_cancel_test() { UpdateOrder update = new UpdateOrder(this.order.Portfolio, this.order.Symbol, StOrder_State.StOrder_State_Cancel, StOrder_Action.StOrder_Action_Buy, StOrder_Type.StOrder_Type_Limit, StOrder_Validity.StOrder_Validity_Day, 150000, this.order.Amount, 0, this.order.Amount, this.cancellationDate, this.orderNo, "0", 1, 0); this.rawData.GetData <UpdateOrder>().Add(update); Assert.IsTrue(this.order.IsCanceled); Assert.AreEqual(this.cancellationDate, this.order.CancellationDate); Assert.AreEqual("StOrder_State_Cancel", this.order.CancellationReason); }
public DisplaySettings(TimeSpan frequency, FileInfo soundInfo, UpdateOrder wallpaperUpd, UpdateOrder phraseUpd) { InitializeComponent(); soundsComboBox.Items.Add("None"); if (SoundFiles != null) { foreach (var sound in SoundFiles) { soundsComboBox.Items.Add(sound); } } if (soundInfo == null) { soundsComboBox.SelectedItem = "None"; } else { soundsComboBox.SelectedItem = soundInfo; } Hours.Text = frequency.Hours.ToString(); Minutes.Text = frequency.Minutes.ToString(); Seconds.Text = frequency.Seconds.ToString(); PhraseUpdateOrderComboBox.SelectedIndex = (byte)phraseUpd; WallpaperUpdateOrderComboBox.SelectedIndex = (byte)wallpaperUpd; UpdateFrequency = frequency; }
public void WhenIUpdateDataThruPutAsyncActionWithResponse(Table table) { UpdateOrder request = table.CreateSet <UpdateOrder>().Single(); JsonServiceClient client = GetClient(); bool response = client.PutAsync <bool>(request).Result; ScenarioContext.Current[ResopnseKey] = response; }
public void Convert(Entity entity, EntityManager manager, GameObjectConversionSystem conversionSystem) { var data = new UpdateOrder { Value = Value }; manager.AddSharedComponentData(entity, data); }
public void updatePoints(UpdateOrder o) { for (int i = 0; i < o.targetsIDs.Count; ++i) { MyPointCloud c = getCloudFor(o.targetsIDs[i]); if (c != null) { c.UpdatePointTarget(o.targetsIDs[i], o.newTargets[i], o.colors[i]); } } }
public async Task <IActionResult> UpdateAsync([FromRoute] int orderId, [FromBody] UpdateOrder updateOrder) { var result = await _service.UpdateOrderAsync(orderId, updateOrder); if (result == null) { return(NotFound()); } return(Ok(result)); }
public async Task <IActionResult> UpdateOrder(string id, [FromServices] UpdateOrder updateOrder) { var success = await updateOrder.DoAsync(id) > 0; if (success) { return(Ok()); } return(BadRequest()); }
public void Update() { for (int i = 0; i < UpdatesPerFrame; i++) { m_subsystemTime.NextFrame(); bool flag = false; foreach (KeyValuePair <IUpdateable, bool> item in m_toAddOrRemove) { if (item.Value) { m_updateables.Add(item.Key, new UpdateableInfo { UpdateOrder = item.Key.UpdateOrder }); flag = true; } else { m_updateables.Remove(item.Key); flag = true; } } m_toAddOrRemove.Clear(); foreach (KeyValuePair <IUpdateable, UpdateableInfo> updateable in m_updateables) { UpdateOrder updateOrder = updateable.Key.UpdateOrder; if (updateOrder != updateable.Value.UpdateOrder) { flag = true; updateable.Value.UpdateOrder = updateOrder; } } if (flag) { m_sortedUpdateables.Clear(); foreach (IUpdateable key in m_updateables.Keys) { m_sortedUpdateables.Add(key); } m_sortedUpdateables.Sort(Comparer.Instance); } float dt = MathUtils.Clamp(m_subsystemTime.GameTimeDelta, 0f, 0.1f); foreach (IUpdateable sortedUpdateable in m_sortedUpdateables) { try { sortedUpdateable.Update(dt); } catch (Exception) { } } } }
public GeneralSettingsData(FileInfo selectedSound, FontInfo generalFontSettings, WallpaperStyle generalWallpaperStyle, Signature defaultSignature, TimeSpan updateFrequency, UpdateOrder wallpaperUpdateOrder, UpdateOrder phraseUpdateOrder) { SelectedSound = selectedSound; GeneralFontSettings = generalFontSettings; GeneralWallpaperStyle = generalWallpaperStyle; DefaultSignature = defaultSignature; UpdateFrequency = updateFrequency; WallpaperUpdateOrder = wallpaperUpdateOrder; PhraseUpdateOrder = phraseUpdateOrder; }
private void ProcessDynamicObjects(Point position, UpdateOrder updateOrder) { var dynamicObjects = ObjectsCollection.OfType <IDynamicObject>() .Where(obj => !obj.Updated && obj.UpdateOrder == updateOrder).ToArray(); foreach (var dynamicObject in dynamicObjects) { dynamicObject.Update(position); dynamicObject.Updated = true; } }
public async Task <IActionResult> UpdateOrder(int id, [FromServices] UpdateOrder updateOrder) { if (await updateOrder.Do(id) > 0) { return(Ok()); } else { return(BadRequest()); } }
public async Task <IActionResult> UpdateOrder([FromServices] UpdateOrder updateOrder, int id) { var success = await updateOrder.Do(id) > 0; if (success) { return(Ok()); } else { return(BadRequest()); } }
public async Task <IActionResult> UpdateOrder(int id, [FromServices] UpdateOrder updateOrder) { var success = await updateOrder.Do(id) > 0; if (success) { return(Ok("order successfully updated")); } else { return(BadRequest("Could not update the order")); }; }
public HttpResponseMessage Post([FromBody] UpdateOrder model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } var pairs = model.ProductsQuantities.ToDictionary(productQuantity => productQuantity.ProductId, productQuantity => productQuantity.Quantity); _orderService.Update(model.OrderId, pairs, (User as IUserPrincipal).Id); return(Request.CreateResponse(HttpStatusCode.OK)); }
public static void UpdateOrderSetStatus([ActivityTrigger] UpdateOrder updateOrder, [Table(OrderEntity.Name, "AzureWebJobsStorage")] out OrderEntity order, ILogger log) { order = new OrderEntity { OrderId = updateOrder.OrderId, RowKey = Guid.NewGuid().ToString("N"), Status = updateOrder.Status.ToString() }; log.LogInformation($"OrderProcess {updateOrder.OrderId} > Set status > {updateOrder.Status}."); }
public object Post(UpdateOrder request) { if (request.Order.ID>0) { Db.Update(request.Order); } else { request.Order.OrderID = GetOrderNo(); request.Order.ID = (int) Db.Insert(request.Order,true); } return new {ID = request.Order.ID, OrderID = request.Order.OrderID}; }