Beispiel #1
0
        public async Task <List <NetworkClass> > GetNetworkGroupsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      networkGroups
                = await sqlIO.RunProcAsync("0GetNetworkGroups");

            List <NetworkClass> colNetworkGroups = new List <NetworkClass>();

            if (networkGroups != null)
            {
                //build a related service list to return to the client
                while (networkGroups.Read())
                {
                    NetworkClass newNetworkGroup = new NetworkClass();
                    newNetworkGroup.PKId = networkGroups.GetInt32(0);
                    newNetworkGroup.NetworkClassLabel          = networkGroups.GetString(1);
                    newNetworkGroup.NetworkClassName           = networkGroups.GetString(2);
                    newNetworkGroup.NetworkClassDesc           = networkGroups.GetString(3);
                    newNetworkGroup.NetworkClassControllerName = networkGroups.GetString(4);
                    newNetworkGroup.NetworkClassUserLanguage   = networkGroups.GetString(5);
                    newNetworkGroup.Network    = new List <Network>();
                    newNetworkGroup.IsSelected = false;
                    colNetworkGroups.Add(newNetworkGroup);
                }
            }
            sqlIO.Dispose();
            return(colNetworkGroups);
        }
Beispiel #2
0
        public async Task <bool> DeleteJoinAndCheckBaseAsync(
            ContentURI uri, ContentURI deletionURI, bool isDbEdit)
        {
            //this should be moved to where the sqlio can be disposed normally
            bool bIsDeleted = false;

            if (isDbEdit)
            {
                string             sQry  = GetDeleteBaseandJoinQry(uri);
                Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
                if (!string.IsNullOrEmpty(sQry))
                {
                    SqlParameter[] colPrams =
                    {
                        sqlIO.MakeInParam("@Id",              SqlDbType.Int,       4, deletionURI.URIId),
                        sqlIO.MakeInParam("@NodeName",        SqlDbType.NVarChar, 25, deletionURI.URINodeName),
                        sqlIO.MakeInParam("@NetworkPartName", SqlDbType.NVarChar, 20, deletionURI.URINetworkPartName)
                    };
                    int iIsCompleted = await sqlIO.RunProcIntAsync(
                        sQry, colPrams);

                    sqlIO.Dispose();
                    if (iIsCompleted == 1)
                    {
                        bIsDeleted = true;
                    }
                }
            }
            return(bIsDeleted);
        }
Beispiel #3
0
        public async Task <int> GetDevTreksGroupIdsFromRegionIdAsync(ContentURI uri,
                                                                     int accountGeoRegionId, int memberGeoRegionId)
        {
            int iAccountGroupId = 0;

            //can't use datacontext because this is used prior to club and member insertion
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     prams =
            {
                sqlIO.MakeInParam("@AccountGroupGeoRegionId", SqlDbType.Int,  4, accountGeoRegionId),
                sqlIO.MakeInParam("@MemberGroupGeoRegionId",  SqlDbType.Int,  4, memberGeoRegionId),
                sqlIO.MakeOutParam("@AccountGroupId",         SqlDbType.Int, 4),
                sqlIO.MakeOutParam("@MemberGroupId",          SqlDbType.Int, 4)
            };
            // run the stored procedure (and close the sqlIO connection)
            int iNotUsed = await sqlIO.RunProcIntAsync(
                "0GetDevTreksGroupIdsFromGeoRegionId", prams);

            if (prams[2].Value != System.DBNull.Value)
            {
                iAccountGroupId = (int)prams[2].Value;
            }
            if (prams[3].Value != System.DBNull.Value)
            {
                int memberGroupId = (int)prams[3].Value;
            }
            sqlIO.Dispose();
            return(iAccountGroupId);
        }
        public async Task <IEnumerable <System.Linq.IGrouping <int, ContentURI> > > GetSearchAsync(
            SearchManager searcher)
        {
            //get the searcher records from the db
            SearchHelpers oSearchHelper = new SearchHelpers();

            Helpers.SqlIOAsync sqlIO         = new Helpers.SqlIOAsync(searcher.SearchResult);
            SqlDataReader      searchresults = await oSearchHelper.GetSearchRecordsAsync(
                sqlIO, searcher);

            int iNewRowCount = searcher.RowCount;
            //fill an List with the search results
            List <ContentURI> colURIs = SearchHelpers.FillSearchList(
                searcher.SearchResult, searchresults);

            sqlIO.Dispose();
            searcher.RowCount = iNewRowCount;
            //group the list(queryGroupURIs) in an IEnumerable<IGrouping<int, ContentURI>>)
            //using their unique parentid property (for display using a parent/children grouping)
            IEnumerable <System.Linq.IGrouping <int, ContentURI> > qryGroupURIs =
                from parent in colURIs
                group parent by ContentURI.GetGroupingParentId(parent.URIDataManager.ParentURIPattern)
                into parents
                select parents;

            return(qryGroupURIs);
        }
Beispiel #5
0
        public async Task <List <AccountToMember> > GetMemberByClubIdAsync(
            ContentURI uri, int accountId)
        {
            List <AccountToMember> colClubToMember = new List <AccountToMember>();

            if (accountId == 0)
            {
                //set default objects
                AccountToMember aton = new AccountToMember(true);
                colClubToMember.Add(aton);
                return(colClubToMember);
            }
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId)
            };
            SqlDataReader dataReader = await sqlIO.RunProcAsync(
                "0GetMembersByClubId", colPrams);

            colClubToMember = await FillClubToMemberList(dataReader);

            sqlIO.Dispose();
            return(colClubToMember);
        }
Beispiel #6
0
        public async Task <bool> ChangeApplicationAndServiceAsync(ContentURI uri,
                                                                  int serviceId, bool needsNewApp)
        {
            bool bIsBaseService = false;

            uri.URIService.PKId = serviceId;
            Helpers.SqlIOAsync sqlIO   = new Helpers.SqlIOAsync(uri);
            SqlDataReader      service = await GetServiceAsync(sqlIO, uri, bIsBaseService);

            if (service != null)
            {
                //set the uri's service object
                uri.URIService = FillServiceObject(service);
            }
            sqlIO.Dispose();
            if (needsNewApp == true)
            {
                if (uri.URIService.Service != null)
                {
                    if (uri.URIService.Service.ServiceClassId != 0)
                    {
                        Helpers.GeneralHelpers.SetAppTypes(uri.URIService.Service.ServiceClassId, uri);
                    }
                }
            }
            return(bIsBaseService);
        }
Beispiel #7
0
        public async Task <List <MemberClass> > GetMemberGroupsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      memberGroups
                = await sqlIO.RunProcAsync("0GetMemberGroups");

            List <MemberClass> colMemberGroups = new List <MemberClass>();

            if (memberGroups != null)
            {
                //build a related service list to return to the client
                while (memberGroups.Read())
                {
                    MemberClass newMemberGroup = new MemberClass();
                    newMemberGroup.PKId            = memberGroups.GetInt32(0);
                    newMemberGroup.MemberClassNum  = memberGroups.GetString(1);
                    newMemberGroup.MemberClassName = memberGroups.GetString(2);
                    newMemberGroup.MemberClassDesc = memberGroups.GetString(3);
                    newMemberGroup.Member          = new List <Member>();
                    colMemberGroups.Add(newMemberGroup);
                }
            }
            sqlIO.Dispose();
            return(colMemberGroups);
        }
Beispiel #8
0
        public async Task <List <AccountToService> > GetServiceByServiceIdAsync(
            ContentURI uri, int serviceId, bool isOwner)
        {
            List <AccountToService> colClubService = new List <AccountToService>();

            if (serviceId == 0)
            {
                //set default objects
                AccountToService atos = new AccountToService(true);
                colClubService.Add(atos);
                return(colClubService);
            }
            int iIsOwner = (isOwner) ? 1 : 0;

            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@ServiceId", SqlDbType.Int, 4, serviceId),
                sqlIO.MakeInParam("@IsOwner",   SqlDbType.Bit, 1, iIsOwner)
            };
            //this sp must also run a subquery that sets the owning club id
            SqlDataReader dataReader = await sqlIO.RunProcAsync(
                "0GetServicesByServiceId", colPrams);

            colClubService = FillClubServiceList(dataReader);
            sqlIO.Dispose();
            return(colClubService);
        }
Beispiel #9
0
        public async Task <string> GetTopClubToMemberJoinIdAsync(ContentURI uriToEdit,
                                                                 string connect, string baseNodeName, string baseId, int accountId)
        {
            //top joins mean the base record can be edited (they were both
            //inserted by the same owner at the same time)
            string sTopJoinTableId = string.Empty;

            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uriToEdit);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@MemberId",        SqlDbType.Int,       4, baseId),
                sqlIO.MakeInParam("@AccountId",       SqlDbType.Int,       4, accountId),
                sqlIO.MakeInParam("@NodeName",        SqlDbType.NVarChar, 25, baseNodeName),
                sqlIO.MakeOutParam("@TopJoinTableId", SqlDbType.Int, 4)
            };
            string sQryName = "0GetMemberTopJoinTableId";
            int    iNotUsed = await sqlIO.RunProcIntAsync(sQryName, colPrams);

            if (colPrams[3].Value != System.DBNull.Value)
            {
                sTopJoinTableId = colPrams[3].Value.ToString();
            }
            sqlIO.Dispose();
            return(sTopJoinTableId);
        }
Beispiel #10
0
        public async Task <List <ServiceClass> > GetServiceGroupsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      serviceGroups
                = await sqlIO.RunProcAsync("0GetServiceGroups");

            List <ServiceClass> colServiceGroups = new List <ServiceClass>();

            if (serviceGroups != null)
            {
                using (serviceGroups)
                {
                    //build a related service list to return to the client
                    while (await serviceGroups.ReadAsync())
                    {
                        ServiceClass newServiceGroup = new ServiceClass();
                        newServiceGroup.PKId             = serviceGroups.GetInt32(0);
                        newServiceGroup.ServiceClassNum  = serviceGroups.GetString(1);
                        newServiceGroup.ServiceClassName = serviceGroups.GetString(2);
                        newServiceGroup.ServiceClassDesc = serviceGroups.GetString(3);
                        newServiceGroup.Service          = new List <Service>();
                        //nondb
                        newServiceGroup.IsSelected = false;
                        colServiceGroups.Add(newServiceGroup);
                    }
                }
            }
            sqlIO.Dispose();
            return(colServiceGroups);
        }
Beispiel #11
0
        public async Task <List <GeoRegion> > GetGeoRegionsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      geoRegions
                = await sqlIO.RunProcAsync("0GetGeoRegions");

            List <GeoRegion> colGeoRegions = new List <GeoRegion>();

            if (geoRegions != null)
            {
                using (geoRegions)
                {
                    //build a related service list to return to the client
                    while (await geoRegions.ReadAsync())
                    {
                        GeoRegion newGeoRegion = new GeoRegion();
                        newGeoRegion.PKId          = geoRegions.GetInt32(0);
                        newGeoRegion.GeoRegionNum  = geoRegions.GetString(1);
                        newGeoRegion.GeoRegionName = geoRegions.GetString(2);
                        newGeoRegion.GeoRegionDesc = geoRegions.GetString(3);
                        colGeoRegions.Add(newGeoRegion);
                    }
                }
            }
            sqlIO.Dispose();
            return(colGeoRegions);
        }
Beispiel #12
0
        public async Task <List <AccountClass> > GetClubGroupsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      clubGroups
                = await sqlIO.RunProcAsync("0GetAccountGroups");

            List <AccountClass> colAccountGroups = new List <AccountClass>();

            if (clubGroups != null)
            {
                using (clubGroups)
                {
                    //build a related service list to return to the client
                    while (await clubGroups.ReadAsync())
                    {
                        AccountClass newAccountGroup = new AccountClass();
                        newAccountGroup.PKId             = clubGroups.GetInt32(0);
                        newAccountGroup.AccountClassNum  = clubGroups.GetString(1);
                        newAccountGroup.AccountClassName = clubGroups.GetString(2);
                        newAccountGroup.AccountClassDesc = clubGroups.GetString(3);
                        newAccountGroup.Account          = new List <Account>();
                        colAccountGroups.Add(newAccountGroup);
                    }
                }
            }
            sqlIO.Dispose();
            return(colAccountGroups);
        }
Beispiel #13
0
        public async Task <List <AccountToAddIn> > GetAddInsByClubIdAsync(
            ContentURI uri, int accountId)
        {
            List <AccountToAddIn> colClubAddIns = new List <AccountToAddIn>();

            if (accountId == 0)
            {
                //set default objects
                AccountToAddIn atoa = new AccountToAddIn(true);
                colClubAddIns.Add(atoa);
                return(colClubAddIns);
            }
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId)
            };
            SqlDataReader dataReader = await sqlIO.RunProcAsync(
                "0GetAddInsByClubId", colPrams);

            if (dataReader != null)
            {
                using (dataReader)
                {
                    while (await dataReader.ReadAsync())
                    {
                        AccountToAddIn atoa = new AccountToAddIn(true);
                        atoa.PKId                      = dataReader.GetInt32(0);
                        atoa.LinkedViewName            = dataReader.GetString(1);
                        atoa.LinkingNodeId             = dataReader.GetInt32(2);
                        atoa.LinkedViewId              = dataReader.GetInt32(3);
                        atoa.IsDefaultLinkedView       = dataReader.GetBoolean(4);
                        atoa.Account                   = new Account(true);
                        atoa.LinkedView                = new LinkedView(true);
                        atoa.LinkedView.PKId           = dataReader.GetInt32(5);
                        atoa.LinkedView.LinkedViewNum  = dataReader.GetString(6);
                        atoa.LinkedView.LinkedViewName = dataReader.GetString(7);
                        atoa.LinkedView.LinkedViewDesc = dataReader.GetString(8);
                        atoa.LinkedView.LinkedViewFileExtensionType = dataReader.GetString(9);
                        atoa.LinkedView.LinkedViewLastChangedDate   = dataReader.GetDateTime(10);
                        atoa.LinkedView.LinkedViewFileName          = dataReader.GetString(11);
                        atoa.LinkedView.LinkedViewXml           = string.Empty;
                        atoa.LinkedView.LinkedViewAddInName     = dataReader.GetString(13);
                        atoa.LinkedView.LinkedViewAddInHostName = dataReader.GetString(14);
                        atoa.LinkedView.LinkedViewPackId        = dataReader.GetInt32(15);
                        colClubAddIns.Add(atoa);
                    }
                }
            }
            else
            {
                //set default objects
                AccountToAddIn atoa = new AccountToAddIn(true);
                colClubAddIns.Add(atoa);
            }
            sqlIO.Dispose();
            return(colClubAddIns);
        }
Beispiel #14
0
        public async Task <SqlDataReader> GetServiceAsync(
            Helpers.SqlIOAsync sqlIO, ContentURI uri, bool isBaseService)
        {
            int iServiceId = (isBaseService == true) ? uri.URIService.ServiceId : uri.URIService.PKId;

            SqlParameter[] colPrams =
            {
                sqlIO.MakeInParam("@Id", SqlDbType.Int, 4, iServiceId)
            };
            string        sQry       = (isBaseService == true) ? "0GetServiceBase" : "0GetService";
            SqlDataReader dataReader = await sqlIO.RunProcAsync(sQry, colPrams);

            return(dataReader);
        }
Beispiel #15
0
        public async Task <string> GetAncestorsAndAuthorizationsAsync(
            ContentURI uri, int clubOrMemberId)
        {
            Dictionary <string, int> ancestors = new Dictionary <string, int>();
            string ancestorArray       = string.Empty;
            int    iAuthorizationLevel = 0;

            string sAdminNetworkPartName
                = Data.Helpers.GeneralHelpers.GetDefaultNetworkPartName();

            Helpers.SqlIOAsync sqlIO  = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     oPrams =
            {
                sqlIO.MakeInParam("@AccountId",            SqlDbType.Int,          4, clubOrMemberId),
                sqlIO.MakeInParam("@ServiceId",            SqlDbType.Int,          4, uri.URIService.ServiceId),
                sqlIO.MakeInParam("@NetworkPartName",      SqlDbType.NVarChar,    20, uri.URINetworkPartName),
                sqlIO.MakeInParam("@AdminNetworkPartName", SqlDbType.NVarChar,    20, sAdminNetworkPartName),
                sqlIO.MakeInParam("@ParamDelimiter",       SqlDbType.NVarChar,     2, Helpers.GeneralHelpers.PARAMETER_DELIMITER),
                sqlIO.MakeOutParam("@AncestorNameArray",   SqlDbType.NVarChar, 1000),
                sqlIO.MakeOutParam("@AuthorizationLevel",  SqlDbType.SmallInt, 2)
            };
            string sQryName = "0GetAncestorNamesAgreementByServiceId";
            int    iNotUsed = await sqlIO.RunProcIntAsync(sQryName, oPrams);

            if (oPrams[5].Value != System.DBNull.Value)
            {
                ancestorArray = oPrams[5].Value.ToString();
            }
            if (oPrams[6].Value != System.DBNull.Value)
            {
                AccountHelper.AUTHORIZATION_LEVELS publicOrPrivateAL
                    = AccountHelper.AUTHORIZATION_LEVELS.viewonly;
                iAuthorizationLevel
                    = Helpers.GeneralHelpers.ConvertStringToInt(oPrams[6].Value.ToString());
                publicOrPrivateAL = AccountHelper.GetAuthorizationLevel(iAuthorizationLevel);
                //new in 1.5.2
                if (uri.URIMember == null)
                {
                    uri.URIMember = new AccountToMember(true);
                }
                if (uri.URIMember.ClubInUse == null)
                {
                    uri.URIMember.ClubInUse = new Account(true);
                }
                //set what the db says is their authorization level
                uri.URIMember.ClubInUse.PrivateAuthorizationLevel = publicOrPrivateAL;
            }
            sqlIO.Dispose();
            return(ancestorArray);
        }
Beispiel #16
0
        public async Task <SqlDataReader> GetNetworkForLoggedinMemberAsync(Helpers.SqlIOAsync sqlIO,
                                                                           SearchManager searcher)
        {
            SqlParameter[] colPrams =
            {
                sqlIO.MakeInParam("@AccountId",      SqlDbType.Int,       4, searcher.SearchResult.URIMember.ClubInUse.PKId),
                sqlIO.MakeInParam("@NetworkType",    SqlDbType.NVarChar, 25, searcher.NetworkType.ToString()),
                sqlIO.MakeInParam("@ServiceGroupId", SqlDbType.Int,       4, searcher.ServiceGroupSelected.PKId),
                sqlIO.MakeInParam("@NetworkGroupId", SqlDbType.Int,       4, searcher.NetworkGroupSelected.PKId),
                sqlIO.MakeInParam("@Language",       SqlDbType.NVarChar,  5, searcher.UserLanguage)
            };
            SqlDataReader dataReader
                = await sqlIO.RunProcAsync("0GetNetworks", colPrams);

            return(dataReader);
        }
Beispiel #17
0
        public async Task <Account> GetClubByIdAsync(ContentURI uri, int accountId)
        {
            Account club = new Account(true);

            Helpers.SqlIOAsync sqlIO  = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     oPrams =
            {
                sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId)
            };
            SqlDataReader dataReader
                = await sqlIO.RunProcAsync("0GetClubById", oPrams);

            if (dataReader != null)
            {
                using (dataReader)
                {
                    int i = 0;
                    //build a related service list to return to the client
                    while (await dataReader.ReadAsync())
                    {
                        if (i == 0)
                        {
                            club.PKId            = dataReader.GetInt32(0);
                            club.AccountName     = dataReader.GetString(1);
                            club.AccountDesc     = dataReader.GetString(2);
                            club.AccountLongDesc = dataReader.GetString(3);
                            club.AccountEmail    = dataReader.GetString(4);
                            club.AccountURI      = dataReader.GetString(5);
                            club.AccountClassId  = dataReader.GetInt32(6);
                            club.GeoRegionId     = dataReader.GetInt32(7);
                            //the objects and collecions are set later
                            //not part of db
                            club.ClubDocFullPath           = string.Empty;
                            club.PrivateAuthorizationLevel = 0;
                            club.URIFull = string.Empty;
                        }
                        else
                        {
                            break;
                        }
                        i++;
                    }
                }
            }
            sqlIO.Dispose();
            return(club);
        }
Beispiel #18
0
        public async Task <List <AccountToService> > GetServiceAsync(SearchManager searcher)
        {
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(searcher.SearchResult);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId",      SqlDbType.Int,       4, searcher.SearchResult.URIMember.ClubInUse.PKId),
                sqlIO.MakeInParam("@NetworkId",      SqlDbType.Int,       4, searcher.SearchResult.URINetwork.PKId),
                sqlIO.MakeInParam("@NetworkType",    SqlDbType.NVarChar, 25, searcher.NetworkType.ToString()),
                sqlIO.MakeInParam("@ServiceGroupId", SqlDbType.Int,       4, searcher.ServiceGroupSelected.PKId)
            };
            SqlDataReader services
                = await sqlIO.RunProcAsync("0GetServices", colPrams);

            List <AccountToService> colService = FillClubServiceList(services);

            sqlIO.Dispose();
            return(colService);
        }
Beispiel #19
0
        public async Task <bool> ChangeApplicationAndServiceFromBaseServiceAsync(
            ContentURI uri)
        {
            bool bIsBaseService = true;

            uri.URIService.ServiceId = uri.URIId;
            Helpers.SqlIOAsync sqlIO   = new Helpers.SqlIOAsync(uri);
            SqlDataReader      service = await GetServiceAsync(sqlIO, uri, bIsBaseService);

            if (service != null)
            {
                //set the uri's service object
                uri.URIService = FillServiceObject(service);
            }
            sqlIO.Dispose();
            Helpers.GeneralHelpers.SetAppTypes(uri.URIService.Service.ServiceClassId, uri);
            return(bIsBaseService);
        }
Beispiel #20
0
        public async Task <bool> UpdateDefaultNetworkForLoggedinMemberAsync(
            ContentURI uri, int accountId, int newIsDefaultAccountToNetworkId)
        {
            bool bHasUpdated = false;

            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId",                      SqlDbType.Int, 4, accountId),
                sqlIO.MakeInParam("@NewIsDefaultAccountToNetworkId", SqlDbType.Int, 4, newIsDefaultAccountToNetworkId)
            };
            int iResult = await sqlIO.RunProcIntAsync("0UpdateNetworkDefaultId", colPrams);

            if (iResult == 1)
            {
                bHasUpdated = true;
            }
            sqlIO.Dispose();
            return(bHasUpdated);
        }
Beispiel #21
0
        public static async Task <string> GetDevPackBaseIdFromJoinIdAsync(
            ContentURI uri, string connect, string currentNodeName, string currentId)
        {
            string sBaseTableId = string.Empty;

            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@Id",           SqlDbType.Int,       4, currentId),
                sqlIO.MakeInParam("@NodeName",     SqlDbType.NVarChar, 25, currentNodeName),
                sqlIO.MakeOutParam("@BaseTableId", SqlDbType.Int, 4)
            };
            string sQryName = "0GetDevPackBaseTableId";
            int    iNotUsed = await sqlIO.RunProcIntAsync(sQryName, colPrams);

            if (colPrams[2].Value != System.DBNull.Value)
            {
                sBaseTableId = colPrams[2].Value.ToString();
            }
            sqlIO.Dispose();
            return(sBaseTableId);
        }
        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);
        }
Beispiel #23
0
        public async Task <List <ContentURI> > GetNetworkCategoriesAsync(
            ContentURI serviceURI)
        {
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(serviceURI);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@NetworkId",      SqlDbType.Int, 4, serviceURI.URIService.Service.NetworkId),
                sqlIO.MakeInParam("@ServiceGroupId", SqlDbType.Int, 4, serviceURI.URIService.Service.ServiceClassId)
            };
            SqlDataReader categories = await sqlIO.RunProcAsync("0GetCategories",
                                                                colPrams);

            List <ContentURI> colCategories = new List <ContentURI>();
            string            sTypeNodeName = Helpers.GeneralHelpers.GetCategoryNodeName(serviceURI.URIService.Service.ServiceClassId);

            if (categories != null)
            {
                //categories return id, label, name, servicegroupid and networkid sorted by label
                //contenturi not strictly needed
                while (categories.Read())
                {
                    ContentURI category = new ContentURI(
                        categories.GetString(2), categories.GetInt32(0),
                        serviceURI.URINetworkPartName, sTypeNodeName, string.Empty);
                    category.URIDataManager.Label = categories.GetString(1);
                    if (category.URIService == null)
                    {
                        category.URIService = new AccountToService(true);
                    }
                    //networkid and servicegroupid can be 0 if it's a static DevTreks-wide category
                    category.URIService.Service.NetworkId      = categories.GetInt32(3);
                    category.URIService.Service.ServiceClassId = categories.GetInt32(4);
                    colCategories.Add(category);
                }
            }
            sqlIO.Dispose();
            return(colCategories);
        }
Beispiel #24
0
        public async Task <bool> SetClubOwnerByServiceAsync(ContentURI uri)
        {
            bool    bHasSet = true;
            Account newClub = new Account();

            Helpers.SqlIOAsync sqlIO  = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     oPrams =
            {
                sqlIO.MakeInParam("@Id",              SqlDbType.Int,        4, uri.URIService.ServiceId),
                sqlIO.MakeOutParam("@AccountId",      SqlDbType.Int,       4),
                sqlIO.MakeOutParam("@AccountName",    SqlDbType.NVarChar, 75),
                sqlIO.MakeOutParam("@AccountGroupId", SqlDbType.Int,       4),
                sqlIO.MakeOutParam("@AccountEmail",   SqlDbType.NVarChar, 255)
            };
            int iNotUsed = await sqlIO.RunProcIntAsync("0GetAccountByService", oPrams);

            if (oPrams[1].Value != System.DBNull.Value)
            {
                newClub.PKId = (int)oPrams[1].Value;
            }
            if (oPrams[2].Value != System.DBNull.Value)
            {
                newClub.AccountName = oPrams[2].Value.ToString();
            }
            if (oPrams[3].Value != System.DBNull.Value)
            {
                int iAccountGroupId = (int)oPrams[3].Value;
                newClub.AccountClassId = iAccountGroupId;
            }
            if (oPrams[4].Value != System.DBNull.Value)
            {
                newClub.AccountEmail = oPrams[4].Value.ToString();
            }
            uri.URIClub = newClub;
            bHasSet     = true;
            sqlIO.Dispose();
            return(bHasSet);
        }
Beispiel #25
0
        public async Task <List <Network> > GetNetworkAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      networks
                = await sqlIO.RunProcAsync("0GetNetworksBase");

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

            if (networks != null)
            {
                //build a related service list to return to the client
                //small set so not async
                while (networks.Read())
                {
                    Network newNetwork = new Network(true);
                    newNetwork.PKId               = networks.GetInt32(0);
                    newNetwork.NetworkName        = networks.GetString(1);
                    newNetwork.NetworkURIPartName = networks.GetString(2);
                    newNetwork.NetworkDesc        = networks.GetString(3);
                    newNetwork.AdminConnection    = networks.GetString(4);
                    newNetwork.WebFileSystemPath  = networks.GetString(5);
                    newNetwork.WebConnection      = networks.GetString(6);
                    newNetwork.WebDbPath          = networks.GetString(7);
                    newNetwork.NetworkClassId     = networks.GetInt32(8);
                    newNetwork.NetworkClass       = new NetworkClass();
                    newNetwork.GeoRegionId        = networks.GetInt32(9);
                    //rest are not stored in db
                    newNetwork.IsDefault        = false;
                    newNetwork.URIFull          = string.Empty;
                    newNetwork.XmlConnection    = string.Empty;
                    newNetwork.AccountToNetwork = new List <AccountToNetwork>();
                    newNetwork.Service          = new List <Service>();
                    colNetwork.Add(newNetwork);
                }
            }
            sqlIO.Dispose();
            return(colNetwork);
        }
Beispiel #26
0
        public async Task <int> InsertNewAuditItemAsync(
            ContentURI uri, AccountToAudit audit)
        {
            int iId = 0;

            Helpers.SqlIOAsync sqlIO  = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     oPrams =
            {
                sqlIO.MakeInParam("@MemberId",                    SqlDbType.Int,        4, audit.MemberId),
                sqlIO.MakeInParam("@MemberRole",                  SqlDbType.NVarChar,  25, audit.MemberRole),
                sqlIO.MakeInParam("@ClubInUseId",                 SqlDbType.Int,        4, audit.ClubInUseId),
                sqlIO.MakeInParam("@ClubInUseAuthorizationLevel", SqlDbType.NVarChar,  25, audit.ClubInUseAuthorizationLevel),
                sqlIO.MakeInParam("@EditedDocURI",                SqlDbType.NVarChar, 300, audit.EditedDocURI),
                sqlIO.MakeInParam("@EditedDocFullPath",           SqlDbType.NVarChar, 400, audit.EditedDocFullPath),
                sqlIO.MakeInParam("@ServerSubAction",             SqlDbType.NVarChar,  25, audit.ServerSubAction),
                sqlIO.MakeInParam("@EditDate",                    SqlDbType.Date,       4, audit.EditDate),
                sqlIO.MakeInParam("@AccountId",                   SqlDbType.Int,        4, audit.AccountId)
            };
            iId = await sqlIO.RunProcIntAsync("0InsertAudit", oPrams);

            sqlIO.Dispose();
            return(iId);
        }
Beispiel #27
0
        public async Task <bool> AddNetworkCategoriesAsync(ContentURI uri,
                                                           int serviceGroupId, int networkId, int numberToAdd)
        {
            bool bIsOkToSave = false;

            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@NetworkId",      SqlDbType.Int, 4, networkId),
                sqlIO.MakeInParam("@ServiceGroupId", SqlDbType.Int, 4, serviceGroupId),
                sqlIO.MakeInParam("@NumberToAdd",    SqlDbType.Int, 4, numberToAdd)
            };
            string sQryName  = "0InsertCategories";
            int    iRowCount = await sqlIO.RunProcIntAsync(sQryName, colPrams);

            //no error means sp ran successfully
            if (iRowCount > 0)
            {
                bIsOkToSave = true;
            }
            sqlIO.Dispose();
            return(bIsOkToSave);
        }
Beispiel #28
0
        public async Task <List <SearchManager.SearchType> > GetTypesAsync(
            ContentURI uri, int networkId, int serviceGroupId)
        {
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@NetworkId",      SqlDbType.Int, 4, networkId),
                sqlIO.MakeInParam("@ServiceGroupId", SqlDbType.Int, 4, serviceGroupId)
            };
            SqlDataReader categories = await sqlIO.RunProcAsync(
                "0GetCategories", colPrams);

            List <SearchManager.SearchType> colSearchTypes
                = new List <SearchManager.SearchType>();

            if (categories != null)
            {
                using (categories)
                {
                    //categories return id, label, name, servicegroupid and networkid sorted by label
                    //contenturi not strictly needed
                    while (categories.Read())
                    {
                        SearchManager.SearchType searchType = new SearchManager.SearchType();
                        searchType.Id             = categories.GetInt32(0);
                        searchType.Label          = categories.GetString(1);
                        searchType.Name           = categories.GetString(2);
                        searchType.NetworkId      = categories.GetInt32(3);
                        searchType.ServiceClassId = categories.GetInt32(4);
                        colSearchTypes.Add(searchType);
                    }
                }
            }
            sqlIO.Dispose();
            return(colSearchTypes);
        }
Beispiel #29
0
        public async Task <List <AccountToAudit> > GetAuditsByClubIdAsync(
            ContentURI uri, int accountId, int numberRecords)
        {
            List <AccountToAudit> colClubAudits = new List <AccountToAudit>();

            if (accountId == 0)
            {
                //set default objects
                AccountToAudit atoa = new AccountToAudit(true);
                colClubAudits.Add(atoa);
                return(colClubAudits);
            }
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId),
                sqlIO.MakeInParam("@Number",    SqlDbType.Int, 4, numberRecords)
            };
            SqlDataReader dataReader = await sqlIO.RunProcAsync(
                "0GetAuditsByClubId", colPrams);

            if (dataReader != null)
            {
                using (dataReader)
                {
                    while (await dataReader.ReadAsync())
                    {
                        AccountToAudit atoa = new AccountToAudit(true);
                        atoa.PKId        = dataReader.GetInt32(0);
                        atoa.MemberId    = dataReader.GetInt32(1);
                        atoa.MemberRole  = dataReader.GetString(2);
                        atoa.ClubInUseId = dataReader.GetInt32(3);
                        atoa.ClubInUseAuthorizationLevel = dataReader.GetString(4);
                        atoa.EditedDocURI            = dataReader.GetString(5);
                        atoa.EditedDocFullPath       = dataReader.GetString(6);
                        atoa.ServerSubAction         = dataReader.GetString(7);
                        atoa.EditDate                = dataReader.GetDateTime(8);
                        atoa.AccountId               = dataReader.GetInt32(9);
                        atoa.Account                 = new Account();
                        atoa.Account.PKId            = dataReader.GetInt32(10);
                        atoa.Account.AccountName     = dataReader.GetString(11);
                        atoa.Account.AccountDesc     = dataReader.GetString(12);
                        atoa.Account.AccountLongDesc = dataReader.GetString(13);
                        atoa.Account.AccountEmail    = dataReader.GetString(14);
                        atoa.Account.AccountURI      = dataReader.GetString(15);
                        atoa.Account.AccountClassId  = dataReader.GetInt32(16);
                        atoa.Account.GeoRegionId     = dataReader.GetInt32(17);
                        //not in db
                        atoa.Account.ClubDocFullPath = string.Empty;
                        atoa.Account.PrivateAuthorizationLevel
                            = AccountHelper.AUTHORIZATION_LEVELS.none;
                        atoa.Account.NetCost   = 0;
                        atoa.Account.TotalCost = 0;
                        atoa.Account.URIFull   = string.Empty;
                        colClubAudits.Add(atoa);
                    }
                }
            }
            else
            {
                //set default objects
                AccountToAudit aton = new AccountToAudit(true);
                colClubAudits.Add(aton);
            }
            sqlIO.Dispose();
            return(colClubAudits);
        }
Beispiel #30
0
        public async Task <List <AccountToLocal> > GetLocalsByClubIdAsync(
            ContentURI uri, int accountId)
        {
            List <AccountToLocal> colClubLocals = new List <AccountToLocal>();

            if (accountId == 0)
            {
                //set default objects
                AccountToLocal atol = new AccountToLocal(true);
                colClubLocals.Add(atol);
                return(colClubLocals);
            }
            Helpers.SqlIOAsync sqlIO    = new Helpers.SqlIOAsync(uri);
            SqlParameter[]     colPrams =
            {
                sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId)
            };
            SqlDataReader dataReader = await sqlIO.RunProcAsync(
                "0GetLocalsByClubId", colPrams);

            if (dataReader != null)
            {
                using (dataReader)
                {
                    while (await dataReader.ReadAsync())
                    {
                        AccountToLocal atol = new AccountToLocal(true);
                        atol.PKId                = dataReader.GetInt32(0);
                        atol.LocalName           = dataReader.GetString(1);
                        atol.LocalDesc           = dataReader.GetString(2);
                        atol.UnitGroupId         = dataReader.GetInt32(3);
                        atol.UnitGroup           = dataReader.GetString(4);
                        atol.CurrencyGroupId     = dataReader.GetInt32(5);
                        atol.CurrencyGroup       = dataReader.GetString(6);
                        atol.RealRateId          = dataReader.GetInt32(7);
                        atol.RealRate            = dataReader.GetFloat(8);
                        atol.NominalRateId       = dataReader.GetInt32(9);
                        atol.NominalRate         = dataReader.GetFloat(10);
                        atol.DataSourceTechId    = dataReader.GetInt32(11);
                        atol.DataSourceTech      = dataReader.GetString(12);
                        atol.GeoCodeTechId       = dataReader.GetInt32(13);
                        atol.GeoCodeTech         = dataReader.GetString(14);
                        atol.DataSourcePriceId   = dataReader.GetInt32(15);
                        atol.DataSourcePrice     = dataReader.GetString(16);
                        atol.GeoCodePriceId      = dataReader.GetInt32(17);
                        atol.GeoCodePrice        = dataReader.GetString(18);
                        atol.RatingGroupId       = dataReader.GetInt32(19);
                        atol.RatingGroup         = dataReader.GetString(20);
                        atol.AccountId           = dataReader.GetInt32(21);
                        atol.IsDefaultLinkedView = dataReader.GetBoolean(22);
                        atol.Account             = new Account();
                        //2.0.0 deprecated
                        //atol.LinkedViewId = dataReader.GetInt32(22);
                        //atol.LinkingXmlDoc = atol.LinkedViewName;
                        //atol.LinkedView = new LinkedView();
                        colClubLocals.Add(atol);
                    }
                }
            }
            else
            {
                //set default objects
                AccountToLocal aton = new AccountToLocal(true);
                colClubLocals.Add(aton);
            }
            sqlIO.Dispose();
            return(colClubLocals);
        }