Changeset 3818 for extensions/PiwigoLib
- Timestamp:
- Sep 3, 2009, 4:03:22 PM (15 years ago)
- Location:
- extensions/PiwigoLib
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/PiwigoLib.csproj
r3816 r3818 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 21022</ProductVersion>6 <ProductVersion>9.0.30729</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{64C068C5-DBFE-4712-9081-B9100698F35C}</ProjectGuid> … … 53 53 <Compile Include="Properties\AssemblyInfo.cs" /> 54 54 <Compile Include="Proxy\PwgTagsProxy.cs" /> 55 <Compile Include="Proxy\Response\Pwg TagsProxyResponse.cs" />55 <Compile Include="Proxy\Response\PwgSessionProxyResponse.cs" /> 56 56 <Compile Include="Proxy\Response\PwgBaseProxyReponse.cs" /> 57 57 <Compile Include="Proxy\Response\PwgBaseProxyReponseRetourEnum.cs" /> 58 <Compile Include="Proxy\Response\Pwg SessionProxyResponse.cs" />58 <Compile Include="Proxy\Response\PwgTagsProxyResponse.cs" /> 59 59 <Compile Include="Proxy\PwgConfigProxy.cs" /> 60 60 <Compile Include="Proxy\PwgGenericProxy.cs" /> -
extensions/PiwigoLib/PiwigoLib/Proxy/PwgGenericProxy.cs
r3816 r3818 12 12 { 13 13 14 static class PwgGenericProxy<T>14 static public class PwgGenericProxy<T> 15 15 { 16 16 -
extensions/PiwigoLib/PiwigoLib/Proxy/PwgTagsProxy.cs
r3816 r3818 30 30 31 31 } 32 33 static public PwgTagsProxyResponse pwg_tags_getAdminList() 34 { 35 PwgTagsProxyResponse response = null; 36 try 37 { 38 response = PwgGenericProxy<PwgTagsProxyResponse>.Get( 39 PwgConfigProxy.PwgServeurUriBuilder.Uri, 40 "pwg.tags.getAdminList", null); 41 } 42 catch (Exception ex) 43 { 44 throw new PwgProxyException("pwg_tags_getAdminList", ex); 45 } 46 return response; 47 48 } 49 32 50 } 33 51 -
extensions/PiwigoLib/PiwigoLib/Proxy/Response/PwgBaseProxyReponse.cs
r3816 r3818 27 27 public PwgBaseProxyReponseRetourEnum Retour { get; set; } 28 28 29 [XmlElement( 29 [XmlElement(ElementName="err")] 30 30 public PwgBaseProxyReponseError Erreur { get; set; } 31 31 -
extensions/PiwigoLib/PiwigoLib/Proxy/Response/PwgTagsProxyResponse.cs
r3816 r3818 12 12 public class PwgTagProxyResponse 13 13 { 14 [Xml Element(ElementName = "id")]14 [XmlAttribute(AttributeName = "id")] 15 15 public Int16 Id { get; set; } 16 [Xml Element(ElementName = "name")]16 [XmlAttribute(AttributeName = "name")] 17 17 public String Name { get; set; } 18 [Xml Element(ElementName = "url_name")]18 [XmlAttribute(AttributeName = "url_name")] 19 19 public String UrlName { get; set; } 20 [Xml Element(ElementName = "counter")]20 [XmlAttribute(AttributeName = "counter")] 21 21 public Int64 Counter { get; set; } 22 [Xml Element(ElementName = "url")]22 [XmlAttribute(AttributeName = "url")] 23 23 public String UrlTag { get; set; } 24 24 } … … 28 28 public class PwgTagsProxyResponse : PwgBaseProxyReponse 29 29 { 30 [XmlElement(ElementName = "tags")] 31 public List<PwgTagProxyResponse> Tags { get; set; } 30 //[XmlElement(ElementName = "tags")] 31 [XmlArray("tags")] 32 [XmlArrayItem("tag")] 33 public PwgTagProxyResponse[] Tags { get; set; } 32 34 } 33 35 } -
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 } -
extensions/PiwigoLib/TestPiwigoLib/Form1.cs
r3817 r3818 11 11 using Com.Piwigo.Lib.Service; 12 12 using Com.Piwigo.Lib.DTO; 13 using Com.Piwigo.Lib.Proxy.Response; 13 14 14 15 … … 40 41 Console.WriteLine("user : " + sess.UserName + " " + sess.Status); 41 42 42 List<PwgTag> lstTag = PwgTagsService.Get ListOfPwgTag(false);43 List<PwgTag> lstTag = PwgTagsService.GetAdminListOfTag(); 43 44 44 45 sess = PwgSessionService.Logout();
Note: See TracChangeset
for help on using the changeset viewer.