Exemplo n.º 1
0
        public static IEnumerable<AssetSubscription> ByPublisherAssetGuid(Guid publisherAssetGuid)
        {
            IEnumerable<AssetSubscription> assetSubscriptions = null;
            DataTable table = null;
            DataLayer.MySQL mySql = null;

            try
            {
                mySql = new DataLayer.MySQL(ConnectionString);
                table = mySql.GetDataTable(StoredProcedures.AssetSubscriptions_Select_ByPublisherAssetGuid.ToString(), "_PublisherAssetGuid", publisherAssetGuid);
                if (table != null)
                    assetSubscriptions = table.Rows.Select<AssetSubscription>( );

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading asset subscriptions.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return assetSubscriptions;
        }
Exemplo n.º 2
0
        public static IEnumerable<Subscription> ByUserGuid(Guid userGuid)
        {
            IEnumerable<Subscription> subscriptions = null;
            DataTable table = null;
            DataLayer.MySQL mySql = null;

            try
            {
                mySql = new DataLayer.MySQL(DatConnectionString);
                table = mySql.GetDataTable(StoredProcedures.Subscriptions_Select_ByUserGuid.ToString(), "_UserGuid", userGuid);
                if (table != null)
                    subscriptions = table.Rows.Select<Subscription>();

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading subscriptions.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return subscriptions;
        }
Exemplo n.º 3
0
        public static IEnumerable<Role> SelectAll()
        {
            IEnumerable<Role> roles = null;
            DataTable table = null;
            DataLayer.MySQL mySql = null;

            try
            {
                mySql = new DataLayer.MySQL(DatConnectionString);
                table = mySql.GetDataTable(StoredProcedures.Roles_Select_All.ToString());
                if (table != null)
                    roles = table.Rows.Select<Role>( );

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading roles.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return roles;
        }
Exemplo n.º 4
0
        public static IEnumerable<RolePermission> ByPermissionId(int permissionId )
        {
            IEnumerable<RolePermission> rolePermissions = null;
              DataTable table = null;
              DataLayer.MySQL mySql = null;

              try
              {
                  mySql = new DataLayer.MySQL(DatConnectionString);
                  table = mySql.GetDataTable(StoredProcedures.RolePermissions_Select_ByPermissionId.ToString(), "_PermissionId", permissionId);
                  if (table != null)
                      rolePermissions = table.Rows.Select<RolePermission>( );

              }
              catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading asset permissions.", ex); }
              finally { if (mySql != null) mySql.Dispose(); }

              return rolePermissions;
        }
Exemplo n.º 5
0
        public List<ValueObject.Column> SelectByTableName(string databaeName, string tableName)
        {
            List<ValueObject.Column> columns = null;
            System.Data.DataTable table = null;
            DataLayer.MySQL mySql = null;
            try
            {
                mySql = new DataLayer.MySQL(ConnectionString);
                table = mySql.GetDataTable(StoredProcedures.Column_Select_ByTableName.ToString(), "@DatabaseName", databaeName, "@TableName", tableName);

                if (table != null)
                {
                    columns = new List<ValueObject.Column>();
                    foreach (System.Data.DataRow row in table.Rows)
                        columns.Add(Fill(row));
                }

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading columns.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return columns;
        }
Exemplo n.º 6
0
        public List<ValueObject.Database> SelectAll()
        {
            List<ValueObject.Database> databases = null;
            System.Data.DataTable table= null;
            DataLayer.MySQL mySql = null;
            try
            {
                mySql = new DataLayer.MySQL(ConnectionString);
                table = mySql.GetDataTable(StoredProcedures.Database_Select_All.ToString());

                if (table != null)
                {
                    databases = new List<ValueObject.Database>();
                    foreach (System.Data.DataRow row in table.Rows)
                        databases.Add(Fill(row));
                }

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading database.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return databases;
        }
Exemplo n.º 7
0
        public static List<PostalCodeInfo> LoadPostalCodes(string postal_code, string connectionString)
        {
            Boolean success = false;
            DataLayer.MySQL mySQL = null;
            DataTable dt = null;
            List<PostalCodeInfo> postalcodes = new List<PostalCodeInfo>(); ;

            try
            {

                mySQL = new DataLayer.MySQL(connectionString);
                dt = mySQL.GetDataTable(DataLayer.StoredProcedures.postal_codes_std_get_postal_code,
                    "@_postal_code", postal_code);
                if (dt != null)
                    foreach (System.Data.DataRow row in dt.Rows)
                    {
                        PostalCodeInfo postalcode = new PostalCodeInfo(connectionString);
                        if (postalcode.Load(row) && postalcode.PostalCodeID > 0)
                            postalcodes.Add(postalcode);
                    }
            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading postal code.", ex); }
            finally { if (mySQL != null) mySQL.Dispose(); }

            return postalcodes;
        }
Exemplo n.º 8
0
        public static IEnumerable<AssetRole> ByRoleId(int roleId)
        {
            IEnumerable<AssetRole> assetRoles = null;
            DataTable table = null;
            DataLayer.MySQL mySql = null;

            try
            {
                mySql = new DataLayer.MySQL(DatConnectionString);
                table = mySql.GetDataTable(StoredProcedures.AssetRoles_Select_ByAssetGuid.ToString(), "_RoleId", roleId);
                if (table != null)
                    assetRoles = table.Rows.Select<AssetRole>();

            }
            catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading asset roles.", ex); }
            finally { if (mySql != null) mySql.Dispose(); }

            return assetRoles;
        }