Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 private static void SetLinkedViewPropertiesForEdit(
     ContentURI selectedLinkedViewURI, XElement selectedViewDoc)
 {
     AccountHelper.AUTHORIZATION_LEVELS eInitialAuthorization
         = selectedLinkedViewURI.URIMember.ClubInUse.PrivateAuthorizationLevel;
     //turn off db editing
     selectedLinkedViewURI.URIMember.ClubInUse.PrivateAuthorizationLevel =
         AccountHelper.AUTHORIZATION_LEVELS.viewonly;
     if (selectedViewDoc != null)
     {
         //prior to editing, change uri's app and subapp type
         //to the custom doc being edited
         string sAppNodeName
             = DevTreks.Data.EditHelpers.XmlLinq.GetRootElementFirstChildNodeName(
                   selectedViewDoc);
         DataHelpers.GeneralHelpers.ChangeAppTypeFromNodeName(
             selectedLinkedViewURI, sAppNodeName);
     }
 }