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

Inserting appointments and displaying results

9 Answers 123 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 31 Jan 2012, 10:34 PM

Hello.

In the web application I have been developing, there is a web page page that uses the RadScheduler component with web service binding.
The RadScheduler component displays appointments grouped by resources.
Since the resources are loaded by a stored procedure that requires input parameters, class SchedulerInfo has been extended:

public class SchedulerInfoExt : SchedulerInfo
{
 public Int16 ClubId { get; set; }
 public String ResourceType { get; set; }
 public String MembershipNumber { get; set; }
 public String InsertResult { get; set; }
  
 public SchedulerInfoExt(ISchedulerInfo baseInfo, Int16 clubId, String resourceType, String membershipNumber) : base(baseInfo)
 {
  ClubId = clubId;
  ResourceType = resourceType;
  MembershipNumber = membershipNumber;
  InsertResult = "";
 }
  
 public SchedulerInfoExt()
 {
 }
}

In the web page, a RadDock component is used to implement a form that allows users to create appointments.
In the Data Provider class, the Insert method validates the business rules and creates the appointment. The scheduler info property InsertResult is set by the Insert method, indicating if the insertion was successful, if there was an error or if there was a violation of the business rules.

On the client side, function AppointmentsPopulated, associated with event OnClientAppointmentsPopulated, is supposed to display a message based on the content of the scheduler info property InsertResult, informing the user if the appointment was created or if there was an error.

Is it possible to access the scheduler info property InsertResult from the client side function AppointmentsPopulated?

Thank you in advance.
Paulo

9 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 01 Feb 2012, 03:43 PM
Hello Paulo,

 
You can assign the scheduler info property InsertResult in OnClientAppointmentsPopulating instead of in OnClientAppointmentsPopulated as it is done in the WebService demo.

Hope this will be helpful.  

Regards,
Plamen Zdravkov
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
0
Paulo
Top achievements
Rank 1
answered on 01 Feb 2012, 05:22 PM

Hello, Plamen.

Thank you for your reply.

As I mentioned in the first post, scheduler info property InsertResult is set by the Insert method.
Unfortunately, the method you suggested, OnClientAppointmentsPopulating, is executed before Insert.
Since OnClientAppointmentsPopulated is executed after Insert, that's where I tried to retrieve the value of InsertResult. Isn't it possible to access the scheduler info properties from there?

Thank you again.

Paulo

0
Plamen
Telerik team
answered on 02 Feb 2012, 11:32 AM
Hello Paulo,

 
Have you considered using the Returning extra data from the Web Service help topic to achieve the desired functionality?
  

Regards,
Plamen Zdravkov
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
0
Paulo
Top achievements
Rank 1
answered on 07 Feb 2012, 05:07 PM
Hello, Plamen.

Thank you for your suggestion.

In order to implement what the help topic suggests, I have implemented the following changes in my application:
1) Creation of class SchedulerResult
public class SchedulerResult : SchedulerOperationResult<AppointmentData>
{
    public String InsertResult { get; set; }
}
The purpose of property InsertResult is to store the result of the method that creates appointments (Insert method, Data Provider class).

2) In the Data Provider class, I have changed the return type of method Insert from
public override void Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert)
to
public override SchedulerResult Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert)

This way, the result of the insertion (stored in the local variable insResult) is assigned to property InsertResult:
SchedulerResult result = new SchedulerResult();
result.InsertResult = insResult;
return result;

The compiler has not "approved" these changes though:
'Scheduling.PersonalTraining_PrivateTraining_DataProvider.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)': return type must be 'void' to match overridden member 'Telerik.Web.UI.SchedulerProviderBase.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)'

I would appreciate whether you could help me address this issue.

Thank you.
Paulo
0
Plamen
Telerik team
answered on 10 Feb 2012, 05:44 PM
Hi Paulo,

 
Would you please try to overrider the WebMethod in the SchedulerWebService.cs:

[WebMethod]
        public IEnumerable<AppointmentData> InsertAppointment(MySchedulerInfo schedulerInfo, AppointmentData appointmentData)
        {
            return Controller.InsertAppointment(schedulerInfo, appointmentData);
        }

Hope this will be helpful.

Regards,
Plamen Zdravkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Paulo
Top achievements
Rank 1
answered on 14 Feb 2012, 12:41 AM
Hello, Plamen.

In the Web Service class, method InsertAppointment has been changed from
public IEnumerable<AppointmentData> InsertAppointment(SchedulerInfoExt schedulerInfo, AppointmentData appointmentData)
{
    return Controller.InsertAppointment(schedulerInfo, appointmentData);
}

to
public SchedulerResult InsertAppointment(SchedulerInfoExt schedulerInfo, AppointmentData appointmentData)
{
    return (SchedulerResult)Controller.InsertAppointment(schedulerInfo, appointmentData);
}

The compiler has issued the same error though:
'Scheduling.PersonalTraining_PrivateTraining_DataProvider.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)': return type must be 'void' to match overridden member 'Telerik.Web.UI.SchedulerProviderBase.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)'

I have also tried
public override SchedulerResult InsertAppointment(SchedulerInfoExt schedulerInfo, AppointmentData appointmentData)
{
    return (SchedulerResult)Controller.InsertAppointment(schedulerInfo, appointmentData);
}
and two errors were issued:
- 'Scheduling.PersonalTraining_PrivateTraining_WS.InsertAppointment(Scheduling.SchedulerInfoExt, Telerik.Web.UI.AppointmentData)': no suitable method found to override
- 'Scheduling.PersonalTraining_PrivateTraining_DataProvider.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)': return type must be 'void' to match overridden member 'Telerik.Web.UI.SchedulerProviderBase.Insert(Telerik.Web.UI.ISchedulerInfo, Telerik.Web.UI.Appointment)'

What could you suggest to solve the problem?

Thank you again.
Paulo
0
Plamen
Telerik team
answered on 16 Feb 2012, 05:12 PM
Hello Paulo,

 
I have attached a sample web page where the Insert WebMethod is overriden as in the help topic that was lined before.

Hope this will be helpful.

All the best,

Plamen Zdravkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Paulo
Top achievements
Rank 1
answered on 17 Feb 2012, 06:07 PM
Hello, Plamen.

Thank you very much for your valuable feedback. It works!

I just have one more question before considering the issue solved.
After adding the appointment and displaying the results on the client side via function alert, I noticed that RadScheduler was refreshed, but no appointments were displayed, neither the existing ones nor the new one.
In order to solve the problem, I added a RadScheduler.rebind() call:
function RequestSuccess(s, e)
{
    if (document.getElementById("insert").value == "InsertProcessed")
    {
        // refreshing RadScheduler
        $find("<%= RadScheduler1.ClientID %>").rebind();
  
        alert("result: " + e.get_result().InsertResult);
        document.getElementById("insert").value = "";
  
        // closing the RadDock
        $find("<%= RadDockInsert.ClientID %>").set_closed(true);
    }
}

Before adding this logic to capture and display the results of the web service call, RadScheduler was being refreshed automatically and all appointments were displayed accordingly (the existing ones and the new one).
Why is this happenning now?

Thank you again for your assistance.
Paulo
0
Plamen
Telerik team
answered on 22 Feb 2012, 08:46 AM
Hello Paulo,

 
I have inspected the issue with the project I attached in the previous post, but every time the appointments were displayed properly just after the alert is closed. Here you can see a video of  my test.

If you still observe the issue please let me know how should I change the ExtraDate project in order to observe the same behavior.

All the best,
Plamen Zdravkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Scheduler
Asked by
Paulo
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Paulo
Top achievements
Rank 1
Share this question
or