Exemplo n.º 1
0
        public void Initialize(IDatabaseHandler dbHandler)
        {
            GlobalContext = new Context(1);
            ValkWFStepPoller.PollContext = GlobalContext;
            ValkWFActivator.ActContext = GlobalContext;
            ValkQueueWFSteps.QueueContext = GlobalContext;
            //setup our inprocess communication
            ActivatorControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            ActivatorControlIntraComm.Bind("inproc://activatorcontrol");
            //poller requires activator, goes after
            PollerControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            PollerControlIntraComm.Bind("inproc://pollercontrol");

            QueueControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            QueueControlIntraComm.Bind("inproc://queuecontrol");

            //anonymous function to pass in dbhandler without parameterizedthreadstart obscurities
            WFStepQueue = new Thread(() => ValkQueueWFSteps.RunQueue(dbHandler));
            WFStepQueue.Start();

            Activator = new Thread(() => ValkWFActivator.ActivateResponder(dbHandler));
            Activator.Start();

            Poller = new Thread(() => ValkWFStepPoller.StartPolling(dbHandler));
            Poller.Start();
        }
Exemplo n.º 2
0
        protected ServerConnector(IDatabaseHandler databaseHandler)
        {
            DatabaseHandler = databaseHandler;

            resultMap = new Dictionary<int, QueryResult>();
            uniqueResultId = -1;
        }
Exemplo n.º 3
0
        protected ServerConnector(IDatabaseHandler databaseHandler)
        {
            DatabaseHandler = databaseHandler;

            resultMap      = new Dictionary <int, QueryResult>();
            uniqueResultId = -1;
        }
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;

            switch (this._databaseConnectionParams.GetProvider())
            {
            case DatabaseConenctionProviders.SQLServerProvider:
                database = new SqlDataAccess(this._databaseConnectionParams.GetConnectionString());
                break;

            case DatabaseConenctionProviders.MySQLProvider:
                database = new MySqlDataAccess(this._databaseConnectionParams.GetConnectionString());
                break;

            case DatabaseConenctionProviders.PostgreSQLProvider:
                database = new PostgresDataAccess(this._databaseConnectionParams.GetConnectionString());
                break;

            default:
                database = new SqlDataAccess(this._databaseConnectionParams.GetConnectionString());
                break;
            }

            return(database);
        }
Exemplo n.º 5
0
        public static void RunDBHandler(IDatabaseHandler _dbHandler)
        {
            dbHandler = _dbHandler;
            //if the DB handler is ever moved outside of this process, it should be responsible for bind
            // rather than this connect
            QueueDBHandlerComm = DBHandlerContext.Socket(SocketType.REP);
            QueueDBHandlerComm.Connect("inproc://dbhandler");

            PollItem[] ControlPoller = new PollItem[1];
            ControlPoller[0] = QueueDBHandlerComm.CreatePollItem(IOMultiPlex.POLLIN);
            ControlPoller[0].PollInHandler += new PollHandler(ValkQueueDBHandler_PollInHandler);

            Stopwatch Watch = new Stopwatch();

            TotalWatch.Start();
            Watch.Start();
            while (!Exit)
            {
                //reasonable to block for a second
                DBHandlerContext.Poll(ControlPoller, 1000);
                //get 5 seconds worth of DB entries
                if (StepsToUpdate.Count > 0 && (Watch.Elapsed.Seconds >= 5 || StepsToUpdate.Count > 1000))
                {
                    TotalSteps += StepsToUpdate.Count();
                    Console.WriteLine(StepsToUpdate.Count.ToString() + "," + Watch.Elapsed.TotalSeconds + "," + TotalSteps + "," + TotalWatch.Elapsed.TotalSeconds);
                    DoUpdates();
                    Watch.Stop();
                    Watch.Reset();
                    Watch.Start();
                }
            }
        }
Exemplo n.º 6
0
        public IDatabaseHandler CreateDatabase(string providerName)
        {
            IDatabaseHandler database = null;

            switch (providerName.ToLower())
            {
            case "system.data.sqlclient":
                database = new SqlDataAccess(connectionStringSettings);
                break;

            case "system.data.oracleclient":
                database = new OracleDataAccess(connectionStringSettings);
                break;

            case "system.data.oleDb":
                database = new OledbDataAccess(connectionStringSettings);
                break;

            case "system.data.odbc":
                database = new OdbcDataAccess(connectionStringSettings);
                break;
            }

            return(database);
        }
Exemplo n.º 7
0
        public void Initialize(IDatabaseHandler dbHandler)
        {
            GlobalContext = new Context(1);
            ValkWFStepPoller.PollContext  = GlobalContext;
            ValkWFActivator.ActContext    = GlobalContext;
            ValkQueueWFSteps.QueueContext = GlobalContext;
            //setup our inprocess communication
            ActivatorControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            ActivatorControlIntraComm.Bind("inproc://activatorcontrol");
            //poller requires activator, goes after
            PollerControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            PollerControlIntraComm.Bind("inproc://pollercontrol");

            QueueControlIntraComm = GlobalContext.Socket(SocketType.REQ);
            QueueControlIntraComm.Bind("inproc://queuecontrol");

            //anonymous function to pass in dbhandler without parameterizedthreadstart obscurities
            WFStepQueue = new Thread(() => ValkQueueWFSteps.RunQueue(dbHandler));
            WFStepQueue.Start();

            Activator = new Thread(() => ValkWFActivator.ActivateResponder(dbHandler));
            Activator.Start();

            Poller = new Thread(() => ValkWFStepPoller.StartPolling(dbHandler));
            Poller.Start();
        }
Exemplo n.º 8
0
 public IDBManager SetUpDataBase(string connectionStringName)
 {
     dbFactory    = new DatabaseHandlerFactory(connectionStringName, Configuration);
     database     = dbFactory.CreateDatabase();
     providerName = dbFactory.GetProviderName();
     return(this);
 }
Exemplo n.º 9
0
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;

            database = new SqlDataAccess(connectionStringSettings.ConnectionString);

            return(database);
        }
Exemplo n.º 10
0
        public void SetUp()
        {
            _communicationInterface = Substitute.For<ICommunicationInterface>();
            _databaseHandler = Substitute.For<IDatabaseHandler>();
            _configProvider = Substitute.For<IConfigprovider>();

            _main = new DbWriterMain(_communicationInterface, _databaseHandler, _configProvider);
        }
Exemplo n.º 11
0
        public TicketController(IDatabaseHandler databaseHandler)
        {
            db = databaseHandler;

            if (db.GetAllSerialNumbers().Count() < 1)
            {
                db.GenerateSerialNumbers();
            }
        }
Exemplo n.º 12
0
        protected ServerConnector(IDatabaseHandler handler)
        {
            if (handler == null)
                throw new ArgumentNullException("handler");

            DatabaseHandler = handler;
            resultMap = new Dictionary<int, QueryResult>();
            blobIdMap = new Dictionary<long, IRef>();
            uniqueResultId = 1;
        }
Exemplo n.º 13
0
        public static async Task <CardDocument> CreateBasedOnWordAsync(IDatabaseHandler mongoHandler, string word)
        {
            if (mongoHandler == null)
            {
                throw new ArgumentNullException("Mongo Handler is Null");
            }

            long id = await mongoHandler.GenerateNewId();

            return(new CardDocument((ulong)id, word));
        }
        /// <summary>
        /// createDatabase
        /// </summary>
        /// <returns></returns>
        public IDatabaseHandler createDatabase()
        {
            IDatabaseHandler database = null;

            switch (connectionStringSettings.ProviderName.ToLower())
            {
            case "system.data.sqlclient":
                database = new SQLDataAccess(connectionStringSettings.ConnectionString);
                break;
            }
            return(database);
        }
        protected ServerConnector(IDatabaseHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            DatabaseHandler = handler;
            resultMap       = new Dictionary <int, QueryResult>();
            blobIdMap       = new Dictionary <long, IRef>();
            uniqueResultId  = 1;
        }
Exemplo n.º 16
0
 void Database_OnDatabaseHandlerLoaded(IDatabaseHandler source)
 {
     source.OnInitialise += new InterruptableEventHandler(DatabaseHandler_OnInitialise);
     foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(IFileManagerDataLayer)))
     {
         IFileManagerDataLayer layer = (IFileManagerDataLayer)Activator.CreateInstance(t);
         if (layer.DatabaseHandlerType == source.GetType())
         {
             dataLayer = layer;
             break;
         }
     }
 }
Exemplo n.º 17
0
 void DatabaseManager_OnDatabaseHandlerLoaded(IDatabaseHandler source)
 {
     foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(IMerchantDataProvider)))
     {
         IMerchantDataProvider dp = (IMerchantDataProvider)Activator.CreateInstance(t);
         if (dp.DatabaseHandlerType == source.GetType())
         {
             dataProvider = dp;
             break;
         }
     }
     source.OnInitialise += new InterruptableEventHandler(Database_OnInitialise);
 }
Exemplo n.º 18
0
 public PlutusService(
     IBinanceHandler binanceHandler,
     IOrdersLoader ordersLoader,
     ILogger logger,
     ITAHandler taHandler,
     IDatabaseHandler databaseHandler)
 {
     _binanceHandler  = binanceHandler;
     Orders           = ordersLoader.Orders;
     _logger          = logger;
     _taHandler       = taHandler;
     _databaseHandler = databaseHandler;
 }
		void DatabaseManager_OnDatabaseHandlerLoaded(IDatabaseHandler source)
		{
			source.OnInitialise += new InterruptableEventHandler(DatabaseHandler_OnInitialise);
			foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(IForumDataHandler)))
			{
				IForumDataHandler dal = (IForumDataHandler)Activator.CreateInstance(t);
				if (dal.DatabaseHandlerType == source.GetType())
				{
					dataLayer = dal;
					break;
				}
			}
		}
 private void DatabaseManager_OnDatabaseHandlerLoaded(IDatabaseHandler source)
 {
     source.OnInitialise += new InterruptableEventHandler(source_OnInitialise);
     foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(T)))
     {
         T provider = (T)Activator.CreateInstance(t);
         if (provider.DatabaseHandlerType == source.GetType())
         {
             dataProvider = provider;
             break;
         }
     }
 }
Exemplo n.º 21
0
        public QuestionController(IStartupTimeStore store, IDatabaseHandler db, IServiceCommunication srvCom)
        {
            Store   = store;
            _db     = db;
            _srvCom = srvCom;

            if (_question == null)
            {
                var dbQuestion = _db.GetQuestion();
                _question      = new Question(dbQuestion);
                _rightAnswerId = dbQuestion.RightAnswerIndex;
            }
        }
		void Instance_OnDatabaseHandlerLoaded(IDatabaseHandler source)
		{
			source.OnInitialise += new InterruptableEventHandler(Database_OnInitialise);
			foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(ISecurityProviderDataLayer)))
			{
				ISecurityProviderDataLayer layer = (ISecurityProviderDataLayer)Activator.CreateInstance(t);
				if (layer.DatabaseHandlerType == source.GetType())
				{
					dataLayer = layer;
					break;
				}
			}
		}
Exemplo n.º 23
0
        private static void LoadChildren(ValkWFStep CurrentStep, IDatabaseHandler dbHandler)
        {
            List <ValkWFStep> Children = dbHandler.LoadChildSteps(CurrentStep);

            //do children loading outside, here
            for (int i = 0; i < Children.Count(); i++)
            {
                ValkWFStep substep = Children[i];
                LoadChildren(substep, dbHandler);
                Children[i] = substep;
            }
            CurrentStep.NextSteps = Children;
        }
Exemplo n.º 24
0
        // INIZIALIZZA LA DLL
        public bool Init(string IdCampagna, string NomeCampagna, TDictionary contactStateConstants)
        {
            try
            {
                Logger.Instance().WriteTrace(String.Format("Init: Begin - Service : {0}", NomeCampagna));

                this.IdCampagna   = IdCampagna;
                this.NomeCampagna = NomeCampagna;

                FillDictionary(contactStateConstants);



                Logger.Instance().WriteTrace(String.Format("Init: Fill Dictionary : {0}", contactStateConstants.ToString()));


                //Creation of proper DatabaseHandler, depending on .ini Configuration

                dbHandler = new DatabaseMYSQLHandler();


                dbHandler.ConnectionString = Properties.Settings.Default.ConnectionString;// "Server=localhost;Database=cprovider;Uid=root;Pwd=root";
                dbHandler.ContactTable     = "cpanagra";
                dbHandler.DbName           = "csfil";
                dbHandler.NomeCampagna     = this.NomeCampagna;
                dbHandler.IdCampagna       = this.IdCampagna;


                //Opening db Connection
                if (dbHandler.OpenConnection())
                {
                    dbHandler.CountContacts();
                    dbHandler.DatabaseRefreshed = true;
                }
                else
                {
                    Logger.Instance().WriteTrace(String.Format("INIT: Errors occured. Closing ContactProvider Istance for Service : {0}", NomeCampagna));
                    return(false);
                }


                Logger.Instance().WriteTrace(string.Format("INIT: End - Service {0}", this.NomeCampagna));
                return(true);
            }
            catch (Exception e)
            {
                Logger.Instance().WriteTrace(string.Format("INIT: Exception occured. Closing ContactProvider Istance for Service {0}. Exception text: {1}", this.NomeCampagna, e.Message + "::" + e.InnerException));
                return(false);
            }
        }
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;

            switch (connectionStringSettings.ProviderName.ToLower())
            {
            case "mysql.data.mysqlclient":
                database = new MySqlDataAccess(connectionStringSettings.ConnectionString);
                break;

            default:
                break;
            }
            return(database);
        }
Exemplo n.º 26
0
        private static void LoadWorkflowTemplates(IDatabaseHandler dbHandler)
        {
            //WorkFlowTemplates
            //list to store loads to help reduce recursive SQL queries
            WFTemplateLoadingData loadingData = dbHandler.LoadWFTemplates();

            LoadedActiveInstanceByType = loadingData.LoadedActiveInstanceByType;
            for (int i = 0; i < loadingData.WFsToLoad.Count(); i++)
            {
                ValkWFStep CurrentStep = loadingData.WFsToLoad[i];
                LoadChildren(CurrentStep, dbHandler);
                loadingData.WFsToLoad[i] = CurrentStep;
                LoadedInstanceTemplates[loadingData.WFsToLoad[i].WFTemplateID] = loadingData.WFsToLoad[i];
            }
            Console.WriteLine("Workflows Loaded");
        }
Exemplo n.º 27
0
        void Core_OnInitialise(Dictionary <Type, List <Type> > interfaceImplementations)
        {
            // need to check web.config to see which database registration name to use
            // instantiate that Type, if found, or throw an error
            // raise a notification event specifying the ISqlDatabase object we're using
            // add an event to this module OnCheckDatabaseStructure, which will eliminate the need for IDataHandlerModule
            if (interfaceImplementations.ContainsKey(typeof(IDatabaseHandler)))
            {
                string databaseEngine = SprocketSettings.GetValue("DatabaseEngine");
                if (databaseEngine == null)
                {
                    return;
                }

                foreach (Type t in interfaceImplementations[typeof(IDatabaseHandler)])
                {
                    if (t.Name == databaseEngine)
                    {
                        dbHandler = (IDatabaseHandler)Activator.CreateInstance(t);
                        Result result = dbHandler.CheckConfiguration();
                        if (!result.Succeeded)
                        {
                            SprocketSettings.Errors.Add(this, result.Message);
                            SprocketSettings.Errors.SetCriticalError();
                            return;
                        }
                        if (OnDatabaseHandlerLoaded != null)
                        {
                            OnDatabaseHandlerLoaded(dbHandler);
                        }
                        return;
                    }
                }

                List <string> list = new List <string>();
                foreach (Type t in interfaceImplementations[typeof(IDatabaseHandler)])
                {
                    list.Add(t.Name);
                }
                SprocketSettings.Errors.Add(this, "The application settings (.config) file requires a valid value for \"DatabaseEngine\".");
                SprocketSettings.Errors.Add(this, "Current valid values for DatabaseEngine are: " + StringUtilities.CommaJoin(list));
                SprocketSettings.Errors.SetCriticalError();
            }
        }
Exemplo n.º 28
0
        public static void RunQueue(IDatabaseHandler dbHandler)
        {
            if (QueueContext == null)
            {
                throw new System.Exception("PollContext not set");
            }
            QueueComm = QueueContext.Socket(SocketType.REP);
            //Bind the comm to an inprocess channel and a TCP channel
            QueueComm.Bind("tcp://*:5000");
            QueueComm.Bind("inproc://queueself");
            QueueControllerIntraComm = QueueContext.Socket(SocketType.REP);
            QueueControllerIntraComm.Connect("inproc://queuecontrol");

            //if the DB handler is ever moved outside of this process, it should be responsible for bind
            // rather than this class
            QueueDBHandlerComm = QueueContext.Socket(SocketType.REQ);
            QueueDBHandlerComm.Bind("inproc://dbhandler");


            PollItem[] ControlPoller = new PollItem[1];
            ControlPoller[0] = QueueControllerIntraComm.CreatePollItem(IOMultiPlex.POLLIN);
            ControlPoller[0].PollInHandler += new PollHandler(ValkQueueWFStepsCTRL_PollInHandler);
            PollItem[] QueuePoller = new PollItem[1];
            QueuePoller[0] = QueueComm.CreatePollItem(IOMultiPlex.POLLIN);
            QueuePoller[0].PollInHandler += new PollHandler(ValkQueueWFSteps_PollInHandler);

            //setup DB handler
            ValkQueueDBHandler.DBHandlerContext = QueueContext;
            DBHandler = new Thread(() => ValkQueueDBHandler.RunDBHandler(dbHandler));
            DBHandler.Start();


            //main loop
            while (!Exit)
            {
                //we may want a way to shut this down...
                QueueContext.Poll(ControlPoller, 1);
                if (!Stop)
                {
                    //block for a little while...
                    QueueContext.Poll(QueuePoller, 1000);
                }
            }
        }
        public IDatabaseHandler CreateDatabaseHandler()
        {
            IDatabaseHandler dbHandler = null;

            switch (connectionStringSettings.ProviderName)
            {
            case "System.Data.SqlClient":
                dbHandler = new SqlDataAccess(this.connectionStringSettings.ConnectionString);
                break;

            case "System.Data.OdbcClient":
                dbHandler = new OdbcDataAccess(this.connectionStringSettings.ConnectionString);
                break;

            default:
                break;
            }
            return(dbHandler);
        }
Exemplo n.º 30
0
 public static bool InitHandlers(
     IDatabaseHandler DataBaseHandler,
     IAccountHandler AccountHandler,
     IUserHandler UserHandler,
     string SystemLocation)
 {
     if (databaseHandler == null)
     {
         databaseHandler = DataBaseHandler;
     }
     if (accountHandler == null)
     {
         accountHandler = AccountHandler;
     }
     if (userHandler == null)
     {
         userHandler = UserHandler;
     }
     _SystemLocation = SystemLocation;
     return(true);
 }
Exemplo n.º 31
0
        public static void StartPolling(IDatabaseHandler dbHandler)
        {
            if (PollContext == null)
            {
                throw new System.Exception("PollContext not set");
            }
            //  Prepare our sockets
            PollerControlIntraComm = PollContext.Socket(SocketType.REP);
            PollerControlIntraComm.Connect("inproc://pollercontrol");

            ActivatorIntraComm = PollContext.Socket(SocketType.REQ);
            ActivatorIntraComm.Connect("inproc://activator");

            PollItem[] Poller = new PollItem[1];
            Poller[0] = PollerControlIntraComm.CreatePollItem(IOMultiPlex.POLLIN);
            Poller[0].PollInHandler += new PollHandler(PollerCTRL_PollInHandler);
            while (!Exit)
            {
                PollContext.Poll(Poller, 5000);
                if (!Stop)
                {
                    //poll
                    //get all available pending workflow instances

                    DataTable dt = dbHandler.GetPendingWFInstances();
                    foreach (DataRow Row in dt.Rows)
                    {
                        //send to kickoff
                        ValkQueueWFMessage Message = new ValkQueueWFMessage();
                        Message.Command      = ValkQueueWFMessage.WFCommand.WFC_LOAD;
                        Message.InstanceID   = int.Parse(Row["WFInstanceID"].ToString());
                        Message.InstanceKey  = Row["InstanceKey"].ToString();
                        Message.InstanceType = Row["WFType"].ToString();
                        ActivatorIntraComm.Send <ValkQueueWFMessage>(Message);
                        string message = ActivatorIntraComm.Recv(Encoding.Unicode);
                        //Console.WriteLine("Instance Insert Reply Received: " + message);
                    }
                }
            }
        }
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;
            var conString             = General.AuthGuard();

            switch (connectionStringSettings.ProviderName.ToLower())
            {
            //case "system.data.sqlclient":
            //database = new SqlDataAccess(connectionStringSettings.ConnectionString);
            //    break;
            case "system.data.oracleclient":
                database = new OracleDataAccess(conString);
                break;
                //case "system.data.oleDb":
                //    database = new OledbDataAccess(connectionStringSettings.ConnectionString);
                //    break;
                //case "system.data.odbc":
                //    database = new OdbcDataAccess(connectionStringSettings.ConnectionString);
                //    break;
            }
            return(database);
        }
Exemplo n.º 33
0
        public static void ActivateResponder(IDatabaseHandler _dbHandler)
        {
            dbHandler = _dbHandler;
            if (ActContext == null)
            {
                throw new System.Exception("ActContext not set");
            }
            ActivatorIntraComm = ActContext.Socket(SocketType.REP);
            ActivatorIntraComm.Bind("inproc://activator");
            ActivatorIntraComm.Bind("tcp://*:5001");
            ActivatorControllerIntraComm = ActContext.Socket(SocketType.REP);
            ActivatorControllerIntraComm.Connect("inproc://activatorcontrol");
            QueueComm = ActContext.Socket(SocketType.REQ);
            QueueComm.Connect("tcp://127.0.0.1:5000");


            PollItem[] Poller        = new PollItem[1];
            PollItem[] ControlPoller = new PollItem[1];
            Poller[0] = ActivatorIntraComm.CreatePollItem(IOMultiPlex.POLLIN);
            Poller[0].PollInHandler        += new PollHandler(ValkWFActivator_PollInHandler);
            ControlPoller[0]                = ActivatorControllerIntraComm.CreatePollItem(IOMultiPlex.POLLIN);
            ControlPoller[0].PollInHandler += new PollHandler(ValkWFActivatorCTRL_PollInHandler);

            //load workflow templates
            LoadWorkflowTemplates(dbHandler);

            //main loop
            while (!Exit)
            {
                //we may want a way to shut this down...
                ActContext.Poll(ControlPoller, 1);
                if (!Stop)
                {
                    //block for a little while...
                    ActContext.Poll(Poller, 1000);
                }
            }
        }
Exemplo n.º 34
0
        protected DatabaseContext(IDatabaseHandler database)
        {
            if (database != null)
            {
                var parentItems = typeof(DatabaseContext)
                                  .GetProperties(BindingFlags.Public
                                                 | BindingFlags.Instance
                                                 | BindingFlags.DeclaredOnly).ToList();

                mTableFields = this.GetType()
                               .GetProperties(BindingFlags.Public
                                              | BindingFlags.Instance
                                              | BindingFlags.DeclaredOnly).ToList();

                mTableFields.AddRange(parentItems);

                System.Threading.Tasks.Parallel.ForEach(mTableFields, (table) =>
                {
                    var instance = Activator.CreateInstance(table.PropertyType, database);
                    table.SetValue(this, instance);
                });
            }
        }
Exemplo n.º 35
0
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;

            switch (databaseName.ToLower())
            {
            case "SQL":
                database = new SqlDataAccess("Data Source=JITHENDRANK01;Initial Catalog=CytelPOC;Integrated Security=SSPI;User ID=sa;Password=Emids123;");
                break;

            case "PostgreSQL":
                database = new postgreSQLDataAccess("User ID=postgres;Password=Cytel1234;Host=cyteldb.c8owe0hgyui5.ap-south-1.rds.amazonaws.com;Port=5432;Database=CytelPOC;");
                break;
                //case "system.data.oleDb":
                //    database = new OledbDataAccess(connectionStringSettings.ConnectionString);
                //    break;
                //case "system.data.odbc":
                //    database = new OdbcDataAccess(connectionStringSettings.ConnectionString);
                //    break;
            }

            return(database);
        }
Exemplo n.º 36
0
        public IDatabaseHandler CreateDatabase()
        {
            IDatabaseHandler database = null;

            switch (connectionStringSettings.ProviderName.ToLower())
            {
            case "system.data.sqlclient":
                database = new SqlDataAccess(connectionStringSettings.ConnectionString);
                break;

            case "mysql.data.mysqlclient":
                database = new MySqlDataAccess(connectionStringSettings.ConnectionString);
                break;
                ////case "system.data.oleDb":
                ////    database = new OledbDataAccess(connectionStringSettings.ConnectionString);
                ////    break;
                //case "MySql.Data.MySqlClient":
                //    database = new OdbcDataAccess(connectionStringSettings.ConnectionString);
                //    break;
            }

            return(database);
        }
Exemplo n.º 37
0
        void Core_OnInitialise(Dictionary<Type, List<Type>> interfaceImplementations)
        {
            // need to check web.config to see which database registration name to use
            // instantiate that Type, if found, or throw an error
            // raise a notification event specifying the ISqlDatabase object we're using
            // add an event to this module OnCheckDatabaseStructure, which will eliminate the need for IDataHandlerModule
            if (interfaceImplementations.ContainsKey(typeof(IDatabaseHandler)))
            {
                string databaseEngine = SprocketSettings.GetValue("DatabaseEngine");
                if (databaseEngine == null)
                    return;

                foreach (Type t in interfaceImplementations[typeof(IDatabaseHandler)])
                    if (t.Name == databaseEngine)
                    {
                        dbHandler = (IDatabaseHandler)Activator.CreateInstance(t);
                        Result result = dbHandler.CheckConfiguration();
                        if (!result.Succeeded)
                        {
                            SprocketSettings.Errors.Add(this, result.Message);
                            SprocketSettings.Errors.SetCriticalError();
                            return;
                        }
                        if (OnDatabaseHandlerLoaded != null)
                            OnDatabaseHandlerLoaded(dbHandler);
                        return;
                    }

                List<string> list = new List<string>();
                foreach (Type t in interfaceImplementations[typeof(IDatabaseHandler)])
                    list.Add(t.Name);
                SprocketSettings.Errors.Add(this, "The application settings (.config) file requires a valid value for \"DatabaseEngine\".");
                SprocketSettings.Errors.Add(this, "Current valid values for DatabaseEngine are: " + StringUtilities.CommaJoin(list));
                SprocketSettings.Errors.SetCriticalError();
            }
        }
Exemplo n.º 38
0
 public void SetUp()
 {
     _db = Substitute.For<IDatabaseHandler>();
     _memberShip = new SolarMemberShip(_db);
 }
Exemplo n.º 39
0
        ///<summary>
        /// Sets up the database interface.
        ///</summary>
        /// <param name="handler"></param>
        /// <param name="databaseName"></param>
        protected DatabaseInterfaceBase(IDatabaseHandler handler, string databaseName)
        {
            databaseHandler = handler;
            if (!String.IsNullOrEmpty(databaseName))
                currentDatabase = handler.GetDatabase(databaseName);

            resultSetMap = new Dictionary<int, ResultSetInfo>();
            blobIdMap = new Dictionary<long, IRef>();
            uniqueResultId = 1;
            disposed = false;
        }
Exemplo n.º 40
0
 public EmbeddedServerConnector(IDatabaseHandler handler)
     : base(handler)
 {
 }
Exemplo n.º 41
0
 public JobData(IDatabaseHandler databaseHandler)
     : base(databaseHandler)
 {
     this.Database = databaseHandler;
 }
Exemplo n.º 42
0
 public ServerConnector(LocalDatabaseClient client, IDatabaseHandler handler)
     : base(handler)
 {
     Client = client;
     client.openConnections++;
 }
Exemplo n.º 43
0
 public DbReader(IConfigprovider configprovider)
 {
     _database =  new DatabaseHandler(configprovider);
 }
Exemplo n.º 44
0
 public RecipientData(IDatabaseHandler databaseHandler)
     : base(databaseHandler)
 {
     this.Database = databaseHandler;
 }
Exemplo n.º 45
0
 public SystemData(IDatabaseHandler databaseHandler)
     : base(databaseHandler)
 {
     this.Database = databaseHandler;
 }
Exemplo n.º 46
0
 void DatabaseManager_OnDatabaseHandlerLoaded(IDatabaseHandler source)
 {
     foreach (Type t in Core.Modules.GetInterfaceImplementations(typeof(IMerchantDataProvider)))
     {
         IMerchantDataProvider dp = (IMerchantDataProvider)Activator.CreateInstance(t);
         if (dp.DatabaseHandlerType == source.GetType())
         {
             dataProvider = dp;
             break;
         }
     }
     source.OnInitialise += new InterruptableEventHandler(Database_OnInitialise);
 }
Exemplo n.º 47
0
 public SolarMemberShip(IDatabaseHandler dbHandler)
 {
     _dbHandler = dbHandler;
 }
Exemplo n.º 48
0
 private void InitDatabaseHandler(DatabaseType oDBType)
 {
     try
     {
         switch (oDBType)
         {
             case DatabaseType.SQL:
                 {
                     //oDatabaseHandler = new SqlHelper();
                     break;
                 }
             case DatabaseType.Oracle:
                 {
                     break;
                 }
             case DatabaseType.File:
                 {
                     break;
                 }
             default:
                 {
                     oDatabaseHandler = new DatabaseHelper();
                     break;
                 }
         }
         DBType = oDBType;
         oDatabaseHandler.CurrentActivity += new CurrentActivityHandler(oDatabaseHandler_CurrentActivity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 49
0
 /// <summary>
 /// Sets up the processor.
 /// </summary>
 /// <param name="handler"></param>
 /// <param name="databaseName"></param>
 /// <param name="host_name"></param>
 public DatabaseInterface(IDatabaseHandler handler, string databaseName, String host_name)
     : base(handler, databaseName)
 {
     this.host_name = host_name;
 }
Exemplo n.º 50
0
 public DbWriterMain(ICommunicationInterface communitaionInterface, IDatabaseHandler databaseHandler, IConfigprovider configprovider)
 {
     _communicationInterface = communitaionInterface;
     _dbHandler = databaseHandler;
     _configProvider = configprovider;
 }
Exemplo n.º 51
0
 public WorkItemData(IDatabaseHandler databaseHandler)
     : base(databaseHandler)
 {
     this.Database = databaseHandler;
 }