Changeset 3818 for extensions/PiwigoLib/PiwigoLib/Service/PwgTagsService.cs
- Timestamp:
- Sep 3, 2009, 4:03:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/Service/PwgTagsService.cs
r3816 r3818 10 10 namespace Com.Piwigo.Lib.Service 11 11 { 12 12 13 13 static public class PwgTagsService 14 14 { 15 16 static public List<PwgTag> GetListOfPwgTag(Boolean sortedByCounter) 15 /// <summary> 16 /// Get the list of tags the user is connected can access 17 /// </summary> 18 /// <param name="sortedByCounter"></param> 19 /// <returns></returns> 20 static public List<PwgTag> GetListOfTag(Boolean sortedByCounter) 17 21 { 18 22 List<PwgTag> returnValue = new List<PwgTag>(); … … 48 52 49 53 /// <summary> 54 /// Get the list of all atgs in piwigo, you must be connected with a high level user 55 /// </summary> 56 /// <param name="sortedByCounter"></param> 57 /// <returns></returns> 58 static public List<PwgTag> GetAdminListOfTag() 59 { 60 List<PwgTag> returnValue = new List<PwgTag>(); 61 62 try 63 { 64 PwgTagsProxyResponse response = PwgTagsProxy.pwg_tags_getAdminList(); 65 66 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) 67 { 68 if (response.Erreur != null) 69 { 70 throw new PwgServiceException("GetAdminListOfTag, the server has return the error.", 71 response.Erreur.Code, 72 response.Erreur.Message); 73 } 74 else 75 { 76 throw new PwgServiceException("GetAdminListOfTag : a error occurs during server process."); 77 } 78 } 79 else 80 { 81 returnValue = ConvertProxyResponseToDTO(response); 82 } 83 } 84 catch (PwgProxyException ex) 85 { 86 throw new PwgServiceException("GetAdminListOfTag : a error is raised by proxy.", ex); 87 } 88 return returnValue; 89 } 90 91 92 /// <summary> 50 93 /// private: convert response to dto object 51 94 /// </summary> … … 56 99 List<PwgTag> returnValue = new List<PwgTag>(); 57 100 101 foreach (PwgTagProxyResponse respTag in response.Tags) 102 { 103 returnValue.Add(ConvertProxyResponseToDTO(respTag)); 104 } 105 106 return returnValue; 107 } 108 109 /// <summary> 110 /// private: convert response to dto object 111 /// </summary> 112 /// <param name="response"></param> 113 /// <param name="session"></param> 114 static private PwgTag ConvertProxyResponseToDTO(PwgTagProxyResponse response) 115 { 116 PwgTag returnValue = new PwgTag(); 117 118 try 119 { 120 returnValue.Counter = response.Counter; 121 returnValue.Id = response.Id; 122 returnValue.Name = response.Name; 123 returnValue.UrlName = response.UrlName; 124 125 if (String.IsNullOrEmpty(response.UrlTag)) 126 { 127 returnValue.UrlTag = null; 128 } 129 else 130 { 131 returnValue.UrlTag = (new UriBuilder(response.UrlTag)).Uri; 132 } 133 } 134 catch (Exception ex) 135 { 136 throw new PwgServiceException("ConvertProxyResponseToDTO : a error is raised when converting PwgTagProxyResponse.", ex); 137 } 138 58 139 return returnValue; 59 140 }
Note: See TracChangeset
for help on using the changeset viewer.