This is a migrated thread and some comments may be shown as answers.

Sending extra info to web service

4 Answers 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mitchell
Top achievements
Rank 1
Mitchell asked on 08 Sep 2011, 04:57 PM
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

4 Answers, 1 is accepted

Sort by
0
Mitchell
Top achievements
Rank 1
answered on 13 Sep 2011, 03:47 PM
Someone? Anyone?
0
Peter
Telerik team
answered on 13 Sep 2011, 04:52 PM
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.
0
Mitchell
Top achievements
Rank 1
answered on 14 Sep 2011, 02:29 PM
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?
0
Peter
Telerik team
answered on 17 Sep 2011, 09:39 AM
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
Tags
Scheduler
Asked by
Mitchell
Top achievements
Rank 1
Answers by
Mitchell
Top achievements
Rank 1
Peter
Telerik team
Share this question
or