Datamodel - working example

6 posts, 0 answers
  1. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 21 Jul 2014 Link to this post

    Hi,

    for days I mess around with "Database Storage" - but it drives me crazy.

    What I got so far was - create a daily recurring appoint and also adding an exception to it.
    But here the problems start.

    Lets say my original recurring appointment was at 10:00.
    I move on occurrence to 9:00 - and what I get is a new Appointment (the exception) and an ExceptionDate with an ExceptionDate of 10:00.

    Now I edit the series and change the start to 11:00.

    I now get a new ExcpetionOccurrence (and a new Exception Appointment).
    Appointment - the same as before.
    Occurrence - pointing to the new exception - with an ExceptionDate of 11:00.

    BUT - the old Exception as well as the old ExpceptionOccurrence still exist.

    To make thing a bit more transparent - I took your xaml-sdk example an tried the same thing here.
    The datamodel there is slightly different than mine - but this doesn't matter.

    I can also add an appointment - and an exception.
    But when I try to move the original appointment I get an exception in SqlExceptionAppointment.cs IAppointment Copy.
    This method is not implemented - instead it throws an InvalidOperation Exception.

    Is there a working DB example?
    Or at least a documentation how data is handled?

    All I found out so far is that ExceptionOccurrence is generated when I create an exception (OK so far) and that if I change the series an extra copy is generate for every existing Exception / Exception occurrence. But the old elements are neither deleted nor remove from the appointments collection.

    About the DataModel - (what I think):
    ExceptionAppointment - the data for an exception.
    ExceptionOcurrence - a reference to the appointment as well as a DataTime for the Occurrence of the appointment which gets an override.

    My Idea - Since ExceptionAppointment and ExceptionOccurrence is 1:1 I could also have one table for "all of it".
    AppointmentID int (PK, auto)
    MasterAppointmentID int (null)
    ExceptionOcurrence DateTime (null)
    Start....

    So I could find Exceptions via MasterAppointmentID!=null
    Find all Appointments via MasterAppointmentID==null


    This would avoid a lot of cascading deletes and so far.
    The only thing to solve could be (but also possible with a "start==end" or so) an exception where there should be no occurrence.
    I found that such a thing results in an ExceptionOcurrence with no ExceptionAppointment.

    By the way - I found no way to remove such an exception via UI.

    Anyhow - a simple working example would be a good starting point.

    Manfred

  2. George
    Admin
    George avatar
    1332 posts

    Posted 22 Jul 2014 Link to this post

    Hello Manfred,

    I just replied in the other ticket that ExceptionDate property specify the time when an occurrence should happen if it wasn't an exception. The ExceptionDate property changes when recurrence rule is changed. Lets take this scenario for example:

    - Create a recurrent appointment with 3 occurrences which last 1 hour (daily occurrences at 9:00am) The generated occurrences will be: 22/7 9:00, 23/7 9:00, 24/7 9:00
    - Change the start/end of the second occurrence from 23/7 9:00 to 23/7 11:00 am. In this case there will be new ExceptionOccurrence with ExceptionDate 23/7 9:00
    - Change the start/end of the third occurrence from 24/7 9:00 to 24/7 10am. In this case there will be new ExceptionOccurrence with ExceptionDate 24/7 9:00
    - Drag the first occurrence and move the series to 1:00 pm. In this case the ExceptionDate for the second and third ExceptionOccurences will be 23/7 1:00pm and 24/7 1:00pm.

    According to the InvalidOperationException, we found this problem and we implemented the Copy method. You can find the modified sample attached.

    Our sdk sample is our current example how to use RadScheduleView with DB. We are always working on improving the sample because of the complex scenario which should support. 

    You can find our documentation about RadScheduleView with DB here.

    We can confirm that there is no way to remove an expcetion via UI at the current stage. You could remove the recurrence rule via the dialog and recreate it again.

    Your approach for storing the data objects seems interesting and it could work. We will be very grateful if you could modify and share with us the code and submit a code library. We will update your Telerik points as well.

    Hope this helps.

    Regards,
    George
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 22 Jul 2014 in reply to George Link to this post

    Hi,

    I checked the attached sample - and got exactly the same results as I get with my modified version.
    Or better with first modification.
    My second modification was to enter (InsertOnSubmit since I use Linq2SQL) newly created exceptions into the DB which brings me the described "double exception entry".

    Your version is not inserting newly created objects so the error is another one.

    I attached the resulting DB and a screenshot.

    What I did with your sample was:
    a.) create a new recurring appointment
    b.) delete all other existing appointments (just to focus on the problems)
    c.) move the first occurrence and select "just this element"
    d.) saved everything and restartet the applicaiton
    --at this point everything looks nice
    e.) move the second appointment and selecte "move series"
    d.) saved everything and restartet the applicaiton

    And what I got is what you see on the screenshot.
    Two (the series and the exception) occurrences on the first day.

    The reason - when changing the start of the series a new exception occurrence and a new exception appointment for the existing exception is created. Also (with this new elements) the values (ExceptionDate,...) are set correctly.
    But this new element is never entered into the database.

    Instead the old (existing) data stays there. The "problem" - ExceptionDate on the exception occurrence is still at the old starting time so it is not totaly identifyed as a matching exception. Therefore two occurrences show up at the first day.

    Two things I want to notice:
    FIRST: I checked the documentation (I read every single word several times :))
    --but the information just shows how the interface (tables) should look - nothing more
    --there is no explanation WHY or WHAT FOR or HOW the elements are used
    --I still don't understand why the ExceptionDate is needed
    ---- I could get original start via relation to the "MasterAppoinment"
    ---- I could get the Exception start from the exception
    ---- by the way - such an approach would avoid the need to update the ExceptionDate when the series is changed
    ---- and the error (we see here) would not occure :)

    SECOND: even you (as the producer) are not able to provide a running example!
    Sorry this was a bit harsh - I'm sure you are able - but the fact that even your corrected example fails shows how difficult it is to implement something running.
    And this although you have "internal knowledge".

    By the way. From my point of view the DB desing is "not so good".
    You have to maintain two tables with (almost) identical content (Appointment, ExceptionAppointment).
    You have to maintain a (somehow) redundant DateTime information (ExceptionDate) - which (as the problem here shows) makes problems.

    This finally brings me back to my first question - can you provide a working example?
    Followed by - can you provide documentation which contains information about how data is stored / handled?

    Manfred
    PS: I tried to attach a ZIP (XAMLSDK.png) whith renamed extension
    I also attached a screenshot - so if the ZIP attachment fails it should be easy to reproduce what I did
  5. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 25 Jul 2014 Link to this post

    Hi Manfred,

    I understand your concerns.

    We are currently working on improving the implementation of the same DB example. I would like to thank you for the shared issue and to let you know that we already fixed that scenario. I'm attaching the latest version of the project and will kindly ask you to give a try and let us know if you face any issues with it. We will be really glad to further assist you in such case.

    As for the documentation, I would like to thank you for feedback and to let you know that will definitely consider improving that part of our documentation. Meanwhile if you have any questions or concerns, please do not hesitate to contact us.

    About the DB design - we have decided to implement it the current way as this design was as close as possible to the implementation of the ScheduleView and the objects used there - all of the tables are required in order to function correctly.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 30 Jul 2014 in reply to Kalin Link to this post

    Hi Kalin,

    I gave this a try - and it became better and (maybe) worse.
    Maybe because I'm not sure if the problems existed before and I just didn't recognize or if they are new.

    FIRST:
    After playing around I again had tow "Exception occurrences" - but I can't reproduce this - maybe it depends on the crashes...

    The new things - CRASHES:
    I modified the XAML with
      <telerik:RadScheduleView.ViewDefinitions>
                        <telerik:DayViewDefinition DayStartTime="7:00:00" DayEndTime="19:00:00" />
                       <telerik:WeekViewDefinition DayStartTime="7:00:00" DayEndTime="19:00:00"  />
                    </telerik:RadScheduleView.ViewDefinitions>

    When I edit the series occurrence and change the start time to 7:00 (Day start time!!) I get an exception:
    System.ArgumentOutOfRangeException occurred
      _HResult=-2146233086
      _message=Der addierte oder subtrahierte Wert ergibt eine nicht darstellbare DateTime.
      HResult=-2146233086
      IsTransient=false
      Message=Der addierte oder subtrahierte Wert ergibt eine nicht darstellbare DateTime.
    Parametername: value
      Source=mscorlib
      ParamName=value
      StackTrace:
           bei System.DateTime.AddTicks(Int64 value)
    Stack:
      Telerik.Windows.Controls.ScheduleView.dll!Telerik.Windows.Controls.DateTimeExtensions.SubtractInterval(System.DateTime dt, Telerik.Windows.Controls.ScheduleView.DateTimeInterval dateTimeInterval) Unknown
      Telerik.Windows.Controls.ScheduleView.dll!Telerik.Windows.Controls.ScheduleViewBase.GetFirstPartOfOccurrencesWithNoEndDates(Telerik.Windows.Controls.ScheduleView.IDateSpan range, System.Collections.Generic.IEnumerable<Telerik.Windows.Controls.ScheduleView.IAppointment> source, bool moveForward, Telerik.Windows.Controls.ScheduleView.DateTimeInterval interval) Unknown
      Telerik.Windows.Controls.ScheduleView.dll!Telerik.Windows.Controls.ScheduleViewBase.HasAppointmentsInRange(Telerik.Windows.Controls.ScheduleView.IDateSpan range, bool skipIntersectedWithTheRangeAppointments, bool moveForward, Telerik.Windows.Controls.ScheduleView.DateTimeInterval interval) Unknown
      Telerik.Windows.Controls.ScheduleView.dll!Telerik.Windows.Controls.ScheduleViewBase.OnQueryGoToPreviousAppointmentCanExecuted(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) Unknown
      PresentationCore.dll!System.Windows.Input.CommandBinding.OnCanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) Unknown




    When I try to delete an appointment I get the exception:
    System.ComponentModel.Win32Exception occurred
      _HResult=-2147467259
      _message=Ungültiges Fensterhandle
      HResult=-2147467259
      IsTransient=false
      Message=Ungültiges Fensterhandle
      Source=WindowsBase
      ErrorCode=-2147467259
      NativeErrorCode=1400
      StackTrace:
           bei MS.Win32.UnsafeNativeMethods.ClientToScreen(HandleRef hWnd, POINT pt)


    I'm still in the hope to get a working sample.
    By the way - this solution is (somehow) better.
    Could you please explain what you changed (related to the previous version)?

    I know I could check the code - but I spent (wasted??) so much time investigating in this...

    Manfred
  7. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 30 Jul 2014 Link to this post

    Hello Manfred,

    Thanks for the feedback. We have mostly improved the ExceptionAppointments implementation where the most issue were. However I was not able to reproduce the described issues, so you I will kindly ask you to share some more details about your environment. We would need to know the OS version, VS and SQL versions, the culture of the machine and anything extra you can think of that might be helpful, so we can try to reproduce the issues on our side and fix them afterwards.

    I'm looking forward to your response.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready