source: extensions/PiwigoLib/PiwigoUpload/Service/Connect.cs @ 12256

Last change on this file since 12256 was 12256, checked in by bayral, 13 years ago

adding PiwigoUpload project for a simple tools for upload your photo recursively

File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6using Com.Piwigo.Lib.IService;
7using Com.Piwigo.Lib.DTO;
8
9using Com.Piwigo.Uploader.DTO;
10
11namespace Com.Piwigo.Uploader.Service
12{
13    public class Connect: IService
14    {         
15        public void runService()
16        {
17            PwgServiceProvider.Instance.PwgSetupService.Setup("UploadToPiwigo", null, ModelManager.Instance.serveurName);
18
19            System.Diagnostics.Debug.WriteLine(ModelManager.Instance.serveurName.AbsoluteUri);
20
21            try
22            {
23                ModelManager.Instance.sess = PwgServiceProvider.Instance.PwgSessionService.Login( ModelManager.Instance.userName,  ModelManager.Instance.password);
24                System.Diagnostics.Debug.WriteLine("user : " + ModelManager.Instance.sess.UserName + " " + ModelManager.Instance.sess.Status);
25
26                if (ModelManager.Instance.sess.Status == PwgSessionStatusEnum.WebMaster)
27                {
28                    ModelManager.Instance.lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetAdminListOfCategory();
29                }
30                else
31                {
32                    ModelManager.Instance.lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(PwgCategory.RootCategoryId, true, false);
33                }
34
35            }
36            catch (PwgServiceException ex)
37            {
38                System.Diagnostics.Debug.WriteLine(ex.Message);
39                throw new ApplicationException ("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
40            }
41        }
42    }
43}
Note: See TracBrowser for help on using the repository browser.