Пример #1
0
        private void dgvListTour_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            _isAdd          = false;
            btnAddTour.Text = "Update";
            int current_id = (int)dgvListTour.CurrentRow.Cells[1].Value;

            _currentTour                = _tourBus.getCustomerById(current_id);
            tbTourName.Text             = _currentTour.name;
            tbTourPrice.Text            = _currentTour.TourPrice.price.ToString("0.00");
            cbTourCategory.SelectedItem = _currentTour.TourCategory;
            cbTourCategory.Text         = _currentTour.TourCategory.name;
            cbDestination.SelectedItem  = _currentTour.Destination;
            cbDestination.Text          = _currentTour.Destination.name;
            dtpStart_date.Value         = _currentTour.TourPrice.start_date;
            dtpEnd_date.Value           = _currentTour.TourPrice.end_date;
            var _site = _currentTour.TourSites;

            for (int i = 0; i < clbTourSite.Items.Count; i++)
            {
                var site = clbTourSite.Items[i];
                foreach (var s in _site)
                {
                    if (site.Equals(s))
                    {
                        clbTourSite.SetItemChecked(i, true);
                    }
                }
            }
        }