Пример #1
0
 public BookingDto(Booking booking)
 {
     _BookingID = booking.ID;
     _BookingDate = booking.BookingDate;
     _Comment = booking.Comment;
     _Status = booking.Status;
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     int bookingId = Convert.ToInt32(this.lblBookingId.Text.Trim());
     Booking b = new Booking().GetById(bookingId, true);
     b.Comment = this.txtComments.Text.Trim();
     if (this.ddlStatus.SelectedIndex != -1)
         b.Status = Convert.ToInt32(this.ddlStatus.SelectedValue);
     b.Update();
     this.lblMessage.Text = "Update successfully";
 }
Пример #3
0
        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");
        }
Пример #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;
            }
        }
Пример #5
0
 private void BindList()
 {
     Booking b = new Booking();
     int statusId = 0;
     if (this.ddlStatus.SelectedIndex != -1)
         int.TryParse(this.ddlStatus.SelectedValue, out statusId);
     DateTime startDate = new DateTime(1900, 1, 1);
     DateTime endDate = DateTime.MaxValue;
     DateTime.TryParse(this.txtStartDate.Text, out startDate);
     DateTime.TryParse(this.txtEndDate.Text, out endDate);
     if (startDate == DateTime.MinValue)
         startDate = new DateTime(1900, 1, 1);
     if (endDate == DateTime.MinValue)
         endDate = DateTime.MaxValue;
     BookingList list = b.GetBookingList(statusId, startDate, endDate);
     this.GV_BookingList.DataSource = list;
     this.GV_BookingList.DataBind();
     this.lblMessage.Text = "";
 }
 private void BindBooking()
 {
     Booking b = new Booking().GetById(Convert.ToInt32(_bookingId), false);
     this.lblBookingId.Text = b.ID.ToString();
     this.lblBookingDate.Text = b.BookingDate.HasValue ? b.BookingDate.Value.ToShortDateString() : "";
     this.txtComments.Text = b.Comment.Trim();
     this.lblTotalAmount.Text = b.TotalAmount.ToString("C");
     //this.ddlStatus.sle
 }