public ActionResult Index() { ConnectionObject connectionObject = new ConnectionObject(); if (Session["ConnectionObject"] != null) { ConnectionObject tempConnectionObject = new ConnectionObject(); tempConnectionObject = Session["ConnectionObject"] as ConnectionObject; if (tempConnectionObject.isConnected == true && tempConnectionObject.clearSession == false) { connectionObject = tempConnectionObject; } else { connectionObject = connection.AddServers(connectionObject); Session["ConnectionObject"] = null; } } else { connectionObject = connection.AddServers(connectionObject); } return(View(connectionObject)); }
public void CloseConnection(ConnectionObject co) { if (co != null && co.socket != null) { if (CheckIfSocketIsConnected(co.socket)) { co.socket.Shutdown(SocketShutdown.Send); } co.socket.Close(); co.socketConnected = false; } int removeIndex = -1; for (int i = 0; i < connections.Count; i++) { if (connections[i] != null && connections[i].serverPlayerID == co.serverPlayerID) { removeIndex = i; break; } } if (removeIndex > -1) { connections.RemoveAt(removeIndex); } else { Debug.LogWarning("Could not remove connection object"); } }
private void UpdateAndConnection() { try { ConnectionObject selectedConnectionObject = connectionObjectList.Where <ConnectionObject>(x => x.ConnectionId == Convert.ToString(updateComboBoxItem.Value)).FirstOrDefault(); ControlAndFillConnectionObject(); Result result = crmHelper.ControlMSCRMConnection(newConnectionObject); if (!result.IsSuccess) { MessageBox.Show(result.Message); } else { newConnectionObject.ConnectionId = selectedConnectionObject.ConnectionId; connectionXmlHelper.UpdateConnection(newConnectionObject); ImportExcelForm importExcelForm = new ImportExcelForm(); importExcelForm.Show(); this.Visible = false; } } catch (ToolExcepiton ex) { MessageBox.Show(ex.CustomMessage); } }
private DataSet FillGrid() { SqlQueryChecker.Check(model.ReportSettings.CommandType, model.ReportSettings.CommandText); DataSet dataSet = ResultPanel.CreateDataSet(); this.txtSqlString.Text = model.ReportSettings.CommandText; switch (model.ReportSettings.CommandType) { case CommandType.Text: this.connectionObject = CreateConnection(); var dataAccess = new SqlDataAccessStrategy(model.ReportSettings, connectionObject); dataSet = dataAccess.ReadData(); dataSet.Tables[0].TableName = CreateTableName(reportStructure); break; case CommandType.StoredProcedure: dataSet = DatasetFromStoredProcedure(); break; case CommandType.TableDirect: MessageService.ShowError("TableDirect is not suppurted at the moment"); break; default: throw new Exception("Invalid value for CommandType"); } return(dataSet); }
private void ReceiveCallback(IAsyncResult ar) { String data = String.Empty; ConnectionObject sco = (ConnectionObject)ar.AsyncState; Socket s = sco.socket; int bytesRead = s.EndReceive(ar); if (bytesRead > 0) { sco.stringBuilder.Append(Encoding.ASCII.GetString(sco.buffer, 0, bytesRead)); data = sco.stringBuilder.ToString(); sco.stringBuilder.Length = 0; } if (s.Connected) { s.BeginReceive(sco.buffer, 0, ConnectionObject.BufferSize, 0, new AsyncCallback(ReceiveCallback), sco); } else { CloseConnection(sco); } if (incomingDataCallback != null) { incomingDataCallback(sco, data); } }
public void deployPackage(Guid PackageId, Guid ConnectionId) { PackageId = Guid.Parse("9e0b2d57-a63b-4493-91a7-7b0504a81923"); ConnectionId = Guid.Parse("a0154912-5f1a-47f7-b5bb-228f3be29c4d"); DataControl DataManager = new DataControl(); ConnectionObject ConnectionData = DataManager.getConnection(ConnectionId); PackageObject PackageData = DataManager.getPackage(PackageId); SQLExecutorClient ExecutorClient = new SQLExecutorClient(); ExecutorClient.deployPackageToDB( new Connection() { Id = ConnectionData.Id, TNS = ConnectionData.TNS, User = ConnectionData.User, Password = ConnectionData.Password, MinPoolSize = ConnectionData.MinPoolSize, MaxPoolSize = ConnectionData.MaxPoolSize }, transferPackage(PackageData) ); }
protected override string OnProcess(string message) { string retval; var user = PlayerRepositoryExtensions.Authenticate(ConnectionObject.User, message); if (user != null) { ConnectionObject.CreateFileSystem(); retval = GetMessage(220, "Password ok, FTP server ready"); } else { retval = GetMessage(530, "Username or password incorrect"); } ////if (ConnectionObject.Login(sMessage)) ////{ //// return GetMessage(220, "Password ok, FTP server ready"); ////} //// ////return GetMessage(530, "Username or password incorrect"); return(retval); }
public ActionResult Index(ConnectionObject connectionObject) { if (Session["ConnectionObject"] != null) { ConnectionObject tempConnectionObject = new ConnectionObject(); tempConnectionObject = Session["ConnectionObject"] as ConnectionObject; Session["ConnectionObject"] = null; } connectionObject = connection.AddServers(connectionObject); if (connectionObject.ServerSelected != 0) { //get database list connectionObject = connection.getDatabases(connectionObject); // prob a more secure way to store this? Session["ConnectionObject"] = connectionObject; } if (connectionObject.DatabaseSelected != null) { // connect to database connectionObject = connection.connectToDatabase(connectionObject); // prob a more secure way to store this? Session["ConnectionObject"] = connectionObject; } return(View(connectionObject)); }
private void SendCallback(IAsyncResult ar) { ServerSendObject sso = (ServerSendObject)ar.AsyncState; ConnectionObject co = sso.co; int bytesSent = co.socket.EndSend(ar); sso.cb?.Invoke(co); }
ConnectionObject CreateConnection() { var conobj = ConnectionObject.CreateInstance(this.model.ReportSettings.ConnectionString, System.Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb")); conobj.QueryString = model.ReportSettings.CommandText; return(conobj); }
/// <summary> /// used by setup /// </summary> /// <param name="filename"></param> /// <param name="targetConfig"></param> public void SaveDataSource(string filename, string targetConfig) { ConnectionObject.SetDataSource(filename); List <Type> types = new List <Type>(); XmlDocument doc = VPL.XmlSerializerUtility.Save(this, types); doc.Save(targetConfig); }
public static ConnectionObject BuildConnectionObject(ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } return(ConnectionObject.CreateInstance(reportSettings.ConnectionString, DbProviderFactories.GetFactory("System.Data.OleDb"))); }
private DataSet FillGrid() { this.connectionObject = ConnectionObject.CreateInstance(this.model.ReportSettings.ConnectionString, System.Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb")); this.txtSqlString.Text = String.Empty; SqlQueryChecker.Check(model.ReportSettings.CommandType, model.ReportSettings.CommandText); DataSet dataSet = ResultPanel.CreateDataSet(); switch (model.ReportSettings.CommandType) { case CommandType.Text: this.txtSqlString.Text = model.ReportSettings.CommandText; dataSet = BuildFromSqlString(); break; case CommandType.StoredProcedure: MessageService.ShowError("Stored Procedures are not suppurted at the moment"); break; case CommandType.TableDirect: MessageService.ShowError("TableDirect is not suppurted at the moment"); break; default: throw new Exception("Invalid value for CommandType"); } if (model.ReportSettings.CommandType == CommandType.StoredProcedure) { /* * if (reportStructure.SharpQueryProcedure == null) { * throw new IllegalQueryException(); * } * * SharpQueryProcedure procedure = reportStructure.SharpQueryProcedure; * SharpQuerySchemaClassCollection sc = procedure.GetSchemaParameters(); * * if ((sc != null) && sc.Count > 0) { * dataSet = ExecuteStoredProc (procedure); * }else { * dataSet = ExecuteStoredProc (); * } */ } // from here we create from an SqlString like "Select...." // if (model.ReportSettings.CommandType == CommandType.Text){ // this.txtSqlString.Text = model.ReportSettings.CommandText; // dataSet = BuildFromSqlString(); // } return(dataSet); }
public void Connect(string address, int port) { //IPHostEntry ipHostInfo = Dns.GetHostEntry(address); IPAddress ipAddress = IPAddress.Parse(address); IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); co = new ConnectionObject(new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp)); co.socket.NoDelay = true; co.socket.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), co); }
protected override Task <string> OnProcess(string sMessage) { if (ConnectionObject.Login(sMessage)) { return(GetMessage(220, "Password ok, FTP server ready")); } else { return(GetMessage(530, "Username or password incorrect")); } }
private void SelectGate(GateObject g) { if (g.BodySelected) { if (selectedGate != null) { selectedGate.Selected = false; } selectedGate = g; dragGate = true; cursorOffset = g.Position - InputController.MouseManager.Position; currentConnection = null; } else if (g.SelectedPin.IsSet) { if (currentConnection == null) { if (g.SelectedPin.IsInput) { currentConnection = new ConnectionObject(null, 0, g, g.SelectedPin.PinIndex); } else { currentConnection = new ConnectionObject(g, g.SelectedPin.PinIndex, null, 0); } connectionStart = g.SelectedPin.PinPosition; } else { if (g.SelectedPin.IsInput) { currentConnection.Inputee = g; currentConnection.InputPin = g.SelectedPin.PinIndex; currentConnection.Connect(); } else { currentConnection.Outputee = g; currentConnection.OutputPin = g.SelectedPin.PinIndex; currentConnection.Connect(); } Gate.Update(currentConnection.Inputee, () => { }); gameMenu.Connections.Add(currentConnection); gameMenu.Connections.RemoveAll(c => c.Connected); currentConnection = null; } } else { currentConnection = null; } }
protected override string OnProcess(string sMessage) { if (sMessage.Trim() != "") { return(GetMessage(501, "REIN needs no parameters")); } // log out current user ConnectionObject.LogOut(); return(GetMessage(220, "Service ready for new user!")); }
public SqlDataAccessStrategy(ReportSettings reportSettings,ConnectionObject connectionObject) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.reportSettings = reportSettings; if (connectionObject == null) { this.connectionObject = ConnectionObjectFactory.BuildConnectionObject(reportSettings); } else { this.connectionObject = connectionObject; } }
public void BeginSend(ConnectionObject co, String message, ServerOnSendCallback cb) { byte[] byteData = Encoding.ASCII.GetBytes(message); if (byteData.Length > ConnectionObject.BufferSize) { Debug.LogWarning("Message length is larger then max buffer size"); } ServerSendObject sso = new ServerSendObject(co, cb); co.socket.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), sso); }
private void ListConnection() { ConnectionObject selectedConnectionObject = connectionObjectList.Where <ConnectionObject>(x => x.ConnectionId == Convert.ToString(comboBoxItem.Value)).FirstOrDefault(); Result result = crmHelper.ControlMSCRMConnection(selectedConnectionObject); if (!result.IsSuccess) { MessageBox.Show(result.Message); } else { } }
public async Task AddToCurrentClientGroup(string connectionId, string eventId, string viewId) { _dictConnections[connectionId] = new ConnectionObject() { EventId = eventId, ViewId = viewId }; await Groups.AddToGroupAsync(connectionId, eventId); if (!string.IsNullOrEmpty(viewId)) { await Groups.AddToGroupAsync(connectionId, $"{eventId}_{viewId}"); } }
public ActionResult DataSniffer() { DataSnifferObject dataSnifferObject = new DataSnifferObject(); ConnectionObject connectionObject = new ConnectionObject(); connectionObject.isConnected = false; if (Session["ConnectionObject"] != null) { connectionObject = Session["ConnectionObject"] as ConnectionObject; } dataSnifferObject.connectionObject = connectionObject; return(View(dataSnifferObject)); }
public async Task PurgeCurrentClientGroup(string connectionId) { if (_dictConnections.ContainsKey(connectionId)) { ConnectionObject connectionObject = _dictConnections[connectionId]; if (connectionObject != null) { await Groups.RemoveFromGroupAsync(Context.ConnectionId, connectionObject.EventId); await Groups.RemoveFromGroupAsync(Context.ConnectionId, $"{connectionObject.EventId}_{connectionObject.ViewId}"); _dictConnections[connectionId] = null; } } }
private void RunProviderIndependent(string reportName) { string conOleDbString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\SharpReport_TestReports\TestReports\Nordwind.mdb;Persist Security Info=False"; ReportParameters parameters = ReportEngine.LoadParameters(reportName); ConnectionObject con = ConnectionObject.CreateInstance(conOleDbString, System.Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb")); parameters.ConnectionObject = con; parameters.SqlParameters[0].ParameterValue = "Provider Independent"; this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e) { this.RunProviderIndependent(reportName); }; this.previewControl1.RunReport(reportName, parameters); }
public ActionResult CoreMeasures() { CoreMeasuresObject coreMeasuresObject = new CoreMeasuresObject(); ConnectionObject connectionObject = new ConnectionObject(); connectionObject.isConnected = false; if (Session["ConnectionObject"] != null) { connectionObject = Session["ConnectionObject"] as ConnectionObject; } coreMeasuresObject.connectionObject = connectionObject; return(View(coreMeasuresObject)); }
protected override string OnProcess(string sMessage) { sMessage = sMessage.Trim(); if (sMessage == "") { return(GetMessage(501, string.Format("{0} needs a parameter", Command))); } if (ConnectionObject.Login(sMessage)) { return(GetMessage(220, "Password ok, FTP server ready")); } return(GetMessage(530, "Username or password incorrect")); }
public SqlDataAccessStrategy(ReportSettings reportSettings, ConnectionObject connectionObject) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.reportSettings = reportSettings; if (connectionObject == null) { this.connectionObject = ConnectionObjectFactory.BuildConnectionObject(reportSettings); } else { this.connectionObject = connectionObject; } }
public List <ConnectionObject> GetAllConnectionObjects() { List <ConnectionObject> listOfConnectionObjects = new List <ConnectionObject> (); foreach (GameObject node in mo2MaComController.moduleRefPointerController.GetAllNodePointers()) { if (node.GetComponent <FixedJoint> () != null) { ConnectionObject co = new ConnectionObject(); co.moduleName1 = node.transform.parent.name; co.moduleName2 = node.GetComponent <FixedJoint> ().connectedBody.transform.parent.name; co.nodeName1 = node.name; co.nodeName2 = node.GetComponent <FixedJoint> ().connectedBody.transform.name; listOfConnectionObjects.Add(co); } } return(listOfConnectionObjects); }
private void connectionList_cbx_SelectedValueChanged(object sender, EventArgs e) { updateComboBoxItem = (ComboboxItem)connectionList_cbx.SelectedItem; ConnectionObject selectedConnectionObject = connectionObjectList.Where <ConnectionObject>(x => x.ConnectionId == Convert.ToString(updateComboBoxItem.Value)).FirstOrDefault(); SystemName_txt.Text = selectedConnectionObject.SystemName; OrgUrl_txt.Text = selectedConnectionObject.URL; UserName_txt.Text = selectedConnectionObject.UserName; if (!UpdateConnection_btn.Visible || !UpdateConnection_btn.Enabled) { UpdateConnection_btn.Visible = true; UpdateConnection_btn.Enabled = true; } if (!listConnection_btn.Enabled) { listConnection_btn.Enabled = true; } }
void HandleIncomingData(ConnectionObject co, String data) { NetworkingMessage inmsg = NetworkingMessageTranslator.ParseMessage(data); if (inmsg.type == NetworkingMessageType.CLIENT_JOIN) { HandleJoin(co, inmsg); } if (inmsg.type == NetworkingMessageType.DISCONNECT) { HandleDisconnect(co, inmsg); } if (inmsg.type == NetworkingMessageType.CMDS) { HandlePlayerCommands(co, inmsg); } }
public void AcceptCallback(IAsyncResult ar) { Socket listener = (Socket)ar.AsyncState; Socket handler = listener.EndAccept(ar); handler.NoDelay = true; ConnectionObject sco = new ConnectionObject(handler); sco.socketConnected = true; Debug.Log("Listener made connection"); if (onNewConnectionCallback != null) { onNewConnectionCallback(sco); } Listen(); }