protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TripDAO tripDao = new TripDAO(); List <String> countryList = tripDao.getCountry(); ddlUpdateLocation.DataSource = countryList; ddlUpdateLocation.DataBind(); ddlUpdateLocation.Items.Insert(0, new ListItem("--Select--", "-1")); int tripId = Convert.ToInt32(Request.QueryString["tripId"]); Trip tripObj = tripDao.getTripById(tripId); if (tripObj == null) { Response.Redirect("Oops.aspx"); } else if (Session["role"].ToString() != "Incharge") { Response.Redirect("Oops.aspx"); } else { tbUpdateTitle.Text = tripObj.tripTitle.ToString(); ddlUpdateLocation.SelectedValue = tripObj.tripLocation.ToString(); tripImage.ImageUrl = tripObj.tripImg.ToString(); tbUpdateStart.Text = tripObj.tripStart.ToString("yyyy-MM-dd"); tbUpdateEnd.Text = tripObj.tripEnd.ToString("yyyy-MM-dd"); tbUpdateOpeningday.Text = tripObj.tripOpen.ToString("yyyy-MM-dd"); tbUpdateActivities.Text = tripObj.tripActivities; tbUpdateCost.Text = tripObj.tripCost.ToString(); DdlUpdateType.SelectedValue = tripObj.tripType.ToString(); } } }
public void CompleteTrip(int tripId) { Trip trip = TripDAO.getTripById(tripId); Order completedOrder = OrderDAO.GetOrderById(trip.OrderId); completedOrder.Status = TripStatusEnum.DONE; OrderDAO.Update(completedOrder); TripDAO.Delete(trip); }