Changeset 3834 for extensions/PiwigoLib/PiwigoLib/Service
- Timestamp:
- Sep 7, 2009, 2:46:08 PM (15 years ago)
- Location:
- extensions/PiwigoLib/PiwigoLib/Service
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/Service/PwgCategoriesService.cs
r3833 r3834 11 11 { 12 12 13 static public class Pwg TagsService13 static public class PwgCategoriesService 14 14 { 15 15 /// <summary> 16 /// Get the list of tagsthe user is connected can access16 /// Get the list of category the user is connected can access 17 17 /// </summary> 18 18 /// <param name="sortedByCounter"></param> 19 19 /// <returns></returns> 20 static public List<Pwg Tag> GetListOfTag(Boolean sortedByCounter)21 { 22 List<Pwg Tag> returnValue = new List<PwgTag>();23 24 try 25 { 26 Pwg TagsProxyResponse response = PwgTagsProxy.pwg_tags_getList(sortedByCounter);20 static public List<PwgCategory> GetListOfCategory(Int32? CatgeroryId, Boolean? Recursive, Boolean? PublicOnly) 21 { 22 List<PwgCategory> returnValue = new List<PwgCategory>(); 23 24 try 25 { 26 PwgCategoriesProxyResponse response = PwgCategoriesProxy.pwg_categories_getList(CatgeroryId, Recursive, PublicOnly); 27 27 28 28 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) … … 30 30 if (response.Erreur != null) 31 31 { 32 throw new PwgServiceException("GetListOf PwgTag, the server has return the error.",32 throw new PwgServiceException("GetListOfCategory, the server has return the error.", 33 33 response.Erreur.Code, 34 34 response.Erreur.Message); … … 36 36 else 37 37 { 38 throw new PwgServiceException("GetListOf PwgTag: a error occurs during server process.");38 throw new PwgServiceException("GetListOfCategory : a error occurs during server process."); 39 39 } 40 40 } … … 46 46 catch (PwgProxyException ex) 47 47 { 48 throw new PwgServiceException("GetListOfPwgTag : a error is raised by proxy.", ex); 49 } 50 return returnValue; 51 } 52 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> 48 throw new PwgServiceException("GetListOfCategory : a error is raised by proxy.", ex); 49 } 50 return returnValue; 51 } 52 53 /// <summary> 54 /// Get List of all Category, must be logged as admin 55 /// </summary> 57 56 /// <returns></returns> 58 static public List<Pwg Tag> GetAdminListOfTag()59 { 60 List<Pwg Tag> returnValue = new List<PwgTag>();61 62 try 63 { 64 Pwg TagsProxyResponse response = PwgTagsProxy.pwg_tags_getAdminList();57 static public List<PwgCategory> GetAdminListOfCategory() 58 { 59 List<PwgCategory> returnValue = new List<PwgCategory>(); 60 61 try 62 { 63 PwgCategoriesProxyResponse response = PwgCategoriesProxy.pwg_categories_getAdminList(); 65 64 66 65 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) … … 68 67 if (response.Erreur != null) 69 68 { 70 throw new PwgServiceException("GetAdminListOf Tag, the server has return the error.",69 throw new PwgServiceException("GetAdminListOfCategory, the server has return the error.", 71 70 response.Erreur.Code, 72 71 response.Erreur.Message); … … 74 73 else 75 74 { 76 throw new PwgServiceException("GetAdminListOf Tag: a error occurs during server process.");75 throw new PwgServiceException("GetAdminListOfCategory : a error occurs during server process."); 77 76 } 78 77 } … … 84 83 catch (PwgProxyException ex) 85 84 { 86 throw new PwgServiceException("GetAdminListOf Tag: a error is raised by proxy.", ex);87 } 88 return returnValue; 89 } 90 91 /// <summary> 92 /// Add a Tag85 throw new PwgServiceException("GetAdminListOfCategory : a error is raised by proxy.", ex); 86 } 87 return returnValue; 88 } 89 90 /// <summary> 91 /// Add a Categorie 93 92 /// </summary> 94 93 /// <param name="tagName"></param> 95 94 /// <returns></returns> 96 static public Boolean Add Tag(String tagName)95 static public Boolean AddCategory(String categoryName, Int32? upperCatId, ref Int32 newId, ref String messageInfo) 97 96 { 98 97 Boolean returnValue = false; … … 100 99 try 101 100 { 102 Pwg TagsProxyResponse response = PwgTagsProxy.pwg_tag_add(tagName);101 PwgAddRequestProxyResponse response = PwgCategoriesProxy.pwg_categories_add(categoryName, upperCatId); 103 102 104 103 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) … … 118 117 { 119 118 returnValue = true; 119 newId = response.NewId; 120 messageInfo = response.Message; 120 121 } 121 122 } … … 126 127 return returnValue; 127 128 } 128 129 /// <summary>130 /// Return the list of image form a list of tag131 /// </summary>132 /// <param name="tagsId"></param>133 /// <param name="tagsUrlName"></param>134 /// <param name="tagsName"></param>135 /// <param name="tagModeAnd"></param>136 /// <param name="perPage"></param>137 /// <param name="Page"></param>138 /// <param name="Order"></param>139 /// <param name="minRate"></param>140 /// <param name="maxRate"></param>141 /// <param name="minHit"></param>142 /// <param name="maxHit"></param>143 /// <param name="minDateAvailable"></param>144 /// <param name="maxDateAvailable"></param>145 /// <param name="minDateCreated"></param>146 /// <param name="maxDateCreated"></param>147 /// <param name="minRatio"></param>148 /// <param name="maxRatio"></param>149 /// <param name="withThumbnail"></param>150 /// <param name="PageReturned"></param>151 /// <param name="PerPageeReturned"></param>152 /// <param name="CountReturned"></param>153 /// <returns></returns>154 static public List<PwgImage> GetListOfImagesFormTags(List<Int32> tagsId,155 List<String> tagsUrlName,156 List<String> tagsName,157 Boolean? tagModeAnd,158 Int32? perPage,159 Int32? Page,160 Int32? Order,161 Int32? minRate,162 Int32? maxRate,163 Int32? minHit,164 Int32? maxHit,165 DateTime? minDateAvailable,166 DateTime? maxDateAvailable,167 DateTime? minDateCreated,168 DateTime? maxDateCreated,169 Int32? minRatio,170 Int32? maxRatio,171 Boolean? withThumbnail,172 ref Int32 PageReturned,173 ref Int32 PerPageeReturned,174 ref Int32 CountReturned)175 {176 List<PwgImage> returnValue = new List<PwgImage>();177 178 try179 {180 PwgImagesProxyResponse response = PwgTagsProxy.pwg_tags_getImages(tagsId,181 tagsUrlName,182 tagsName,183 tagModeAnd,184 perPage,185 Page,186 Order,187 minRate,188 maxRate,189 minHit,190 maxHit,191 minDateAvailable,192 maxDateAvailable,193 minDateCreated,194 maxDateCreated,195 minRatio,196 maxRatio,197 withThumbnail);198 199 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok)200 {201 if (response.Erreur != null)202 {203 throw new PwgServiceException("GetListOfImagesFormTags, the server has return the error.",204 response.Erreur.Code,205 response.Erreur.Message);206 }207 else208 {209 throw new PwgServiceException("GetListOfImagesFormTags : a error occurs during server process.");210 }211 }212 else213 {214 PwgImagesService.ConvertProxyResponseToDTO(response, returnValue,215 ref PageReturned,216 ref PerPageeReturned,217 ref CountReturned);218 }219 }220 catch (PwgProxyException ex)221 {222 throw new PwgServiceException("GetListOfImagesFormTags : a error is raised by proxy.", ex);223 }224 return returnValue;225 }226 227 129 228 130 /// <summary> … … 231 133 /// <param name="response"></param> 232 134 /// <param name="session"></param> 233 static public List<Pwg Tag> ConvertProxyResponseToDTO(PwgTagsProxyResponse response)234 { 235 List<Pwg Tag> returnValue = new List<PwgTag>();236 237 foreach (Pwg TagProxyResponse respTag in response.Tags)238 { 239 returnValue.Add(ConvertProxyResponseToDTO(resp Tag));135 static public List<PwgCategory> ConvertProxyResponseToDTO(PwgCategoriesProxyResponse response) 136 { 137 List<PwgCategory> returnValue = new List<PwgCategory>(); 138 139 foreach (PwgCategoryProxyResponse respCat in response.Categories) 140 { 141 returnValue.Add(ConvertProxyResponseToDTO(respCat)); 240 142 } 241 143 … … 249 151 /// <param name="response"></param> 250 152 /// <param name="session"></param> 251 static public PwgTag ConvertProxyResponseToDTO(PwgTagProxyResponse response) 252 { 253 PwgTag returnValue = new PwgTag(); 254 255 try 256 { 257 returnValue.Counter = response.Counter; 153 static public PwgCategory ConvertProxyResponseToDTO(PwgCategoryProxyResponse response) 154 { 155 PwgCategory returnValue = new PwgCategory(); 156 157 try 158 { 258 159 returnValue.Id = response.Id; 259 160 returnValue.Name = response.Name; 260 returnValue.UrlName = response.UrlName; 261 262 if (String.IsNullOrEmpty(response.UrlTag)) 263 { 264 returnValue.UrlTag = null; 265 } 266 else 267 { 268 returnValue.UrlTag = (new UriBuilder(response.UrlTag)).Uri; 161 162 returnValue.DeepImagesCount = response.DeepImagesCount; 163 returnValue.ImagesCount = response.ImagesCount; 164 returnValue.SubCategoriesCount = response.SubCategoriesCount; 165 166 returnValue.UpperCategoriesId = new List<int>(); 167 if (response.UpperCategoryId != null) 168 { 169 foreach (String stringId in response.UpperCategoryId.Split(',')) 170 { 171 returnValue.UpperCategoriesId.Add(Int32.Parse(stringId)); 172 } 173 } 174 175 if (response.LastDate != null) 176 { 177 DateTime tryDate; 178 if (DateTime.TryParse(response.LastDate, out tryDate)) 179 { 180 returnValue.LastDate = tryDate; 181 } 182 } 183 184 if (String.IsNullOrEmpty(response.Url)) 185 { 186 returnValue.Url = null; 187 } 188 else 189 { 190 returnValue.Url = (new UriBuilder(response.Url)).Uri; 269 191 } 270 192 } -
extensions/PiwigoLib/PiwigoLib/Service/PwgTagsService.cs
r3828 r3834 18 18 /// <param name="sortedByCounter"></param> 19 19 /// <returns></returns> 20 static public List<PwgTag> GetListOfTag(Boolean sortedByCounter)20 static public List<PwgTag> GetListOfTag(Boolean? sortedByCounter) 21 21 { 22 22 List<PwgTag> returnValue = new List<PwgTag>(); … … 94 94 /// <param name="tagName"></param> 95 95 /// <returns></returns> 96 static public Boolean AddTag(String tagName )96 static public Boolean AddTag(String tagName, ref Int32 newId, ref String messageInfo) 97 97 { 98 98 Boolean returnValue = false; … … 100 100 try 101 101 { 102 Pwg TagsProxyResponse response = PwgTagsProxy.pwg_tag_add(tagName);102 PwgAddRequestProxyResponse response = PwgTagsProxy.pwg_tag_add(tagName); 103 103 104 104 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) … … 118 118 { 119 119 returnValue = true; 120 newId = response.NewId; 121 messageInfo = response.Message; 120 122 } 121 123 }
Note: See TracChangeset
for help on using the changeset viewer.