Changeset 3837 for extensions/PiwigoLib


Ignore:
Timestamp:
Sep 8, 2009, 12:08:52 AM (15 years ago)
Author:
bayral
Message:

connect pwg_category_setInfo into PwgCategoriesService from proxy class

Location:
extensions/PiwigoLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoLib/Service/PwgCategoriesService.cs

    r3835 r3837  
    131131        }
    132132
     133
     134        /// <summary>
     135        /// Update category data
     136        /// </summary>
     137        /// <param name="IdCat"></param>
     138        /// <param name="categoryName"></param>
     139        /// <param name="categoryComment"></param>
     140        /// <returns></returns>
     141        static public Boolean UpdateCategoryInfo(Int32 IdCat, String categoryName, String categoryComment)
     142        {
     143            Boolean returnValue = false;
     144
     145            try
     146            {
     147                PwgBaseProxyReponse response = PwgCategoriesProxy.pwg_categories_setInfo(IdCat, categoryName, categoryComment);
     148
     149                if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok)
     150                {
     151                    if (response.Erreur != null)
     152                    {
     153                        throw new PwgServiceException("UpdateCategoryInfo, the server has return the error.",
     154                            response.Erreur.Code,
     155                            response.Erreur.Message);
     156                    }
     157                    else
     158                    {
     159                        throw new PwgServiceException("UpdateCategoryInfo : a error occurs during server process.");
     160                    }
     161                }
     162                else
     163                {
     164                    returnValue = true;
     165                }
     166            }
     167            catch (PwgProxyException ex)
     168            {
     169                throw new PwgServiceException("UpdateCategoryInfo : a error is raised by proxy.", ex);
     170            }
     171            return returnValue;
     172        }
     173
     174        /// <summary>
     175        /// return the list of PwgImage in the category
     176        /// </summary>
     177        /// <param name="categoryId"></param>
     178        /// <param name="recursive"></param>
     179        /// <param name="perPage"></param>
     180        /// <param name="Page"></param>
     181        /// <param name="Order"></param>
     182        /// <param name="minRate"></param>
     183        /// <param name="maxRate"></param>
     184        /// <param name="minHit"></param>
     185        /// <param name="maxHit"></param>
     186        /// <param name="minDateAvailable"></param>
     187        /// <param name="maxDateAvailable"></param>
     188        /// <param name="minDateCreated"></param>
     189        /// <param name="maxDateCreated"></param>
     190        /// <param name="minRatio"></param>
     191        /// <param name="maxRatio"></param>
     192        /// <param name="withThumbnail"></param>
     193        /// <param name="PageReturned"></param>
     194        /// <param name="PerPageeReturned"></param>
     195        /// <param name="CountReturned"></param>
     196        /// <returns></returns>
    133197        static public List<PwgImage> GetListOfImagesFormCategory(Int32 categoryId,
    134198                                                    Boolean? recursive,
  • extensions/PiwigoLib/TestPiwigoLib/Form1.cs

    r3835 r3837  
    4949                //List<PwgTag> lstTag = PwgTagsService.GetAdminListOfTag();
    5050
    51                 Int32 Page = 0;
    52                 Int32 PerPage = 0;
    53                 Int32 Count = 0;
     51                //Int32 Page = 0;
     52                //Int32 PerPage = 0;
     53                //Int32 Count = 0;
    5454
    5555                //List<PwgImage> lstImg = PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 },
     
    5757                //    ref Page, ref PerPage, ref Count);
    5858
    59                 List<PwgImage> lstImg = PwgCategoriesService.GetListOfImagesFormCategory(1,
    60                     null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
    61                     ref Page, ref PerPage, ref Count);
     59                //List<PwgImage> lstImg = PwgCategoriesService.GetListOfImagesFormCategory(1,
     60                //    null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
     61                //    ref Page, ref PerPage, ref Count);
    6262
    6363                //Console.WriteLine("lstImg : Page " + Page.ToString() + " PerPage " + PerPage);
    6464
    6565                //List<PwgCategory> lstCat = PwgCategoriesService.GetAdminListOfCategory();
     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");
    6672
    6773
Note: See TracChangeset for help on using the changeset viewer.