Appointment creation / modification type detection / load limit

Hello!

Since I am evaluating Your controls, we are currently testing Scheduler component, as it is our main interest and a deciding factor in a purchase process for my company.

Currently we are trying to decide what would be the Syncfusion preferred way of presented action:

Given:

  • App is Blazor server.
  • App does not use direct db connection / controllers.
  • cqrs is in use.

Objective:

Scheduler should load only appointments that are currently visible to user (user has daily / monthly timeline views available),
so there will not be a repetitive data polling for data that are not needed.

We have to be able to determine current action when user is adding / modifying / deleting an appointment, with granularity of "modified single occurrence from recurring appointment", "deleted single appointment occurrence from recurring appointment" etc - Those details are a must, because our database schema does not hold something like Your "Recurrence string" and keeps every exception as a separate database entry.

Given those two main concerns, what is the suggested way to go?
- Using OnActionBegin / ActionCompleted? if so, how to limit initial load of data and just grab appointments that are currently visible (remember, no db connection, only queries like "GetAppointmentsFromBetweenDates(date1, date2))

- Using custom data manager? It does provide (at least we think that) required date range for querying only needed appointment range, but then - how to determine current action with separation of "editing occurrence", "modifying single occurrence" etc, etc.


Best regards,
Henryk



9 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team August 11, 2021 10:52 AM UTC

Hi Henryk, 

Greetings from Syncfusion Support. 

We have checked your reported scenario at our end and suggest you to use custom data manager using which you can get current view date range as shown below. 
                                                                                                                                         
 

Also you can get current action like ‘EditOccurrence’, ‘EditSeries’,  etc .., of the Scheduler using GetCurrentAction method. Please refer to the following sample for the same and let us know if this meets your requirement. 

            CurrentAction action = ScheduleRef.GetCurrentAction(); 


Regards, 
Nevitha 



HW Henryk Wisniewski August 11, 2021 11:04 AM UTC

Thanks for quick reply.

Main concern is that scheduler instance CANNOT BE static.

Lets say we will use Custom Data Adaptor.

Since Custom Adaptor is it's own object, which instance is created by Your scheduler, how can we get access to the scheduler's GetCurrentAction() method?

Whole of actual database communication is performed by using command or query objects, that are called upon inside Custom Data Adaptor - in which we seem to not be able to get instance of scheduler to grab the action that triggered for example the "BatchUpdate" method inside adaptor.

So, in simple terms - how, inside custom adaptor, get the actual action (for example "EditOccurrence") that triggered adaptor method (for example "batch update") when scheduler instance is NOT static and adaptor is it's own object, in it's



NR Nevitha Ravi Syncfusion Team August 12, 2021 02:52 PM UTC

Hi Henryk, 

Thanks for your update, 

In custom adaptor, the updated values will be retrieved properly using which you can directly update the appointments to the list collection or to your database. For example, if you edit a single occurrence in a series then BatchUpdateAsync method will call with parent recurrence appointment with exception date in changedRecords and edited occurrence with parent id in addedRecords which you can update it to database without knowing current action. 

changedRecords holding parent recurrence 
 

addedRecords with edited occurrence 


 


So please try the previously shared custom adaptor sample, if you still facing any issue please share the purpose of current action needed in custom adaptor class and issue you are facing in updating the events to the database. 

Regards, 
Nevitha 



HW Henryk Wisniewski August 13, 2021 08:00 AM UTC

Current database operation method prevents direct database connection / action.

There is no way to access any form of context, nor sql, dapper or EF.
Only way to use scheduler is with the atomic-level actions, like:

  • Create recurrence
  • Delete occurrence in series
  • Add exception to recurrence series (one-time modified occurrence)
  • Change subject
  • etc, etc...

Therefore, to perform such actions, one must know, or be able to determine programmatically, which of given actions was performed by user, so one can use the data provided by data manager to perform one of mentioned actions.

More detailed information in either data manager and / or OnActionSuccess would be very useful.

For example a list of properties, that have been changed with additional information about built-in actions that were performed would be useful.

Example:

User edits an recurring appointment - he adds one new modified occurrence to the series. He changed subject and time of meeting. Developer would get the list of actions performed upon:

A - appointment series - exception to rule added
B - new exceptional appointment - Exception appointment created, subject was changed to... , date was changed to...

If modification is not possible, than at least some sort of algorithm that is used in scheduler would be useful - how to determine 100% which atomic action(s) were taken - for example BatchUpdate with one changed record and one added record, when created record have recurrence id = updated record id is a 100% "an exception to recurrence rule was just created", etc, etc/



NR Nevitha Ravi Syncfusion Team August 16, 2021 01:13 PM UTC

Hi Henryk, 

Thanks for your update. 

We suspect that you need to update the appointments on performing CRUD to the database which can be done in Datamanager without the current action details. Please refer to the following UG and sample. 
 
Note: You need to change the path for accessing the database in the below link with the directory path of your database.  
  
Also with custom adaptor, as code snippets in the previously shared image you could update the data in foreach of added, changed, deleted records using respective methods like Add, Remove of _context.  

Please try the above solutions, if you still face any problem could you please share the following details which will help us to provide proper solution. 
  • Whether you are using Entity Framework?
  • Share code snippets you have tried
  • Issue replicating sample or code snippet

Regards, 
Nevitha 



HW Henryk Wisniewski August 16, 2021 01:56 PM UTC

I will write it again - there is no CRUD operation that can be performed directly on a database - there is NO such thing, nor there is any direct way of database connection.

For the sake of this conversation assume following:

- No access to Entity framework.

- No dapper

- No access to any form of direct database communication

- No access to performing any kind of SQL query

- no access to SQLconnection string

- For simplicity - no SQL, it does not exist in our case, same for EF, Dapper, etc - non-existent.


Assume that in this case database is just a fairytale, a something that someone is heard something about, but have never - ever saw it and he will never see it.

You, as a programmer, can only use provided custom commands, that are executed by a object using mediator pattern. Nothing else.


You, as a programmer, can send a command, for example a command named "CreateNewExcemptionFromRecurrenceRule(Appointment appointment, Appointment exception, DateTime replaceTime)". appointment in this case is base appointment with some recurrence, exception is a appointment object that replaces one of the base occurrences and replaceTime is a precise date of the replaced appointment time.

Nothing else, no more, no less - this is the only form of communication with something, that is passing your "messages" further into the "no-one saw it never ever ever" database-land.


There are many different commands or queries, that will ask data source for something, but there is no DIRECT way of just performing any sort of query,


Therefor - a 100% reliable information about user action, be it add, remove, property change, exception to recurrence rule creation or similar is needed.



NR Nevitha Ravi Syncfusion Team August 19, 2021 10:46 AM UTC

Hi Henryk, 

Sorry for the delay and miscommunication. 

You can get the current action of the scheduler without setting static for component reference by having custom adaptor as separate component which can be referred from the following sample and code snippet. 

 
<SfSchedule @ref="ScheduleRef" TValue="AppointmentData" Width="100%" Height="650px" SelectedDate="@(new DateTime(2020, 1, 9))"> 
    <ScheduleEventSettings TValue="AppointmentData"> 
            <SfDataManager Adaptor="Adaptors.CustomAdaptor"> 
                <CustomAdaptor></CustomAdaptor> 
            </SfDataManager> 
    </ScheduleEventSettings> 
</SfSchedule> 
 
@code { 
    [Inject] 
    protected AppointmentDataService Service { get; set; } 
    public SfSchedule<AppointmentData> ScheduleRef; 
    protected override async Task OnAfterRenderAsync(bool firstRender) 
    { 
        if (firstRender) 
        { 
            Service.ScheduleRef = ScheduleRef; 
        } 
        await base.OnAfterRenderAsync(firstRender); 
    } 
} 

CustomAdaptor.razor 
 
<CascadingValue Value="@this"> 
    @ChildContent 
</CascadingValue> 
 
@code { 
    [Parameter] 
    [JsonIgnore] 
    public RenderFragment ChildContent { get; set; } 
 
    [Inject] 
    protected AppointmentDataService ServicePage { get; set; } 
 
    List<AppointmentData> EventData = new AppointmentDataService().DataList(); 
 
    public async override Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null) 
    { 
 
        await Task.Delay(100); //To mimic asynchronous operation, we delayed this operation using Task.Delay 
        return dataManagerRequest.RequiresCounts ? new DataResult() { Result = EventData, Count = EventData.Count() } : (object)EventData; 
    } 
    public async override Task<object> InsertAsync(DataManager dataManager, object data, string key) 
    { 
        ServicePage.ScheduleRef.GetCurrentAction(); 
        await Task.Delay(100); //To mimic asynchronous operation, we delayed this operation using Task.Delay 
        EventData.Insert(0, data as AppointmentData); 
        return data; 
    } 

Please try the solution and let us know if this works for you to pass the commands at your end. 

Regards, 
Nevitha 



HW Henryk Wisniewski August 19, 2021 10:47 AM UTC

Great answer - I will try it soon, thanks!



VD Vinitha Devi Murugan Syncfusion Team August 20, 2021 06:32 AM UTC

 
Thanks for the update.  
 
Please try out our solution and let us know if you need any further assistance.  
 
We will be waiting to hear from you.  
 
Regards, 
Vinitha 


Marked as answer
Loader.
Up arrow icon