Beispiel #1
0
        public static void LoadByDate(DateTime date, TourCollection tours)
        {
            try
            {
                cache      = tours;
                cache.Time = date;

                tours.Clear();
                toursRepo.GetByDate(tours, date);

                foreach (Entities.Tour tour in tours)
                {
                    DomainModel.TourGroups.Load(tour);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }
        }
Beispiel #2
0
        public static void Init(string sqlConnectionString)
        {
            cnnString = sqlConnectionString;
            cache     = new TourCollection();

            toursRepo = new Repository.Sql.Tours(sqlConnectionString);
        }
Beispiel #3
0
        //Boton para realizar la accion de eliminar un Tour.
        private void btnEliminarTour_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtIdServicio.Text))
                {
                    MessageBox.Show("Debe seleccionar un campo de las tablas.");
                }
                else
                {
                    tc = new TourCollection();

                    tc.EliminaTourC(int.Parse(txtIdServicio.Text));

                    txtIdServicio.Text = string.Empty;
                    txt1.Text          = string.Empty;
                    txt2.Text          = string.Empty;
                    lblmensaje.Content = "Eliminado!";
                    Limpiar();
                    datosTour();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error, contacte al administrador: " + ex.Message, "Excepción detectada", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Beispiel #4
0
        //Boton para realizar la accion de actualizar datos de Tour.
        private void btnActualizarTour_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtIdServicio.Text))
                {
                    MessageBox.Show("Debe seleccionar un campo de las tablas.");
                }
                else if (string.IsNullOrEmpty(txt1.Text) || txt1.Text.Length < 5 && txt1.Text.Length > 200)
                {
                    MessageBox.Show("Descripción no debe estar vacío y tiene que estar entre 5 a 200 carácteres.");
                }
                else
                {
                    tc = new TourCollection();

                    tc.ActualizaTourC(int.Parse(txtIdServicio.Text), txt1.Text);

                    lblmensaje.Content = "Actualización correcta!";
                    Limpiar();
                    datosTour();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error, contacte al administrador: " + ex.Message, "Excepción detectada", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Beispiel #5
0
        //Metodo para mostrar los datos de Tour.
        private void datosTour()
        {
            tc = new TourCollection();

            dtgTour.ItemsSource = tc.ListaTourC().DefaultView;

            dtgTour.Items.Refresh();
        }
        // GET: Tour/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TourCollection tours = _db.TourCollections.Find(id);

            if (tours == null)
            {
                return(HttpNotFound());
            }
            return(View(tours));
        }
        //Tour
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var            data  = _db.TourCollections.Where(s => s.TourCollectionID == id).FirstOrDefault();
            TourCollection tours = _db.TourCollections.Find(id);

            if (tours == null)
            {
                return(HttpNotFound());
            }
            return(View(data));
        }
Beispiel #8
0
        public ActionResult TourCollectionDetails(int tourId)
        {
            if (tourId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TourCollection tour = _db.TourCollections.Find(tourId);

            if (tour == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TourId = tourId;

            return(View(_unitOfWork.GetRepositoryInstance <TourCollection>().GetFirstorDefault(tourId)));
        }
        public ActionResult Edit(TourCollection _tourCol, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string pic = null;
                    if (file != null)
                    {
                        pic = System.IO.Path.GetFileName(file.FileName);
                        _tourCol.CollectionImage = pic;
                        string path = System.IO.Path.Combine(Server.MapPath("~/Images/Tour/"), _tourCol.CollectionImage);
                        ViewBag.Message = "File uploaded successfully.";
                        // file is uploaded
                        file.SaveAs(path);
                    }
                    _tourCol.CollectionImage = file != null ? pic : _tourCol.CollectionImage;
                }
                catch (DataException)
                {
                    ModelState.AddModelError("", "Unable to save changes");
                }


                var data = _db.TourCollections.Find(_tourCol.TourCollectionID);

                data.TourCollectionTitle   = _tourCol.TourCollectionTitle;
                data.TourCollectionDetails = _tourCol.TourCollectionDetails;
                data.TourCollectionDate    = _tourCol.TourCollectionDate;
                data.EndCol_date           = _tourCol.EndCol_date;
                data.UpdatedCol_at         = DateTime.Now;
                data.UserId           = User.Identity.GetUserId();
                data.CollectionImage  = _tourCol.CollectionImage;
                data.TourColOwner     = _tourCol.TourColOwner;
                _db.Entry(data).State = EntityState.Modified;
                _db.SaveChanges();
                // return Json(_tourCol);
                return(RedirectToAction("Index"));
            }
            var dataEdit = _db.TourCollections.Where(s => s.TourCollectionID == _tourCol.TourCollectionID).FirstOrDefault();

            return(View(dataEdit));
        }
        public ActionResult Create([Bind(Include = "TourCollectionId,UserId,TourCollectionTitle,TourCollectionDetails,CreatedCol_at,UpdatedCol_at,TourCollectionDate,TourColOwner")] TourCollection _tourCol, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string pic = null;
                    if (file != null)
                    {
                        pic = System.IO.Path.GetFileName(file.FileName);
                        _tourCol.CollectionImage = pic;
                        string path = System.IO.Path.Combine(Server.MapPath("~/Images/Tour/"), _tourCol.CollectionImage);
                        // file is uploaded
                        file.SaveAs(path);
                    }
                }
                catch (DataException)
                {
                    ModelState.AddModelError("", "Unable to save changes");
                }
                var title = _tourCol.TourCollectionTitle;
                var user  = User.Identity.GetUserId();

                var count = _db.TourCollections.Where(s => s.TourCollectionTitle.Contains(title)).Count();
                if (count > 0)
                {
                    ViewBag.message = "Title already exists";
                    return(View());
                }

                _tourCol.CreatedCol_at = DateTime.Now;
                _tourCol.UserId        = user;

                _db.TourCollections.Add(_tourCol);
                _db.SaveChanges();
                return(RedirectToAction("Create", "Tour", new { id = _tourCol.TourCollectionID }));

                //return Json(_tour);
            }
            ViewBag.message = "Insert failed!";
            return(View());
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            TourCollection tc = new TourCollection();
            ObservableCollection <Tour> allTours = tc.getTours();
            Tour tour = tc.getTour(tourID);

            ct = new Cart(username);


            //Show specific tour details
            TextTourID.Text        = tour.TourID;
            TextTourTitle.Text     = tour.TourDesc;
            TextTourPrice.Text     = "PRICE : $" + tour.TourPrice;
            TextTourDuration.Text  = "TOUR AVAILABILITY : " + tour.TourStartDate + " - " + tour.TourEndDate;
            ImageTourSource.Source = new BitmapImage(new Uri(tour.TourImageSource));
            ItineraryDetails.Text  = tour.TourItinerary;
            TextTourSummary.Text   = tour.TourSummary;

            displayReviews();
        }
        //Boton para realizar la accion de ingresar datos de Tour.
        private void btnRegistrarTour_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cbxIdServicioTour.SelectedIndex == -1)
                {
                    MessageBox.Show("Debe seleccionar un código de servicio.");
                }
                else if (string.IsNullOrEmpty(txtDescripcionTour.Text) || txtDescripcionTour.Text.Length < 5 && txtDescripcionTour.Text.Length > 200)
                {
                    MessageBox.Show("Descripción no debe estar vacío y tiene que estar entre 5 a 200 carácteres.");
                }
                else
                {
                    tc = new TourCollection();

                    int    id_servicio = int.Parse(cbxIdServicioTour.SelectedValue.ToString());
                    string descripcion = txtDescripcionTour.Text;

                    var insercion = tc.InsertaTourC(id_servicio, descripcion);

                    if (insercion == true)
                    {
                        this.Close();
                    }
                    else
                    {
                        lblmensaje.Content = "Error de inserción.";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error, contacte al administrador: " + ex.Message, "Excepción detectada", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            double    totalCost    = 0;
            DataTable bookingTable = db.getDataTable("select * from tblBooking where BookingID = '" + bookingID + "'");


            for (int i = 0; i < bookingTable.Rows.Count; i++)
            {
                DataRow row = bookingTable.Rows[i];
                txtBoxBookingID.Text = row["BookingID"].ToString();
                username             = row["Username"].ToString();
                bookingDate.Text     = Convert.ToDateTime(row["BookingDate"].ToString()).ToShortDateString();
                bookingTime.Text     = Convert.ToDateTime(row["BookingTime"].ToString()).ToShortTimeString();


                Customer c    = new Customer(username);
                Customer cust = (Customer)c.getCustomerRow(username);


                custName.Text = cust.getCustomerDetail(username, 0) + " " + cust.getCustomerDetail(username, 1);
                email.Text    = cust.getCustomerDetail(username, 2);
                contact.Text  = cust.getCustomerDetail(username, 3);

                totalCost += double.Parse(row["Subtotal"].ToString());

                TourCollection tc   = new TourCollection();
                Tour           tour = tc.getTour(row["TourID"].ToString());

                TextBlock tourID = new TextBlock();
                tourID.Text       = string.Format("({0}) TourID : ", (i + 1));
                tourID.FontWeight = FontWeights.Bold;

                TextBlock tourIDValue = new TextBlock();
                tourIDValue.Text = row["TourID"].ToString();

                TextBlock tourQty = new TextBlock();
                tourQty.Text       = "No. Of People : ";
                tourQty.FontWeight = FontWeights.Bold;

                TextBlock qtyValue = new TextBlock();
                qtyValue.Text = row["PeopleQty"].ToString();

                TextBlock tourDate = new TextBlock();
                tourDate.Text       = "Selected Tour Date : ";
                tourDate.FontWeight = FontWeights.Bold;

                TextBlock dateRange = new TextBlock();
                dateRange.Text = row["SelectedTourStartDate"].ToString() + " - " + row["SelectedTourEndDate"].ToString();

                TextBlock flight = new TextBlock();
                flight.Text       = "Flight Choice : ";
                flight.FontWeight = FontWeights.Bold;

                TextBlock flightSelection = new TextBlock();
                flightSelection.Text = row["FlightSelection"].ToString();

                TextBlock fTicket = new TextBlock();
                fTicket.Text       = "No. Of Tickets : ";
                fTicket.FontWeight = FontWeights.Bold;

                TextBlock ticketQty = new TextBlock();
                ticketQty.Text = row["TicketQty"].ToString();

                TextBlock room = new TextBlock();
                room.Text       = "Room Choice : ";
                room.FontWeight = FontWeights.Bold;

                TextBlock roomSelection = new TextBlock();
                roomSelection.Text = row["RoomSelection"].ToString();

                TextBlock roomType = new TextBlock();
                roomType.Text       = "Room Type : ";
                roomType.FontWeight = FontWeights.Bold;

                TextBlock roomValue = new TextBlock();
                roomValue.Text = string.Format("Single x {0}, Double x {1}", row["SingleRmQty"].ToString(), row["DoubleRmQty"].ToString());

                TextBlock tourPrice = new TextBlock();
                tourPrice.Text       = "Total Tour Price : ";
                tourPrice.FontWeight = FontWeights.Bold;

                TextBlock tourPriceValue = new TextBlock();
                tourPriceValue.Text = (int.Parse(row["PeopleQty"].ToString()) * tour.TourPrice).ToString("c2");

                TextBlock flightPrice = new TextBlock();
                flightPrice.Text       = "Flight Price : ";
                flightPrice.FontWeight = FontWeights.Bold;

                TextBlock flightPriceValue = new TextBlock();
                flightPriceValue.Text = "$" + row["CalculatedFlightPrice"].ToString();

                TextBlock roomPrice = new TextBlock();
                roomPrice.Text       = "Room Price : ";
                roomPrice.FontWeight = FontWeights.Bold;

                TextBlock roomPriceValue = new TextBlock();
                roomPriceValue.Text = "$" + row["CalculatedRoomPrice"].ToString();

                TextBlock addon = new TextBlock();
                addon.Text       = "Add-on : ";
                addon.FontWeight = FontWeights.Bold;

                TextBlock addonSelection = new TextBlock();
                addonSelection.Text = row["AddOnSelection"].ToString();

                TextBlock subTotal = new TextBlock();
                subTotal.Text       = "Subtotal : ";
                subTotal.FontWeight = FontWeights.Bold;

                TextBlock subValue = new TextBlock();
                subValue.Text = "$" + row["Subtotal"].ToString();

                StackPanel tourPanel = new StackPanel();
                tourPanel.Margin      = new Thickness(10, 10, 0, 0);
                tourPanel.Orientation = Orientation.Horizontal;
                tourPanel.Children.Add(tourID);
                tourPanel.Children.Add(tourIDValue);

                StackPanel qty = new StackPanel();
                qty.Margin      = new Thickness(27, 20, 0, 0);
                qty.Orientation = Orientation.Horizontal;
                qty.Children.Add(tourQty);
                qty.Children.Add(qtyValue);

                StackPanel selectedDate = new StackPanel();
                selectedDate.Margin      = new Thickness(27, 20, 0, 0);
                selectedDate.Orientation = Orientation.Horizontal;
                selectedDate.Children.Add(tourDate);
                selectedDate.Children.Add(dateRange);

                StackPanel flightChoice = new StackPanel();
                flightChoice.Margin      = new Thickness(27, 0, 0, 0);
                flightChoice.Orientation = Orientation.Horizontal;
                flightChoice.Children.Add(flight);
                flightChoice.Children.Add(flightSelection);

                StackPanel flightTicket = new StackPanel();
                flightTicket.Margin      = new Thickness(27, 0, 0, 0);
                flightTicket.Orientation = Orientation.Horizontal;
                flightTicket.Children.Add(fTicket);
                flightTicket.Children.Add(ticketQty);

                StackPanel roomChoice = new StackPanel();
                roomChoice.Margin      = new Thickness(27, 0, 0, 0);
                roomChoice.Orientation = Orientation.Horizontal;
                roomChoice.Children.Add(room);
                roomChoice.Children.Add(roomSelection);

                StackPanel rmType = new StackPanel();
                rmType.Margin      = new Thickness(27, 0, 0, 0);
                rmType.Orientation = Orientation.Horizontal;
                rmType.Children.Add(roomType);
                rmType.Children.Add(roomValue);

                StackPanel totalTour = new StackPanel();
                totalTour.Margin      = new Thickness(27, 0, 0, 0);
                totalTour.Orientation = Orientation.Horizontal;
                totalTour.Children.Add(tourPrice);
                totalTour.Children.Add(tourPriceValue);

                StackPanel totalFlight = new StackPanel();
                totalFlight.Margin      = new Thickness(27, 0, 0, 0);
                totalFlight.Orientation = Orientation.Horizontal;
                totalFlight.Children.Add(flightPrice);
                totalFlight.Children.Add(flightPriceValue);

                StackPanel totalRoom = new StackPanel();
                totalRoom.Margin      = new Thickness(27, 0, 0, 0);
                totalRoom.Orientation = Orientation.Horizontal;
                totalRoom.Children.Add(roomPrice);
                totalRoom.Children.Add(roomPriceValue);

                StackPanel subTotal1 = new StackPanel();
                subTotal1.Margin      = new Thickness(27, 0, 0, 0);
                subTotal1.Orientation = Orientation.Horizontal;
                subTotal1.Children.Add(subTotal);
                subTotal1.Children.Add(subValue);

                StackPanel addons = new StackPanel();
                addons.Margin      = new Thickness(27, 0, 0, 0);
                addons.Orientation = Orientation.Horizontal;
                addons.Children.Add(addon);
                addons.Children.Add(addonSelection);

                Line divider = new Line();
                divider.X1 = 10;
                divider.X2 = 460;
                SolidColorBrush Gray = new SolidColorBrush();
                Gray.Color     = Colors.DarkGray;
                divider.Stroke = Gray;
                divider.Margin = new Thickness(0, 20, 0, 0);

                mainContent.Children.Add(tourPanel);
                mainContent.Children.Add(qty);
                mainContent.Children.Add(selectedDate);
                mainContent.Children.Add(flightChoice);
                mainContent.Children.Add(flightTicket);
                mainContent.Children.Add(roomChoice);
                mainContent.Children.Add(rmType);
                mainContent.Children.Add(addons);
                mainContent.Children.Add(totalTour);
                mainContent.Children.Add(totalFlight);
                mainContent.Children.Add(totalRoom);
                mainContent.Children.Add(subTotal1);
                mainContent.Children.Add(divider);
            }

            TotalCost.Text = totalCost.ToString("c2");
        }