コード例 #1
0
        public static List <Configuration> GetMessagePosition(MessageGroupInstance messageGroupInstance)
        {
            List <Configuration>    configurations = new List <Configuration>();
            SysDataAccessCredential dac            = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.SERVICE_VIEW_GET_MESSAGE_POSITION;
                command.Parameters.AddWithValue(ConfigurationDAO.AT_MESSAGE_GROUP_INSTANCE_ID,
                                                messageGroupInstance.id);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            configurations.Add(new Configuration(reader,
                                                                 Configuration.View.GetMessagePosition));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getMessagePosition(MessageGroupInstance messageGroupInstance)", messageGroupInstance.id.ToString());
                }
            }
            return(configurations);
        }
コード例 #2
0
        private static bool deleteMessageGroup(MessageGroup messageGroup)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.DELETE_MESSAGE_GROUP;
                command.Parameters.AddWithValue(MessageGroupDAO.AT_ID, messageGroup.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            messageGroup.id = DAOUtility.GetData <int>(reader, MessageGroupDAO.ID);
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "DeleteMessageGroup()", messageGroup.id.ToString());
                }
            }
            return(true);
        }
コード例 #3
0
        private static List <Communication> getSingleCommunication(Communication communication)
        {
            List <Communication>    communications = new List <Communication>();
            SysDataAccessCredential dac            = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_COMMUNICATION;
                command.Parameters.AddWithValue(CommunicationDAO.AT_ID, communication.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            communications.Add(new Communication(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleCommunication(Communication Communication)", communication.id.ToString());
                }
            }

            return(communications);
        }
コード例 #4
0
        private static DirectionType postUpdateDirectionType(DirectionType directionType)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = das.PUT_DIRECTION_TYPE;
                command.Parameters.AddWithValue(DirectionTypeDAO.AT_NAME, directionType.name);
                command.Parameters.AddWithValue(DirectionTypeDAO.AT_ID, directionType.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            directionType.id = DAOUtility.GetData <int>(reader, DirectionTypeDAO.ID);
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "postUpdateDirectionType()", directionType.id.ToString());
                }
            }
            return(directionType);
        }
コード例 #5
0
        private static List <Credential> getCredentials()
        {
            List <Credential>       credentials = new List <Credential>();
            SysDataAccessCredential dac         = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_ALL_CREDENTIAL;

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            credentials.Add(new Credential(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getCredentials()");
                }
            }

            return(credentials);
        }
コード例 #6
0
        private static List <DatabaseTableRelation> getDatabaseTableRelations()
        {
            List <DatabaseTableRelation> databaseTableRelations = new List <DatabaseTableRelation>();
            SysDataAccessCredential      dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_ALL_DATABASE_TABLE_RELATION;

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            databaseTableRelations.Add(new DatabaseTableRelation(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getDatabaseTableRelations()");
                }
            }

            return(databaseTableRelations);
        }
コード例 #7
0
        private static List <WebservicePropertySet> getSingleWebservicePropertySet(WebservicePropertySet WebservicePropertySet)
        {
            List <WebservicePropertySet> webservicePropertySets = new List <WebservicePropertySet>();
            SysDataAccessCredential      dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_WEBSERVICE_PROPERTY_SET;
                command.Parameters.AddWithValue(WebservicePropertySetDAO.AT_ID, WebservicePropertySet.id);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            webservicePropertySets.Add(new WebservicePropertySet(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleWebservicePropertySet(WebservicePropertySet WebservicePropertySet)", WebservicePropertySet.id.ToString());
                }
            }

            return(webservicePropertySets);
        }
コード例 #8
0
        public void UpdateCustomerUpdatesCustomerInfoInDB()
        {
            //arrange
            var options = new DbContextOptionsBuilder <DAOUtility>()
                          .UseInMemoryDatabase(databaseName: "TestDb")
                          .Options;

            //act
            Customer c1 = new Customer();

            using (var context = new DAOUtility(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                DAOMethodsImpl repo = new DAOMethodsImpl(context);
                c1.Fname        = "Chris";
                c1.Lname        = "Sophiea";
                c1.EmailAddress = "*****@*****.**";
                c1 = repo.AddCustomer(c1);

                repo.UpdateCustomer(c1, "David", "Sophiea", "*****@*****.**");
            }

            //assert
            using (var context1 = new DAOUtility(options))
            {
                DAOMethodsImpl repo = new DAOMethodsImpl(context1);

                Assert.True(context1.customers.Where(x => x.Fname == "David").FirstOrDefault() != null);
            }
        }
コード例 #9
0
 private void fillDataReader(IDataRecord reader)
 {
     this.id = DAOUtility.GetData <int>(reader, CredentialDAO.ID);
     this.credentialTypeId = DAOUtility.GetData <int>(reader, CredentialDAO.CREDENTIAL_TYPE_ID);
     this.username         = DAOUtility.GetData <string>(reader, CredentialDAO.USERNAME);
     this.password         = DAOUtility.GetData <string>(reader, CredentialDAO.PASSWORD);
 }
コード例 #10
0
        public void RemoveItemDeletesItemFromDB()
        {
            //arrange
            var options = new DbContextOptionsBuilder <DAOUtility>()
                          .UseInMemoryDatabase(databaseName: "TestDb")
                          .Options;

            //act
            Item i1 = new Item()
            {
                ItemName        = "PlayStation",
                ItemType        = "Console",
                ItemDescription = "The first sony video-game console.",
                ItemPrice       = 199.99
            };

            using (var context = new DAOUtility(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                DAOMethodsImpl repo = new DAOMethodsImpl(context);
                repo.AddItem(i1);

                repo.DeleteItem(i1);
            }

            //assert
            using (var context1 = new DAOUtility(options))
            {
                DAOMethodsImpl repo = new DAOMethodsImpl(context1);

                Assert.True(context1.items.Where(x => x.ItemName == "PlayStation").FirstOrDefault() == null);
            }
        }
コード例 #11
0
        public void UpdateStoreUpdatesStoreInfoInDB()
        {
            //arrange
            var options = new DbContextOptionsBuilder <DAOUtility>()
                          .UseInMemoryDatabase(databaseName: "TestDb")
                          .Options;

            //act
            Store s1 = new Store()
            {
                StoreAddress = "123 Fake St, Phoenix, AZ",
                PhoneNumber  = "123-555-4567"
            };

            using (var context = new DAOUtility(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                DAOMethodsImpl repo = new DAOMethodsImpl(context);

                repo.AddStore(s1);

                repo.UpdateStore(s1, "123 Fake St, Phoenix, AZ", "555-555-5555");
            }

            //assert
            using (var context1 = new DAOUtility(options))
            {
                DAOMethodsImpl repo = new DAOMethodsImpl(context1);

                Assert.True(context1.stores.Where(x => x.PhoneNumber == "555-555-5555").FirstOrDefault() != null);
            }
        }
コード例 #12
0
        public void AddCustomerSavesCustomerToDB()
        {
            //arrange
            var options = new DbContextOptionsBuilder <DAOUtility>()
                          .UseInMemoryDatabase(databaseName: "TestDb")
                          .Options;

            //act
            Customer c1 = new Customer();

            using (var context = new DAOUtility(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                DAOMethodsImpl repo = new DAOMethodsImpl(context);
                c1.Fname        = "Chris";
                c1.Lname        = "Sophiea";
                c1.EmailAddress = "*****@*****.**";
                c1 = repo.AddCustomer(c1);
            }

            //assert
            using (var context1 = new DAOUtility(options))
            {
                Customer       c2   = new Customer();
                DAOMethodsImpl repo = new DAOMethodsImpl(context1);
                c2.Fname        = "Chris";
                c2.Lname        = "Sophiea";
                c2.EmailAddress = "*****@*****.**";
                c2 = repo.AddCustomer(c2);
                Assert.Equal(c1.CustomerId, c2.CustomerId);
            }
        }
コード例 #13
0
 private void fillDataReader(IDataRecord reader)
 {
     this.id = DAOUtility.GetData <int>(reader, MessageGroupDAO.ID);
     this.messageGroupInstanceId = DAOUtility.GetData <int>(reader, MessageGroupDAO.MESSAGE_GROUP_INSTANCE_ID);
     this.messagePartId          = DAOUtility.GetData <int>(reader, MessageGroupDAO.MESSAGE_PART_ID);
     this.position = DAOUtility.GetData <int>(reader, MessageGroupDAO.POSITION);
 }
コード例 #14
0
        public static List <Configuration> getApplications()
        {
            List <Configuration>    configurations = new List <Configuration>();
            SysDataAccessCredential dac            = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.SERVICE_VIEW_GET_ALL_APPLICATION_CONFIG;
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            configurations.Add(new Configuration(reader,
                                                                 Configuration.View.GetApplicationConfiguration));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleApplication(Application application)", "-9");
                }
            }
            return(configurations);
        }
コード例 #15
0
        private static List <MessageHeaderInstance> getMessageHeaderInstances()
        {
            List <MessageHeaderInstance> messageHeaderInstances = new List <MessageHeaderInstance>();
            SysDataAccessCredential      dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_ALL_MESSAGE_HEADER_INSTANCE;

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            messageHeaderInstances.Add(new MessageHeaderInstance(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getMessageHeaderInstances()");
                }
            }

            return(messageHeaderInstances);
        }
コード例 #16
0
 private void fillDataReaderCustomView(IDataRecord reader)
 {
     this.id   = DAOUtility.GetData <int>(reader, WebservicePropertySetDAO.VIEW_WEBSERVICE_PROPERTY_ID);
     this.name = DAOUtility.GetData <string>(reader, WebservicePropertySetDAO.VIEW_WEBSERVICE_PROPERTY);
     this.messageGroupInstanceId = DAOUtility.GetData <int>(reader, WebservicePropertySetDAO.VIEW_WEBSERVICE_PROPERTY_MESSAGE_GROUP_INSTANCE_ID);
     this.columnDataType         = DAOUtility.GetData <string>(reader, WebservicePropertySetDAO.VIEW_WEBSERVICE_PROPERTY_COLUMN_DATA_TYPE);
 }
コード例 #17
0
        private static bool deleteDatabaseTableRelation(DatabaseTableRelation databaseTableRelation)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.DELETE_DATABASE_TABLE_RELATION;
                command.Parameters.AddWithValue(DatabaseTableRelationDAO.AT_ID, databaseTableRelation.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            databaseTableRelation.id = DAOUtility.GetData <int>(reader, DatabaseTableDAO.ID);
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "DeleteDatabaseTableRelation()", databaseTableRelation.id.ToString());
                }
            }
            return(true);
        }
コード例 #18
0
 private void fillDataReaderCustomView(IDataRecord reader)
 {
     this.name      = DAOUtility.GetData <string>(reader, DatabaseInstanceDAO.VIEW_DATABASE_NAME);
     this.server    = DAOUtility.GetData <string>(reader, DatabaseInstanceDAO.VIEW_DATABASE_SERVER);
     this.ipAddress = DAOUtility.GetData <string>(reader, DatabaseInstanceDAO.VIEW_DATABASE_IP_ADDRESS);
     this.id        = DAOUtility.GetData <int>(reader, DatabaseInstanceDAO.VIEW_DATABASE_INSTANCE_ID);
 }
コード例 #19
0
        private static bool deleteWebservicePropertySet(WebservicePropertySet WebservicePropertySet)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.DELETE_WEBSERVICE_PROPERTY_SET;
                command.Parameters.AddWithValue(WebservicePropertySetDAO.AT_ID, WebservicePropertySet.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            WebservicePropertySet.id = DAOUtility.GetData <int>(reader, WebservicePropertySetDAO.ID);
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "DeleteWebservicePropertySet()", WebservicePropertySet.name);
                }
            }
            return(true);
        }
コード例 #20
0
 private void fillDataReaderCustomView(IDataRecord reader)
 {
     this.id = DAOUtility.GetData <int>(reader, CommunicationDAO.VIEW_COMMUNICATION_ID);
     this.directionTypeId     = DAOUtility.GetData <int>(reader, CommunicationDAO.VIEW_COMMUNICATION_DIRECTION_TYPE_ID);
     this.communicationTypeId = DAOUtility.GetData <int>(reader, CommunicationDAO.VIEW_COMMUNICATION_COMMUNICATION_TYPE_ID);
     this.applicationId       = DAOUtility.GetData <int>(reader, CommunicationDAO.VIEW_COMMUNICATION_APPLICATION_ID);
 }
コード例 #21
0
        private static bool risResendAllMissing()
        {
            // set the flag which determines the reprocess
            bool isProcessed = false;

            try
            {
                SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
                DataAccess das = new DataAccess();

                using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
                {
                    conn.Open();

                    SqlCommand command = new SqlCommand();
                    command.Connection  = conn;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = das.EXTERNAL_REPROCESS_RIS_REPORT;
                    command.Parameters.AddWithValue(MessageBucketDAO.AT_ACCESSION_NO, DBNull.Value);
                    command.ExecuteNonQuery();

                    isProcessed = true;
                }
            }
            catch (Exception e)
            {
                ErrorLogger.LogError(e, "BrokerDAO.risResendSpecificaReport()");
            }

            return(isProcessed);
        }
コード例 #22
0
        private static void updateLastMessageStats(Broker broker)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            try
            {
                using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
                {
                    SqlCommand command = new SqlCommand();
                    conn.Open();
                    command.Connection  = conn;
                    command.CommandText = das.UPDATE_MESSAGE_STATS;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue(BrokerDAO.AT_LAST_MESSAGE_ID, broker.lastMessageId);
                    command.Parameters.AddWithValue(BrokerDAO.AT_LAST_MESSAGE_DTTM, broker.lastMessageDTTM);
                    command.Parameters.AddWithValue(BrokerDAO.AT_QUEUE_COUNT, broker.queueCount);
                    command.Parameters.AddWithValue(BrokerDAO.ID, broker.id);
                    command.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                ErrorLogger.LogError(ex, "BrokerDAO.updateLastMessageStats(Broker broker", broker.id.ToString() + "|" + broker.lastMessageDTTM.ToString());
            }
        }
コード例 #23
0
        private static List <DirectionType> getSingleDirectionType(DirectionType directionType)
        {
            List <DirectionType>    directionTypes = new List <DirectionType>();
            SysDataAccessCredential dac            = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_DIRECTION_TYPE;
                command.Parameters.AddWithValue(DirectionTypeDAO.AT_ID, directionType.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            directionTypes.Add(new DirectionType(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleDirectionType(DirectionType DirectionType)", directionType.id.ToString());
                }
            }

            return(directionTypes);
        }
コード例 #24
0
        private static List <Broker> getSingleBroker(Broker broker)
        {
            List <Broker>           brokers = new List <Broker>();
            SysDataAccessCredential dac     = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_BROKER;
                command.Parameters.AddWithValue(BrokerDAO.AT_ID, broker.id);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            brokers.Add(new Broker(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleBroker(Broker broker)", broker.id.ToString());
                }
            }

            return(brokers);
        }
コード例 #25
0
        private static List <Credential> getSingleCredential(Credential credential)
        {
            List <Credential>       credentials = new List <Credential>();
            SysDataAccessCredential dac         = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_CREDENTIAL_TYPE;
                command.Parameters.AddWithValue(CredentialDAO.AT_ID, credential.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            credentials.Add(new Credential(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleCredential(Credential Credential)", credential.id.ToString());
                }
            }

            return(credentials);
        }
コード例 #26
0
        public static List <Broker> GetBrokerWorklist()
        {
            List <Broker>           brokers = new List <Broker>();
            SysDataAccessCredential dac     = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.SERVICE_VIEW_GET_BROKER_WORKLIST;

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            brokers.Add(new Broker(reader, true));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "GetBrokerWorklist()");
                }
            }

            return(brokers);
        }
コード例 #27
0
        private static List <MessageGroup> getSingleMessageGroup(MessageGroup messageGroup)
        {
            List <MessageGroup>     messageGroups = new List <MessageGroup>();
            SysDataAccessCredential dac           = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_MESSAGE_GROUP;
                command.Parameters.AddWithValue(MessageGroupDAO.AT_ID, messageGroup.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            messageGroups.Add(new MessageGroup(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleMessageGroup(MessageGroup MessageGroup)", messageGroup.id.ToString());
                }
            }

            return(messageGroups);
        }
コード例 #28
0
        private static List <ApplicationSetting> getSingleApplicationSetting(ApplicationSetting applicationSetting)
        {
            List <ApplicationSetting> applicationSettings = new List <ApplicationSetting>();
            SysDataAccessCredential   dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.GET_SINGLE_APPLICATION_SETTING;
                command.Parameters.AddWithValue(ApplicationSettingDAO.AT_ID, applicationSetting.id);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            applicationSettings.Add(new ApplicationSetting(reader));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "getSingleApplicationSetting(ApplicationSetting applicationSetting)", applicationSetting.id.ToString());
                }
            }

            return(applicationSettings);
        }
コード例 #29
0
        private static bool deleteCommunicationType(CommunicationType communicationType)
        {
            SysDataAccessCredential dac = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();

                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.DELETE_COMMUNICATION_TYPE;
                command.Parameters.AddWithValue(CommunicationTypeDAO.AT_ID, communicationType.id);

                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            communicationType.id = DAOUtility.GetData <int>(reader, CommunicationTypeDAO.ID);
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "DeleteCommunicationType()", communicationType.id.ToString());
                }
            }
            return(true);
        }
コード例 #30
0
        public static List <Configuration> GetWebserviceObjectProperties(WebserviceObject webserviceObject)
        {
            List <Configuration>    configurations = new List <Configuration>();
            SysDataAccessCredential dac            = DAOUtility.GetSysCredentials();
            DataAccess das = new DataAccess();

            using (SqlConnection conn = new SqlConnection(DAOUtility.GetConnectionString(dac)))
            {
                conn.Open();
                SqlCommand command = new SqlCommand();
                command.Connection  = conn;
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = das.SERVICE_VIEW_GET_WEBSERVICE_PROPERTIES;
                command.Parameters.AddWithValue(ConfigurationDAO.AT_WEBSERVICE_OBJECT_ID,
                                                webserviceObject.id);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            configurations.Add(new Configuration(reader,
                                                                 Configuration.View.GetWebserviceObjectProperties));
                        }
                    }
                }
                catch (Exception e)
                {
                    ErrorLogger.LogError(e, "GetWebserviceObjectProperties(WebserviceObject webserviceObject)", webserviceObject.id.ToString());
                }
            }
            return(configurations);
        }