Ejemplo n.º 1
0
        private void createTransaction(string dataConnectProviders)
        {
            Connector _connector = new Connector(dataConnectProviders);

            if (String.IsNullOrEmpty(_connector.ConnectionString))
            {
                _connector.ConnectionString = "zstoreConnectionString";
            }
            string conString = "";

            if (_connector.RegistryKeyValue.ToLower() != "config" && _connector.RegistryKeyValue.ToUpper() != "CONNECTIONVAR")
            {
                conString = RegistryAccess.getRegistryKeyValue(_connector.RegistryKeyValue, _connector.ConnectionString);
            }
            else
            {
                conString = _connector.ConnectionString;
            }
            try
            {
                if (_connector.ProviderType == "PostgreSQL")
                {
                    NpgsqlConnection conn = new NpgsqlConnection(_connector.ConnectionString);
                    conn.Open();

                    dbConnect = conn;

                    Npgsql.NpgsqlTransaction _trans = conn.BeginTransaction();

                    _transaction = _trans;

                    _inTrans = true;
                }
                else
                {
                    DbProviderFactory dbFactory = DbProviderFactories.GetFactory(_connector.ProviderType);
                    dbConnect = dbFactory.CreateConnection();
                    dbConnect.ConnectionString = conString;
                    dbConnect.Open();


                    _transaction = dbConnect.BeginTransaction();
                    //transaction = new CommittableTransaction();
                    //dbConnect.EnlistTransaction(transaction);
                    _inTrans = true;
                }
            }
            catch (Exception ex)
            {
                this.SentEmail(conString, ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public DataFactory(string url, string providerType, string keyValue)
        {
            if (url.ToLower() != "config" && url.ToUpper() != "CONNECTIONVAR")
            {
                this._conString = RegistryAccess.getRegistryKeyValue(url, keyValue);
            }
            else
            {
                this._conString = keyValue;
            }

            this._providerType = providerType;
        }
Ejemplo n.º 3
0
        private static string getFile(string fileName)
        {
            string _path = "";

            if (System.Configuration.ConfigurationSettings.AppSettings["SQLConfigFromRegistry"] != null)
            {
                string _registryKey = System.Configuration.ConfigurationSettings.AppSettings["SQLConfigFromRegistry"];
                if (_registryKey.ToUpper() != "URL")
                {
                    _path = RegistryAccess.getRegistryKeyValue(_registryKey, "SqlConfigPath");
                }
                else
                {
                    _path = RegistryAccess.getRegistryKeyValue(WComm.Utilities.urlPath, "SqlConfigPath");
                }

                _path = _path + "\\" + fileName + ".Config";
            }
            else
            {
                if (HttpContext.Current != null)
                {
                    _path = "SQL\\" + fileName + ".Config";

                    try
                    {
                        _path = HttpContext.Current.Request.PhysicalApplicationPath + _path;
                    }
                    catch { }
                }
                else
                {
                    string assemblyFilePath = Assembly.GetExecutingAssembly().Location;

                    string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath);


                    _path = assemblyDirPath + "\\SQL\\" + fileName + ".Config";
                }
            }

            return(_path);
        }
Ejemplo n.º 4
0
 public DataFactory(string url, string providerType)
 {
     this._conString    = RegistryAccess.getRegistryKeyValue(url, "zstoreConnectionString");
     this._providerType = providerType;
 }