private void button4_Click(object sender, EventArgs e) { //initialize the cursor to waiting while updating //Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor; string sourcePath = System.Configuration.ConfigurationManager.AppSettings["SourceDirectory"]; string destPath = System.Configuration.ConfigurationManager.AppSettings["DestDirectory"]; string ticker = textBox1.Text; int holdDays = int.Parse(textBox3.Text); double cutoff = double.Parse(textBox4.Text); int rollingDays = int.Parse(textBox5.Text); //instantiate a new back test for the symbol BackTest test = new BackTest(ticker, sourcePath, cutoff); test.BackTestLongShort(holdDays, rollingDays); //update the database for the test results via Entity Framework try { using (NetEntities db = new NetEntities()) { //use a stored procedure to delete all the data in the database that matches the symbol db.DeleteData(ticker); } string sql = "Select * from Table5"; SQLConnection Test1 = new SQLConnection(); Test1.ExecuteSelect(sql, test.DT); } catch { Cursor = Cursors.Default; } Cursor = Cursors.Default; }
/// <summary> /// In Update we listen to messages. /// </summary> public void Update() { for (int i = 0; i < NetServer.Connections.Count; ++i) { var con = NetServer.Connections[i]; var peer = con.Peer; NetIncomingMessage message; while ((message = peer.ReadMessage()) != null) { switch (message.MessageType) { // Handle custom messages case NetIncomingMessageType.Data: var netbuffer = message.ReadString(); //var data = message.ReadAllProperties(this.NetEntities[i]); // Something like this might be neccessary? Note: Does not work. //if(message.SenderConnection.RemoteUniqueIdentifier == NetEntities[i].NetClient.UniqueIdentifier) //{ //} Console.WriteLine(string.Format("Custom data from uuid:{0}, buffer:{1}", NetEntities[i].uuid, netbuffer)); if (netbuffer.StartsWith("move:")) { if (netbuffer.Equals("move:up")) { NetEntities[i].pos.Y -= 1; } else if (netbuffer.Equals("move:down")) { NetEntities[i].pos.Y += 1; } else if (netbuffer.Equals("move:left")) { NetEntities[i].pos.X -= 1; } else if (netbuffer.Equals("move:right")) { NetEntities[i].pos.X += 1; } } break; // Handle connection status messages case NetIncomingMessageType.StatusChanged: switch (message.SenderConnection.Status) { /* .. */ case NetConnectionStatus.Connected: { Console.WriteLine("NetConnectionStatus Connected"); NetEntities.Add(new NetEntity(message.SenderConnection.Peer)); break; } case NetConnectionStatus.Disconnected: { Console.WriteLine("NetConnectionStatus Disconnected"); break; } } break; // Handle debug messages (only received when compiled in DEBUG mode) case NetIncomingMessageType.DebugMessage: Console.WriteLine(message.ReadString()); break; // Unknown default: Console.WriteLine("Unhandled message with type: " + message.MessageType); break; } } } }