protected void ParkingDetailsGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { ParkingDetailsGrid.DataSource = parkingSlots; // GetParkingSlotsDetailsFromAPI(ParkingSpaceIdLbl.Value); ParkingDetailsGrid.PageIndex = e.NewPageIndex; ParkingDetailsGrid.DataBind(); BindColorwithSlotStatus(); }
protected void BookedParkingSlots_ServerClick(object sender, EventArgs e) { //List<CustomerSlot> parkingSlots = GetParkingSlotsDetailsFromAPI(ParkingSpaceIdLbl.Value); if (parkingSlots != null) { ParkingDetailsGrid.DataSource = parkingSlots.Where(s => s.SlotStatus == "Booked").ToList(); ParkingDetailsGrid.DataBind(); BindColorwithSlotStatus(); } }
protected void LinkBtnParkingSpaceName_Click(object sender, EventArgs e) { //Response.Redirect("ParkingSlots.aspx?ParkingSpaceId=" + ((LinkButton)sender).CommandArgument); ParkingSpaceIdLbl.Value = ((LinkButton)sender).CommandArgument; CarPark carparkObj = GetParkingSlotsSummaryFromAPI(ParkingSpaceIdLbl.Value); ParkingSpaceNameLbl.Text = string.Format("Parking Space: {0}", carparkObj.Name); TotalParkingSlotsLbl.Text = string.Format("Total Slots: {0}", carparkObj.Tspaces); // OccupiedParkingSlotsLbl.Text = string.Format("Occupied Slots: {0}", carparkObj.Ospaces); AvailableParkingSlotsLbl.Text = string.Format("Available Slots: {0}", carparkObj.Aspaces); GetParkingSlotsDetailsFromAPI(ParkingSpaceIdLbl.Value); var occupiedres = (from cs in parkingSlots join cp in parkingSpaceDetailsList on cs.car_park_id equals cp._Id where cs.car_park_id == carparkObj._Id && cs.SlotStatus == "Parked" select cs).Count <CustomerSlot>(); OccupiedParkingSlotsLbl.Text = string.Format("Occupied Slots: {0}", occupiedres); var bookedres = (from cs in parkingSlots join cp in parkingSpaceDetailsList on cs.car_park_id equals cp._Id where cs.car_park_id == carparkObj._Id && cs.SlotStatus == "Booked" select cs).Count <CustomerSlot>(); BookedParkingSlotsLbl.Text = string.Format("Booked Slots: {0}", bookedres); var result = parkingSlots.Where(x => x.car_park_id == carparkObj._Id); List <CustomerSlot> parkDetails = new List <CustomerSlot>(); parkDetails = result.ToList <CustomerSlot>(); PnlForParkingSlots.Visible = true; if (parkDetails.Count != 0) { ParkingDetailsGrid.Visible = true; ParkingDetailsGrid.DataSource = parkDetails; ParkingDetailsGrid.DataBind(); BindColorwithSlotStatus(); } else { ParkingDetailsGrid.Visible = false; } }
protected void TotalParkingSlots_ServerClick(object sender, EventArgs e) { ParkingDetailsGrid.DataSource = parkingSlots; //GetParkingSlotsDetailsFromAPI(ParkingSpaceIdLbl.Value); ParkingDetailsGrid.DataBind(); BindColorwithSlotStatus(); }