protected override void Nested_LoadDataFromDataSource() { ResourceHandler h = new ResourceHandler(); _current = h.GetElementById(m_IdShowedObject.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource;; if (_current == null) { throw new Exception("Elemento non trovato"); } }
private void schedulerStorage1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e) { try { Nested_CheckSecurityForChanging(); } catch (Exception ex) { ErrorHandler.Show(ex); return; } foreach (DevExpress.XtraScheduler.Appointment app in e.Objects) { // DevExpress.XtraScheduler.Appointment app = e.Objects[0] as DevExpress.XtraScheduler.Appointment; //imposto per sicurezza il campo allday a false; app.AllDay = false; MyAppointment a = app.GetSourceObject(schedulerStorage1) as MyAppointment; //se ho cambiato risorsa dal calendario e non dal form //(il form tiene i valori sincronizzati) recupero la risorsa e la setto if (a.ResourceId != a.Resource.Id) { ResourceHandler h1 = new ResourceHandler(); WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource res = h1.GetElementById(a.ResourceId.ToString()) as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource; a.Resource = res; app.SetValue(schedulerStorage1, "Resource", res); } ////i save on my db AppointmentHandler h = new AppointmentHandler(); try { h.SaveOrUpdate(a); } catch (Exception ex) { WIN.SCHEDULING_APP.GUI.Utility.ErrorHandler.Show(ex); } } }