How to get and save the exact user that created a new appointment

4 posts, 1 answers
  1. Nikola
    Nikola avatar
    65 posts
    Member since:
    Sep 2012

    Posted 07 Nov 2012 Link to this post

    Heey Guys

    My quest is how to get the current user that is using the scheduler and when he is creating a new Appointment,how  to save  his userId in the same table where the appointment is saved . 


    Thanks for fast answer 

    Nikola 
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 09 Nov 2012 Link to this post

    Hello Nikola,

    One easy and convenient way to achieve the described functionality would be:
    • Adding a column with name ClientID to the table where you are saving your appointments.
    • Modify your current select,update, delete and insert queries if some exist ( optional in case of using SQL data source).
    • Adding an appointment attribute with name ClientID and a string value equals its number onAppointmentInsert server-side event. 
    • You could implement your custom logic for retrieving the ClientID number. In the attached sample project it is always a value of "23" added to the table column ClientID.
    Please find the attached project that implements functionality very similar to your scenario.

    Hope that this will lead you into right direction.

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Nikola
    Nikola avatar
    65 posts
    Member since:
    Sep 2012

    Posted 09 Nov 2012 Link to this post

    Heey 

    I see your solution and thanks for that but is it somehow possible to to it dynamical because yee it is how to say stupid for a user to know his id ... is there some solution when the user create a new appointment to get his userid and to save it with the new appointment in the same table  
  4. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 14 Nov 2012 Link to this post

    Hello Nikola,

    Easy and convenient way for getting a client number would be using the Session or Cookie object for example.  As long as you have a table column for this number in your database you can set it for every appointment as attribute from the code behind. This way it will use that value instead of the "23" as shown in the sample project.
    The provided solution will not require each user to select or type this client number since this approach is not creating a resource field to your advanced form.

    Hope that this will lead you into right direction.

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top