public ViewModelSelectConnection()
 {
     _connectionTypes = Enum.GetValues(typeof(ConnectionTypes)).Cast<ConnectionTypes>()
         .Where(t => t != HLU.Data.Connection.ConnectionTypes.Unknown).ToArray();
     object initVal = Enum.Parse(typeof(ConnectionTypes), Resources.DefaultConnectionType, true);
     if (initVal != null) _connectionType = (ConnectionTypes)initVal;
 }
示例#2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="update">
 /// Setting this to true will set values to improper ones.
 /// This so we know if we have Updated value or if we should ignore it</param>
 public TagInfo(bool update)
 {
     mode = 0;
     hubs_op = -1;
     hubs_normal = -1;
     hubs_regged = -1;
     slots = -1;
     tag = null;
     version = null;
 }
示例#3
0
 public SPOnlineConnection(ClientContext context, ConnectionTypes connectionType, int minimalHealthScore, int retryCount, int retryWait, PSCredential credential)
 {
     if (context == null)
         throw new ArgumentNullException("context");
     this.Context = context;
     this.ConnectionType = connectionType;
     this.MinimalHealthScore = minimalHealthScore;
     this.RetryCount = retryCount;
     this.RetryWait = retryWait;
     this.PSCredential = credential;
 }
 /// <summary>
 /// Gets the connection.
 /// </summary>
 /// <param name="connectionType">Type of the connection.</param>
 /// <returns></returns>
 public override IConnectionInformation GetConnection(ConnectionTypes connectionType)
 {
     switch (connectionType)
     {
         case ConnectionTypes.NotSpecified:
         case ConnectionTypes.Send:
             return new SqliteConnectionInformation(_sendQueue, _sendConnection);
         case ConnectionTypes.Receive:
             return new SqliteConnectionInformation(_receiveQueue, _receiveConnection);
     }
     throw new DotNetWorkQueueException($"unhandled type {connectionType}");
 }
示例#5
0
 public Connection(Proxy proxy, int id, IPEndPoint remoteEndPoint, ConnectionTypes connectionType)
 {
     // TODO: Complete member initialization
     _myProxy = proxy;
     _id = id;
     _remoteEndPoint = remoteEndPoint;
     _connectionType = connectionType;
     _mySecurity = new Security();
     _lockObject = new object();
     _buffer = new byte[4096];
     _ip = String.Empty;
     _port = 0;
 }
 /// <summary>
 /// Gets the connection.
 /// </summary>
 /// <param name="connectionType">Type of the connection.</param>
 /// <returns></returns>
 public override IConnectionInformation GetConnection(ConnectionTypes connectionType)
 {
     switch (connectionType)
     {
         case ConnectionTypes.NotSpecified:
         case ConnectionTypes.Send:
             return new BaseConnectionInformation(_queue, _connection);
         case ConnectionTypes.Receive:
             return new BaseConnectionInformation(string.Concat(_queue, "Response"), _connection);
         default:
             throw new DotNetWorkQueueException($"unhandled type {connectionType}");
     }
 }
 public ConnectionItem(int id, string name, string host, int connPort,
                       string username, string password,
                       ConnectionTypes connectionType, string defaultConnection)
     : this()
 {
     this.ID              = id;
     this.Name            = name;
     this.Host            = host;
     this.ConnPort        = connPort;
     this.Username        = username;
     this.Password        = password;
     this.ConnectionType  = connectionType;
     this.DefaultDatabase = defaultConnection;
 }
 public ConnectionItem(int id, string name, string host, int connPort, 
     string username, string password,
     ConnectionTypes connectionType, string defaultConnection)
     : this()
 {
     this.ID = id;
     this.Name = name;
     this.Host = host;
     this.ConnPort = connPort;
     this.Username = username;
     this.Password = password;
     this.ConnectionType = connectionType;
     this.DefaultDatabase = defaultConnection;
 }
示例#9
0
        internal static IOperable GetOperationBasedOnConnectionType(ConnectionTypes connectionType)
        {
            switch (connectionType)
            {
            case ConnectionTypes.MySQL:
                return(new MySqlOperation());

            case ConnectionTypes.MSSQL:
                return(new MsSqlOperation());

            default:
                return(new MsSqlOperation());
            }
        }
示例#10
0
 public UpdateStorehouseFields(ConnectionTypes connectionType)
 {
     InitializeComponent();
     materialSkinManager = MaterialSkin.MaterialSkinManager.Instance;
     materialSkinManager.EnforceBackcolorOnAllComponents = true;
     materialSkinManager.AddFormToManage(this);
     materialSkinManager.Theme       = MaterialSkin.MaterialSkinManager.Themes.LIGHT;
     materialSkinManager.ColorScheme = new MaterialSkin.ColorScheme(MaterialSkin.Primary.Indigo500,
                                                                    MaterialSkin.Primary.Indigo700, MaterialSkin.Primary.Indigo100, MaterialSkin.Accent.Pink200,
                                                                    MaterialSkin.TextShade.WHITE);
     TextBoxStatusId.ForeColor  = Color.Red;
     TextBoxStatusRId.ForeColor = Color.Red;
     this.connectionType        = connectionType;
 }
示例#11
0
 /// <summary>
 /// create a command interface
 /// </summary>
 /// <param name="query"></param>
 /// <param name="connection"></param>
 /// <param name="ConnectionType"></param>
 /// <returns></returns>
 public static IDbCommand CreateCommand(string query, IDbConnection connection, ConnectionTypes ConnectionType)
 {
     switch (ConnectionType)
     {
         case ConnectionTypes.SQLServer:
             return new SqlCommand(query, (SqlConnection)connection);
         case ConnectionTypes.Oracle:
             return new OracleCommand(query, (OracleConnection)connection);
         case ConnectionTypes.ODBC:
             return new OdbcCommand(query, (OdbcConnection)connection);
         default:
             return null;
     }
 }
示例#12
0
 /// <summary>
 /// creates a connection interface
 /// </summary>
 /// <param name="ConnectionString"></param>
 /// <param name="ConnectionType"></param>
 /// <returns></returns>
 public static IDbConnection CreateConnection(string ConnectionString, ConnectionTypes ConnectionType)
 {
     switch (ConnectionType)
     {
         case ConnectionTypes.SQLServer:
             return new SqlConnection(ConnectionString);
         case ConnectionTypes.Oracle:
             return new OracleConnection(ConnectionString);
         case ConnectionTypes.ODBC:
             return new OdbcConnection(ConnectionString);
         default:
             return null;
     }
 }
示例#13
0
        /// <summary>
        /// Gets the connection.
        /// </summary>
        /// <param name="connectionType">Type of the connection.</param>
        /// <returns></returns>
        public override IConnectionInformation GetConnection(ConnectionTypes connectionType)
        {
            switch (connectionType)
            {
            case ConnectionTypes.NotSpecified:
            case ConnectionTypes.Send:
                return(new BaseConnectionInformation(_queue, _connection));

            case ConnectionTypes.Receive:
                return(new BaseConnectionInformation(string.Concat(_queue, "Response"), _connection));

            default:
                throw new DotNetWorkQueueException($"unhandled type {connectionType}");
            }
        }
示例#14
0
 public SPOnlineConnection(ClientContext context, ConnectionTypes connectionType, int minimalHealthScore, int retryCount, int retryWait, PSCredential credential, string url)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     this.Context            = context;
     this._initialContext    = context;
     this.ConnectionType     = connectionType;
     this.MinimalHealthScore = minimalHealthScore;
     this.RetryCount         = retryCount;
     this.RetryWait          = retryWait;
     this.PSCredential       = credential;
     this.Url = url;
 }
示例#15
0
        public static IQuery BuildInsertAndGetId(IBaseBO bo, ConnectionTypes conn_type)
        {
            IQuery q = null;

            try
            {
                q = Build(bo, conn_type, QueryTypes.InsertAndGetId);
            }
            catch (Exception)
            {
                throw;
            }

            return(q);
        }
示例#16
0
        /// <summary>
        /// Creates the IConnection with given parameters.
        /// </summary>
        /// <param name="connectionType">Connection Type</param>
        /// <param name="connectionString">Connection String</param>
        public static IConnection Build(ConnectionTypes connectionType, string connectionString)
        {
            IConnection conn = null;

            try
            {
                conn = new Connection(connectionType, connectionString);
            }
            catch (Exception)
            {
                throw;
            }

            return(conn);
        }
示例#17
0
 public Neuron(int rank, int column, int length, NeuronTypes neuronType, ConnectionTypes connectionType, int maxSynapses = 0)
 {
     Key          = Guid.NewGuid().ToString();
     Rank         = rank;
     AxonLength   = length;
     Column       = column;
     m_NeuronType = neuronType;
     if (m_NeuronType == NeuronTypes.Interneuron)
     {
         IsEmptyNeuron = true;
     }
     ConnectionType = connectionType;
     Synapses       = new List <Synapse> ();
     MaxSynapses    = maxSynapses;
 }
示例#18
0
        public static IQuery BuildDelete(IBaseBO bo, ConnectionTypes conn_type)
        {
            IQuery q = null;

            try
            {
                q = Build(bo, conn_type, QueryTypes.Delete);
            }
            catch (Exception)
            {
                throw;
            }

            return(q);
        }
示例#19
0
        /// <summary>
        /// Returns a IDbConnection object instance.
        /// </summary>
        /// <param name="conType">Connection Type</param>
        /// <returns>Returns a IDbConnection object instance.</returns>
        public static IDbConnection GetConnection(ConnectionTypes conType)
        {
            try
            {
                switch (conType)
                {
                case ConnectionTypes.SqlExpress:
                    return(new SqlConnection());

                case ConnectionTypes.SqlServer:
                    return(new SqlConnection());

                case ConnectionTypes.EnterpriseDB:
                    return(new NpgsqlConnection());

                //throw new Exception();

                case ConnectionTypes.OleDb:
                    return(new OleDbConnection());

                case ConnectionTypes.FireBird:
                    return(new FbConnection());

                //throw new NotSupportedException("FireBirdSQL Driver is not supported.");

                case ConnectionTypes.Oracle:
                    return(new OracleConnection());

                //throw new NotSupportedException("Oracle Driver is not supported.");

                case ConnectionTypes.SQLite:
                    //    return new SQLiteConnection();
                    throw new NotSupportedException("SQLite Driver is not supported.");

                case ConnectionTypes.MySQL:
                    return(new MySqlConnection());

                //throw new NotSupportedException("MySQL Driver is not supported.");

                default:
                    throw new NotSupportedException("UnSupported Driver Type");
                }
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
示例#20
0
 /// <summary>
 /// protected ctor of BaseDL.
 /// </summary>
 /// <param name="connectionType">Connection Type.</param>
 /// <param name="connectionString">Connection String.</param>
 protected BaseDL(ConnectionTypes connectionType, string connectionString)
 {
     try
     {
         /*
          * conn_name = "from_driver";
          * this.Conn = ConnectionFactory.Build(connectionType, connectionString);
          * conn_type = this.Conn.ConnectionType;
          * conn_str = this.Conn.ConnectionString;
          */
     }
     catch (Exception e)
     {
         throw;
     }
 }
示例#21
0
        public static ClientConnectionBase CreateClientConnection(ConnectionTypes conType)
        {
            ClientConnectionBase client = null;

            switch (conType)
            {
            case ConnectionTypes.Sockets:
                client = new SocketClient(SocketHost, SocketPort);
                break;

            case ConnectionTypes.RabbitMQ:
                client = new MessageQueueClient(MQUserName, MQPassword, MQVirtualHost, MQHostName, MQPort, RpcQueueName);
                break;
            }
            return(client);
        }
示例#22
0
        public static ServerConnectionBase CreateServerConnection(ConnectionTypes conType)
        {
            ServerConnectionBase server = null;

            switch (conType)
            {
            case ConnectionTypes.Sockets:
                server = new SocketServer(SocketHost, SocketPort);
                break;

            case ConnectionTypes.RabbitMQ:
                server = new MessageQueueServer(MQUserName, MQPassword, MQVirtualHost, MQHostName, MQPort, RpcQueueName);
                break;
            }
            return(server);
        }
        private void SetConnection(ConnectionTypes connectionType)
        {
            switch (connectionType)
            {
            case ConnectionTypes.Memory:
                ConnectionString = ":memory:";
                break;

            case ConnectionTypes.Direct:
            case ConnectionTypes.Shared:
                var localPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
                _fileName        = localPath + "\\" + GenerateQueueName.CreateFileName();
                ConnectionString = connectionType == ConnectionTypes.Direct ? $"Filename={_fileName};Connection=direct;" : $"Filename={_fileName};Connection=shared;";
                break;
            }
        }
示例#24
0
        /// <summary>
        /// creates a connection interface
        /// </summary>
        /// <param name="ConnectionString"></param>
        /// <param name="ConnectionType"></param>
        /// <returns></returns>
        public static IDbConnection CreateConnection(string ConnectionString, ConnectionTypes ConnectionType)
        {
            switch (ConnectionType)
            {
            case ConnectionTypes.SQLServer:
                return(new SqlConnection(ConnectionString));

            case ConnectionTypes.Oracle:
                return(new OracleConnection(ConnectionString));

            case ConnectionTypes.ODBC:
                return(new OdbcConnection(ConnectionString));

            default:
                return(null);
            }
        }
示例#25
0
        public IConnectionSettings GetConnection(ConnectionTypes connectionType)
        {
            IConnectionSettings result = null;

            switch (connectionType)
            {
            case ConnectionTypes.FTP:
                result = new FtpConnectionSettings();
                break;

            default:
                result = new FtpConnectionSettings();
                break;
            }

            return(result);
        }
示例#26
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             ConnectionTypes lst = new ConnectionTypes(service);
             service.DropDownControl(lst);
             if (lst.SelectedType != null)
             {
                 value = lst.SelectedType;
             }
         }
     }
     return(value);
 }
示例#27
0
        private void ConnectionTypeRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = (RadioButton)sender;

            if (rb.Content.ToString() == "Network")
            {
                connectionType = ConnectionTypes.Network;
            }
            else if (rb.Content.ToString() == "UART")
            {
                connectionType = ConnectionTypes.UART;
            }
            else if (rb.Content.ToString() == "Bluetooth")
            {
                connectionType = ConnectionTypes.Bluetooth;
            }
        }
示例#28
0
        /// <summary>
        /// protected ctor of BaseDL.
        /// </summary>
        /// <param name="connectionName">connection property name</param>
        protected BaseDL(string connectionName)
        {
            try
            {
                conn_name   = connectionName;
                db_property = FreeConfiguration.BuildProperty(conn_name);

                this.Conn = ConnectionFactory.Build(db_property);

                conn_type = this.Conn.ConnectionType;
                //ConnectionTypeBuilder.GetConnectionType(db_property.ConnType);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#29
0
 //Изменить объект расчета
 private void ChangeCalc()
 {
     if (SelectedConnectionType != null)
     {
         int index = ConnectionTypes.IndexOf(SelectedConnectionType);
         MyCalculation = calc_list[index];
     }
     if (MyCalculation == null)
     {
         return;
     }
     MyCalculation.BoltQuantity          = BoltQuantity;
     MyCalculation.SelectedBolt          = SelectedBolt;
     MyCalculation.SelectedStrengthClass = SelectedStrengthClass;
     MyCalculation.GammaC = selected_item_gamma_c.Value;
     MyCalculation.Force  = Force;
 }
        private void DefaultWindowsSettings(object param)
        {
            ConnectionTypes connectionType = (ConnectionTypes)param;

            if (MessageBoxResult.No ==
                MessageBox.Show("Выполнить сброс настроек \"по умолчанию\" для "
                                + (connectionType == ConnectionTypes.FourWires?"4":"3")
                                + "-х проводного подключения?", Constants.messageBoxTitle, MessageBoxButton.YesNo,
                                MessageBoxImage.Question))
            {
                return;
            }

            if (connectionType == ConnectionTypes.FourWires)
            {
                _po3DeviceUnitWindowsSettings.Copy(new PO3DeviceUnitWindowsSettings(_po3DeviceUnitWindowsSettings.GetContainer()));
            }
            else
            {
                _po3DeviceUnitWindowsSettings.Copy(new PO3DeviceUnitWindowsSettings(_po3DeviceUnitWindowsSettings.GetContainer()));
                _po3DeviceUnitWindowsSettings.WindowsCount       = 4;
                _po3DeviceUnitWindowsSettings.DefaultWindowIndex = 0;

                _po3DeviceUnitWindowsSettings.Windows[0].FirstStringParameterIndex  = 3;
                _po3DeviceUnitWindowsSettings.Windows[0].SecondStringParameterIndex = 4;
                _po3DeviceUnitWindowsSettings.Windows[0].ThirdStringParameterIndex  = 5;
                _po3DeviceUnitWindowsSettings.Windows[0].AnalogBarParameterIndex    = 3;

                _po3DeviceUnitWindowsSettings.Windows[1].FirstStringParameterIndex  = 6;
                _po3DeviceUnitWindowsSettings.Windows[1].SecondStringParameterIndex = 26;
                _po3DeviceUnitWindowsSettings.Windows[1].ThirdStringParameterIndex  = 8;
                _po3DeviceUnitWindowsSettings.Windows[1].AnalogBarParameterIndex    = 6;

                _po3DeviceUnitWindowsSettings.Windows[2].FirstStringParameterIndex  = 18;
                _po3DeviceUnitWindowsSettings.Windows[2].SecondStringParameterIndex = 19;
                _po3DeviceUnitWindowsSettings.Windows[2].ThirdStringParameterIndex  = 20;
                _po3DeviceUnitWindowsSettings.Windows[2].AnalogBarParameterIndex    = 18;

                _po3DeviceUnitWindowsSettings.Windows[3].FirstStringParameterIndex  = 24;
                _po3DeviceUnitWindowsSettings.Windows[3].SecondStringParameterIndex = 25;
                _po3DeviceUnitWindowsSettings.Windows[3].ThirdStringParameterIndex  = 26;
                _po3DeviceUnitWindowsSettings.Windows[3].AnalogBarParameterIndex    = 24;
            }
            UpdateAllViewModelProperties();
        }
示例#31
0
        public static IQuery Build(IBaseBO bo, ConnectionTypes conn_type, QueryTypes query_type)
        {
            IQuery q = null;

            try
            {
                IQueryFormat qformat = new QueryFormat(query_type);
                IQueryAdds   adds    = new QueryAdds(conn_type);

                q = Build(bo, qformat, adds, query_type, conn_type);
            }
            catch (Exception)
            {
                throw;
            }

            return(q);
        }
示例#32
0
 public NetworkAvailableHelper()
 {
     NetworkInformation.NetworkStatusChanged += (s) =>
     {
         ConnectionProfile internetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();
         ConnectionTypes   conn = ConnectionTypes.None;
         if (internetConnectionProfile != null)
         {
             NetworkConnectivityLevel connectionLevel = internetConnectionProfile.GetNetworkConnectivityLevel();
             conn = (connectionLevel == NetworkConnectivityLevel.InternetAccess) ? ConnectionTypes.Internet : ConnectionTypes.LocalNetwork;
         }
         if (AvailabilityChanged != null)
         {
             try { AvailabilityChanged(conn); }
             catch { }
         }
     };
 }
        public static IEnumerable <CipherInstrumentParameters> GetParameters(TestContext ctx, InstrumentationCategory category)
        {
            switch (category)
            {
            case InstrumentationCategory.SelectClientCipher:
                return(SelectClientCipherTypes.Select(t => Create(ctx, category, t)));

            case InstrumentationCategory.SelectServerCipher:
                return(SelectServerCipherTypes.Select(t => Create(ctx, category, t)));

            case InstrumentationCategory.SelectCipher:
                return(ConnectionTypes.Select(t => Create(ctx, category, t)));

            default:
                ctx.AssertFail("Unsupported instrumentation category: '{0}'.", category);
                return(null);
            }
        }
示例#34
0
        public static Exception AddQuery(ConnectionTypes conType, string queryKey, string query)
        {
            if (DataQueries.Queries[conType] == null)
            {
                DataQueries.Queries[conType] = new Dictionary <string, string>();
            }

            if (!DataQueries.Queries[conType].ContainsKey(queryKey))
            {
                DataQueries.Queries[conType].Add(queryKey, query);
            }
            else
            {
                return(new Exception("This query aleady added for this connection type !"));
            }

            return(null);
        }
示例#35
0
        public static string GetConnectionSpeed(ConnectionTypes connectionType)
        {
            var resourceTypes = new Dictionary <string, string>
            {
                { "Unthrottled", "" },
                { "Cable", "5000/1000/30" },
                { "DSL", "1500/384/50" },
                { "Mobile3G", "1600/768/200" },
                { "Mobile2G", "240/200/400" },
                { "56K", "50/30/125" }
            };

            string value;

            resourceTypes.TryGetValue(connectionType.ToString(), out value);

            return(value);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConnectionViewModel" /> class.
        /// </summary>
        /// <param name="runtime">The runtime service.</param>
        /// <param name="connectionType">Type of the connection.</param>
        public ConnectionViewModel(IRuntimeService runtime, ConnectionTypes connectionType)
        {
            _log.Debug("Creating View Model");

            Runtime           = runtime;
            ConnectionType    = connectionType;
            ConnectionNames   = new string[0];
            IsEtpConnection   = connectionType == ConnectionTypes.Etp;
            DisplayName       = $"{ConnectionType.ToString().ToUpper()} Connection";
            CanTestConnection = true;

            SecurityProtocols = new BindableCollection <SecurityProtocolItem>
            {
                new SecurityProtocolItem(SecurityProtocolType.Tls12, "TLS 1.2"),
                new SecurityProtocolItem(SecurityProtocolType.Tls11, "TLS 1.1"),
                new SecurityProtocolItem(SecurityProtocolType.Tls, "TLS 1.0"),
                new SecurityProtocolItem(SecurityProtocolType.Ssl3, "SSL 3.0")
            };
        }
示例#37
0
        /// <summary>
        /// Returns Prefix for parameters according to Connection Type.
        /// </summary>
        /// <returns> Returns Prefix for parameters according to Connection Type.</returns>
        private string GetParameterPrefix(ConnectionTypes conn_type)
        {
            string _s = "";

            switch (conn_type)
            {
            case ConnectionTypes.DB2:
            case ConnectionTypes.OleDb:
            case ConnectionTypes.SqlExpress:
            case ConnectionTypes.SqlServer:
            case ConnectionTypes.VistaDB:
            case ConnectionTypes.SqlServerCe:
            case ConnectionTypes.MySQL:
            case ConnectionTypes.MariaDB:
            case ConnectionTypes.SQLite:
            case ConnectionTypes.PostgreSQL:
                _s = "@";
                break;

            case ConnectionTypes.OracleNet:
            case ConnectionTypes.OracleManaged:
            case ConnectionTypes.FireBird:
            case ConnectionTypes.SqlBase:
                _s = ":";
                break;

            case ConnectionTypes.Odbc:
            case ConnectionTypes.External:
                _s = "?";
                break;

            default:
            case ConnectionTypes.Informix:
            case ConnectionTypes.Ingres:
            case ConnectionTypes.Sybase:
            case ConnectionTypes.Synergy:
            case ConnectionTypes.U2:
                break;
                //return String.Empty;
            }

            return(_s);
        }
示例#38
0
        /// <summary>
        /// Creates IConnection object with given parameters.
        /// </summary>
        /// <param name="connType">Connection Type</param>
        /// <param name="connectionString">Connection String</param>
        /// <returns>Returns IConnection object.</returns>
        public static IConnection CreateConnection(ConnectionTypes connType, string connectionString)
        {
            IConnection conn = null;

            try
            {
                switch (connType)
                {
                case ConnectionTypes.DB2:
                    conn = new ConnectionDB2(connectionString);
                    break;

                case ConnectionTypes.Oracle:
                    conn = new ConnectionOracle(connectionString);
                    break;

                case ConnectionTypes.Oledb:
                    conn = new ConnectionOleDb(connectionString);
                    break;

                case ConnectionTypes.Odbc:
                    conn = new ConnectionOdbc(connectionString);
                    break;

                case ConnectionTypes.PgSQL:
                    conn = new ConnectionPgSql(connectionString);
                    break;

                case ConnectionTypes.Sql:
                    conn = new ConnectionSql(connectionString);
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return(conn);
        }
 /// <summary>
 ///		Guarda los datos del formulario en el modelo
 /// </summary>
 protected override void Save()
 {
     if (ValidateData())
     {
         // Asigna las propiedades
         Connection.Name        = Name;
         Connection.Description = Description;
         Connection.Type        = ConnectionTypes.GetSelectedItemTyped(DatabaseConnectionModel.DataBaseType.Odbc);
         // Limpia los datos de conexión
         Connection.ConnectionString   = string.Empty;
         Connection.Server             = string.Empty;
         Connection.Port               = 0;
         Connection.DataBase           = string.Empty;
         Connection.IntegratedSecurity = false;
         Connection.User               = string.Empty;
         Connection.Password           = string.Empty;
         Connection.FileName           = string.Empty;
         // Asigna los datos de la conexión
         if (Connection.IsServerConnection)
         {
             Connection.Server             = Server;
             Connection.Port               = Port;
             Connection.IntegratedSecurity = IntegratedSecurity;
             if (!IntegratedSecurity)
             {
                 Connection.User     = User;
                 Connection.Password = Password;
             }
             Connection.DataBase = DataBase;
         }
         else if (Connection.UseConnectionString)
         {
             Connection.ConnectionString = ConnectionString;
         }
         else if (Connection.Type == DatabaseConnectionModel.DataBaseType.SqLite)
         {
             Connection.FileName = FileName;
         }
         // Lanza el evento de cerrar
         RaiseEventClose(true);
     }
 }
示例#40
0
        public ControllerViewModel(ISendService sendService, ServiceInstaller serviceInstaller, string controllerId, string controllerName, ConnectionTypes connection)
        {
            this.sp = sendService;
            this.si = serviceInstaller;

            this.BatteryValue = -1;
            this.ControllerId = controllerId;
            this.ControllerName = controllerName;
            this.ControllerUsbChecked = connection == ConnectionTypes.USB;
            this.ControllerBtChecked = connection == ConnectionTypes.Bluetooth;

            if (ControllerUsbChecked)
            {
                ExecuteUsbChange();
            }
            else
            {
                ExecuteBtChange();
            }
        }
示例#41
0
        public static DbBase CreateConnection()
        {
            if (Enum.IsDefined(typeof(ConnectionTypes), Settings.Default.DbConnectionType))
                _connType = (ConnectionTypes)Settings.Default.DbConnectionType;
            else
                _connType = ConnectionTypes.Unknown;

            string connString = Settings.Default.DbConnectionString;
            string defaultSchema = Settings.Default.DbDefaultSchema;
            bool promptPwd = Settings.Default.DbPromptPwd;

            if ((_connType == ConnectionTypes.Unknown) || String.IsNullOrEmpty(connString) ||
                ((DbBase.GetBackend(connString, _connType) != Backends.Access) && String.IsNullOrEmpty(defaultSchema)))
            {
                promptPwd = false;
                SelectConnectionType();
            }

            if (_connType == ConnectionTypes.Unknown) return null;

            DbBase db = null;

            switch (_connType)
            {
                case ConnectionTypes.ODBC:
                    db = new DbOdbc(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone,
                        Settings.Default.DbTextLength, Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.OleDb:
                    db = new DbOleDb(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.Oracle:
                    db = new DbOracle(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.PostgreSQL:
                    db = new DbPgSql(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
                case ConnectionTypes.SQLServer:
                    db = new DbSqlServer(ref connString, ref defaultSchema, ref promptPwd,
                        Properties.Resources.PasswordMaskString, Settings.Default.UseAutomaticCommandBuilders,
                        true, Settings.Default.DbIsUnicode, Settings.Default.DbUseTimeZone, Settings.Default.DbTextLength,
                        Settings.Default.DbBinaryLength, Settings.Default.DbTimePrecision,
                        Settings.Default.DbNumericPrecision, Settings.Default.DbNumericScale);
                    break;
            }

            if (db != null)
            {
                Settings.Default.DbConnectionType = (int)_connType;
                Settings.Default.DbConnectionString = connString;
                Settings.Default.DbDefaultSchema = defaultSchema;
                Settings.Default.DbPromptPwd = promptPwd;
                Settings.Default.Save();
            }

            return db;
        }
示例#42
0
        private static void _selConnViewModel_RequestClose(ConnectionTypes connType, string errorMsg)
        {
            _selConnViewModel.RequestClose -= _selConnViewModel_RequestClose;
            _selConnWindow.Close();

            if (!String.IsNullOrEmpty(errorMsg))
                MessageBox.Show(errorMsg, "Connection Type", MessageBoxButton.OK, MessageBoxImage.Error);

            _connType = connType;
        }
        /// <summary>
        /// Allows the transport to set default configuration settings or other values
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="connectionType">Type of the connection.</param>
        public override void SetDefaultsIfNeeded(IContainer container, RegistrationTypes registrationType, ConnectionTypes connectionType)
        {
            var factory = container.GetInstance<ISqLiteMessageQueueTransportOptionsFactory>();
            var options = factory.Create();
            var configurationSend = container.GetInstance<QueueProducerConfiguration>();
            var configurationReceive = container.GetInstance<QueueConsumerConfiguration>();

            configurationSend.AdditionalConfiguration.SetSetting("SQLiteMessageQueueTransportOptions", options);
            configurationReceive.AdditionalConfiguration.SetSetting("SQLiteMessageQueueTransportOptions", options);

            var transportReceive = container.GetInstance<TransportConfigurationReceive>();


            transportReceive.HeartBeatSupported = options.EnableHeartBeat && options.EnableStatus;

            transportReceive.MessageExpirationSupported = options.EnableMessageExpiration ||
                                                          options.QueueType == QueueTypes.RpcReceive ||
                                                          options.QueueType == QueueTypes.RpcSend;

            transportReceive.MessageRollbackSupported = options.EnableStatus;

            transportReceive.QueueDelayBehavior.Clear();
            transportReceive.QueueDelayBehavior.Add(DefaultQueueDelay());
            transportReceive.FatalExceptionDelayBehavior.Clear();
            transportReceive.FatalExceptionDelayBehavior.Add(ExceptionDelay());

            transportReceive.LockFeatures();

            SetupHeartBeat(container);
            SetupMessageExpiration(container);

            //create in memory hold
            var connection = container.GetInstance<IConnectionInformation>();
            var fileName = GetFileNameFromConnectionString.GetFileName(connection.ConnectionString);
            if(fileName.IsInMemory)
            {
                var scope = container.GetInstance<ICreationScope>();
                var holder = new SqLiteHoldConnection();
                holder.AddConnectionIfNeeded(connection);
                scope.AddScopedObject(holder);
            }
        }
示例#44
0
        /// <summary>
        /// Manual connect constructor.
        /// </summary>
        /// <param name="akaName">The AKA name of the OpenROAD remote server object.</param>
        /// <param name="location">The Location of the OpenROAD Remote Server Object.</param>
        /// <param name="routing">The Routing of the OpenROAD Remote Server Object.</param>
        /// <param name="keepConnected"></param>
        public BaseFacade(string akaName, string location, string routing, string flags, ConnectionTypes connectionType, bool keepConnected)
        {
            //Validate - AKA Name is mandatory.
            if (akaName == null || akaName == String.Empty)
            {
                throw new SCPConnectException(Constants.INVALID_AKA_NAME_EXCEPTION_MESSAGE);
            }

            InitialiseClass();

            if (location == null)
            {
                location = System.Environment.MachineName;
            }

            if (routing == null)
            {
                routing = String.Empty;
            }

            AKAName     = akaName;
            Location    = location;
            Routing     = routing;
            Flags       = flags;
            ConnectionType = connectionType;

            ORSession   = new ORASOSessionClass();

            alreadyConnected = keepConnected;

            //We now have enough info for a connect;
            Connect();
        }
        /// <summary>
        /// Allows the transport to set default configuration settings or other values
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="connectionType">Type of the requested connection.</param>
        public virtual void SetDefaultsIfNeeded(IContainer container, RegistrationTypes registrationType, ConnectionTypes connectionType)
        {

        }
 /// <summary>
 /// Gets the connection.
 /// </summary>
 /// <param name="connectionType">Type of the connection.</param>
 /// <returns></returns>
 public abstract IConnectionInformation GetConnection(ConnectionTypes connectionType);
示例#47
0
        /// <summary>
        /// Allows the transport to set default configuration settings or other values
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="connectionType">Type of the connection.</param>
        public override void SetDefaultsIfNeeded(IContainer container, RegistrationTypes registrationType, ConnectionTypes connectionType)
        {
            var options = container.GetInstance<RedisQueueTransportOptions>();
            var configurationSend = container.GetInstance<QueueProducerConfiguration>();
            var configurationReceive = container.GetInstance<QueueConsumerConfiguration>();

            configurationSend.AdditionalConfiguration.SetSetting("RedisQueueTransportOptions", options);
            configurationReceive.AdditionalConfiguration.SetSetting("RedisQueueTransportOptions", options);

            var transportReceive = container.GetInstance<TransportConfigurationReceive>();
            transportReceive.HeartBeatSupported = true;
            transportReceive.MessageExpirationSupported = true;
            transportReceive.MessageRollbackSupported = true;

            transportReceive.QueueDelayBehavior.Clear();
            transportReceive.QueueDelayBehavior.Add(DefaultQueueDelay());
            transportReceive.FatalExceptionDelayBehavior.Clear();
            transportReceive.FatalExceptionDelayBehavior.Add(ExceptionDelay());

            options.TimeServer = TimeLocations.RedisServer;

            transportReceive.LockFeatures();

            SetupHeartBeat(container);
            SetupMessageExpiration(container);

            //only compile scripts if the container is not in verification mode
            if (!container.IsVerifying)
            {
                SetupScripts(container);
            }
        }
示例#48
0
 /// <summary>
 /// Manual connect constructor.
 /// </summary>
 /// <param name="akaName">The AKA name of the OpenROAD remote server object.</param>
 /// <param name="location">The location of the OpenROAD remote server object.</param>
 /// <param name="routing">The routing of the OpenROAD remote server object.</param>
 public BaseFacade(string akaName, string location, string routing, string flags, ConnectionTypes connectionType)
     : this(akaName, location, routing, flags, connectionType, false)
 {
 }
        /// <summary>
        /// Allows the transport to set default configuration settings or other values
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="connectionType">Type of the connection.</param>
        public override void SetDefaultsIfNeeded(IContainer container, RegistrationTypes registrationType, ConnectionTypes connectionType)
        {
            var factory = container.GetInstance<IPostgreSqlMessageQueueTransportOptionsFactory>();
            var options = factory.Create();
            var configurationSend = container.GetInstance<QueueProducerConfiguration>();
            var configurationReceive = container.GetInstance<QueueConsumerConfiguration>();

            configurationSend.AdditionalConfiguration.SetSetting("PostgreSQLMessageQueueTransportOptions", options);
            configurationReceive.AdditionalConfiguration.SetSetting("PostgreSQLMessageQueueTransportOptions", options);

            var transportReceive = container.GetInstance<TransportConfigurationReceive>();


            transportReceive.HeartBeatSupported = options.EnableHeartBeat && options.EnableStatus &&
                                                  !options.EnableHoldTransactionUntilMessageCommited;

            transportReceive.MessageExpirationSupported = options.EnableMessageExpiration ||
                                                          options.QueueType == QueueTypes.RpcReceive ||
                                                          options.QueueType == QueueTypes.RpcSend;

            transportReceive.MessageRollbackSupported = options.EnableStatus ||
                                                        options.EnableHoldTransactionUntilMessageCommited;

            transportReceive.QueueDelayBehavior.Clear();
            transportReceive.QueueDelayBehavior.Add(DefaultQueueDelay());
            transportReceive.FatalExceptionDelayBehavior.Clear();
            transportReceive.FatalExceptionDelayBehavior.Add(ExceptionDelay());

            transportReceive.LockFeatures();

            SetupHeartBeat(container);
            SetupMessageExpiration(container);
        }
示例#50
0
        private void HubTest(string protocol, ConnectionTypes connectionType)
        {
            _settings.Protocol = protocol;

            _hubConnection = new Hub(_settings, this);
            _hubConnection.ProtocolChange += new FmdcEventHandler(hubConnection_ProtocolChange);

            // We need to have a share
            _hubConnection.Share = new Share("temp");

            _hubConnection.Me.TagInfo.Mode = connectionType;

            _hubConnection.Connect();

            //Thread thread = new Thread(new ThreadStart(AutoDownloadNewStuff));
            //thread.IsBackground = true;
            //thread.Start();

            int i = 0;
            while (!_isFinished && i++ < _testTimeoutLength)
            {
                Thread.Sleep(500);
            }

            // Close all open threads
            //thread.Abort();
            _hubConnection.Disconnect("Test time exceeded");
            _hubConnection.Dispose();
        }