コード例 #1
0
 public static bool DeleteCommunityObject(long CommunityId, long ComponentId)
 {
     try
     {
         if (CommunityId > 0)
         {
             if (ComponentId > 0)
             {
                 CloudCommunityComponentsAPI.apiCommunityComponents api = new CloudCommunityComponentsAPI.apiCommunityComponents();
                 long?ownerId = api.Get(CloudCommunities.GetTokenFromId(), CommunityId, ComponentId, false, false).OwnerComponentId;
                 api.Delete(CloudCommunities.GetTokenFromId(), CommunityId, ComponentId);
                 SetAvoidCache(CommunityId, ownerId.HasValue ? ownerId.Value : 0);
                 return(true);
             }
             else
             {
                 CloudCommunitiesAPI.apiCommunities api = new CloudCommunitiesAPI.apiCommunities();
                 api.Delete(CloudCommunities.GetTokenFromId(), CommunityId);
                 SetAvoidCache(CommunityId, 0);
                 return(true);
             }
         }
     }
     catch (SoapException ex)
     {
         CloudCommunities.ProcessSoapException(ex);
         return(true); // failed but still tried
     }
     return(false);
 }
コード例 #2
0
 public static void UpdateCommunityObject(object obj)
 {
     try
     {
         if (obj is Folder)
         {
             Folder folder = (Folder)obj;
             if (folder.MSRCommunityId > 0)
             {
                 if (folder.MSRComponentId > 0)
                 {
                     CloudCommunityComponentsAPI.apiCommunityComponents api = new CloudCommunityComponentsAPI.apiCommunityComponents();
                     api.Update(CloudCommunities.GetTokenFromId(), folder.MSRCommunityId, folder.MSRComponentId, folder.Name,
                                null, null, false, null, null);
                     SetAvoidCache(folder.MSRCommunityId, folder.MSRComponentId);
                 }
                 else
                 {
                     CloudCommunitiesAPI.apiCommunities api = new CloudCommunitiesAPI.apiCommunities();
                     api.Update(CloudCommunities.GetTokenFromId(), folder.MSRCommunityId, folder.Name, null, null, null);
                     SetAvoidCache(folder.MSRCommunityId, 0);
                 }
             }
         }
         else
         {
             if (obj is Place)
             {
                 Place place = (Place)obj;
                 if (place.MSRCommunityId > 0 && place.MSRComponentId > 0)
                 {
                     AddUpdObjectToCommunity(place.MSRCommunityId, place.MSRComponentId, obj, true);
                 }
             }
             else
             {
                 if (obj is Tour)
                 {
                     Tour tour = (Tour)obj;
                     if (tour.MSRCommunityId > 0 && tour.MSRComponentId > 0)
                     {
                         AddUpdObjectToCommunity(tour.MSRCommunityId, tour.MSRComponentId, obj, true);
                     }
                 }
             }
         }
     }
     catch (SoapException ex)
     {
         CloudCommunities.ProcessSoapException(ex);
     }
 }
コード例 #3
0
 public static void UpdateCommunityObject(object obj)
 {
     try
     {
         if (obj is Folder)
         {
             Folder folder = (Folder)obj;
             if (folder.MSRCommunityId > 0)
             {
                 if (folder.MSRComponentId > 0)
                 {
                     CloudCommunityComponentsAPI.apiCommunityComponents api = new CloudCommunityComponentsAPI.apiCommunityComponents();
                     api.Update(CloudCommunities.GetTokenFromId(), folder.MSRCommunityId, folder.MSRComponentId, folder.Name,
                         null, null, false, null, null);
                     SetAvoidCache(folder.MSRCommunityId, folder.MSRComponentId);
                 }
                 else
                 {
                     CloudCommunitiesAPI.apiCommunities api = new CloudCommunitiesAPI.apiCommunities();
                     api.Update(CloudCommunities.GetTokenFromId(), folder.MSRCommunityId, folder.Name, null, null, null);
                     SetAvoidCache(folder.MSRCommunityId, 0);
                 }
             }
         }
         else
         {
             if (obj is Place)
             {
                 Place place = (Place)obj;
                 if (place.MSRCommunityId > 0 && place.MSRComponentId > 0)
                     AddUpdObjectToCommunity(place.MSRCommunityId, place.MSRComponentId, obj, true);
             }
             else
             {
                 if (obj is Tour)
                 {
                     Tour tour = (Tour)obj;
                     if (tour.MSRCommunityId > 0 && tour.MSRComponentId > 0)
                         AddUpdObjectToCommunity(tour.MSRCommunityId, tour.MSRComponentId, obj, true);
                 }
             }
         }
     }
     catch (SoapException ex)
     {
         CloudCommunities.ProcessSoapException(ex);
     }
 }
コード例 #4
0
 public static bool DeleteCommunityObject(long CommunityId, long ComponentId)
 {
     try
     {
         if (CommunityId > 0)
         {
             if (ComponentId > 0)
             {
                 CloudCommunityComponentsAPI.apiCommunityComponents api = new CloudCommunityComponentsAPI.apiCommunityComponents();
                 long? ownerId = api.Get(CloudCommunities.GetTokenFromId(), CommunityId, ComponentId, false, false).OwnerComponentId;
                 api.Delete(CloudCommunities.GetTokenFromId(), CommunityId, ComponentId);
                 SetAvoidCache(CommunityId, ownerId.HasValue ? ownerId.Value : 0);
                 return true;
             }
             else
             {
                 CloudCommunitiesAPI.apiCommunities api = new CloudCommunitiesAPI.apiCommunities();
                 api.Delete(CloudCommunities.GetTokenFromId(), CommunityId);
                 SetAvoidCache(CommunityId, 0);
                 return true;
             }
         }
     }
     catch (SoapException ex)
     {
         CloudCommunities.ProcessSoapException(ex);
         return true; // failed but still tried
     }
     return false;
 }