-
Notifications
You must be signed in to change notification settings - Fork 1
/
exchangeflight.aspx.cs
55 lines (54 loc) · 1.86 KB
/
exchangeflight.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
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class exchangeflight : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Interaction.redirIfNotLoggedIn();
if (!(Interaction.LoggedInUser is Agent))
{
Interaction.redirUnauthorize();
}
Literal1.Text = "";
Literal2.Text = "";
}
protected void exchangeBtn_Click(object sender, EventArgs e)
{
if (!(Interaction.LoggedInUser is Agent))
{
Interaction.redirUnauthorize();
}
if (!Page.IsValid) return;
Agent a = (Agent)Interaction.LoggedInUser;
User first=a.getUser(firstNameTxt.Text, lastNameTxt.Text, userNameTxt.Text);
if (first == null)
{
Interaction.setFailureMessage(Literal1,"first user information mismatch");
return;
//throw new UserException("first user information mismatch");
}
User second=a.getUser(first2.Text, last2.Text, username2.Text);
if (second == null)
{
Interaction.setFailureMessage(Literal2, "<br />second user information mismatch");
return;
//throw new UserException("second user information mismatch");
}
if (first.TheTicket == null)
{
Interaction.setFailureMessage(Literal1, "first user has no flight booked");
return;
}
else if (second.TheTicket == null)
{
Interaction.setFailureMessage(Literal2, "second user has no flight booked");
return;
}
Session["firstExchange"] = first.TheTicket;
Session["secondExchange"] = second.TheTicket;
Response.Redirect("exchange2.aspx");
}
}