protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect("Login.aspx"); } SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); Booking[] bookings = client.showBookings(Convert.ToInt32(Session["UserId"])); Response.Write("<br /><div><h1 style='color:#dcdcdc;font-size:35px;text-align:center;'>MY BOOKINGS</h1><br />"); Response.Write("</br><center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'><tr><th colspan='5' style='padding:12px 10px;font-size:21px;'>Currently Active Bookings</th></tr>"); Response.Write("<tr style='font-size:18px;'><th style='padding:10px 15px;'>Booking Id</th><th style='padding:10px 15px;'>Slot Id</th><th style='padding:10px 15px;'>Plate Number</th><th style='padding:10px 75px;'>Arrival Time</th><th style='padding:10px 75px;'>Exit Time</th></tr>"); if (bookings == null) { Response.Write("<tr colspan='4'>You Haven't booked any slots yet</tr>"); } else { foreach (Booking b in bookings) { Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.BookingId + "</td><td style='padding:10px 0px;'>" + b.SlotId + "</td><td style='padding:10px 0px;'>" + b.PlateNumber + "</td><td style='padding:10px 0px;'>" + b.Arrival + "</td><td style='padding:10px 0px;'>" + b.Exit + "</td></tr>"); } } Response.Write("</table></center></div></br></br>"); }
protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e) { SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); DropDownList2.Items.Clear(); int[] floor = client.available_floor(DropDownList5.SelectedValue); DropDownList2.Items.Add("--- Available floors ---"); foreach (int j in floor) { DropDownList2.Items.Add(j + ""); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); DropDownList4.Items.Clear(); string[] type = client.available_type(DropDownList5.SelectedValue, Int32.Parse(DropDownList2.SelectedValue)); DropDownList4.Items.Add("--- Type of Vehicles ---"); foreach (string z in type) { DropDownList4.Items.Add(z); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect("Login.aspx"); } SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); Booking1[] bookings = client.showAllBookings(); Response.Write("<br /><div><h1 style='color:#dcdcdc;font-size:35px;text-align:center;'>BOOKINGS HISTORY</h1><br />"); Response.Write("<center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'>"); Response.Write("<tr style='font-size:18px;'><th style='padding:10px 15px;'>Booking Id</th><th style='padding:10px 15px;'>User Id</th><th style='padding:10px 15px;'>Slot Id</th><th style='padding:10px 15px;'>Plate Number</th><th style='padding:10px 75px;'>Arrival Time</th><th style='padding:10px 75px;'>Exit Time</th></tr>"); if (bookings == null) { Response.Write("<tr colspan='4'>You Haven't booked any slots yet</tr>"); } else { foreach (Booking1 b in bookings) { Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.BookingId + "</td><td style='padding:10px 0px;'>" + b.UserId + "</td><td style='padding:10px 0px;'>" + b.SlotId + "</td><td style='padding:10px 0px;'>" + b.PlateNumber + "</td><td style='padding:10px 0px;'>" + b.Arrival + "</td><td style='padding:10px 0px;'>" + b.Exit + "</td></tr>"); } } Response.Write("</table></center></div></br>"); Response.Write("<div><h1 style='color:#dcdcdc;font-size:35px;text-align:center;'>ACTIVE BOOKINGS</h1><br />"); Response.Write("<center><table style='border:3px solid #fff;background:#dcdcdc;text-align:center;'>"); Response.Write("<tr style='font-size:18px;'><th style='padding:10px 15px;'>Booking Id</th><th style='padding:10px 15px;'>User Id</th><th style='padding:10px 15px;'>Slot Id</th><th style='padding:10px 15px;'>Plate Number</th><th style='padding:10px 75px;'>Arrival Time</th><th style='padding:10px 75px;'>Exit Time</th></tr>"); UserService.UserServiceClient client2 = new UserService.UserServiceClient(); String[] users = client2.getUsers(); foreach (string u in users) { Booking[] bookings1 = client.showBookings(Int32.Parse(u)); if (bookings1 == null) { Response.Write("<tr colspan='4'>You Haven't booked any slots yet</tr>"); } else { foreach (Booking b in bookings1) { Response.Write("<tr style='font-size:18px;'><td style='padding:10px 0px;'>" + b.BookingId + "</td><td style='padding:10px 0px;'>" + u + "</td><td style='padding:10px 0px;'>" + b.SlotId + "</td><td style='padding:10px 0px;'>" + b.PlateNumber + "</td><td style='padding:10px 0px;'>" + b.Arrival + "</td><td style='padding:10px 0px;'>" + b.Exit + "</td></tr>"); } } } Response.Write("</table></center></div></br>"); }
protected void Button1_Click(object sender, EventArgs e) { string section, type; int amount, normalcharges, overtimecharges, floor; section = TextBox1.Text; type = DropDownList3.SelectedValue; normalcharges = Int32.Parse(TextBox3.Text); overtimecharges = Int32.Parse(TextBox4.Text); amount = Int32.Parse(TextBox5.Text); floor = Int32.Parse(DropDownList1.SelectedValue); SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); int count = client.addSlots(section, floor, type, normalcharges, overtimecharges, amount); //Response.Write(@"<script langauge='text/javascript'>alert('" + count + " Slots added successfully');</script>"); Response.Redirect(Request.RawUrl); }
protected void Button2_Click(object sender, EventArgs e) { SlotService.SlotServiceClient slotService = new SlotService.SlotServiceClient(); int result = slotService.cancelBooking(Convert.ToInt32(TextBox9.Text), Convert.ToInt32(Session["UserId"])); if (result == -4) { Label2.Text = "Cannot Cancel Booking,It is within 30 minutes from now " + result.ToString(); } else if (result == 1) { Label2.Text = "Cancellation Successful"; } else { Label2.Text = "Unknown Error. Error code: " + result.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect("Login.aspx"); } if (!Page.IsPostBack) { SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); String[] section = client.available_section(); DropDownList1.Items.Add("--- Select section ---"); DropDownList2.Items.Add("--- Available floors ---"); DropDownList3.Items.Add("--- Type of Vehicles ---"); foreach (string i in section) { DropDownList1.Items.Add(i); } } }
protected void Button1_Click(object sender, EventArgs e) { SlotService.SlotServiceClient slotService = new SlotService.SlotServiceClient(); //Label1.Text = TextBox5.Text + TextBox6.Text; DateTime arrival = DateTime.Parse(TextBox5.Text + " " + TextBox6.Text); DateTime exit = DateTime.Parse(TextBox7.Text + " " + TextBox8.Text); SlotService.bookingResult booked = slotService.bookSlot(DropDownList1.Text, Convert.ToInt32(DropDownList2.Text), DropDownList3.Text, Convert.ToInt32(Session["UserId"]), TextBox4.Text, arrival, exit); if (booked.Booking_Id == -1) { Label1.Text = "No slots are available right now for given selection"; } else if (booked.Booking_Id == -2) { Label1.Text = "Arrival time and Exit time is Inappropriate"; } else { Label1.Text = "Your Booking ID is: " + booked.Booking_Id.ToString() + " Open My Bookings to know more"; } }
protected void Button3_Click(object sender, EventArgs e) { string section, type; int amount, floor; section = DropDownList5.SelectedValue; type = DropDownList4.SelectedValue; floor = Int32.Parse(DropDownList2.SelectedValue); amount = Int32.Parse(TextBox8.Text); SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); int count = client.removeSlots(section, floor, type, amount); //Response.Write(@"<script langauge='text/javascript'>alert('"+ count +" Slots deleted successfully');</script>"); if (count == -2) { Label1.Text = "Slots are booked cannot be deleted"; } else { Label1.Text = count + " slots deleted successfully"; Response.Redirect(Request.RawUrl); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null || Session["UserName"].ToString() != "admin") { Response.Redirect("Login.aspx"); } if (!Page.IsPostBack) { SlotService.SlotServiceClient client1 = new SlotService.SlotServiceClient(); String[] section = client1.available_section(); DropDownList5.Items.Add("--- Select section ---"); DropDownList2.Items.Add("--- Available floors ---"); DropDownList4.Items.Add("--- Type of Vehicles ---"); foreach (string i in section) { DropDownList5.Items.Add(i); } } Response.Write("<br /><h1 style='text-align:center; color:#dcdcdc;font-size:35px;'>ADMIN PANEL</h1>"); SlotService.SlotServiceClient client = new SlotService.SlotServiceClient(); String[] sections = client.available_section(); Response.Write("<div style='float:left;margin:1% 8% 0% 12%'><table border='1' style='border-collapse: collapse;background:#dcdcdc;'><th style='text-align:center;font-size:24px;padding:10px;' colspan='2' >SLOT DETAILS</th>"); foreach (string i in sections) { int[] floor = client.available_floor(i); Response.Write("<tr><td colspan='2' style='text-align:center;font-size:19px;padding:10px;'>SECTION : " + i + "</td></tr>"); foreach (int j in floor) { string[] type = client.available_type(i, j); Response.Write("<tr><td rowspan = '" + type.Length + "' style='font-size:16px;padding:8px 22px'>Floor : " + j + "</td>"); foreach (string z in type) { int count = client.showAllSlots(i, j, z); Response.Write("<td style='font-size:16px;padding:8px 22px'>" + z + " : " + count + "</td></tr>"); } } } Response.Write("</table></div>"); }