public override void OnSaveData() { try { JarsDefaultAppointment storeAppt = defaultBindingSource.Current as JarsDefaultAppointment; StoreJarsDefaultAppointment storeReq = new StoreJarsDefaultAppointment(); storeReq.Appointment = storeAppt.ConvertTo <JarsDefaultAppointmentDto>(); var response = ServiceClient.Post(storeReq); //if the response was good, then notify the others. if (response.ResponseStatus == null) { storeAppt = response.Appointment.ConvertTo <JarsDefaultAppointment>(); Context.ServiceClient.PostAsync(new JarsDefaultAppointmentNotification() { FromUserName = Context.LoggedInUser.UserName, Selector = SelectorTypes.store, Ids = new List <int>() { response.Appointment.Id } }); } base.OnSaveData(); } catch (Exception exS) { OnExceptionEvent(exS); } }
public override void OnAddData() { base.OnAddData(); //Create a new record JarsDefaultAppointment newOp = defaultBindingSource.AddNew() as JarsDefaultAppointment; defaultBindingSource.Position = defaultBindingSource.IndexOf(newOp); }
SchedulerDragData GetDragData(GridView gridView) { Appointment appointment = null; try { int[] selection = gridView.GetSelectedRows(); if (selection == null) { return(null); } if (gridView != null && gridView.FocusedRowHandle > -1) { if (gridView.GetRow(gridView.FocusedRowHandle) is JarsDefaultAppointment) { JarsDefaultAppointment defAppt = gridView.GetRow(gridView.FocusedRowHandle) as JarsDefaultAppointment; appointment = schedulerDataStorage.CreateAppointment(AppointmentType.Normal); //create a devexpress appointment appointment.Subject = defAppt.Subject; appointment.Description = defAppt.Description; if (defAppt.IsAllDay) { appointment.AllDay = true; } else { appointment.Duration = TimeSpan.FromHours(defAppt.DefaultDuration); } //appointment that will be wrapped by the devexpress appt. StandardAppointment stdAppointment = new StandardAppointment(); //convert to standard appointment that can be saved stdAppointment = appointment.ConvertTo <StandardAppointment>(); appointment.SetId(stdAppointment.GuidValue); appointment.CustomFields["ENTITY"] = stdAppointment; } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw new Exception("DefaultStandardAppointmentControl_GetDridData", ex); #endif } return(new SchedulerDragData(appointment)); }
public override bool OnDeleteData() { try { if (base.OnDeleteData(true)) { JarsDefaultAppointment delJobDefAppt = defaultBindingSource.Current as JarsDefaultAppointment; DeleteJarsDefaultAppointment delReq = new DeleteJarsDefaultAppointment { Id = delJobDefAppt.Id }; ServiceClient.Delete(delReq); defaultBindingSource.RemoveCurrent(); defaultBindingSource.ResetBindings(false); } } catch (Exception exD) { OnExceptionEvent(exD); } //call this after the record removal was successful. return(base.OnDeleteData()); }