public RouteOrderVehicleDetailDto(RouteOrderVehicleDetail routeOrderVehicleDetail)
     : base(routeOrderVehicleDetail)
 {
     _VAPSettingID = routeOrderVehicleDetail.VAPSettingID;
     _VehVAPSettingID = routeOrderVehicleDetail.VehVAPSettingID;
     _FareTypeName = routeOrderVehicleDetail.FareTypeName;
     _Length = routeOrderVehicleDetail.Length;
     _LicensePlate = routeOrderVehicleDetail.LicensePlate;
     _MakeModel = routeOrderVehicleDetail.MakeModel;
 }
 public RouteOrderVehicleDetailList GetVehicleListByRoute(int routeOrderId)
 {
     OQL oql = new OQL(typeof(RouteOrderVehicleDetail));
      RouteOrderVehicleDetail v = new RouteOrderVehicleDetail();
      oql.AddAssociation("RouteOrderDetail", "rod")
          .AddCondition(Condition.Eq("rod.RouteOrderID", routeOrderId));
      oql.AddAssociation("RouteOrderDetail.FareType", "ft")
          .AddCondition(Condition.Eq("ft.CategoryId", 2));
      return new RouteOrderVehicleDetail().GetList(oql);
 }
        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");
        }
Beispiel #4
0
        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;
            }
        }
        protected void Rpt_RouteList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
                return;
            RouteOrder ro = (RouteOrder)e.Item.DataItem;
            Label lblRouteTitle = (Label)e.Item.FindControl("lblRouteTitle");
            lblRouteTitle.Text = " Route " + e.Item.ItemIndex.ToString() + " (" + ro.Schedule.Fare.Routes.DeparturePort.PortName + " - " +
                    ro.Schedule.Fare.Routes.ArriavlPort.PortName + ")";

            Label lblRouteTotalAmount = (Label)e.Item.FindControl("lblRouteTotalAmount");
            lblRouteTotalAmount.Text = ro.RouteTotalAmount.ToString("C");
            //Bind Passengers;
            Repeater rptPassengers = (Repeater)e.Item.FindControl("Rpt_PassengerList");
            RouteOrderPassengerDetail p = new RouteOrderPassengerDetail();
            _pList = p.GetPassengerListByRoute(ro.ID);
            rptPassengers.DataSource = _pList;
            rptPassengers.DataBind();
            //Bind Vehicles
            Repeater rptVehicleList = (Repeater)e.Item.FindControl("Rpt_VehicleList");
            RouteOrderVehicleDetail v = new RouteOrderVehicleDetail();
            _vList = v.GetVehicleListByRoute(ro.ID);
            rptVehicleList.DataSource = _vList;
            rptVehicleList.DataBind();
            Label lblCabinInfo = (Label)e.Item.FindControl("lblCabinInfo");
            RouteOrderDetailList cabinList = ro.GetListByRoute(1);
            StringBuilder sb = new StringBuilder();
            foreach (RouteOrderDetail item in cabinList)
            {
                sb.Append(item.FareType.FullFareTypeName);
                sb.Append("<br />");
            }
            lblCabinInfo.Text = sb.ToString();
            Label lblAddonInfo = (Label)e.Item.FindControl("lblAddonInfo");
            RouteOrderDetailList addonList = ro.GetListByRoute(4);
            StringBuilder sb1 = new StringBuilder();
            foreach (RouteOrderDetail item in addonList)
            {
                sb1.Append(item.FareType.FullFareTypeName);
                sb1.Append("<br />");
            }
            lblAddonInfo.Text = sb1.ToString();
        }