Save with UserId

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

    Posted 09 Nov 2012 Link to this post

    heey Guy

    I got a short question is it some how possible to save a appointment with the usual table id and a foraging key 
    some code example would be good 


    Thanks for help and  fast answer 
  2. Answer
    Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 13 Nov 2012 Link to this post

    Hi Nikola,

     
    Here is the database structure that we recommend for RadScheduler. Please review it and if you still have questions please elaborate a little bit what exactly are you trying to change it because it is not quite clear from the explanation provided.

    Regards,
    Plamen
    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 13 Nov 2012 Link to this post

    heey 
    thanks for help that helps^^
     
    but know i have some strange errors when im trying to save the userid 

    public static int GetUserIdByLogin(string p, HolidayTrackerEntities ctx, String login)
           {
               HtUser retUser = null;
               
               int backslashIndex = login.IndexOf("\\");
               String domain = backslashIndex >= 0 ? login.Substring(0, backslashIndex) : "";
               String username = backslashIndex >= 0 ? login.Substring(backslashIndex + 1, login.Length - backslashIndex - 1) : login;
     
               retUser = ctx.HtUsers.Where(au => au.UserName.ToLower() == username.ToLower()).Single();
     
                
           }
    Error 1 'HolidayTracker.Data.Model.HtUser.GetUserIdByLogin(string, HolidayTracker.Data.Model.HolidayTrackerEntities, string)': not all code paths return a value C:\Development\Projects\Vs2012\HolidayTracker\HolidayTrackerData\Model\HtUser.cs 265 27 HolidayTrackerData


    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
           {
               if (ExceedsLimit(e.Appointment))
               {
                   e.Cancel = true;
                   RegisterScript();
               }
               else
               {
                   int id = HtUser.GetUserIdByLogin(Page.User.Identity.Name);
                   e.Appointment.Attributes.Add("UserId","1");
               }
           }
    Error 10 'HolidayTracker.Data.Model.HtUser' does not contain a definition for 'GetUserIdByLogin' C:\Development\Projects\Vs2012\HolidayTracker\HolidayTracker\User\UserScheduler.aspx.cs 66 33 HolidayTracker

    why is here a error ? 

    thanks for help 
  4. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 13 Nov 2012 Link to this post

    Hello Nikola, 

     
    I have inspected the code shared and the error observed but it does not seems to be connected with RadControls but rather to your custom implementation. Please let me know if I am missing something.

    Regards,
    Plamen
    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.
  5. Nikola
    Nikola avatar
    65 posts
    Member since:
    Sep 2012

    Posted 13 Nov 2012 Link to this post

    heey

    nope it was my error but thanks for your time !!


Back to Top