Beispiel #1
0
        protected void rptRoomTypex_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            try
            {
                RoomTypex item = Module.RoomTypexGetById(Convert.ToInt32(e.CommandArgument));
                switch (e.CommandName)
                {
                case "Edit":
                    textBoxName.Text       = item.Name;
                    textBoxCapacity.Text   = item.Capacity.ToString();
                    chkAllowSingle.Checked = item.AllowSingBook;
                    chkShared.Checked      = item.IsShared;
                    RoomTypexId            = item.Id;
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Error when rptRoomTypex_ItemCommand in RoomTypexEdit", ex);
                ShowError(ex.Message);
            }
        }
Beispiel #2
0
        protected void rptRoomTypex_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RoomTypex item = e.Item.DataItem as RoomTypex;

            if (item != null)
            {
                #region Name

                using (Label label_Name = e.Item.FindControl("label_Name") as Label)
                {
                    if (label_Name != null)
                    {
                        label_Name.Text = item.Name;
                    }
                }
                #endregion

                #region Capacity

                using (Label label_Capacity = e.Item.FindControl("label_Capacity") as Label)
                {
                    if (label_Capacity != null)
                    {
                        label_Capacity.Text = item.Capacity.ToString();
                    }
                }
                #endregion
            }
        }
Beispiel #3
0
        public void BookingRoomAdd(RoomClass roomClass, RoomTypex roomType)
        {
            BookingRoom bookingRoom = new BookingRoom()
            {
                RoomClass = roomClass,
                RoomType  = roomType,
                Book      = Booking
            };

            Customer customer1 = new Customer()
            {
                Type         = CustomerType.Adult,
                BookingRooms = new List <BookingRoom>(),
            };

            customer1.BookingRooms.Add(bookingRoom);

            Customer customer2 = new Customer()
            {
                Type         = CustomerType.Adult,
                BookingRooms = new List <BookingRoom>(),
            };

            customer2.BookingRooms.Add(bookingRoom);

            bookingRoom.Customers.Add(customer1);
            bookingRoom.Customers.Add(customer2);

            BookingViewBLL.CustomerSaveOrUpdate(customer1);
            BookingViewBLL.CustomerSaveOrUpdate(customer2);
            BookingViewBLL.BookingRoomSaveOrUpdate(bookingRoom);
        }
Beispiel #4
0
        /// <summary>
        /// Kiểm tra xem có tồn tại phòng tương ứng với type và class hay ko?
        /// </summary>
        /// <param name="roomType"></param>
        /// <param name="roomClass"></param>
        /// <returns></returns>
        public bool RoomCheckExist(RoomTypex roomType, RoomClass roomClass)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq(Room.ROOMCLASS, roomClass))
            .Add(Expression.Eq(Room.ROOMTYPE, roomType))
            .Add(Expression.Eq(Room.DELETED, false));
            return(criteria.List().Count > 0);
        }
        /// <summary>
        /// Kiểm tra xem có tồn tại phòng tương ứng với type và class hay ko?
        /// </summary>
        /// <param name="roomType"></param>
        /// <param name="roomClass"></param>
        /// <returns></returns>
        public bool RoomCheckExist(RoomTypex roomType, RoomClass roomClass)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq("RoomClass", roomClass))
            .Add(Expression.Eq("RoomType", roomType))
            .Add(Expression.Eq("Deleted", false));
            return(criteria.List().Count > 0);
        }
Beispiel #6
0
        /// <summary>
        /// Lấy về danh Room theo class và type
        /// </summary>
        /// <param name="cruise"></param>
        /// <param name="roomClass"></param>
        /// <param name="roomType"></param>
        /// <returns></returns>
        public IList RoomGetBy_ClassType(Cruise cruise, RoomClass roomClass, RoomTypex roomType)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room));

            criteria.Add(Expression.Eq(Room.ROOMTYPE, roomType))
            .Add(Expression.Eq(Room.ROOMCLASS, roomClass));
            if (cruise != null)
            {
                criteria.Add(Expression.Eq("Cruise", cruise));
            }
            return(criteria.List());
        }
Beispiel #7
0
 protected void rptRoomTypes_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.DataItem is RoomTypex)
     {
         RoomTypex type        = (RoomTypex)e.Item.DataItem;
         Literal   litRoomName = (Literal)e.Item.FindControl("litRoomName");
         litRoomName.Text = _currentClass.Name + " " + type.Name;
         //TODO: CRUISE INFO
         SailsPriceConfig config = Module.SailsPriceConfigGet(_currentClass, type, _trip, null, TripOption.Option1,
                                                              DateTime.Today, BookingType.Double, null);
         Literal litPrice = (Literal)e.Item.FindControl("litPrice");
         //litPrice.Text = Module.ApplyPriceFor(config.NetPrice,CurrentPolicies).ToString("$#,0");
     }
 }
        protected void RptRoomTypeItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RoomTypex rtype     = e.Item.DataItem as RoomTypex;
            RoomClass father    = (RoomClass)(((RepeaterItem)e.Item.Parent.Parent).DataItem);
            TextBox   txtSingle = (e.Item.Parent.Parent).FindControl("txtSingle") as TextBox;

            if (rtype != null)
            {
                #region RoomType Id

                using (Label labelRoomTypeId = e.Item.FindControl("labelRoomTypeId") as Label)
                {
                    if (labelRoomTypeId != null)
                    {
                        labelRoomTypeId.Text = rtype.Id.ToString();
                    }
                }

                #endregion

                TextBox textBoxPrice            = (TextBox)e.Item.FindControl("textBoxPrice");
                Label   labelSailsPriceConfigId = (Label)e.Item.FindControl("labelSailsPriceConfigId");

                //Kiểm tra xem có tồn tại room nào mà class và type là rtype và father ko?
                IList room = Module.RoomGetBy_ClassType(ActiveCruise, father, rtype);
                //Nếu có thì hiện giá
                if (room.Count > 0)
                {
                    Domain.SailsPriceConfig priceConfig = Module.SailsPriceConfigGet(Table, rtype, father);
                    //Module.SailsPriceConfigGetBy_RoomType_RoomClass_Trip(_trip,rtype,father,Option);
                    //Nếu có giá thì hiện
                    if (priceConfig != null)
                    {
                        labelSailsPriceConfigId.Text = priceConfig.Id.ToString();
                        textBoxPrice.Text            = priceConfig.NetPrice.ToString("####");
                        if (txtSingle != null)
                        {
                            txtSingle.Text = priceConfig.SpecialPrice.ToString("#,0.#");
                        }
                    }
                }
                //Nếu không tồn tại room thì để N/A
                else
                {
                    textBoxPrice.Enabled = false;
                    textBoxPrice.Text    = "N/A";
                }
            }
        }
Beispiel #9
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(textBoxName.Text))
                {
                    if (RoomTypexId > 0)
                    {
                        _roomTypex = Module.RoomTypexGetById(RoomTypexId);
                    }
                    else
                    {
                        _roomTypex       = new RoomTypex();
                        _roomTypex.Order = Module.RoomTypeCount();
                    }
                    _roomTypex.Name = textBoxName.Text;
                    int capacity;
                    if (!string.IsNullOrEmpty(textBoxCapacity.Text) && Int32.TryParse(textBoxCapacity.Text, out capacity))
                    {
                        _roomTypex.Capacity = capacity;
                    }
                    else
                    {
                        _roomTypex.Capacity = 0;
                    }

                    _roomTypex.AllowSingBook = chkAllowSingle.Checked;
                    _roomTypex.IsShared      = chkShared.Checked;

                    if (RoomTypexId < 0)
                    {
                        Module.Save(_roomTypex);
                        RoomTypexId = _roomTypex.Id;
                    }
                    else
                    {
                        Module.Update(_roomTypex);
                    }
                    GetDataSource();
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Error when buttonSubmit_Click in RoomTypexEdit", ex);
                ShowError(ex.Message);
            }
        }
Beispiel #10
0
        protected void rptRoomType_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is RoomTypex)
            {
                RoomTypex    rtype           = e.Item.DataItem as RoomTypex;
                RoomClass    rclass          = ((RepeaterItem)((e.Item.Parent).Parent)).DataItem as RoomClass;
                Label        label_RoomClass = e.Item.FindControl("label_RoomClass") as Label;
                Label        label_RoomType  = e.Item.FindControl("label_RoomType") as Label;
                Label        label_Avaliable = e.Item.FindControl("label_Avaliable") as Label;
                DropDownList ddlSelect       = e.Item.FindControl("ddlSelect") as DropDownList;
                if (rclass != null && rtype != null && label_Avaliable != null && label_RoomClass != null &&
                    label_RoomType != null && ddlSelect != null)
                {
                    label_RoomClass.Text = rclass.Name;
                    label_RoomType.Text  = rtype.Name;
                    int roomCount = Module.RoomCount(rclass, rtype, null, _startDate, _trip.NumberOfDay);
                    if (roomCount < 0)
                    {
                        e.Item.Visible = false;
                        return;
                    }
                    if (roomCount == 0)
                    {
                        ddlSelect.Visible = false;
                    }

                    if (rtype.Id != SailsModule.TWIN)
                    {
                        label_Avaliable.Text = string.Format("{0} room(s)", roomCount);
                        for (int i = 0; i <= roomCount; i++)
                        {
                            ddlSelect.Items.Add(new ListItem(string.Format("{0} room", i), i.ToString()));
                        }
                    }
                    else
                    {
                        label_Avaliable.Text = string.Format("{0} room(s) ({1} person)", roomCount / 2, roomCount);
                        for (int i = 0; i <= roomCount; i++)
                        {
                            ddlSelect.Items.Add(new ListItem(string.Format("{0} person", i), i.ToString()));
                        }
                    }
                }
            }
        }
Beispiel #11
0
        protected void btnAddRoom_Click(object sender, EventArgs e)
        {
            bool canAddRoom = false;

            string[]  values = ddlRoomTypes.SelectedValue.Split('|');
            RoomClass rclass = Module.RoomClassGetById(Convert.ToInt32(values[0]));
            RoomTypex rtype  = Module.RoomTypexGetById(Convert.ToInt32(values[1]));

            int available;

            if (Booking.IsTransferred)
            {
                available = Module.RoomCount(rclass, rtype, Booking.Cruise, Booking.StartDate,
                                             Booking.Trip.NumberOfDay, true, Booking.Trip.HalfDay);
            }
            else
            {
                available = Module.RoomCount(rclass, rtype, Booking.Cruise, Booking.StartDate, Booking.Trip.NumberOfDay, Booking.Trip.HalfDay);
            }

            if (available <= 0)
            {
                ShowErrors("Can not add room because not enough room on that day. Please check again");
            }
            else
            {
                canAddRoom = true;
            }

            if (canAddRoom)
            {
                BookingRoomAdd(rclass, rtype);
                BookingHistorySave();
                BookingTrackSaveAddRoom();
            }
            Response.Redirect(Request.RawUrl);
        }
Beispiel #12
0
        private bool SaveData()
        {
            //Luu vao session theo dang roomclass - roomtype - so luong phong
            #region -- Lưu thông tin phòng đã chọn --
            const string confStr    = "{0},{1},{2}";
            int          confInt    = 0;
            int          totalRooms = 0;
            foreach (RepeaterItem classItem in rptRoomClass.Items)
            {
                Label     labelRoomClassId = (Label)classItem.FindControl("labelRoomClassId");
                RoomClass roomClass        = Module.RoomClassGetById(Convert.ToInt32(labelRoomClassId.Text));
                Repeater  rptRoomType      = (Repeater)classItem.FindControl("rptRoomType");

                foreach (RepeaterItem typeItem in rptRoomType.Items)
                {
                    Label        labelRoomTypeId = (Label)typeItem.FindControl("labelRoomTypeId");
                    DropDownList ddlSelect       = (DropDownList)typeItem.FindControl("ddlSelect");

                    RoomTypex roomTypex = Module.RoomTypexGetById(Convert.ToInt32(labelRoomTypeId.Text));
                    if (ddlSelect.SelectedIndex > 0)
                    {
                        confInt++;
                        Session.Add("Config" + confInt,
                                    string.Format(confStr, roomClass.Id, roomTypex.Id, ddlSelect.SelectedValue));
                        totalRooms += Convert.ToInt32(ddlSelect.SelectedValue);
                    }
                }
            }
            if (confInt == 0)
            {
                return(false);
            }
            Session.Add("ConfigCount", confInt);
            Session.Add("RoomCount", totalRooms);
            #endregion

            #region -- Lưu thông tin extra service --
            foreach (RepeaterItem service in rptExtraOption.Items)
            {
                string      services      = string.Empty;
                CheckBox    checkBoxExtra = (CheckBox)service.FindControl("checkBoxExtra");
                HiddenField hiddenId      = (HiddenField)service.FindControl("hiddenId");
                if (checkBoxExtra.Checked)
                {
                    if (string.IsNullOrEmpty(services))
                    {
                        services = hiddenId.Value;
                    }
                    else
                    {
                        services += "," + hiddenId.Value;
                    }
                }

                if (!string.IsNullOrEmpty(services))
                {
                    Session.Add("ExtraService", services);
                }
            }
            #endregion
            return(true);
        }
Beispiel #13
0
        public void BookingRoomProcess()
        {
            bool canChange = false;

            foreach (RepeaterItem item in rptRoomList.Items)
            {
                var txtRoomNumber       = (TextBox)item.FindControl("txtRoomNumber");
                var hiddenBookingRoomId = (HiddenField)item.FindControl("hiddenBookingRoomId");
                var checkBoxAddChild    = (HtmlInputCheckBox)item.FindControl("checkBoxAddChild");
                var checkBoxAddBaby     = (HtmlInputCheckBox)item.FindControl("checkBoxAddBaby");
                var checkBoxSingle      = (HtmlInputCheckBox)item.FindControl("checkBoxSingle");
                var customerInfo1       = (CustomerInfoRowInput)item.FindControl("customer1");
                var customerInfo2       = (CustomerInfoRowInput)item.FindControl("customer2");

                BookingRoom bookingRoom = Module.BookingRoomGetById(Convert.ToInt32(hiddenBookingRoomId.Value));
                bookingRoom.HasBaby    = checkBoxAddBaby.Checked;
                bookingRoom.HasChild   = checkBoxAddChild.Checked;
                bookingRoom.IsSingle   = checkBoxSingle.Checked;
                bookingRoom.RoomNumber = txtRoomNumber.Text;

                DropDownList ddlRoomTypeChanger         = (DropDownList)item.FindControl("ddlRoomTypes");
                var          stringBookingRoomTypeClass = string.Format("{0}|{1}", bookingRoom.RoomClass.Id, bookingRoom.RoomType.Id);
                if (ddlRoomTypeChanger.Visible && ddlRoomTypeChanger.SelectedValue != stringBookingRoomTypeClass)
                {
                    string[]  ids      = ddlRoomTypeChanger.SelectedValue.Split('|');
                    RoomTypex newType  = Module.RoomTypexGetById(Convert.ToInt32(ids[1]));
                    RoomClass newClass = Module.RoomClassGetById(Convert.ToInt32(ids[0]));

                    int available = Module.RoomCount(newClass, newType, Booking.Cruise, Booking.StartDate, Booking.Trip.NumberOfDay, Booking.Trip.HalfDay);
                    if (available > 0)
                    {
                        canChange = true;
                    }
                    else
                    {
                        canChange = false;
                        ShowErrors("Cant not change room" + bookingRoom.RoomClass.Name + bookingRoom.RoomType.Name + " to " + newClass.Name + newType.Name + "because not enough room " + newClass.Name + newType.Name + " available. Please check again");
                    }

                    if (canChange)
                    {
                        bookingRoom.RoomType  = newType;
                        bookingRoom.RoomClass = newClass;
                        bookingRoom.Room      = null;
                    }
                }
                Module.SaveOrUpdate(bookingRoom);
                bookingRoom.Customers.Clear();

                Customer customer1 = customerInfo1.NewCustomer(Module);
                customer1.Booking = Booking;
                customer1.BookingRooms.Clear();
                customer1.BookingRooms.Add(bookingRoom);
                customer1.Type = CustomerType.Adult;
                Module.SaveOrUpdate(customer1);

                if (!checkBoxSingle.Checked)
                {
                    Customer customer2 = customerInfo2.NewCustomer(Module);
                    customer2.Booking = Booking;
                    customer2.BookingRooms.Clear();
                    customer2.BookingRooms.Add(bookingRoom);
                    customer2.Type = CustomerType.Adult;
                    Module.SaveOrUpdate(customer2);
                }

                CustomerInfoRowInput customerChild = (CustomerInfoRowInput)item.FindControl("customerChild");
                Customer             child         = customerChild.NewCustomer(Module);
                if (checkBoxAddChild.Checked)
                {
                    child.Booking = Booking;
                    child.BookingRooms.Clear();
                    child.BookingRooms.Add(bookingRoom);
                    child.Type = CustomerType.Children;
                    Module.SaveOrUpdate(child);
                }

                CustomerInfoRowInput customerBaby = (CustomerInfoRowInput)item.FindControl("customerBaby");
                Customer             baby         = customerBaby.NewCustomer(Module);
                if (checkBoxAddBaby.Checked)
                {
                    baby.Booking = Booking;
                    baby.BookingRooms.Clear();
                    baby.BookingRooms.Add(bookingRoom);
                    baby.Type = CustomerType.Baby;
                    Module.SaveOrUpdate(baby);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                roomMap = new Dictionary <string, int>();
                #region -- Get room data --

                #region -- Lấy dữ liệu từ session --
                int configCount = Convert.ToInt32(Session["ConfigCount"]);

                string[] roomList = new string[configCount];
                // MAP các room theo format <"ClassId#TypeID", số lượng>
                for (int i = 1; i <= configCount; i++)
                {
                    //Lấy từng dữ liệu cấu hình có trong session ra
                    //Lấy room class, room type theo số lượng yêu cầu
                    string   sessionStr = Session["Config" + i].ToString();
                    string[] data       = sessionStr.Split(',');

                    // Lấy về ba dữ liệu trong mỗi config là class, type và số lượng
                    int classId = Convert.ToInt32(data[0]);
                    int typeId  = Convert.ToInt32(data[1]);
                    int number  = Convert.ToInt32(data[2]);

                    // Tạo thành từ điển phòng loại nào có bao nhiêu phòng
                    if (typeId == SailsModule.TWIN)
                    {
                        if (number % 2 == 1)
                        {
                            panelWarning.Visible = true;
                        }
                        number = number / 2;
                    }
                    roomMap.Add(string.Format("{0}#{1}", classId, typeId), number);

                    // Nếu là lần đầu load thì cần hiển thị danh sách phòng cần chọn cho người dùng xem
                    if (!IsPostBack)
                    {
                        RoomTypex rtype  = Module.RoomTypexGetById(typeId);
                        RoomClass rclass = Module.RoomClassGetById(classId);
                        roomList[i - 1] = string.Format("{0} {1} {2} room(s)", number, rclass.Name, rtype.Name);
                    }
                }

                if (!IsPostBack)
                {
                    rptRooms.DataSource = roomList;
                    rptRooms.DataBind();
                }

                #endregion

                #region build current room data from listbox
                currentMap = new Dictionary <string, int>();
                foreach (ListItem item in listSelectedRooms.Items)
                {
                    string[] values = item.Value.Split(',');
                    string   key    = values[0] + "#" + values[1];
                    if (currentMap.ContainsKey(key))
                    {
                        currentMap[key] += 1;
                    }
                    else
                    {
                        currentMap.Add(key, 1);
                    }
                }
                #endregion
                #endregion

                if (!IsPostBack)
                {
                    LocalizeControls();
                    if (Session["StartDate"] != null)
                    {
                        _trip = Module.TripGetById(Convert.ToInt32(Session["TripId"]));
                        CultureInfo cultureInfo = new CultureInfo("vi-VN");
                        DateTime    startDate   = DateTime.ParseExact(Session["StartDate"].ToString(), "dd/MM/yyyy",
                                                                      cultureInfo.DateTimeFormat);
                        rptRoomList.DataSource = Module.RoomGetAllWithAvaiableStatus(null, startDate, _trip.NumberOfDay);
                    }
                    else
                    {
                        rptRoomList.DataSource = Module.RoomGetAll(true);
                    }

                    rptRoomList.DataBind();
                }
                ScriptManager.RegisterClientScriptInclude(Page, GetType(), "dropdown", "/js/dropdown.js");
            }
            catch (Exception ex)
            {
                _logger.Error("Error when Page_Load in PreferedRooms contrrol", ex);
                throw;
            }
        }
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                bool isvalid = false;

                #region -- Lấy thông tin bảng giá, độc lập với lưu giá --
                SailsPriceTable table;
                if (_tableId <= 0)
                {
                    table = new SailsPriceTable();
                }
                else
                {
                    table = Table;
                }
                table.StartDate = DateTime.ParseExact(textBoxStartDate.Text, "dd/MM/yyyy",
                                                      CultureInfo.InvariantCulture);
                table.EndDate = DateTime.ParseExact(textBoxEndDate.Text, "dd/MM/yyyy",
                                                    CultureInfo.InvariantCulture);
                table.Trip       = _trip;
                table.TripOption = Option;
                table.Note       = string.Empty;
                table.Agency     = ActiveAgency;
                if (ActiveCruise != null)
                {
                    table.Cruise = ActiveCruise;
                }
                else
                {
                    if (ddlCruises.SelectedIndex > 0)
                    {
                        table.Cruise = Module.CruiseGetById(Convert.ToInt32(ddlCruises.SelectedValue));
                    }
                    else
                    {
                        table.Cruise = null;
                    }
                }

                #endregion

                foreach (RepeaterItem rptClassItem in rptRoomClass.Items)
                {
                    Repeater rptRoomTypeCell  = rptClassItem.FindControl("rptRoomTypeCell") as Repeater;
                    Label    labelRoomClassId = rptClassItem.FindControl("labelRoomClassId") as Label;
                    if (labelRoomClassId != null && labelRoomClassId.Text != string.Empty && rptRoomTypeCell != null)
                    {
                        RoomClass roomClass = Module.RoomClassGetById(Convert.ToInt32(labelRoomClassId.Text));

                        #region -- Kiểm tra tính hợp lệ của bảng giá --

                        foreach (RepeaterItem priceItem in rptRoomTypeCell.Items)
                        {
                            TextBox txtCellPrice = priceItem.FindControl("textBoxPrice") as TextBox;
                            //Kiểm tra xem textboxPrice có enable ko ( không nghĩa là o tồn tại giá kiểu class và type đó)
                            if (txtCellPrice != null && txtCellPrice.Enabled)
                            {
                                double price;
                                //kiểm tra xem price có hợp lệ ko
                                isvalid = double.TryParse(txtCellPrice.Text, out price);
                                if (!isvalid)
                                {
                                    break;
                                }
                            }
                        }

                        #endregion

                        //Nếu bảng giá hợp lệ thì lưu
                        if (isvalid)
                        {
                            Module.SaveOrUpdate(table);

                            TextBox txtSingle = rptClassItem.FindControl("txtSingle") as TextBox;
                            double  single    = 0;
                            if (txtSingle != null && !string.IsNullOrEmpty(txtSingle.Text))
                            {
                                single = Convert.ToDouble(txtSingle.Text);
                            }

                            foreach (RepeaterItem priceItem in rptRoomTypeCell.Items)
                            {
                                Label labelRoomTypeId         = priceItem.FindControl("labelRoomTypeId") as Label;
                                Label labelSailsPriceConfigId =
                                    priceItem.FindControl("labelSailsPriceConfigId") as Label;
                                TextBox   textBoxPrice = priceItem.FindControl("textBoxPrice") as TextBox;
                                RoomTypex roomType     = null;

                                #region Lấy về RoomType tương ứng để chuẩn bị lưu

                                if (labelRoomTypeId != null && labelRoomTypeId.Text != string.Empty)
                                {
                                    if (Convert.ToInt32(labelRoomTypeId.Text) > 0)
                                    {
                                        roomType = Module.RoomTypexGetById(Convert.ToInt32(labelRoomTypeId.Text));
                                    }
                                }

                                #endregion

                                if (textBoxPrice != null && textBoxPrice.Enabled &&
                                    textBoxPrice.Text != string.Empty)
                                {
                                    double price;
                                    //Check giá người dùng nhập vào
                                    if (!double.TryParse(textBoxPrice.Text, out price))
                                    {
                                        isvalid = false;
                                        break;
                                    }
                                    Domain.SailsPriceConfig rPrice;
                                    if (labelSailsPriceConfigId != null &&
                                        !string.IsNullOrEmpty(labelSailsPriceConfigId.Text) &&
                                        Convert.ToInt32(labelSailsPriceConfigId.Text) > 0)
                                    {
                                        //update
                                        rPrice =
                                            Module.SailsPriceConfigGetById(Convert.ToInt32(labelSailsPriceConfigId.Text));
                                    }
                                    else
                                    {
                                        //insert
                                        rPrice            = new Domain.SailsPriceConfig();
                                        rPrice.RoomType   = roomType;
                                        rPrice.RoomClass  = roomClass;
                                        rPrice.TripOption = Option;
                                        rPrice.Trip       = _trip;
                                    }

                                    // Giá single supplement
                                    rPrice.SpecialPrice = single;
                                    rPrice.NetPrice     = price;
                                    rPrice.Table        = table;
                                    Module.SaveOrUpdate(rPrice);
                                }
                            }
                        }
                    }
                }

                PageRedirect(Request.RawUrl);
            }
            catch (Exception ex)
            {
                _logger.Error("Error when buttonSubmit_Click in SailsPriceConfig", ex);
                ShowError(ex.Message);
            }
        }
        /// <summary>
        /// Kiểm tra xem có còn đủ phòng trống hay không, đồng thời tạo ra dữ liệu booking room
        /// </summary>
        /// <returns></returns>
        public bool CheckAvailable()
        {
            _bookingRooms = new ArrayList();
            foreach (RepeaterItem classItem in rptClass.Items)
            {
                var hiddenId = (HiddenField)classItem.FindControl("hiddenId");
                var rclass   = Module.RoomClassGetById(Convert.ToInt32(hiddenId.Value));
                var rptTypes = (Repeater)classItem.FindControl("rptTypes");
                foreach (RepeaterItem typeItem in rptTypes.Items)
                {
                    if (!typeItem.Visible)
                    {
                        continue; // Bỏ qua nếu là đối tượng ẩn (ẩn là do không tồn tại loại phòng này)
                    }
                    HiddenField  hiddenTypeId = (HiddenField)typeItem.FindControl("hiddenId");
                    RoomTypex    rtype        = Module.RoomTypexGetById(Convert.ToInt32(hiddenTypeId.Value));
                    DropDownList ddlAdults    = (DropDownList)typeItem.FindControl("ddlAdults");
                    DropDownList ddlChild     = (DropDownList)typeItem.FindControl("ddlChild");
                    DropDownList ddlBaby      = (DropDownList)typeItem.FindControl("ddlBaby");
                    double       unitprice    = 0;
                    if (CustomPriceAddBooking)
                    {
                        TextBox txtPrice = (TextBox)typeItem.FindControl("txtPrice");
                        unitprice = Convert.ToDouble(txtPrice.Text);
                    }

                    // Tìm số phòng available
                    int    roomCount;
                    Locked locked = null;
                    var    cruise = null as Cruise;
                    if (ViewState["cruiseId"] != null)
                    {
                        var cruiseIdViewState = (int)ViewState["cruiseId"];
                        cruise = Module.GetObject <Cruise>(cruiseIdViewState);
                        locked = Module.LockedCheckByDate(cruise, Date.Value,
                                                          Date.Value.AddDays(Trip.NumberOfDay - 1));
                    }
                    if (locked != null)
                    {
                        if (!string.IsNullOrEmpty(locked.Description))
                        {
                            ShowErrors(
                                string.Format(
                                    "Hành trình này đã bị khóa với lý do: {0}, vẫn có thể add booking như buộc phải chuyển sang tàu khác",
                                    locked.Description));
                        }
                        // Khi ấy thì lấy về số phòng, trong đó bỏ qua lock
                        roomCount = Module.RoomCount(rclass, rtype, cruise, Date.Value, Trip.NumberOfDay, true,
                                                     Trip.HalfDay);
                    }
                    else
                    {
                        roomCount = Module.RoomCount(rclass, rtype, cruise, Date.Value, Trip.NumberOfDay,
                                                     Trip.HalfDay);
                    }

                    if (roomCount < 0)
                    {
                        continue;
                    }

                    // Lấy về số phòng (đối với phòng thường) và số người đối với phòng ở ghép
                    int adult = Convert.ToInt32(ddlAdults.SelectedValue);
                    int child = Convert.ToInt32(ddlChild.SelectedValue);
                    int baby  = Convert.ToInt32(ddlBaby.SelectedValue);
                    int room;

                    // Nếu là phòng ở ghép thì tính theo đơn vị số người chứ không phải số phòng
                    if (rtype.IsShared)
                    {
                        room = adult / rtype.Capacity;
                    }
                    else
                    {
                        room = adult;
                    }

                    if (child > room || baby > room)
                    {
                        ShowErrors(Resources.errorOneChildOneBaby);
                        return(false);
                    }

                    if (adult > roomCount)
                    {
                        ShowErrors(Resources.errorNotEnoughAvailable);
                        return(false);
                    }

                    // Nếu đủ số phòng trống thì mới thực hiện việc tạo dữ liệu phòng đã book

                    bool isShared = false;
                    if (rtype.IsShared && adult % 2 == 1)
                    {
                        room    += 1;
                        isShared = true;
                    }

                    // Với mỗi loại room, căn cứ theo số phòng xác định phòng có child, baby và phòng share
                    for (int ii = 1; ii <= room; ii++)
                    {
                        var booking = new BookingRoom();
                        booking.BookingType = BookingType.Double;
                        booking.RoomType    = rtype;
                        booking.RoomClass   = rclass;

                        // Nếu là phòng cuối thì cho phòng này là phòng shared
                        if (ii == room && isShared)
                        {
                            booking.Booked = 1;
                        }
                        else
                        {
                            booking.Booked = 2;
                        }

                        // Các phòng đầu sẽ ghép child/baby vào (nếu có) vì có thể đảm bảo rằng không phải ở ghép
                        if (child > 0)
                        {
                            booking.HasChild = true;
                            child--;
                        }

                        if (baby > 0)
                        {
                            booking.HasBaby = true;
                            baby--;
                        }

                        if (CustomPriceAddBooking)
                        {
                            booking.Total = unitprice;
                        }

                        _bookingRooms.Add(booking);
                    }
                }
            }
            return(true);
        }
        protected void rptTypes_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is RoomTypex)
            {
                RoomTypex type      = (RoomTypex)e.Item.DataItem;
                Label     labelName = e.Item.FindControl("labelName") as Label;
                if (labelName != null)
                {
                    labelName.Text = string.Format("{0} {1}", _roomClass.Name, type.Name);
                }

                #region -- thông tin về khách và phòng trống --

                DropDownList ddlAdults = (DropDownList)e.Item.FindControl("ddlAdults");
                DropDownList ddlChild  = (DropDownList)e.Item.FindControl("ddlChild");
                DropDownList ddlBaby   = (DropDownList)e.Item.FindControl("ddlBaby");
                if (Date != null)
                {
                    ddlAdults.Items.Clear();
                    ddlChild.Items.Clear();
                    ddlBaby.Items.Clear();

                    int roomCount;

                    Locked locked = Module.LockedCheckByDate(ActiveCruise, Date.Value,
                                                             Date.Value.AddDays(Trip.NumberOfDay - 1));
                    if (locked != null)
                    {
                        if (!string.IsNullOrEmpty(locked.Description))
                        {
                            ShowErrors(
                                string.Format(
                                    "Hành trình này đã bị khóa với lý do: {0}, vẫn có thể add booking như buộc phải chuyển sang tàu khác",
                                    locked.Description));
                        }
                        else
                        {
                            ShowErrors(
                                string.Format(
                                    "Hành trình này đã bị khóa, vẫn có thể add booking như buộc phải chuyển sang tàu khác"));
                        }
                        // Khi ấy thì lấy về số phòng, trong đó bỏ qua lock
                        roomCount = Module.RoomCount(_roomClass, type, ActiveCruise, Date.Value, Trip.NumberOfDay, true,
                                                     Trip.HalfDay);
                    }
                    else
                    {
                        roomCount = Module.RoomCount(_roomClass, type, ActiveCruise, Date.Value, Trip.NumberOfDay,
                                                     Trip.HalfDay);
                    }

                    if (roomCount < 0)
                    {
                        e.Item.Visible = false;
                        return;
                    }
                    int maxAdults;

                    // Nếu là phòng ở ghép thì số người = giá trị lấy về, số phòng = giá trị lấy về chia cho sức chứa
                    if (type.IsShared)
                    {
                        maxAdults = roomCount;
                        roomCount = roomCount / type.Capacity;
                    }
                    else
                    {
                        // Nếu không số người = giá gị lấy về nhân với sức chứa
                        maxAdults = roomCount * type.Capacity;
                    }

                    // Nếu là phòng ở ghép thì cho chọn theo số người
                    if (type.IsShared)
                    {
                        // Từ 0 đến số người max
                        for (int i = 0; i <= maxAdults; i++)
                        {
                            ddlAdults.Items.Add(new ListItem(string.Format(Resources.formatPersonItem, i), i.ToString()));
                        }
                    }
                    else
                    {
                        // Nếu không phải phòng ở ghép thì lấy theo số phòng
                        for (int i = 0; i <= roomCount; i++)
                        {
                            ddlAdults.Items.Add(new ListItem(string.Format(Resources.formatRoomItem, i), i.ToString()));
                        }
                    }

                    for (int i = 0; i <= roomCount; i++)
                    {
                        ddlBaby.Items.Add(new ListItem(string.Format(Resources.formatBabyItem, i), i.ToString()));
                        ddlChild.Items.Add(new ListItem(string.Format(Resources.formatChildItem, i), i.ToString()));
                    }
                }

                #endregion

                #region -- Giá thủ công --

                // Nếu hệ thống được cấu hình để nhập giá thủ công cho từng loại phòng ngay khi add booking thì hiển thị khu vực này
                PlaceHolder plhCustomPrice = e.Item.FindControl("plhCustomPrice") as PlaceHolder;
                if (plhCustomPrice != null)
                {
                    if (CustomPriceAddBooking)
                    {
                        plhCustomPrice.Visible = true;
                        TextBox txtPrice = e.Item.FindControl("txtPrice") as TextBox;
                        if (txtPrice != null)
                        {
                            double price;
                            try
                            {
                                price = BookingRoom.Calculate(_roomClass, type, type.Capacity, 0, false, _trip,
                                                              ActiveCruise,
                                                              TripOption.Option1, Date.Value, Module, _policies,
                                                              ChildPrice, AgencySupplement, null);
                            }
                            catch (PriceException ex)
                            {
                                ShowErrors(ex.Message);
                                price = 0;
                            }
                            txtPrice.Text = price.ToString("0.##");
                        }
                    }
                    else
                    {
                        plhCustomPrice.Visible = false;
                    }
                }

                #endregion
            }
        }
Beispiel #18
0
        public void Save()
        {
            foreach (RepeaterItem rptClassItem in rptRoomClass.Items)
            {
                Repeater rptRoomTypeCell  = rptClassItem.FindControl("rptRoomTypeCell") as Repeater;
                Label    labelRoomClassId = rptClassItem.FindControl("labelRoomClassId") as Label;
                if (labelRoomClassId != null && labelRoomClassId.Text != string.Empty && rptRoomTypeCell != null)
                {
                    RoomClass roomClass = Module.RoomClassGetById(Convert.ToInt32(labelRoomClassId.Text));

                    #region -- Kiểm tra tính hợp lệ của bảng giá --

                    foreach (RepeaterItem priceItem in rptRoomTypeCell.Items)
                    {
                        TextBox txtCellPrice = priceItem.FindControl("textBoxPrice") as TextBox;
                        //Kiểm tra xem textboxPrice có enable ko ( không nghĩa là o tồn tại giá kiểu class và type đó)
                        if (txtCellPrice != null && txtCellPrice.Enabled)
                        {
                            double price;
                            //kiểm tra xem price có hợp lệ ko
                            _isValid = double.TryParse(txtCellPrice.Text, out price);
                            if (!_isValid)
                            {
                                break;
                            }
                        }
                    }

                    #endregion

                    //Nếu bảng giá hợp lệ thì lưu
                    if (_isValid)
                    {
                        //Module.SaveOrUpdate(Table);

                        TextBox txtSingle    = rptClassItem.FindControl("txtSingle") as TextBox;
                        TextBox txtSingleVND = rptClassItem.FindControl("txtSingleVND") as TextBox;
                        double  single       = 0;
                        double  singleVND    = 0;
                        if (txtSingle != null && !string.IsNullOrEmpty(txtSingle.Text))
                        {
                            single = Convert.ToDouble(txtSingle.Text);
                        }

                        if (txtSingleVND != null && !string.IsNullOrEmpty(txtSingleVND.Text))
                        {
                            singleVND = Convert.ToDouble(txtSingleVND.Text);
                        }

                        foreach (RepeaterItem priceItem in rptRoomTypeCell.Items)
                        {
                            Label labelRoomTypeId         = priceItem.FindControl("labelRoomTypeId") as Label;
                            Label labelSailsPriceConfigId =
                                priceItem.FindControl("labelSailsPriceConfigId") as Label;
                            TextBox   textBoxPrice    = priceItem.FindControl("textBoxPrice") as TextBox;
                            TextBox   textBoxPriceVND = priceItem.FindControl("textBoxPriceVND") as TextBox;
                            RoomTypex roomType        = null;

                            #region Lấy về RoomType tương ứng để chuẩn bị lưu

                            if (labelRoomTypeId != null && labelRoomTypeId.Text != string.Empty)
                            {
                                if (Convert.ToInt32(labelRoomTypeId.Text) > 0)
                                {
                                    roomType = Module.RoomTypexGetById(Convert.ToInt32(labelRoomTypeId.Text));
                                }
                            }

                            #endregion

                            if (textBoxPrice != null && textBoxPrice.Enabled &&
                                textBoxPrice.Text != string.Empty && textBoxPriceVND != null && textBoxPriceVND.Enabled &&
                                textBoxPriceVND.Text != string.Empty)
                            {
                                double price;
                                double priceVND;
                                //Check giá người dùng nhập vào
                                if (!double.TryParse(textBoxPrice.Text, out price))
                                {
                                    _isValid = false;
                                    break;
                                }

                                if (!double.TryParse(textBoxPriceVND.Text, out priceVND))
                                {
                                    _isValid = false;
                                    break;
                                }
                                Domain.SailsPriceConfig rPrice;
                                if (SailsPriceTableTemplate != null)
                                {
                                    rPrice                 = new SailsPriceConfig();
                                    rPrice.RoomType        = roomType;
                                    rPrice.RoomClass       = roomClass;
                                    rPrice.TripOption      = Option;
                                    rPrice.Trip            = Trip;
                                    rPrice.SpecialPrice    = single;
                                    rPrice.SpecialPriceVND = singleVND;
                                    rPrice.NetPrice        = price;
                                    rPrice.NetPriceVND     = priceVND;
                                    rPrice.Table           = SailsPriceTable;
                                    rPrice.Trip            = Trip;
                                    rPrice.TripOption      = Option;
                                    rPrice.Cruise          = ActiveCruise;
                                    Module.SaveOrUpdate(rPrice);
                                }
                                else
                                {
                                    if (labelSailsPriceConfigId != null &&
                                        !string.IsNullOrEmpty(labelSailsPriceConfigId.Text) &&
                                        Convert.ToInt32(labelSailsPriceConfigId.Text) > 0)
                                    {
                                        //update
                                        rPrice =
                                            Module.SailsPriceConfigGetById(Convert.ToInt32(labelSailsPriceConfigId.Text));
                                    }
                                    else
                                    {
                                        //insert
                                        rPrice            = new Domain.SailsPriceConfig();
                                        rPrice.RoomType   = roomType;
                                        rPrice.RoomClass  = roomClass;
                                        rPrice.TripOption = Option;
                                        rPrice.Trip       = Trip;
                                    }
                                    rPrice.SpecialPrice    = single;
                                    rPrice.SpecialPriceVND = singleVND;
                                    rPrice.NetPrice        = price;
                                    rPrice.NetPriceVND     = priceVND;
                                    rPrice.Table           = SailsPriceTable;
                                    rPrice.Trip            = Trip;
                                    rPrice.TripOption      = Option;
                                    rPrice.Cruise          = ActiveCruise;
                                    Module.SaveOrUpdate(rPrice);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// Lấy về price config theo trip, room type và room class
        /// </summary>
        /// <param name="trip"></param>
        /// <param name="type"></param>
        /// <param name="roomClass"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        public SailsPriceConfig SailsPriceConfigGetBy_RoomType_RoomClass_Trip(SailsTrip trip, RoomTypex type, RoomClass roomClass, TripOption option)
        {
            ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(SailsPriceConfig));

            criteria.Add(Expression.Eq(SailsPriceConfig.TRIP, trip))
            .Add(Expression.Eq(SailsPriceConfig.ROOMTYPE, type))
            .Add(Expression.Eq(SailsPriceConfig.ROOMCLASS, roomClass))
            .Add(Expression.Eq(SailsPriceConfig.TRIPOPTION, option));
            criteria.AddOrder(new Order("Id", false));
            IList result = criteria.List();

            if (result.Count > 0)
            {
                return(result[0] as SailsPriceConfig);
            }
            return(null);
        }
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //Biến để đếm tổng số customer

                // Tạo đối tượng booking mới
                Booking     booking     = new Booking();
                CultureInfo cultureInfo = new CultureInfo("vi-VN");

                #region -- Các thông tin cơ bản --
                if (PageEngine.User.Identity is User)
                {
                    booking.CreatedBy  = (User)Page.User.Identity;
                    booking.ModifiedBy = (User)Page.User.Identity;
                    booking.Partner    = (User)Page.User.Identity;
                    //booking.Sale = (User)Page.User.Identity;
                }

                booking.CreatedDate  = DateTime.Now;
                booking.ModifiedDate = DateTime.Now;
                DateTime startDate = DateTime.ParseExact(Session["StartDate"].ToString(), "dd/MM/yyyy",
                                                         cultureInfo.DateTimeFormat);
                booking.StartDate = startDate;
                booking.Status    = StatusType.Cancelled;
                #endregion

                #region - Lấy trip và trip option đã book từ biến session -

                SailsTrip trip = Module.TripGetById(Convert.ToInt32(Session["TripId"]));
                booking.Trip = trip;

                TripOption tripOption = TripOption.Option1;
                if (!string.IsNullOrEmpty(Session["TripOption"].ToString()))
                {
                    tripOption = (TripOption)Convert.ToInt32(Session["TripOption"]);
                }

                booking.TripOption = tripOption;
                #endregion

                // Save booking lại
                if (panelCustomer.Visible)
                {
                    booking.Note = fckCustomers.Value;
                }

                if (liAnonymous.Visible)
                {
                    booking.Name  = txtYourName.Text;
                    booking.Email = txtEmail.Text;
                }

                booking.PickupAddress  = txtPickupAddress.Text;
                booking.SpecialRequest = txtSpecialRequest.Text;
                Module.Save(booking, null);

                #region -- Lấy thông tin về extra services từ session --
                // Mặc dù extra service đã được chọn từ form trước, tuy nhiên tại form này mới lưu lại thông tin booking
                // Do đó đến form này mới lấy lại thông tin extra service
                if (Session["ExtraService"] != null)
                {
                    string[] services = Session["ExtraService"].ToString().Split(',');
                    foreach (string serviceId in services)
                    {
                        ExtraOption  service        = Module.ExtraOptionGetById(Convert.ToInt32(serviceId));
                        BookingExtra bookingService = new BookingExtra();
                        bookingService.Booking     = booking;
                        bookingService.ExtraOption = service;
                        Module.Save(bookingService);
                    }
                }
                #endregion

                #region -- Lưu thông tin khách hàng --
                foreach (RepeaterItem item in rptRoomList.Items)
                {
                    // Đối với mỗi đối tượng trong room list
                    Label label_RoomId = (Label)item.FindControl("label_RoomId");

                    #region -- Thông tin về phòng --
                    HiddenField hiddenRoomClassId = (HiddenField)item.FindControl("hiddenRoomClassId");
                    HiddenField hiddenRoomTypeId  = (HiddenField)item.FindControl("hiddenRoomTypeId");

                    // Lấy về room id theo label Room id đã bound trước đó
                    int roomId = 0;
                    // Lấy ID của phòng nếu đã có phòng chọn (prefer room)
                    if (!string.IsNullOrEmpty(label_RoomId.Text))
                    {
                        roomId = Convert.ToInt32(label_RoomId.Text);
                    }
                    Room room = null;
                    if (roomId > 0)
                    {
                        room = Module.RoomGetById(roomId);
                    }
                    #endregion

                    #region -- Lấy thông tin khách hàng --
                    CheckBox checkBoxAddChild = (CheckBox)item.FindControl("checkBoxAddChild");
                    CheckBox checkBoxAddBaby  = (CheckBox)item.FindControl("checkBoxAddBaby");
                    CheckBox checkBoxSingle   = (CheckBox)item.FindControl("checkBoxSingle");

                    //TODO: CHECK THIS
                    //BookingType bookingType = (BookingType) Enum.Parse(typeof(BookingType),ddlRoomType.SelectedValue);
                    const BookingType bookingType   = BookingType.Double;
                    CustomerInfoInput customerInfo1 = (CustomerInfoInput)item.FindControl("customer1");
                    CustomerInfoInput customerInfo2 = (CustomerInfoInput)item.FindControl("customer2");

                    BookingRoom bookingRoom;
                    if (room != null)
                    {
                        bookingRoom = new BookingRoom(booking, room, room.RoomClass, room.RoomType);
                    }
                    else
                    {
                        RoomClass roomClass = Module.RoomClassGetById(Convert.ToInt32(hiddenRoomClassId.Value));
                        RoomTypex roomType  = Module.RoomTypexGetById(Convert.ToInt32(hiddenRoomTypeId.Value));
                        bookingRoom = new BookingRoom(booking, null, roomClass, roomType);
                    }
                    bookingRoom.BookingType = bookingType;
                    bookingRoom.HasBaby     = checkBoxAddBaby.Checked;
                    bookingRoom.HasChild    = checkBoxAddChild.Checked;
                    bookingRoom.IsSingle    = checkBoxSingle.Checked;
                    Module.Save(bookingRoom);
                    #endregion

                    #region -- Khách hàng --
                    Customer customer1;
                    Customer customer2;

                    Control trCustomer2 = item.FindControl("trCustomer2");

                    customer1             = customerInfo1.NewCustomer(Module);
                    customer1.BookingRoom = bookingRoom;
                    customer1.Booking     = booking;
                    customer1.Type        = CustomerType.Adult;
                    Module.Save(customer1);

                    if (bookingRoom.RoomType.Id != SailsModule.TWIN || trCustomer2.Visible)
                    {
                        customer2             = customerInfo2.NewCustomer(Module);
                        customer2.BookingRoom = bookingRoom;
                        customer2.Booking     = booking;
                        customer2.Type        = CustomerType.Adult;
                        Module.Save(customer2);
                    }

                    if (checkBoxAddChild.Checked)
                    {
                        CustomerInfoInput customerChild = (CustomerInfoInput)item.FindControl("customerChild");
                        Customer          child         = customerChild.NewCustomer(Module);
                        child.BookingRoom = bookingRoom;
                        child.Booking     = booking;
                        child.Type        = CustomerType.Children;
                        Module.Save(child);
                    }

                    if (checkBoxAddBaby.Checked)
                    {
                        CustomerInfoInput customerBaby = (CustomerInfoInput)item.FindControl("customerBaby");
                        Customer          baby         = customerBaby.NewCustomer(Module);
                        baby.BookingRoom = bookingRoom;
                        baby.Booking     = booking;
                        baby.Type        = CustomerType.Baby;
                        Module.Save(baby);
                    }

                    #endregion
                }
                #endregion

                Session.Add("Finish", booking.Id);

                // Chuyển sang trang kết thúc (trang confirm lại lần cuối booking)
                PageEngine.PageRedirect(string.Format("{0}/{1}{2}", UrlHelper.GetUrlFromSection(Module.Section),
                                                      SailsModule.ACTION_BOOKING_FINISH_PARAM,
                                                      UrlHelper.EXTENSION));
            }
            catch (Exception ex)
            {
                _logger.Error("Error when buttonSubmit_Click inCustomersInfo control", ex);
                throw;
            }
        }