public RouteOrderDto(RouteOrder routeOrder) { _RouteOrderID = routeOrder.ID; _ScheduleId = routeOrder.ScheduleId; _BookingID = routeOrder.BookingID; _IsPrimary = routeOrder.IsPrimary; }
public RouteOrder GetPrimaryRouteOrder(int bookingId) { OQL oql = new OQL(typeof(RouteOrder)); oql.AddCondition(Condition.Eq(RouteOrder.Properties.BookingID, bookingId)); oql.AddCondition(Condition.Eq(RouteOrder.Properties.IsPrimary, true)); RouteOrderList list = new RouteOrder().GetList(oql); if (list.Count >= 1) return list[0]; else return null; }
protected void btnContinue_Click(object sender, EventArgs e) { //todo: validation //create new booking instance to store the booking information Session[SessionVariable.BookingInstance] = null; Booking newBookingInstace = new Booking(); int rowIdx = 0; foreach (ListViewDataItem item in lvSchedule.Items) { DropDownList ddlTime = (DropDownList)(item.FindControl("ddlTime")); RouteOrder routeOrder = new RouteOrder(); routeOrder.ScheduleId = Convert.ToInt32(ddlTime.SelectedValue); if (rowIdx == 0) routeOrder.IsPrimary = true; ListView lvVehicle = (ListView)(this.lvTravelMethod.Items[rowIdx].FindControl("lvVehicle")); foreach (ListViewDataItem vItem in lvVehicle.Items) { RouteOrderVehicleDetail vehicleDetail = new RouteOrderVehicleDetail(); //todo: need add column to store the type user seleced DropDownList ddlType = (DropDownList)(vItem.FindControl("ddlType")); if (ddlType != null && ddlType.SelectedIndex != 0) vehicleDetail.FareTypeName = ddlType.SelectedItem.Text; DropDownList ddlHeight = (DropDownList)(vItem.FindControl("ddlHeight")); DropDownList ddlWidth = (DropDownList)(vItem.FindControl("ddlWidth")); TextBox txtLength = (TextBox)(vItem.FindControl("txtLength")); vehicleDetail.VAPSettingID = Convert.ToInt32(ddlHeight.SelectedValue); vehicleDetail.VehVAPSettingID = Convert.ToInt32(ddlWidth.SelectedValue); vehicleDetail.Length = Convert.ToInt32(txtLength.Text); routeOrder.RouteOrderDetails.Add(vehicleDetail); //todo: add vehicleDetail to the routeorder, but need change the table schema, the vehicleDetail should be inherited from routeOrderDetail. } if (rowIdx == 0) { foreach (ListViewDataItem pitem in lvPassenger.Items) { TextBox txtPassengerAge = (TextBox)(pitem.FindControl("txtPassengerAge")); RouteOrderPassengerDetail passengerDetail = new RouteOrderPassengerDetail(); passengerDetail.Age = Convert.ToInt32(txtPassengerAge.Text); routeOrder.RouteOrderDetails.Add(passengerDetail); } } newBookingInstace.RouteOrders.Add(routeOrder); rowIdx++; } Session[SessionVariable.BookingInstance] = newBookingInstace; Response.Redirect("Accommodation.aspx"); }
protected void btnContinue_Click(object sender, EventArgs e) { //todo: validation if (Session[SessionVariable.BookingInstance] is Booking) { //update booking instance already exists in session } else { //create new booking instance to store the booking information Booking newBookingInstace = new Booking(); int rowIdx = 0; foreach (ListViewDataItem item in lvSchedule.Items) { DropDownList ddlTime = (DropDownList)(item.FindControl("ddlTime")); RouteOrder routeOrder = new RouteOrder(); routeOrder.ScheduleId = Convert.ToInt32(ddlTime.SelectedValue); newBookingInstace.RouteOrders.Add(routeOrder); ListView lvVehicle = (ListView)(this.lvTravelMethod.Items[rowIdx].FindControl("lvVehicle")); foreach (ListViewDataItem vItem in lvVehicle.Items) { RouteOrderVehicleDetail rovd = new RouteOrderVehicleDetail(); //todo: need add column to store the type user seleced //DropDownList ddlType = (DropDownList)(vItem.FindControl("ddlType")); DropDownList ddlHeight = (DropDownList)(vItem.FindControl("ddlHeight")); DropDownList ddlWidth = (DropDownList)(vItem.FindControl("ddlWidth")); TextBox txtLength = (TextBox)(vItem.FindControl("txtLength")); rovd.VAPSettingID = Convert.ToInt32(ddlHeight.SelectedValue); rovd.VehVAPSettingID = Convert.ToInt32(ddlWidth.SelectedValue); rovd.Length = Convert.ToInt32(txtLength.Text); //todo: add vehicleDetail to the routeorder, but need change the table schema, the vehicleDetail should be inherited from routeOrderDetail. } rowIdx++; } foreach (ListViewDataItem item in lvPassenger.Items) { TextBox txtPassengerAge = (TextBox)(item.FindControl("txtPassengerAge")); RouteOrderPassengerDetail passengerDetail = new RouteOrderPassengerDetail(); passengerDetail.Age = Convert.ToInt32(txtPassengerAge.Text); newBookingInstace.RouteOrders[0].RouteOrderDetails.Add(passengerDetail); } Session[SessionVariable.BookingInstance] = newBookingInstace; } }
private void BindRoutes() { int bookingId = Convert.ToInt32(_bookingId); RouteOrder ro = new RouteOrder(); _roList = ro.GetRouteOrderList(bookingId); this.Rpt_RouteList.DataSource = _roList; this.Rpt_RouteList.DataBind(); }