Beispiel #1
0
        public ActionResult Create([Bind(Include = "Id_TravelPackage,PackageName,Description,FromDay,ToDay,FlightOrBus")] TravelPackageViewModel travelPackageViewModel)
        {
            var travelPackage = new TravelPackage
            {
                Id_TravelPackage = travelPackageViewModel.Id_TravelPackage,
                PackageName      = travelPackageViewModel.PackageName,
                Description      = travelPackageViewModel.Description,
                FromDay          = travelPackageViewModel.FromDay,
                ToDay            = travelPackageViewModel.ToDay,
                FlightOrBus      = travelPackageViewModel.FlightOrBus
            };

            if (ModelState.IsValid)
            {   //validación de fechas
                if (travelPackageViewModel.FromDay > System.DateTime.Now & travelPackageViewModel.ToDay > System.DateTime.Now & travelPackage.FromDay != travelPackageViewModel.ToDay)
                {
                    Service.UnitOfWork.TravelPackageRepository.Insert(travelPackage); //se crea y guarda el paquete. se busca el id del creado
                    Service.UnitOfWork.Save();
                    travelPackageViewModel.Id_TravelPackage =
                        Service.UnitOfWork.TravelPackageRepository.Get(filter: p => p.PackageName == travelPackage.PackageName && p.Description == travelPackage.Description).FirstOrDefault().Id_TravelPackage;
                    return(RedirectToAction(AddPlacesString, routeValues: new{ TravelPackageId = travelPackageViewModel.Id_TravelPackage })); //redirección a la siguiente vista
                }
            }

            return(View(travelPackageViewModel));
        }
Beispiel #2
0
        public void SetToBackFlightReservationToNewTravelPackage(TravelPackage travelPackage)
        {
            var reservationFlightRequest = new FlightReservationsToTravelPackageRequest
            {
                FlightID  = travelPackage.ToBackFlight.Id_Flight,
                SeatCount = travelPackage.ReservationAmount
            };

            //FlightCompany FlightCompany = UnitOfWork.FlightCompanyRepository.GetByID(travelPackage.ToGoFlight.Id_Flight);

            FlightCompany FlightCompany = new FlightCompany
            {
                APIURLToReserveSeatsToTravelPackage = "http://demo4736431.mockable.io/ReserveFlightSeat"
            };
            var consumerFlights = new Consumer <List <FlightReservationsToTravelPackageResponse> >();

            List <FlightReservationsToTravelPackageResponse> getSeatsResponse = consumerFlights.ReLoadEntities(FlightCompany.APIURLToReserveSeatsToTravelPackage, "GET", reservationFlightRequest).Result;

            foreach (var item in getSeatsResponse)
            {
                var auxSeat = new FlightReservedSeat()
                {
                    Id_ReservedSeat = item.Id_Seat,
                    Flight          = UnitOfWork.FlightRepository.GetByID(item.Id_Flight),
                    TravelPackage   = travelPackage,
                    Available       = true
                };
                auxSeat.Flight.ReservedSeat.Add(auxSeat);
                UnitOfWork.ReservedSeatRepository.Insert(auxSeat);
                UnitOfWork.FlightRepository.Update(auxSeat.Flight);
            }
            UnitOfWork.Save();
        }
Beispiel #3
0
        public void SetEventReservationToNewTravelPackage(TravelPackage travelPackage)
        {
            var reservationEventRequest = new EventReservationsToTravelPackageRequest
            {
                EventID       = travelPackage.Event.Id_Event,
                TicketsAmount = travelPackage.ReservationAmount
            };

            EventCompany EventsCompany = UnitOfWork.EventCompanyRepository.GetByID(travelPackage.Event.Id_Event);

            var consumerEvents = new Consumer <List <EventReservationsToTravelPackageResponse> >();

            List <EventReservationsToTravelPackageResponse> getTicketsResponse = consumerEvents.ReLoadEntities(EventsCompany.APIURLToReserveTickets, "POST", reservationEventRequest).Result;

            foreach (var item in getTicketsResponse)
            {
                var auxTicket = new ReservedTicket()
                {
                    Id_Event          = item.EventID,
                    Id_ReservedTicket = item.TicketID,
                    Event             = UnitOfWork.EventRepository.GetByID(item.EventID)
                };
                auxTicket.Event.ReservedTicket.Add(auxTicket);
                UnitOfWork.ReservedTicketRepository.Insert(auxTicket);
                UnitOfWork.EventRepository.Update(auxTicket.Event);
            }
            UnitOfWork.Save();
        }
Beispiel #4
0
        public void SetToBackBusReservationToNewTravelPackage(TravelPackage travelPackage)
        {
            var reservationBusRequest = new BusReservationsToTravelPackageRequest
            {
                TripID    = travelPackage.ToBackBus.TripID,
                SeatCount = travelPackage.ReservationAmount
            };

            BusCompany BusCompany = UnitOfWork.BusCompanyRepository.GetByID(travelPackage.ToBackBus.IdAPI_Bus);

            var consumerBuss = new Consumer <List <BusReservationsToTravelPackageResponse> >();

            List <BusReservationsToTravelPackageResponse> getSeatsResponse = consumerBuss.ReLoadEntities(BusCompany.APIURLToReserveSeatToTravelPackage, "POST", reservationBusRequest).Result;

            foreach (var item in getSeatsResponse)
            {
                var auxSeat = new BusReservedSeat()
                {
                    IdAPI_Bus          = item.TripID,
                    TripID             = item.TripID,
                    Id_BusReservedSeat = item.BookingID,
                    Bus = UnitOfWork.BusRepository.GetByID(item.TripID)
                };
                auxSeat.Bus.BusReservedSeat.Add(auxSeat);
                UnitOfWork.BusReservedSeatRepository.Insert(auxSeat);
                UnitOfWork.BusRepository.Update(auxSeat.Bus);
            }
            UnitOfWork.Save();
        }
Beispiel #5
0
        public void SetToBackBusReservationToNewTravelPackage(TravelPackage travelPackage)
        {
            var reservationBusRequest = new BusReservationsToTravelPackageRequest
            {
                TripID    = travelPackage.ToBackBus.TripID,
                SeatCount = travelPackage.ReservationAmount
            };

            //BusCompany BusCompany = UnitOfWork.BusCompanyRepository.GetByID(travelPackage.ToBackBus.IdAPI_Bus);

            BusCompany BusCompany = new BusCompany
            {
                APIURLToReserveSeatToTravelPackage = "http://demo4736431.mockable.io/ReserverBusSeat",
            };

            var consumerBuss = new Consumer <List <BusReservationsToTravelPackageResponse> >();

            List <BusReservationsToTravelPackageResponse> getSeatsResponse = consumerBuss.ReLoadEntities(BusCompany.APIURLToReserveSeatToTravelPackage, "GET", reservationBusRequest).Result;

            foreach (var item in getSeatsResponse)
            {
                var auxSeat = new BusReservedSeat()
                {
                    TripID          = item.TripID,
                    Id_ReservedSeat = item.BookingID,
                    Bus             = UnitOfWork.BusRepository.GetByID(item.TripID),
                    TravelPackage   = travelPackage,
                    Available       = true
                };
                auxSeat.Bus.BusReservedSeat.Add(auxSeat);
                UnitOfWork.BusRepository.Update(auxSeat.Bus);
            }
            UnitOfWork.Save();
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(TravelPackage travelPackage)
        {
            if (travelPackage == null)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _travelPackageRepository.Update(travelPackage);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (travelPackage == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(travelPackage));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(int id, TravelPackage travelPackage)
        {
            if (id != travelPackage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _db.Update(travelPackage);
                    await _db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TravelPackageExists(travelPackage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { area = "Administration" }));
            }
            return(View(travelPackage));
        }
Beispiel #8
0
        public IActionResult Create(CreateBookingVM vm)
        {
            if (ModelState.IsValid)
            {
                TravelPackage package = _packageRepo.GetSingle(p => p.TravelPackageId == vm.PackageId);

                //get logged user info
                var userId = _userManager.GetUserId(User);

                double totalCost = vm.NumberOfPeople * package.Price;

                Booking booking = new Booking
                {
                    DateBooked     = DateTime.Now,
                    StartDate      = vm.StartDate,
                    TotalPrice     = totalCost,
                    NumberOfPeople = vm.NumberOfPeople,
                    PackageId      = package.TravelPackageId,
                    UserId         = userId,
                    PackageName    = package.Name
                };
                _bookingRepo.Create(booking);
                return(RedirectToAction("Index", "TravelPackage", new { id = booking.PackageId }));
            }
            return(View(vm));
        }
Beispiel #9
0
        public void SetToBackFlightReservationToNewTravelPackage(TravelPackage travelPackage)
        {
            var reservationFlightRequest = new FlightReservationsToTravelPackageRequest
            {
                FlightID  = travelPackage.ToBackFlight.Id_Flight,
                SeatCount = travelPackage.ReservationAmount
            };

            FlightCompany FlightCompany = UnitOfWork.FlightCompanyRepository.GetByID(travelPackage.ToBackFlight.Id_Flight);

            var consumerFlights = new Consumer <List <FlightReservationsToTravelPackageResponse> >();

            List <FlightReservationsToTravelPackageResponse> getSeatsResponse = consumerFlights.ReLoadEntities(FlightCompany.APIURLToReserveSeatsToTravelPackage, "POST", reservationFlightRequest).Result;

            foreach (var item in getSeatsResponse)
            {
                var auxSeat = new ReservedSeat()
                {
                    Id_Flight       = item.Id_Flight,
                    Id_ReservedSeat = item.Id_Seat,
                    Flight          = UnitOfWork.FlightRepository.GetByID(item.Id_Flight)
                };
                auxSeat.Flight.ReservedSeat.Add(auxSeat);
                UnitOfWork.ReservedSeatRepository.Insert(auxSeat);
                UnitOfWork.FlightRepository.Update(auxSeat.Flight);
            }
            UnitOfWork.Save();
        }
Beispiel #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,StatusId,RRP")] TravelPackage travelPackage)
        {
            if (id != travelPackage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(travelPackage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TravelPackageExists(travelPackage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(travelPackage));
        }
Beispiel #11
0
        public async Task <IActionResult> Create(CreateTravelPackageVM vm, IFormFile photoPath)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByNameAsync(User.Identity.Name);

                IEnumerable <TravelPackage> list = _packageRepo.Query(l => l.UserId == user.Id && !l.Discontinued);
                if (list != null)
                {
                    if (list.Any(n => n.Name == vm.Name))
                    {
                        ModelState.AddModelError("PackageName", "Please Choose a Different Package Name");
                        return(View(vm));
                    }
                }

                //map vm to model
                TravelPackage pack = new TravelPackage
                {
                    Name         = vm.Name,
                    Price        = vm.Price,
                    Location     = vm.Location,
                    State        = vm.State,
                    Description  = vm.Description,
                    UserId       = user.Id,
                    ProviderName = user.UserName
                };
                //upload photo
                ////
                if (photoPath != null)
                {
                    //1 -) create directory
                    string uploadPath = Path.Combine(_environment.WebRootPath, "Uploads\\TravelPackages");
                    uploadPath = Path.Combine(uploadPath, User.Identity.Name);
                    Directory.CreateDirectory(Path.Combine(uploadPath, pack.Name));
                    //2 -) get the file name
                    string FileName = Path.GetFileName(photoPath.FileName);

                    //3 -)
                    using (FileStream fs = new FileStream(Path.Combine(uploadPath, pack.Name, FileName), FileMode.Create))
                    {
                        photoPath.CopyTo(fs);
                    }
                    //4 -) change the pack photoPath
                    pack.PhotoPath = Path.Combine(User.Identity.Name, pack.Name, FileName);
                }
                else
                {
                    pack.PhotoPath = "";
                }

                //save to db
                _packageRepo.Create(pack);
                //go home/index
                return(RedirectToAction("Index", "TravelPackage"));
            }

            return(View(vm));
        }
Beispiel #12
0
 /// <summary>
 /// Fills the package controls.
 /// </summary>
 /// <param name="package">The package.</param>
 private void FillPackageControls(TravelPackage package)
 {
     txtPkgDesc.Text       = package.Description;
     datPkgStart.Value     = package.StartDate;
     datPkgEnd.Value       = package.EndDate;
     txtPkgBasePrice.Text  = package.BasePrice.ToString();
     txtPkgCommission.Text = package.Commission.ToString();
 }
Beispiel #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(id);

            Service.UnitOfWork.TravelPackageRepository.Delete(travelPackage);
            Service.UnitOfWork.Save();
            return(RedirectToAction("Index"));
        }
        public static TravelPackageBuilder Start()
        {
            _traavelPackage = new TravelPackage()
            {
                Name = "Pacote Buenos Aires"
            };

            return(new TravelPackageBuilder());
        }
Beispiel #15
0
        public void AddEventToTravelPackagePartialView(int?EventId, int TravelPackageId)
        {
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(TravelPackageId);

            if (EventId != null)
            {
                travelPackage.Event = Service.UnitOfWork.EventRepository.GetByID(EventId);
                Service.UnitOfWork.Save();
            }
        }
Beispiel #16
0
 public ActionResult Edit([Bind(Include = "Id_Package")] TravelPackage travelPackage)
 {
     if (ModelState.IsValid)
     {
         Service.UnitOfWork.TravelPackageRepository.Update(travelPackage);
         Service.UnitOfWork.Save();
         return(RedirectToAction("Index"));
     }
     return(View(travelPackage));
 }
Beispiel #17
0
        public void AddHotelToTravelPackagePartialView(int?HotelId, int TravelPackageId)
        {
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(TravelPackageId);

            if (HotelId != null)
            {
                travelPackage.Hotel = Service.UnitOfWork.HotelRepository.GetByID(HotelId);
                Service.UnitOfWork.Save();
            }
        }
Beispiel #18
0
 /// <summary>
 /// Fills the package product list box with named Product_Supplier objects.
 /// </summary>
 /// <param name="selectedPackage">The selected package.</param>
 /// <exception cref="NotImplementedException"></exception>
 private void FillPackageProductList(TravelPackage selectedPackage)
 {
     lstPkgProductSuppliers.Items.Clear();
     foreach (NamedPackageProductSupplier prodSup in selectedPackage.ProductsAndSuppliers)
     {
         ListViewItem item = new ListViewItem(prodSup.ProductName);
         item.SubItems.Add(prodSup.SupplierName);
         lstPkgProductSuppliers.Items.Add(item);
     }
 }
Beispiel #19
0
        public async Task <IActionResult> Create(TravelPackage travelPackage)
        {
            if (ModelState.IsValid)
            {
                await _travelPackageRepository.Add(travelPackage);

                return(RedirectToAction("Index"));
            }
            return(View(travelPackage));
        }
Beispiel #20
0
        public void AddFlightToTravelPackagePartialView(int?ToGoFlightId, int?ToBackFlightId, int?TravelPackageId)
        {
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(TravelPackageId);

            if (ToBackFlightId != null && ToGoFlightId != null)
            {
                travelPackage.ToGoFlight   = Service.UnitOfWork.FlightRepository.GetByID(ToGoFlightId);
                travelPackage.ToBackFlight = Service.UnitOfWork.FlightRepository.GetByID(ToBackFlightId);
                Service.UnitOfWork.Save();
            }
        }
Beispiel #21
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,StatusId,RRP")] TravelPackage travelPackage)
        {
            if (ModelState.IsValid)
            {
                _db.Add(travelPackage);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(travelPackage));
        }
Beispiel #22
0
        public void AddBusToTravelPackagePartialView(int?ToGoBusId, int?ToBackBusId, int?TravelPackageId)
        {
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(TravelPackageId);

            if (ToBackBusId != null && ToGoBusId != null)
            {
                travelPackage.ToGoBus   = Service.UnitOfWork.BusRepository.GetByID(ToGoBusId);
                travelPackage.ToBackBus = Service.UnitOfWork.BusRepository.GetByID(ToBackBusId);
                Service.UnitOfWork.Save();
            }
        }
Beispiel #23
0
        public async Task <IActionResult> Comment(int id, TravelPackage travelPackage)
        {
            if (ModelState.IsValid)
            {
                _db.Update(travelPackage);
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            return(NotFound());
        }
        // validate text boxes and put fields into an object to be added into database
        private void btnAddPackage_Click(object sender, EventArgs e)
        {
            if (Validator.IsProvided(txtPkgName, "Package Name") &&
                Validator.IsProvided(txtPkgDesc, "Package Description") &&
                Validator.IsProvided(txtPkgBasePrice, "Package Base Price") &&
                Validator.IsNonNegativeMoney(txtPkgBasePrice, "Package Base Price") &&
                Validator.IsNonNegativeMoney(txtPkgAgncCommish, "Agency Commision"))
            {
                if (dtpStartDate.Value < dtpEndDate.Value)
                {
                    // get input fields
                    string   pkgName        = txtPkgName.Text;
                    DateTime pkgStartDate   = dtpStartDate.Value;
                    DateTime pkgEndDate     = dtpEndDate.Value;
                    string   pkgDesc        = txtPkgDesc.Text;
                    decimal  pkgBasePrice   = Convert.ToDecimal(txtPkgBasePrice.Text);
                    decimal  pkgAgncCommish = 0;
                    if (txtPkgAgncCommish.Text == "")
                    {
                        txtPkgAgncCommish.Text = null;
                    }
                    else
                    {
                        pkgAgncCommish = Convert.ToDecimal(txtPkgAgncCommish.Text);
                    }

                    //create package class
                    TravelPackage package = new TravelPackage();
                    package.PkgName             = pkgName;
                    package.PkgStartDate        = pkgStartDate;
                    package.PkgEndDate          = pkgEndDate;
                    package.PkgDesc             = pkgDesc;
                    package.PkgBasePrice        = pkgBasePrice;
                    package.PkgAgencyCommission = pkgAgncCommish;

                    // call insert command
                    TravelPackageDB.AddPackage(package);

                    // clear fields
                    txtPkgName.Text        = "";
                    dtpStartDate.Value     = DateTime.Today;
                    txtPkgDesc.Text        = "";
                    txtPkgBasePrice.Text   = "";
                    txtPkgAgncCommish.Text = "";

                    displayPackages();
                }
                else
                {
                    MessageBox.Show("The Start Date must be before the End Date");
                }
            }
        }
 // load selected package items from list table into object to pass into delete or
 private void lstPackages_SelectedIndexChanged(object sender, EventArgs e)
 {
     btnEditPackage.Enabled              = true;
     btnDelete.Enabled                   = true;
     selectedPackage                     = new TravelPackage();
     selectedPackage.PkgID               = Convert.ToInt32(lstPackages.FocusedItem.SubItems[0].Text);
     selectedPackage.PkgName             = lstPackages.FocusedItem.SubItems[1].Text;
     selectedPackage.PkgStartDate        = Convert.ToDateTime(lstPackages.FocusedItem.SubItems[2].Text);
     selectedPackage.PkgEndDate          = Convert.ToDateTime(lstPackages.FocusedItem.SubItems[3].Text);
     selectedPackage.PkgDesc             = Convert.ToString(lstPackages.FocusedItem.SubItems[4].Text);
     selectedPackage.PkgBasePrice        = Convert.ToDecimal(lstPackages.FocusedItem.SubItems[5].Text.Substring(1));
     selectedPackage.PkgAgencyCommission = Convert.ToDecimal(lstPackages.FocusedItem.SubItems[6].Text.Substring(1));
 }
Beispiel #26
0
        public IActionResult Create(int id)
        {
            TravelPackage tp = _packageRepo.GetSingle(p => p.TravelPackageId == id);

            CreateBookingVM vm = new CreateBookingVM
            {
                TravelPackageName = tp.Name,
                PackageId         = id,
                PackagePrice      = tp.Price
            };

            return(View(vm));
        }
        public async Task <IActionResult> Index(TravelPackage travelPackage)
        {
            Person customer = await _ctpr.GetCustomerByUserId(User.FindFirstValue(ClaimTypes.NameIdentifier));

            var cpa = new CustomerTravelPackage();

            cpa.CustomerId      = customer.Id;
            cpa.TravelPackageId = travelPackage.Id;
            cpa.SalePrice       = travelPackage.RRP;
            cpa.StartDate       = DateTime.Now;
            cpa.Id = 0;
            return(View(cpa));
        }
Beispiel #28
0
        // GET: TravelPackages/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TravelPackage travelPackage = Service.UnitOfWork.TravelPackageRepository.GetByID(id);

            if (travelPackage == null)
            {
                return(HttpNotFound());
            }
            return(View(travelPackage));
        }
Beispiel #29
0
        /// <summary>
        /// Handles the SelectedValueChanged event of the cmbPackageID control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void cmbPackageID_SelectedValueChanged(object sender, EventArgs e)
        {
            if ((sender as ComboBox).SelectedItem == null)
            {
                selectedPackage = null;
                return;
            }

            selectedPackage = cmbPackageID.SelectedItem as TravelPackage;
            FillPackageControls(selectedPackage);
            FillPackageProductList(selectedPackage);
            accessMode         = AccessMode.Read;
            btnPkgSave.Enabled = false;
            lblPkgStatus.Text  = "Package loaded";
        }
        // on click validate text fields and create new package for insertion
        private void btnUpdatePackage_Click(object sender, EventArgs e)
        {
            if (Validator.IsProvided(txtPkgName, "Package Name") &&
                Validator.IsProvided(txtPkgDesc, "Package Description") &&
                Validator.IsProvided(txtPkgBasePrice, "Package Base Price") &&
                Validator.IsNonNegativeMoney(txtPkgBasePrice, "Package Base Price") &&
                Validator.IsNonNegativeMoney(txtPkgAgncComm, "Agency Commision"))
            {
                if (dtpStartDate.Value < dtpEndDate.Value)
                {
                    // get input fields
                    string   pkgName        = txtPkgName.Text;
                    DateTime pkgStartDate   = dtpStartDate.Value.Date;
                    DateTime pkgEndDate     = dtpEndDate.Value.Date;
                    string   pkgDesc        = txtPkgDesc.Text;
                    decimal  pkgBasePrice   = Convert.ToDecimal(txtPkgBasePrice.Text);
                    decimal  pkgAgncCommish = 0;
                    if (txtPkgAgncComm.Text == "")
                    {
                        txtPkgAgncComm.Text = null;
                    }
                    else
                    {
                        pkgAgncCommish = Convert.ToDecimal(txtPkgAgncComm.Text);
                    }

                    //create new newpackage class
                    TravelPackage newpackage = new TravelPackage();
                    newpackage.PkgName             = pkgName;
                    newpackage.PkgStartDate        = pkgStartDate;
                    newpackage.PkgEndDate          = pkgEndDate;
                    newpackage.PkgDesc             = pkgDesc;
                    newpackage.PkgBasePrice        = pkgBasePrice;
                    newpackage.PkgAgencyCommission = pkgAgncCommish;

                    // call insert function and insert new package with old package
                    if (TravelPackageDB.UpdatePackage(package, newpackage))
                    {
                        MessageBox.Show("Package was updated successfully");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error while updating, try again");
                    }
                }
            }
        }