public void Send(DataInteraction dataInteraction) { //NetSimAgent.Instance.SetDISenderId(dataInteraction.IntPtr, dataInteraction.SenderId); //NetSimAgent.Instance.SetDIReceiverId(dataInteraction.IntPtr, dataInteraction.ReceiverId); //NetSimAgent.Instance.SetDIRequestId(dataInteraction.IntPtr, dataInteraction.RequestId); NetSimAgent.Instance.SendDI(ExerciseConnection.ExerciseConnectionPtr, dataInteraction.IntPtr); }
public ActionResult EditSaveCogMethod(RfidCollections data) { data.Code = bll.getCode(data.Code); ServerMessage msg = new DataInteraction().DataMethod(data); return(Json(new { success = true, message = JsonConvert.SerializeObject(msg) }, JsonRequestBehavior.AllowGet)); }
private void DataInteractionReceived(IntPtr dataInteractionIntPtr) { DataInteraction dataInteraction = new DataInteraction(dataInteractionIntPtr); foreach (var subscriber in DataInteractionSubscribers) { //dataInteraction.IntPtr = dataInteractionIntPtr; //dataInteraction.SenderId = NetSimAgent.Instance.DISenderId(dataInteractionIntPtr); //dataInteraction.ReceiverId = NetSimAgent.Instance.DIReceiverId(dataInteractionIntPtr); //dataInteraction.RequestId = NetSimAgent.Instance.DIRequestId(dataInteractionIntPtr); subscriber(dataInteraction); } }
public void ShouldChangeBuyerPortfolio() { IOutputProvider testoutput = new TestOutputProvider(); ILogger testLogger = new TestLogger(); IContextProvider testContext = new TestContext(); IDataInteraction testDataInteraction = new DataInteraction(); testDataInteraction.Context = testContext; testDataInteraction.Context.Traders.Add(new Trader { TraderId = 1, FirstName = "William", LastName = "Shakespeare", PhoneNumber = "5550001", Balance = 100M }); testDataInteraction.Context.Traders.Add(new Trader { TraderId = 11, FirstName = "Leo", LastName = "Tolstoy", PhoneNumber = "5550011", Balance = 200M }); testDataInteraction.Context.Shares.Add(new Share { ShareId = 1, Name = "AAA", Price = 48.06M }); testDataInteraction.Context.Portfolios.Add(new Portfolio { TraderID = 1, ShareId = 1, Quantity = 10 }); testDataInteraction.Context.Portfolios.Add(new Portfolio { TraderID = 11, ShareId = 1, Quantity = 10 }); var testSimulation = new Simulation(); int sellerId = 1; int buyerId = 11; int shareId = 1; decimal sharePrice = 48.06M; int purchaseQuantity = 9; decimal oldBuyerSharesCount; decimal newBuyerSharesCount; oldBuyerSharesCount = testDataInteraction.Context.Portfolios.Single(p => p.TraderID == buyerId && p.ShareId == shareId).Quantity; testSimulation.UpdateDatabase(testDataInteraction, testoutput, testLogger, sellerId, buyerId, shareId, sharePrice, purchaseQuantity); newBuyerSharesCount = testDataInteraction.Context.Portfolios.Single(p => p.TraderID == buyerId && p.ShareId == shareId).Quantity; Assert.IsTrue(testDataInteraction.Context.Portfolios.Where(p => p.TraderID == buyerId && p.ShareId == shareId).ToList().Count == 1); Assert.IsTrue(newBuyerSharesCount == oldBuyerSharesCount + purchaseQuantity); }
public MainWindow() { IDataInteraction dataInteraction = new DataInteraction(); ISimulation simulation = new Simulation(); IOutputProvider outputProvider = new OutputToStatusTextBox(); IContextProvider contextProvider = new EntityFrameworkContextProvider(); ILogger logger = new Logger(); dataInteraction.Context = contextProvider; program = new Program(dataInteraction, simulation, outputProvider, contextProvider, logger); InitializeComponent(); SetVisibilityToCollapsed(); StatusTextBox.Visibility = Visibility.Visible; AppWindow = this; }
void DataQueryInteractionCallBack(DataQueryInteraction dataQueryInteraction) { if (!dataQueryInteraction.ReceiverId.Equals(PublishedEntity.MyEntityId)) { return; } int numFixedFieldsRequested = dataQueryInteraction.NumFixedFields; int numVarFieldsRequested = dataQueryInteraction.NumVarFields; if ((numFixedFieldsRequested + numVarFieldsRequested) <= 0) { return; } DataInteraction dataInteraction = new DataInteraction(); for (int i = 1; i <= numFixedFieldsRequested; ++i) { int datumId = dataQueryInteraction.FixedDatumId(i); switch (datumId) { case (int)NetStructs.DatumId.DATUM_STATUS_ORIENTATION_HEADING_FLOAT: { dataInteraction.AddDataInteractionFixedFloat(Camera.transform.rotation.eulerAngles.y, (uint)datumId); break; } case (int)NetStructs.DatumId.DATUM_STATUS_ORIENTATION_PITCH_FLOAT: { float pitch = Camera.transform.rotation.eulerAngles.x; if (pitch > 180) { pitch -= 360; } pitch *= -1; dataInteraction.AddDataInteractionFixedFloat(pitch, (uint)datumId); break; } case (int)NetStructs.DatumId.DATUM_STATUS_FOV_HORIZONTAL: { float hfov = Mathf.Rad2Deg * (2 * Mathf.Atan(Mathf.Tan((Camera.fieldOfView / 2) * Mathf.Deg2Rad) * Camera.aspect)); //google dataInteraction.AddDataInteractionFixedFloat(hfov, (uint)datumId); break; } case (int)NetStructs.DatumId.DATUM_STATUS_FOV_VERTICAL: { float vfov = Camera.fieldOfView; dataInteraction.AddDataInteractionFixedFloat(vfov, (uint)datumId); break; } default: break; } } for (int i = 1; i <= numVarFieldsRequested; ++i) { int datumId = dataQueryInteraction.VarDatumId(i); switch (datumId) { case (int)NetStructs.DatumId.DATUM_STATUS_DEVICE: { string weaponName = InfantryDevices.SelectedDeviceEngName; dataInteraction.AddDataInteractionVarString(weaponName, (int)((weaponName.Length + 1) * sizeof(char)), (uint)datumId); break; } default: break; } } dataInteraction.SenderId = PublishedEntity.MyEntityId; dataInteraction.ReceiverId = dataQueryInteraction.SenderId; dataInteraction.RequestId = dataQueryInteraction.RequestId; DataInteractionManager.Send(dataInteraction); }