-
Notifications
You must be signed in to change notification settings - Fork 0
/
Meteo.asmx.cs
74 lines (60 loc) · 2.03 KB
/
Meteo.asmx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WEB_SERV
{
/// <summary>
/// Summary description for Meteo
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Meteo : System.Web.Services.WebService
{
SqlConnection cnx = new SqlConnection("Data Source=.;Initial Catalog=Meteo;Integrated Security=True");
[WebMethod]
public int TempMin(string Ville)
{
String req = "select TempMin from Meteo where Ville ='" + Ville + "'";
SqlCommand cmd = new SqlCommand(req, cnx);
cnx.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
int res = int.Parse(dr[0].ToString());
cnx.Close();
dr.Close();
return res;
}
[WebMethod]
public int TempMax(string Ville)
{
String req = "select TempMax from Meteo where Ville ='" + Ville + "'";
SqlCommand cmd = new SqlCommand(req, cnx);
cnx.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
int res = int.Parse(dr[0].ToString());
cnx.Close();
dr.Close();
return res;
}
[WebMethod]
public int Humid(string Ville)
{
String req = "select Humid from Meteo where Ville ='" + Ville + "'";
SqlCommand cmd = new SqlCommand(req, cnx);
cnx.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
int res = int.Parse(dr[0].ToString());
cnx.Close();
dr.Close();
return res;
}
}
}