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

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

changing dot.net framework prerequisite from framework 4.0 to framework 4.0 client profile according to setup process download

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 internal class PwgSessionProxy
12    {
13        static internal PwgSessionProxyResponse pwg_session_getStatus()
14        {
15            PwgSessionProxyResponse response = null;
16            try
17            {           
18            response = PwgGenericProxy<PwgSessionProxyResponse>.Get(
19                                PwgConfigProxy.PwgServeurUri, 
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 internal 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=" + Uri.EscapeUriString(UserName));
38                data.Append("&password=" + Uri.EscapeUriString(Password));
39
40
41                response = PwgGenericProxy<PwgSessionProxyResponse>.Post(
42                    PwgConfigProxy.PwgServeurUri, 
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 internal 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.PwgServeurUri,
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.