Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
    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");
        }
    }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
    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);
        }
    }
Ejemplo n.º 6
0
        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)

                );
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
    private void SendCallback(IAsyncResult ar)
    {
        ServerSendObject sso = (ServerSendObject)ar.AsyncState;
        ConnectionObject co  = sso.co;
        int bytesSent        = co.socket.EndSend(ar);

        sso.cb?.Invoke(co);
    }
Ejemplo n.º 10
0
        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")));
 }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
    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);
    }
Ejemplo n.º 15
0
 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"));
     }
 }
Ejemplo n.º 16
0
        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!"));
        }
Ejemplo n.º 18
0
		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;
			}
		}
Ejemplo n.º 19
0
    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);
    }
Ejemplo n.º 20
0
        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
            {
            }
        }
Ejemplo n.º 21
0
        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}");
            }
        }
Ejemplo n.º 22
0
        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));
        }
Ejemplo n.º 23
0
        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;
                }
            }
        }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        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));
        }
Ejemplo n.º 26
0
        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"));
        }
Ejemplo n.º 27
0
 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;
     }
 }
Ejemplo n.º 28
0
    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);
    }
Ejemplo n.º 29
0
        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;
            }
        }
Ejemplo n.º 30
0
    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);
        }
    }
Ejemplo n.º 31
0
    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();
    }