private void RefreshGridDataSource() { _gridControl1.DataSource = null; AssignmentHandler hh = new AssignmentHandler(); _gridControl1.DataSource = hh.GetAssignmentsByBookingId(_parentBooking.Id); }
private void LoadCurrentBookingData() { dtpDate.DateTime = _currentBooking.Date; memoEdit1.Text = _currentBooking.Notes; cboTipo.EditValue = _currentBooking.BookingType; cboOp.EditValue = _currentBooking.Operator; colorEdit1.Color = Color.FromArgb(_currentBooking.Color); chkColorBookings.Checked = _currentBooking.ColorBookings; memoEdit2.Text = _currentBooking.Notes1; chkConfirm.Checked = _currentBooking.Confirmed; if (_currentBooking.Confirmed) { //Visualizzo il pannello del pagamento layoutControlGroup4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; //se è confermata avrà sicuramente un pagamento; lblRiepilogoSaldo.Text = String.Format("{0:c2}({1:c2})", _currentBooking.Payment.RestOfPayment, _currentBooking.Payment.ToPay); lblRiepilogoAcconto.Text = _currentBooking.Payment.Accont.ToString("c2"); spTassa.EditValue = _currentBooking.Payment.StayTax; spTotale.EditValue = _currentBooking.Payment.Total; if (_currentBooking.Payment.Accont != 0) { spAcconto.EditValue = _currentBooking.Payment.Accont; cboModAcconto.EditValue = _currentBooking.Payment.AccountPaymentType; dtpAcconto.EditValue = _currentBooking.Payment.AccontData; } if (_currentBooking.Payment.RestOfPayment != 0) { spSaldo.EditValue = _currentBooking.Payment.RestOfPayment; cboModSaldo.EditValue = _currentBooking.Payment.RestOfPaymentPaymentType; dtpSaldo.EditValue = _currentBooking.Payment.RestOfPaymentData; } } else { layoutControlGroup4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } AssignmentHandler hh = new AssignmentHandler(); //prendo tutto dal db per la questione della cache IList k = hh.GetAssignmentsByBookingId(_currentBooking.Id); gridControl1.DataSource = k; //rinfresco SetImageAndDescriptionState(); }
private void rem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { Assignment a = gridView1.GetRow(gridView1.FocusedRowHandle) as Assignment; IBooking b = a.Booking; if (a != null) { //if (XtraMessageBox.Show("Rimuovere l'assegnazione selezionata?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //{ Appointment app = GetAppointment(a); if (app != null) { _control.Storage.Appointments.Remove(app); } //dopo che viene eseguito l'evento posso procedere a verificare lo stato della prenotazione //se non ci sono altre assegnazioni posso chiudere il form (la prenotazione è stata cancellata dal //bookingControl //if (b.Assignments.Count == 0) // this.Close(); //else //ripristibno il data source della griglia //{ gridControl1.DataSource = null; AssignmentHandler hh = new AssignmentHandler(); //prendo tutto dal db per la questione della cache gridControl1.DataSource = hh.GetAssignmentsByBookingId(_currentBooking.Id); //} //} } else { XtraMessageBox.Show("Selezionare una assegnazione!", "Messaggio", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { ErrorHandler.Show(ex); } }