Changeset 3827


Ignore:
Timestamp:
Sep 6, 2009, 12:58:44 AM (15 years ago)
Author:
bayral
Message:

pwg.tags.getImages support

Location:
extensions/PiwigoLib
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoLib/DTO/PwgTag.cs

    r3816 r3827  
    99    public class PwgTag
    1010    {
    11         public Int16  Id      { get; set; }
     11        public Int32  Id      { get; set; }
    1212        public String Name    { get; set; }
    1313        public String UrlName { get; set; }
  • extensions/PiwigoLib/PiwigoLib/PiwigoLib.csproj

    r3818 r3827  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6     <ProductVersion>9.0.30729</ProductVersion>
     6    <ProductVersion>9.0.21022</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    88    <ProjectGuid>{64C068C5-DBFE-4712-9081-B9100698F35C}</ProjectGuid>
     
    4747  </ItemGroup>
    4848  <ItemGroup>
     49    <Compile Include="DTO\PwgImage.cs" />
    4950    <Compile Include="DTO\Helper\PwgEnumHelper.cs" />
    5051    <Compile Include="DTO\PwgSessionStatusEnum.cs" />
     
    5253    <Compile Include="DTO\PwgSession.cs" />
    5354    <Compile Include="Properties\AssemblyInfo.cs" />
     55    <Compile Include="Proxy\Helper\PwgProxyReponseHelper.cs" />
    5456    <Compile Include="Proxy\PwgTagsProxy.cs" />
     57    <Compile Include="Proxy\Response\PwgCategoriesProxyResponse.cs" />
     58    <Compile Include="Proxy\Response\PwgImagesProxyResponse.cs" />
    5559    <Compile Include="Proxy\Response\PwgSessionProxyResponse.cs" />
    5660    <Compile Include="Proxy\Response\PwgBaseProxyReponse.cs" />
     
    6165    <Compile Include="Proxy\PwgProxyException.cs" />
    6266    <Compile Include="Proxy\PwgSessionProxy.cs" />
     67    <Compile Include="Service\PwgImagesService.cs" />
    6368    <Compile Include="Service\PwgTagsService.cs" />
    6469    <Compile Include="Service\PwgServiceException.cs" />
  • extensions/PiwigoLib/PiwigoLib/Proxy/PwgGenericProxy.cs

    r3818 r3827  
    150150            try
    151151            {
    152                 //Console.WriteLine(xmlData.ReadToEnd());
     152 //               Console.WriteLine(xmlData.ReadToEnd());
    153153
    154154                System.Xml.Serialization.XmlSerializer xsSerializer = new System.Xml.Serialization.XmlSerializer(typeof(T));
  • extensions/PiwigoLib/PiwigoLib/Proxy/PwgTagsProxy.cs

    r3819 r3827  
    66using System.Web;
    77using Com.Piwigo.Lib.Proxy.Response;
     8using Com.Piwigo.Lib.Proxy.Helper;
    89
    910namespace Com.Piwigo.Lib.Proxy
     
    4849        }
    4950
     51        static public PwgImagesProxyResponse pwg_tags_getImages(List<Int32> tagsId,             
     52                                                                    List<String>    tagsUrlName,
     53                                                                    List<String>    tagsName,
     54                                                                    Boolean?         tagModeAnd,
     55                                                                    Int32?           perPage,
     56                                                                    Int32?           Page,
     57                                                                    Int32?          Order,
     58                                                                    Int32?           minRate,
     59                                                                    Int32?           maxRate,
     60                                                                    Int32?           minHit,
     61                                                                    Int32?           maxHit,
     62                                                                    DateTime?        minDateAvailable,
     63                                                                    DateTime?        maxDateAvailable,
     64                                                                    DateTime?        minDateCreated,
     65                                                                    DateTime?        maxDateCreated,
     66                                                                    Int32?           minRatio,
     67                                                                    Int32?           maxRatio,
     68                                                                    Boolean?         withThumbnail)
     69        {
     70            PwgImagesProxyResponse response = null;
     71            try
     72            {
     73                StringBuilder data = new StringBuilder();
     74                Boolean firstOcc = true;
     75                data.AppendFormat("method={0}","pwg.tags.getImages");
     76                firstOcc = false;
     77                PwgProxyReponseHelper<Int32>.buildQueryFromArray(tagsId, "tag_id", ref firstOcc, data);
     78                PwgProxyReponseHelper<String>.buildQueryFromArray(tagsUrlName, "tag_url_name", ref firstOcc, data);
     79                PwgProxyReponseHelper<String>.buildQueryFromArray(tagsName, "tag_name", ref firstOcc, data);
     80
     81                if (tagModeAnd.HasValue)
     82                {
     83                    data.Append("&tag_mode_and=" + HttpUtility.UrlEncode(tagModeAnd.ToString().ToLower()));
     84                }
     85                if (perPage.HasValue)
     86                {
     87                    data.Append("&per_page=" + HttpUtility.UrlEncode(perPage.ToString().ToLower()));
     88                }
     89                if (Page.HasValue)
     90                {
     91                    data.Append("&page=" + HttpUtility.UrlEncode(Page.ToString().ToLower()));
     92                }
     93                if (Order.HasValue)
     94                {
     95                    data.Append("&order=" + HttpUtility.UrlEncode(Order.ToString().ToLower()));
     96                }
     97                if (minRate.HasValue)
     98                {
     99                    data.Append("&f_min_rate=" + HttpUtility.UrlEncode(minRate.ToString().ToLower()));
     100                }
     101                if (maxRate.HasValue)
     102                {
     103                    data.Append("&f_max_rate=" + HttpUtility.UrlEncode(maxRate.ToString().ToLower()));
     104                }
     105                if (minHit.HasValue)
     106                {
     107                    data.Append("&f_min_hit=" + HttpUtility.UrlEncode(minHit.ToString().ToLower()));
     108                }
     109                if (maxHit.HasValue)
     110                {
     111                    data.Append("&f_max_hit=" + HttpUtility.UrlEncode(maxHit.ToString().ToLower()));
     112                }
     113                if (minDateAvailable.HasValue)
     114                {
     115                    data.Append("&f_min_date_available=" + HttpUtility.UrlEncode(minDateAvailable.ToString().ToLower()));
     116                }
     117                if (maxDateAvailable.HasValue)
     118                {
     119                    data.Append("&f_max_date_available=" + HttpUtility.UrlEncode(maxDateAvailable.ToString().ToLower()));
     120                }
     121                if (minDateCreated.HasValue)
     122                {
     123                    data.Append("&f_min_date_created=" + HttpUtility.UrlEncode(minDateCreated.ToString().ToLower()));
     124                }
     125                if (maxDateCreated.HasValue)
     126                {
     127                    data.Append("&f_max_date_created=" + HttpUtility.UrlEncode(maxDateCreated.ToString().ToLower()));
     128                }
     129                if (minRatio.HasValue)
     130                {
     131                    data.Append("&f_min_ratio=" + HttpUtility.UrlEncode(minRatio.ToString().ToLower()));
     132                }
     133                if (maxRatio.HasValue)
     134                {
     135                    data.Append("&f_max_ratio=" + HttpUtility.UrlEncode(maxRatio.ToString().ToLower()));
     136                }
     137                if (withThumbnail.HasValue)
     138                {
     139                    data.Append("&f_with_thumbnail=" + HttpUtility.UrlEncode(withThumbnail.ToString().ToLower()));
     140                }
     141
     142                response = PwgGenericProxy<PwgImagesProxyResponse>.Post(
     143                                PwgConfigProxy.PwgServeurUriBuilder.Uri,
     144                                data.ToString());
     145            }
     146            catch (Exception ex)
     147            {
     148                throw new PwgProxyException("pwg_tags_getImages", ex);
     149            }
     150            return response;
     151
     152        }
    50153        static public PwgTagsProxyResponse pwg_tag_add(string tagName)
    51154        {
  • extensions/PiwigoLib/PiwigoLib/Proxy/Response/PwgTagsProxyResponse.cs

    r3818 r3827  
    1313    {
    1414        [XmlAttribute(AttributeName = "id")]
    15         public Int16 Id { get; set; }
     15        public Int32 Id { get; set; }
    1616        [XmlAttribute(AttributeName = "name")]
    1717        public String Name { get; set; }
  • extensions/PiwigoLib/PiwigoLib/Service/PwgTagsService.cs

    r3819 r3827  
    140140        }
    141141
     142        static public List<PwgImage> GetListOfImagesFormTags(List<Int32> tagsId,
     143                                                            List<String> tagsUrlName,
     144                                                            List<String> tagsName,
     145                                                            Boolean? tagModeAnd,
     146                                                            Int32? perPage,
     147                                                            Int32? Page,
     148                                                            Int32? Order,
     149                                                            Int32? minRate,
     150                                                            Int32? maxRate,
     151                                                            Int32? minHit,
     152                                                            Int32? maxHit,
     153                                                            DateTime? minDateAvailable,
     154                                                            DateTime? maxDateAvailable,
     155                                                            DateTime? minDateCreated,
     156                                                            DateTime? maxDateCreated,
     157                                                            Int32? minRatio,
     158                                                            Int32? maxRatio,
     159                                                            Boolean? withThumbnail,
     160                                                            ref Int32 PageReturned,
     161                                                            ref Int32 PerPageeReturned,
     162                                                            ref Int32 CountReturned)
     163        {
     164            List<PwgImage> returnValue = new List<PwgImage>();
     165
     166            try
     167            {
     168                PwgImagesProxyResponse response = PwgTagsProxy.pwg_tags_getImages(tagsId,
     169                                                            tagsUrlName,
     170                                                            tagsName,
     171                                                            tagModeAnd,
     172                                                            perPage,
     173                                                            Page,
     174                                                            Order,
     175                                                            minRate,
     176                                                            maxRate,
     177                                                            minHit,
     178                                                            maxHit,
     179                                                            minDateAvailable,
     180                                                            maxDateAvailable,
     181                                                            minDateCreated,
     182                                                            maxDateCreated,
     183                                                            minRatio,
     184                                                            maxRatio,
     185                                                            withThumbnail);
     186
     187                if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok)
     188                {
     189                    if (response.Erreur != null)
     190                    {
     191                        throw new PwgServiceException("GetListOfImagesFormTags, the server has return the error.",
     192                            response.Erreur.Code,
     193                            response.Erreur.Message);
     194                    }
     195                    else
     196                    {
     197                        throw new PwgServiceException("GetListOfImagesFormTags : a error occurs during server process.");
     198                    }
     199                }
     200                else
     201                {
     202                    PwgImagesService.ConvertProxyResponseToDTO(response, returnValue,
     203                                                            ref PageReturned,
     204                                                            ref PerPageeReturned,
     205                                                            ref CountReturned);
     206                }
     207            }
     208            catch (PwgProxyException ex)
     209            {
     210                throw new PwgServiceException("GetListOfImagesFormTags : a error is raised by proxy.", ex);
     211            }
     212            return returnValue;
     213        }
     214
    142215        /// <summary>
    143216        /// private: convert response to dto object
  • extensions/PiwigoLib/TestPiwigoLib/Form1.cs

    r3821 r3827  
    4848
    4949                //List<PwgTag> lstTag = PwgTagsService.GetAdminListOfTag();
     50                Int32 Page = 0;
     51                Int32 PerPage = 0;
     52                Int32 Count = 0;
     53
     54                List<PwgImage> lstImg = PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 },
     55                    null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
     56                    ref Page, ref PerPage, ref Count);
     57
     58                Console.WriteLine("lstImg : Page " + Page.ToString() + " PerPage " + PerPage);
    5059
    5160                sess = PwgSessionService.Logout();
  • extensions/PiwigoLib/TestPiwigoLib/app.config

    r3821 r3827  
    1111                <value />
    1212            </setting>
    13             <setting name="pwdData" serializeAs="String">
    14                 <value />
    15             </setting>
    16             <setting name="serverUrlData" serializeAs="String">
     13            <setting name="PwdData" serializeAs="String">
    1714                <value />
    1815            </setting>
Note: See TracChangeset for help on using the changeset viewer.