Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public Cruise GetCruise()
        {
            Cruise cruise = null;

            try
            {
                cruise = BookingViewBLL.CruiseGetById(Convert.ToInt32(ddlCruises.SelectedValue));
            }
            catch { }
            return(cruise);
        }
Exemplo n.º 3
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.Params[txtPickup.UniqueID]))
            {
                ShowWarning("Pick up address is required.");
            }

            //ScreenCaptureSave();
            BookingSetData();
            BookingViewBLL.BookingSaveOrUpdate(Booking);
            ShowSuccess("Booking updated. Please fix errors if exists and submit again");

            bool   needEmail = !Booking.Special && chkSpecial.Checked;
            string email     = string.Empty;

            if (needEmail)
            {
                email = "&confirm=1";
            }
            foreach (RepeaterItem extraService in rptExtraServices.Items)
            {
                var chkService = (HtmlInputCheckBox)extraService.FindControl("chkService");
                if (chkService.Checked)
                {
                    SaveExtraService();
                }
                else
                {
                    DeleteExtraService();
                }
            }
            foreach (RepeaterItem item in rptCustomers.Items)
            {
                CustomerInfoRowInput customerInfo1 = item.FindControl("customerData") as CustomerInfoRowInput;
                if (customerInfo1 != null)
                {
                    Customer customer1 = customerInfo1.NewCustomer(Module);
                    customer1.Booking = this.Booking;
                    Module.SaveOrUpdate(customer1);

                    Repeater rptService1 = item.FindControl("rptServices1") as Repeater;
                    if (rptService1 != null)
                    {
                        if (DetailService)
                        {
                            CustomerServiceRepeaterHandler.Save(rptService1, Module, customer1);
                        }
                    }
                }
            }
            Booking.EndDate     = Booking.StartDate.AddDays(Booking.Trip.NumberOfDay - 1);
            Session["Redirect"] = true;
            PageRedirect(string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}{3}", Node.Id, Section.Id, Booking.Id, email));
        }
Exemplo n.º 4
0
        public SailsTrip GetTrip()
        {
            SailsTrip trip = null;

            try
            {
                trip = BookingViewBLL.TripGetById(Convert.ToInt32(ddlTrips.SelectedValue));
            }
            catch { }
            return(trip);
        }
Exemplo n.º 5
0
        public void SaveExtraService()
        {
            var busTypeId = -1;

            try
            {
                busTypeId = Int32.Parse(Request.Form["radBusType"]);
            }
            catch { }
            Booking.Transfer_BusType = BookingViewBLL.BusTypeGetById(busTypeId);
            if (rbtTransferService_OneWay.Checked)
            {
                Booking.Transfer_Service = "One Way";
            }
            if (rbtTransferService_TwoWay.Checked)
            {
                Booking.Transfer_Service = "Two Way";
            }
            var transfer_DateTo = Booking.StartDate;

            try
            {
                transfer_DateTo = DateTime.ParseExact(txtTransfer_Dateto.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            catch { }
            var transfer_DateBack = Booking.EndDate;

            try
            {
                transfer_DateBack = DateTime.ParseExact(txtTransfer_Dateback.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            catch { }
            if (Booking.Transfer_Service == "One Way")
            {
                if (!String.IsNullOrEmpty(txtTransfer_Dateto.Text))
                {
                    Booking.Transfer_DateTo   = transfer_DateTo;
                    Booking.Transfer_DateBack = null;
                }
                else
                if (!String.IsNullOrEmpty(txtTransfer_Dateback.Text))
                {
                    Booking.Transfer_DateTo   = null;
                    Booking.Transfer_DateBack = transfer_DateBack;
                }
            }
            if (Booking.Transfer_Service == "Two Way")
            {
                Booking.Transfer_DateBack = transfer_DateBack;
                Booking.Transfer_DateTo   = transfer_DateTo;
            }
            Booking.Transfer_Note = txtTransfer_Note.Text;
            BookingViewBLL.BookingSaveOrUpdate(Booking);
        }
Exemplo n.º 6
0
 protected void btnUnlockIncome_Click(object sender, EventArgs e)
 {
     if (!PermissionUtil.UserCheckPermission(CurrentUser.Id, (int)PermissionEnum.LOCK_INCOME))
     {
         ShowErrors("You don't have permission to perform this action");
         return;
     }
     Booking.LockDate = null;
     Booking.LockBy   = null;
     BookingViewBLL.BookingSaveOrUpdate(Booking);
     Response.Redirect(Request.RawUrl);
 }
Exemplo n.º 7
0
        public void ControlLoadData()
        {
            ddlStatusType.DataSource = Enum.GetNames(typeof(StatusType));
            ddlStatusType.DataBind();

            ddlAgencies.DataSource     = BookingViewBLL.AgencyGetAll().OrderBy(x => x.Name);
            ddlAgencies.DataTextField  = "Name";
            ddlAgencies.DataValueField = "Id";
            ddlAgencies.DataBind();
            ddlAgencies.Items.Insert(0, "-- Agency --");

            var trips = BookingViewBLL.TripGetAll();

            foreach (var trip in trips)
            {
                var listItemTrip = new ListItem(trip.Name, trip.Id.ToString());
                if (trip.NumberOfOptions == 2)
                {
                    listItemTrip.Attributes.Add("data-option-visible", "true");
                }
                ddlTrips.Items.Add(listItemTrip);
            }

            ddlCruises.DataSource     = BookingViewBLL.CruiseGetAll();
            ddlCruises.DataTextField  = "Name";
            ddlCruises.DataValueField = "Id";
            ddlCruises.DataBind();
            if (ddlCruises.Items.Count == 1)
            {
                ddlCruises.Visible = false;
            }

            cddlBooker.DataSource      = Module.ContactGetAllEnabled();
            cddlBooker.DataTextField   = "Name";
            cddlBooker.DataValueField  = "Id";
            cddlBooker.DataParentField = "AgencyId";
            cddlBooker.ParentClientID  = ddlAgencies.ClientID;
            cddlBooker.DataBind();
            cddlBooker.Items.Insert(0, "-- Contact --");

            rptExtraServices.DataSource = Module.ExtraOptionGetBooking();
            rptExtraServices.DataBind();

            TotalDisplay();
            TotalLockedDisplay();
            AddRoomControlGenerate();
            CustomerBirthdayDisplay();
        }
Exemplo n.º 8
0
        private void PendingStatusProcess()
        {
            var statusType        = (StatusType)Enum.Parse(typeof(StatusType), ddlStatusType.SelectedValue);
            var bookingHistories  = BookingViewBLL.BookingHistoryGetByBookingId(Booking.Id).OrderBy(x => x.Date);
            var bookingLastStatus = bookingHistories.Last().Status;
            var canApplyStatus    = bookingLastStatus == StatusType.Approved ? false : true;

            if (canApplyStatus)
            {
                Booking.Status = statusType;
            }
            else
            {
                ShowErrors("Approved booking can not switch to pending");
            }
        }
Exemplo n.º 9
0
 protected void Page_Unload(object sender, EventArgs e)
 {
     if (bookingViewBLL != null)
     {
         bookingViewBLL.Dispose();
         bookingViewBLL = null;
     }
     if (userUtil != null)
     {
         userUtil.Dispose();
         userUtil = null;
     }
     if (permissionUtil != null)
     {
         permissionUtil.Dispose();
         permissionUtil = null;
     }
 }
Exemplo n.º 10
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.Params[txtPickup.UniqueID]))
            {
                ShowWarning("Pick up address is required.");
            }

            //ScreenCaptureSave();
            BookingSetData();
            BookingViewBLL.BookingSaveOrUpdate(Booking);
            ShowSuccess("Booking updated. Please fix errors if exists and submit again");

            bool   needEmail = !Booking.Special && chkSpecial.Checked;
            string email     = string.Empty;

            if (needEmail)
            {
                email = "&confirm=1";
            }
            PageRedirect(string.Format("BookingView.aspx?NodeId={0}&SectionId={1}&bi={2}{3}", Node.Id, Section.Id, Booking.Id, email));
        }
Exemplo n.º 11
0
        public void WarningShowIfCruiseLocked()
        {
            var isLocked = false;
            var cruiseId = -1;

            try
            {
                cruiseId = Booking.Cruise.Id;
            }
            catch { }

            DateTime?startDate = Booking.StartDate;
            DateTime?endDate   = Booking.EndDate;
            var      locks     = BookingViewBLL.LockedGetBy(startDate, endDate, cruiseId);

            if (locks.Count() > 0)
            {
                isLocked = true;
            }

            string lockDate = "";

            foreach (var locked in locks)
            {
                lockDate = lockDate + locked.Start.ToString("dd/MM/yyyy") + ",";
            }
            if (lockDate.Length > 0)
            {
                lockDate = lockDate.Remove(lockDate.Length - 1);
            }

            if (isLocked)
            {
                try
                {
                    ShowWarning("Cruise " + Booking.Cruise.Name + " is locked on " + lockDate);
                }
                catch { }
            }
        }
Exemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ControlLoadData();
         BookingLoadData();
         WarningShowIfNotBookingOwner();
         WarningShowIfCruiseLocked();
         rptBusType.DataSource = BookingViewBLL.BusTypeGetAll().Future().ToList();
         rptBusType.DataBind();
         if (Booking.Transfer_Service == "One Way")
         {
             rbtTransferService_OneWay.Checked = true;
         }
         else
         if (Booking.Transfer_Service == "Two Way")
         {
             rbtTransferService_TwoWay.Checked = true;
         }
         txtTransfer_Note.Text = Booking.Transfer_Note;
     }
     BookingHistorySave();
 }
Exemplo n.º 13
0
        public void BookingSetData()
        {
            Booking.Inspection      = chkInspection.Checked;
            Booking.CancelledReason = txtCancelledReason.Text;
            Booking.AgencyCode      = txtAgencyCode.Text;
            Booking.PickupAddress   = txtPickup.Text;
            Booking.SpecialRequest  = txtSpecialRequest.Text;
            Booking.IsPaymentNeeded = chkIsPaymentNeeded.Checked;
            Booking.Note            = txtCustomerInfo.Text;
            Booking.Special         = chkSpecial.Checked;

            Booking.IsEarlyBird = chkEarlyBird.Checked;

            try
            {
                Booking.Agency = Module.AgencyGetById(Convert.ToInt32(ddlAgencies.SelectedValue));
            }
            catch { }

            if (Booking.Agency == null)
            {
                ShowErrors("Please select one agency");
            }

            try
            {
                Booking.Deadline = DateTime.ParseExact(txtDeadline.Text, "dd/MM/yyyy HH:mm",
                                                       CultureInfo.InvariantCulture);
            }
            catch { }

            try
            {
                Booking.Booker = Module.ContactGetById(Convert.ToInt32(cddlBooker.SelectedValue));
            }
            catch { }

            try
            {
                Booking.IsTotalUsd = Convert.ToBoolean(Int32.Parse(ddlCurrencies.SelectedValue));
            }
            catch { }

            try
            {
                Booking.CancelPay = Convert.ToDouble(txtPenalty.Text);
            }
            catch { }

            BookingStatusProcess();
            TripProcess();

            StartDateProcess();

            ExtraServicesProcess(); //not cleanly
            VoucherProcess();       //not cleany
            TotalPriceProcess();    //not cleany

            if (Booking.Trip.NumberOfDay == 3)
            {
                Booking.TripOption = (TripOption)ddlOptions.SelectedIndex;
            }

            var seriesCode = "";

            seriesCode = txtSeriesCode.Text;

            if (!String.IsNullOrEmpty(seriesCode))
            {
                var series = BookingViewBLL.SeriesGetBySeriesCode(seriesCode);
                if (series != null)
                {
                    Booking.Series = series;
                }
                else
                {
                    ShowErrors("Không tồn tại series này");
                }
            }
            var guideExpense = 0.0;

            try
            {
                guideExpense = Double.Parse(txtGuideExpense.Text);
            }catch (Exception) {}
            Booking.Expense_Guide = guideExpense;
            var mealExpense = 0.0;

            try
            {
                mealExpense = Double.Parse(txtMealExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Meal = mealExpense;
            var hotelExpense = 0.0;

            try
            {
                hotelExpense = Double.Parse(txtHotelExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Hotel = hotelExpense;
            var busExpense = 0.0;

            try
            {
                busExpense = Double.Parse(txtBusExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Bus = busExpense;
            var ticketExpense = 0.0;

            try
            {
                ticketExpense = Double.Parse(txtTicketExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Ticket = ticketExpense;
            var limousineExpense = 0.0;

            try
            {
                limousineExpense = Double.Parse(txtLimousineExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Limousine = limousineExpense;
            var busHaNoiSapaExpense = 0.0;

            try
            {
                busHaNoiSapaExpense = Double.Parse(txtBusHaNoiSapaExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Bus_HanoiSapa = busHaNoiSapaExpense;
            var commissionExpense = 0.0;

            try
            {
                commissionExpense = Double.Parse(txtCommissionExpense.Text);
            }
            catch (Exception) { }
            Booking.Expense_Commission = commissionExpense;

            Booking.Expense_Meal_CurrencyType          = ddlMealExpenseCurrencyType.SelectedValue;
            Booking.Expense_Hotel_CurrencyType         = ddlHotelExpenseCurrencyType.SelectedValue;
            Booking.Expense_Guide_CurrencyType         = ddlGuideExpenseCurrencyType.SelectedValue;
            Booking.Expense_Ticket_CurrencyType        = ddlTicketExpenseCurrencyType.SelectedValue;
            Booking.Expense_Bus_CurrencyType           = ddlBusExpenseCurrencyType.SelectedValue;
            Booking.Expense_Limousine_CurrencyType     = ddlLimousineExpenseCurrencyType.SelectedValue;
            Booking.Expense_Bus_HanoiSapa_CurrencyType = ddlBusHaNoiSapaExpenseCurrencyType.SelectedValue;
            Booking.Expense_Commission_CurrencyType    = ddlCommissionExpenseCurrencyType.SelectedValue;
        }
        public void BookingSetData()
        {
            Booking.Inspection      = chkInspection.Checked;
            Booking.CancelledReason = txtCancelledReason.Text;
            Booking.AgencyCode      = txtAgencyCode.Text;
            Booking.PickupAddress   = txtPickup.Text;
            Booking.SpecialRequest  = txtSpecialRequest.Text;
            Booking.IsPaymentNeeded = chkIsPaymentNeeded.Checked;
            Booking.Note            = txtCustomerInfo.Text;
            Booking.Special         = chkSpecial.Checked;
            Booking.IsCharter       = chkCharter.Checked;
            Booking.IsEarlyBird     = chkEarlyBird.Checked;

            try
            {
                Booking.Agency = Module.AgencyGetById(Convert.ToInt32(ddlAgencies.SelectedValue));
            }
            catch { }

            if (Booking.Agency == null)
            {
                ShowErrors("Please select one agency");
            }

            try
            {
                Booking.Deadline = DateTime.ParseExact(txtDeadline.Text, "dd/MM/yyyy HH:mm",
                                                       CultureInfo.InvariantCulture);
            }
            catch { }

            try
            {
                Booking.Booker = Module.ContactGetById(Convert.ToInt32(cddlBooker.SelectedValue));
            }
            catch { }

            try
            {
                Booking.IsTotalUsd = Convert.ToBoolean(Int32.Parse(ddlCurrencies.SelectedValue));
            }
            catch { }

            try
            {
                Booking.CancelPay = Convert.ToDouble(txtPenalty.Text);
            }
            catch { }

            BookingStatusProcess();
            TripProcess();
            CruiseProcess();
            StartDateProcess();
            CharterProcess();       //not cleanly
            ExtraServicesProcess(); //not cleanly
            VoucherProcess();       //not cleany
            TotalPriceProcess();    //not cleany
            BookingRoomProcess();

            if (Booking.Trip.NumberOfDay == 3)
            {
                Booking.TripOption = (TripOption)ddlOptions.SelectedIndex;
            }

            var seriesCode = "";

            seriesCode = txtSeriesCode.Text;

            if (!String.IsNullOrEmpty(seriesCode))
            {
                var series = BookingViewBLL.SeriesGetBySeriesCode(seriesCode);
                if (series != null)
                {
                    Booking.Series = series;
                }
                else
                {
                    ShowErrors("Không tồn tại series này");
                }
            }
        }