-
Notifications
You must be signed in to change notification settings - Fork 0
/
RideOfferPath.aspx.cs
62 lines (54 loc) · 2.43 KB
/
RideOfferPath.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
public partial class RideOfferPath : System.Web.UI.Page
{
public string originPoint;
public string destinationPoint;
protected void Page_Load(object sender, EventArgs e)
{
originPoint = Request.QueryString["origin"];
destinationPoint = Request.QueryString["destination"];
}
protected void BackBtn_Click(object sender, EventArgs e)
{
Response.Redirect("~/RideOfferForm.aspx");
}
protected void RideOfferPathBtn_Click(object sender, EventArgs e)
{
RideOfferCoordinates rideOfferCoordinates = new RideOfferCoordinates();
string[] coordinateX;
string[] coordinateY;
string xmlStr="";
coordinateX = coordinateXArray.Text.Split(','); //from js
coordinateY = coordinateYArray.Text.Split(',');
int coordinateXLength = coordinateX.Length;
xmlStr+="<Coordinates>";
for (int i = 0; i < coordinateXLength; i++)
{
xmlStr += "<row";
xmlStr += " X=\"" + coordinateX[i] + "\"";
xmlStr += " Y=\"" + coordinateY[i] + "\"";
xmlStr += " ordinal=\"" + i + "\"";
xmlStr += "/>";
}
xmlStr += "</Coordinates>";
RideOffer rideOffer = new RideOffer(Convert.ToInt32(Request.QueryString["userId"]), (Convert.ToDateTime(Request.QueryString["rideDate"])), Convert.ToInt32(Request.QueryString["minute"]), Convert.ToInt32(Request.QueryString["hour"]), Request.QueryString["email"], Request.QueryString["phone"], Request.QueryString["notes"], Convert.ToInt32(Request.QueryString["price"]), Convert.ToInt32(Request.QueryString["gender"]), Request.QueryString["origin"], Request.QueryString["destination"]);
int rideOfferId;
try
{
rideOfferId=rideOffer.SaveRideOffer();
rideOfferCoordinates.SaveRideOfferCoordinate(rideOfferId, xmlStr);
}
catch(Exception ex)
{
throw ex;
}
Response.Redirect("MatchUsersForOffer.aspx?rideOfferId="+rideOfferId);
//Response.Redirect("~/MatchUsersForOffer.aspx?rideOfferId=" + Request.QueryString["rideOfferId"] + "&originPoint=" + Request.QueryString["OriginPoint"] + "&destinationPoint=" + Request.QueryString["DestinationPoint"]);
}
}