Sending extra info to web service

5 posts, 0 answers
  1. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 08 Sep 2011 Link to this post

    I know there's a couple of posts on this topic already, but I have questions still.

    I have to pass the current user ID that is creating the appointment to the Insert method of the web service so that attribute can be saved to the appointment.

    I have this set up here in MySchedulerInfo.cs

        public int UserID { get; set; }

        public MySchedulerInfo(ISchedulerInfo baseInfo, int doctorID, int userID) : base(baseInfo) {
            UserID = userID;
        }

        public MySchedulerInfo() {
        }


    And then on the front end, I have this:

        protected void radAppointmentsDoctors_AppointmentInsert(Object sender, AppointmentInsertEventArgs e) {
            e.SchedulerInfo = new MySchedulerInfo(e.SchedulerInfo, c_user_id);
        }

    So then in MyDbSchedulerProvider,cs , I have:

    public override void Insert(RadScheduler owner, Appointment appointmentToInsert) {
            if (!PersistChanges) {
                return;
            }

            bvAppointmentDoctor a = new bvAppointmentDoctor();

            a.AssignedTo = int.Parse(appointmentToInsert.Resources.GetResourceByType("Doctor").Key.ToString());
            a.UserId = ?????
    ^^^ here's the problem. How do I get access to the schedulerinfo UserID property from within this method?

    // Then Assign other object properties here and save object
  2. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 13 Sep 2011 Link to this post

    Someone? Anyone?
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Sep 2011 Link to this post

    Hello Mitchell,

    Attached are a couple of demos that will probably help you with this task. Let me know if you have further questions.

    Greetings,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 14 Sep 2011 Link to this post

    Peter:

    This doesn't seem to be working. I was able to get access to the SchedulerInfo property "userid" successfully, but it's not being assigned a value?

    I'm using:

    protected void radAppointmentsDoctors_AppointmentInsert(Object sender, AppointmentInsertEventArgs e) {
            e.SchedulerInfo = new MySchedulerInfo(e.SchedulerInfo, c_user_id);
        }

    But if I do logging on that function, it never even gets to it. The value for c_user_id is assigned at page load (class variable), so I know it has a value, but it doesn't appear that AppointmentInsert is even being called before the insert is performed.

    Do I need to use the client side version OnClientAppointmentInserting? If so, what's the syntax for that for me to pass the class variable of the user ID through?
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Sep 2011 Link to this post

    Hi Mitchell,

    With Web Service binding you should use OnClientAppointmentWebServiceInserting instead of AppointmentInsert since server side events do not occur in this mode. Please, refer to this help topic for more details on the matter -
    http://www.telerik.com/help/aspnet-ajax/scheduler-sending-additional-information-to-the-web-service.html.

    Regards, Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Back to Top