public async Task <Network> GetNetworkByPartialNameAsync(ContentURI uri, string partName)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            Network             network        = await oNetworkHelper.GetNetworkAsync(uri, partName);

            return(network);
        }
        public async Task <Network> GetNetworkByIdAsync(ContentURI uri, int id)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            Network             network        = await oNetworkHelper.GetNetworkAsync(uri, id.ToString());

            return(network);
        }
        public async Task <List <Network> > GetNetworkAsync(ContentURI uri)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            List <Network>      networks
                = await oNetworkHelper.GetNetworkAsync(uri);

            return(networks);
        }
        public async Task <List <NetworkClass> > GetNetworkGroupsAsync(ContentURI uri)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            List <NetworkClass> networkgroups
                = await oNetworkHelper.GetNetworkGroupsAsync(uri);

            return(networkgroups);
        }
Example #5
0
        //deprecated in 2.0.0 in favor of uniform EF form edits
        //public async Task<int> InsertNewClubForMemberAsync(ContentURI uri, string accountName,
        //    string accountEmail, int accountGroupId, int accountGroupGeoRegionId)
        //{
        //    int iAccountId = 0;
        //    if (uri.URIMember != null)
        //    {
        //        if (uri.URIMember.Member != null)
        //        {
        //            if (uri.URIMember.Member.PKId != 0)
        //            {
        //                var newAccount = new Account
        //                {
        //                    AccountName = accountName,
        //                    AccountEmail = accountEmail,
        //                    AccountURI = string.Empty,
        //                    AccountDesc = string.Empty,
        //                    AccountLongDesc = string.Empty,
        //                    AccountClassId = accountGroupId,
        //                    GeoRegionId = accountGroupGeoRegionId,
        //                    GeoRegion = null,
        //                    AccountClass = null,
        //                    AccountToAddIn = null,
        //                    AccountToAudit = null,
        //                    AccountToCredit = null,
        //                    AccountToLocal = null,
        //                    AccountToMember = null,
        //                    AccountToNetwork = null,
        //                    AccountToPayment = null,
        //                    AccountToService = null
        //                };
        //                //join table (each member can join one or more accounts (clubs))
        //                var newAccountToMember = new AccountToMember
        //                {
        //                    MemberId = uri.URIMember.Member.PKId,
        //                    //each member is the coordinator of their own club
        //                    MemberRole = AppHelpers.Members.MEMBER_ROLE_TYPES.coordinator.ToString(),
        //                    //next step after insertion switches the default club to this club
        //                    IsDefaultClub = false,
        //                    ClubDefault = null,
        //                    Member = null
        //                };
        //                try
        //                {
        //                    _dataContext.Entry(newAccount).State = EntityState.Added;
        //                    await _dataContext.SaveChangesAsync();
        //                    newAccountToMember.AccountId = newAccount.PKId;
        //                    _dataContext.Entry(newAccountToMember).State = EntityState.Added;
        //                    await _dataContext.SaveChangesAsync();
        //                    iAccountId = newAccount.PKId;
        //                    //160
        //                    newAccountToMember.Member = new Member(uri.URIMember.Member);
        //                    uri.URIMember = newAccountToMember;
        //                }
        //                catch
        //                {
        //                    throw;
        //                }
        //            }
        //        }
        //    }
        //    return iAccountId;
        //}
        public async Task <Network> GetNetworkByIdAsync(ContentURI uri, int id)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            Network             network        = await oNetworkHelper.GetNetworkAsync(uri, id.ToString());

            //152 uses ef only to edit content
            //network = await _dataContext.Network.SingleOrDefaultAsync(x => x.PKId == id);
            return(network);
        }
Example #6
0
        public async Task <Network> GetNetworkByPartialNameAsync(ContentURI uri, string partName)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            Network             network        = await oNetworkHelper.GetNetworkAsync(uri, partName);

            //152 uses ef only to edit content
            //network = await _dataContext.Network
            //    .FirstOrDefaultAsync(n => n.NetworkURIPartName == partName);
            return(network);
        }
Example #7
0
        private async Task <bool> UpdateConcurrentSettingsAsync(
            ContentURI uri, EditHelper.ArgumentsEdits argumentsEdits)
        {
            bool bNeedsUpdate    = true;
            int  iNewIsDefaultId = 0;
            bool bIsUpdated      = false;

            switch (argumentsEdits.URIToEdit.URIDataManager.AppType)
            {
            case Helpers.GeneralHelpers.APPLICATION_TYPES.members:
                AppHelpers.Members oMember = new AppHelpers.Members();
                iNewIsDefaultId = Helpers.GeneralHelpers.ConvertStringToInt(argumentsEdits.EditAttValue);
                bIsUpdated      = await oMember.UpdateDefaultClubForLoggedinMemberAsync(argumentsEdits.URIToAdd,
                                                                                        uri.URIMember.MemberId, iNewIsDefaultId);

                break;

            case Helpers.GeneralHelpers.APPLICATION_TYPES.networks:
                AppHelpers.Networks oNetwork = new AppHelpers.Networks();
                iNewIsDefaultId = Helpers.GeneralHelpers.ConvertStringToInt(argumentsEdits.EditAttValue);
                bIsUpdated      = await oNetwork.UpdateDefaultNetworkForLoggedinMemberAsync(
                    argumentsEdits.URIToAdd, uri.URIId, iNewIsDefaultId);

                break;

            default:
                if (uri.URIDataManager.SubActionView
                    == Helpers.GeneralHelpers.SUBACTION_VIEWS.linkedviewslist.ToString())
                {
                    iNewIsDefaultId = Helpers.GeneralHelpers.ConvertStringToInt(argumentsEdits.EditAttValue);
                    AppHelpers.LinkedViews oLinkedView = new AppHelpers.LinkedViews();
                    bIsUpdated = await oLinkedView.UpdateDefaultLinkedViewAsync(uri, iNewIsDefaultId);
                }
                else if (argumentsEdits.URIToEdit.URIDataManager.AppType
                         == Helpers.GeneralHelpers.APPLICATION_TYPES.addins ||
                         argumentsEdits.URIToEdit.URIDataManager.AppType
                         == Helpers.GeneralHelpers.APPLICATION_TYPES.locals)
                {
                    //2.0.0 made the addin and local edit pattern the same as the rest
                    iNewIsDefaultId = Helpers.GeneralHelpers.ConvertStringToInt(argumentsEdits.EditAttValue);
                    AppHelpers.LinkedViews oLinkedView = new AppHelpers.LinkedViews();
                    bIsUpdated = await oLinkedView.UpdateDefaultLinkedViewAsync(uri, iNewIsDefaultId);
                }
                break;
            }
            if (bIsUpdated)
            {
                bNeedsUpdate = false;
            }

            return(bNeedsUpdate);
        }
        public async Task <List <Network> > GetNetworkForLoggedinMemberAsync(SearchManager searcher)
        {
            AppHelpers.Networks oNetworkHelper = new AppHelpers.Networks();
            Helpers.SqlIOAsync  sqlIO          = new Helpers.SqlIOAsync(searcher.SearchResult);
            SqlDataReader       networks       = await oNetworkHelper.GetNetworkForLoggedinMemberAsync(sqlIO,
                                                                                                       searcher);

            List <Network> colNetwork = new List <Network>();

            if (networks != null)
            {
                int iClubNetworkPKId = 0;
                //build a network list to return to the client
                //small inmemory data set so not async
                while (networks.Read())
                {
                    Network network = new Network();
                    iClubNetworkPKId                      = networks.GetInt32(0);
                    network.PKId                          = networks.GetInt32(1);
                    network.NetworkName                   = networks.GetString(2);
                    network.NetworkURIPartName            = networks.GetString(3);
                    network.NetworkDesc                   = networks.GetString(4);
                    network.AdminConnection               = networks.GetString(5);
                    network.WebFileSystemPath             = networks.GetString(6);
                    network.WebConnection                 = networks.GetString(7);
                    network.WebDbPath                     = networks.GetString(8);
                    network.NetworkClassId                = networks.GetInt32(9);
                    network.NetworkClass                  = new NetworkClass();
                    network.NetworkClass.PKId             = network.NetworkClassId;
                    network.NetworkClass.NetworkClassName = networks.GetString(10);
                    //version 1.5.2 standardized on this approach
                    network.AdminConnection = Helpers.AppSettings.GetConnection(searcher.SearchResult);
                    network.WebConnection   = Helpers.AppSettings.GetConnection(searcher.SearchResult);
                    colNetwork.Add(network);
                }
            }
            sqlIO.Dispose();
            return(colNetwork);
        }