Changeset 3861 for extensions
- Timestamp:
- Sep 17, 2009, 11:14:31 PM (15 years ago)
- Location:
- extensions/PiwigoLib
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/DTO/PwgImage.cs
r3835 r3861 11 11 public Int32 Id { get; set; } 12 12 public Int32 Width { get; set; } 13 13 public Int32 Height { get; set; } 14 14 public String File { get; set; } 15 15 public Uri UrlThunb { get; set; } … … 23 23 24 24 } 25 26 public class PwgImageRate 27 { 28 public Int32 Count { get; set; } 29 public Double Average { get; set; } 30 public Double Stdev { get; set; } 31 } 25 32 } -
extensions/PiwigoLib/PiwigoLib/PiwigoLib.csproj
r3834 r3861 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 30729</ProductVersion>6 <ProductVersion>9.0.21022</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{64C068C5-DBFE-4712-9081-B9100698F35C}</ProjectGuid> … … 54 54 <Compile Include="DTO\PwgSession.cs" /> 55 55 <Compile Include="Properties\AssemblyInfo.cs" /> 56 <Compile Include="Proxy\PwgImagesProxy.cs" /> 56 57 <Compile Include="Proxy\PwgCategoriesProxy.cs" /> 57 58 <Compile Include="Proxy\Helper\PwgProxyReponseHelper.cs" /> -
extensions/PiwigoLib/PiwigoLib/Proxy/PwgGenericProxy.cs
r3827 r3861 150 150 try 151 151 { 152 //Console.WriteLine(xmlData.ReadToEnd());152 //Console.WriteLine(xmlData.ReadToEnd()); 153 153 154 154 System.Xml.Serialization.XmlSerializer xsSerializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); -
extensions/PiwigoLib/PiwigoLib/Proxy/Response/PwgImagesProxyResponse.cs
r3835 r3861 8 8 namespace Com.Piwigo.Lib.Proxy.Response 9 9 { 10 11 [Serializable()] 12 [XmlRoot(ElementName = "rsp")] 13 public class PwgImageRateProxyResponse : PwgBaseProxyReponse 14 { 15 [XmlElement("count")] 16 public Int32 Count { get; set; } 17 [XmlElement("average")] 18 public String Average { get; set; } 19 [XmlElement("stdev")] 20 public String Stdev { get; set; } 21 } 22 10 23 [Serializable()] 11 24 [XmlRoot(ElementName = "categorie")] … … 63 76 public PwgImageListProxyResponse ImageList { get; set; } 64 77 } 78 65 79 } -
extensions/PiwigoLib/PiwigoLib/Service/PwgImagesService.cs
r3835 r3861 2 2 using System.Collections.Generic; 3 3 using System.Text; 4 using System.Globalization; 4 5 5 6 using Com.Piwigo.Lib.DTO; … … 13 14 static public class PwgImagesService 14 15 { 16 static public PwgImageRate RateImage(Int32 imageId, Int32 imageRate) 17 { 18 PwgImageRate returnValue = new PwgImageRate(); 19 20 try 21 { 22 PwgImageRateProxyResponse response = PwgImagesProxy.pwg_images_rate(imageId, imageRate); 23 24 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) 25 { 26 if (response.Erreur != null) 27 { 28 throw new PwgServiceException("RateImage, the server has return the error.", 29 response.Erreur.Code, 30 response.Erreur.Message); 31 } 32 else 33 { 34 throw new PwgServiceException("RateImage : a error occurs during server process."); 35 } 36 } 37 else 38 { 39 returnValue = ConvertProxyResponseToDTO(response); 40 } 41 } 42 catch (PwgProxyException ex) 43 { 44 throw new PwgServiceException("RateImage : a error is raised by proxy.", ex); 45 } 46 return returnValue; 47 } 48 49 /// <summary> 50 /// private: convert response to dto object 51 /// </summary> 52 /// <param name="response"></param> 53 /// <param name="session"></param> 54 static public PwgImageRate ConvertProxyResponseToDTO(PwgImageRateProxyResponse response) 55 { 56 PwgImageRate returnValue = new PwgImageRate(); 57 Double aDouble = 0; 58 NumberStyles style = NumberStyles.AllowDecimalPoint; 59 CultureInfo en_us = CultureInfo.CreateSpecificCulture("en-US"); 60 61 returnValue.Count = response.Count; 62 63 returnValue.Stdev = 0.0 ; 64 if (Double.TryParse(response.Stdev, style, en_us, out aDouble)) 65 { 66 returnValue.Stdev = aDouble; 67 } 68 69 returnValue.Average = 0.0; 70 if (Double.TryParse(response.Average, style, en_us, out aDouble)) 71 { 72 returnValue.Average = aDouble; 73 } 74 75 76 return returnValue; 77 } 78 15 79 /// <summary> 16 80 /// private: convert response to dto object -
extensions/PiwigoLib/TestPiwigoLib/Form1.cs
r3837 r3861 65 65 //List<PwgCategory> lstCat = PwgCategoriesService.GetAdminListOfCategory(); 66 66 67 Int32 newid = 0;68 String msg = String.Empty;69 Boolean rc = PwgCategoriesService.AddCategory("test_cat", 1, ref newid, ref msg);70 Console.WriteLine(String.Format("newid : {0} message : {1}", newid,msg));71 rc = PwgCategoriesService.UpdateCategoryInfo(newid, "test2", "rename cat");67 //Int32 newid = 0; 68 //String msg = String.Empty; 69 //Boolean rc = PwgCategoriesService.AddCategory("test_cat", 1, ref newid, ref msg); 70 //Console.WriteLine(String.Format("newid : {0} message : {1}", newid,msg)); 71 //rc = PwgCategoriesService.UpdateCategoryInfo(newid, "test2", "rename cat"); 72 72 73 PwgImageRate imgRate = PwgImagesService.RateImage(1, 5); 73 74 74 75 sess = PwgSessionService.Logout();
Note: See TracChangeset
for help on using the changeset viewer.