-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContentPage.aspx.cs
80 lines (75 loc) · 3.43 KB
/
ContentPage.aspx.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
75
76
77
78
79
80
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
using System.Data;
public partial class ContentPage : System.Web.UI.Page
{
protected string distance;
protected string dis_name;
protected string division;
protected string district;
public string GetConnectionString()
{
return System.Configuration.ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
}
protected void Page_Load(object sender, EventArgs e)
{
if (Request["District"] != null)
{
district = Request["District"].ToString();
SqlConnection con = new SqlConnection(GetConnectionString());
string sql = "SELECT District.Dis_name,District.Area,District.Distance,District.Rivers,District.Map,District.Details,Division.Div_name FROM District INNER JOIN Division ON District.Div_id = Division.Div_id WHERE Dis_id = '" + district + "'";
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr = null;
dr = cmd.ExecuteReader();
while (dr.Read())
{
Image1.ImageUrl = "~/images/Districts/" + dr["Map"].ToString();
Bitmap myBitmap = new Bitmap(Server.MapPath("~/images/Districts/" + dr["Map"].ToString()));
double width = myBitmap.Width;
double height = myBitmap.Height;
double a = width / height;
double b = 450 / a;
int c = Convert.ToInt32(b);
Image1.Height = c;
Image1.Width = 450;
division = dr["Div_name"].ToString();
Label1.Text = dr["Dis_name"].ToString();
this.Title = dr["Dis_name"].ToString();
dis_name = Label1.Text;
Label2.Text = dr["Area"].ToString();
Label3.Text = dr["Details"].ToString();
Label5.Text = dr["Rivers"].ToString(); ;
Label6.Text = division;
distance = dr["Distance"].ToString();
}
con.Close();
string sql1 = "SELECT Place_name,Place_id FROM Place WHERE Dis_id = '"+ district +"'";
SqlCommand cmd1 = new SqlCommand(sql1, con);
con.Open();
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd1);
DataSet ds = new DataSet();
da.Fill(ds);
Repeater1.DataSource = ds;
Repeater1.DataBind();
con.Close();
string sql2 = "SELECT TripDetail.Tripname,TripDetail.Tripid,TripDetail.Agencyid,TravelAgency.Agencyname FROM TripDetail INNER JOIN TravelAgency ON TripDetail.Agencyid=TravelAgency.Agencyid WHERE (Disid1 = '" + district + "' OR Disid2 = '" + district + "' OR Disid3 = '" + district + "' OR Disid4 = '" + district + "' OR Disid5 = '" + district + "' OR Disid1 = '" + district + "') GROUP BY TripDetail.Tripname,TripDetail.Tripid,TripDetail.Agencyid,TravelAgency.Agencyname";
SqlCommand cmd2 = new SqlCommand(sql2, con);
con.Open();
cmd.ExecuteNonQuery();
SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
DataSet ds2 = new DataSet();
da2.Fill(ds2);
Repeater2.DataSource = ds2;
Repeater2.DataBind();
con.Close();
}
}
}