Example #1
0
        private void btnAddTour_Click(object sender, EventArgs e)
        {
            if (_isAdd)
            {
                if (tbTourName.Text.Trim() == "" || tbTourPrice.Text.Trim() == "")
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin, bạn đã bỏ sót thông tin nào đó!");
                    return;
                }
                var tour        = new Tour();
                var category    = (TourCategory)cbTourCategory.SelectedItem;
                var destination = (Destination)cbDestination.SelectedItem;

                tour.name           = tbTourName.Text.ToString();
                tour.category_id    = category.id;
                tour.destination_id = destination.id;
                if (addNewTourPrice() == null)
                {
                    return;
                }
                else
                {
                    tour.TourPrice = addNewTourPrice();
                }
                //_toursite = _tourBus.getAllTourSites();

                var _newtoursite = clbTourSite.CheckedItems.Cast <TourSite>();
                foreach (var site in _newtoursite)
                {
                    tour.TourSites.Add(site);
                }

                _tourBus.add(tour);
                updateDataGridView();
            }
            else
            {
                updateTour();
            }
        }