source: extensions/PiwigoLib/PiwigoLib/Proxy/PwgSessionProxy.cs @ 3816

Last change on this file since 3816 was 3816, checked in by bayral, 15 years ago

Initial import

File size: 2.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using Com.Piwigo.Lib.DTO;
6using System.Web;
7using Com.Piwigo.Lib.Proxy.Response;
8
9namespace Com.Piwigo.Lib.Proxy
10{
11    static class PwgSessionProxy
12    {
13        static public PwgSessionProxyResponse pwg_session_getStatus()
14        {
15            PwgSessionProxyResponse response = null;
16            try
17            {           
18            response = PwgGenericProxy<PwgSessionProxyResponse>.Get(
19                                PwgConfigProxy.PwgServeurUriBuilder.Uri, 
20                                "pwg.session.getStatus", null);
21            }
22            catch (Exception ex)
23            {
24                throw new PwgProxyException("pwg_session_getStatus", ex);
25            }
26            return response;
27
28        }
29
30        static public PwgSessionProxyResponse pwg_session_login(string UserName, string Password)
31        {
32            PwgSessionProxyResponse response = null;
33            try
34            {
35                StringBuilder data = new StringBuilder();
36                data.Append("method=pwg.session.login");
37                data.Append("&username=" + HttpUtility.UrlEncode(UserName));
38                data.Append("&password=" + HttpUtility.UrlEncode(Password));
39
40
41                response = PwgGenericProxy<PwgSessionProxyResponse>.Post(
42                    PwgConfigProxy.PwgServeurUriBuilder.Uri, 
43                    data.ToString());
44            }
45            catch (Exception ex)
46            {
47                throw new PwgProxyException("pwg_session_login",ex);
48            }
49
50            return response;
51        }
52
53        static public PwgSessionProxyResponse pwg_session_logout()
54        {
55            PwgSessionProxyResponse response = null;
56            try
57            {
58                StringBuilder data = new StringBuilder();
59                data.Append("method=pwg.session.logout");
60
61                response = PwgGenericProxy<PwgSessionProxyResponse>.Post(
62                    PwgConfigProxy.PwgServeurUriBuilder.Uri,
63                    data.ToString());
64            }
65            catch (Exception ex)
66            {
67                throw new PwgProxyException("pwg_session_logout", ex);
68            }
69            return response;
70        }
71
72    }
73
74}
75
Note: See TracBrowser for help on using the repository browser.