Hi,
I'm loading appointments to scheduler using:
This is my scheduler.asmx.cs
Within MyDBSchedulerProvider:
I'm loading my resources (Vans), but I need to be able to pass a parameter (HubID) from my aspx to allow me to load the right resources.. I've tried doing this via "Session["schHubID"] = schedulerInfo.HubID;"
I'm no having much luck passing the param to the session... any ideas?
using Version 2010.1.309.35
Thanks
I'm loading appointments to scheduler using:
<
WebServiceSettings
Path
=
"~/Webservices/Scheduler.asmx"
ResourcePopulationMode
=
"ServerSide"
/>
This is my scheduler.asmx.cs
public class MySchedulerInfo : SchedulerInfo
{
private int _hubID;
public int HubID
{
get { return _hubID; }
set { _hubID = value; }
}
private int _orderID;
public int OrderID
{
get { return _orderID; }
set { _orderID = value; }
}
private string _date;
public string Date
{
get { return _date; }
set { _date = value; }
}
}
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class Scheduler : System.Web.Services.WebService
{
private WebServiceAppointmentController _controller;
/// <
summary
>
/// The WebServiceAppointmentController class is used as a facade to the SchedulerProvider.
/// </
summary
>
private WebServiceAppointmentController Controller
{
get
{
if (_controller == null)
{
_controller = new WebServiceAppointmentController("MyDBSchedulerProvider");
}
return _controller;
}
}
[WebMethod(EnableSession=true)]
//public IEnumerable<
AppointmentData
> GetAppointments(SchedulerInfo schedulerInfo)
public IEnumerable<
AppointmentData
> GetAppointments(MySchedulerInfo schedulerInfo)
{
//
Session["schHubID"] = schedulerInfo.HubID;
Session["schDate"] = schedulerInfo.Date;
Session["schOrderID"] = schedulerInfo.OrderID;
return Controller.GetAppointments(schedulerInfo);
}
[WebMethod(EnableSession = true)]
//public IEnumerable<
AppointmentData
> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
public IEnumerable<
AppointmentData
> UpdateAppointment(MySchedulerInfo schedulerInfo, AppointmentData appointmentData)
{
Session["schHubID"] = schedulerInfo.HubID;
Session["schDate"] = schedulerInfo.Date;
Session["schOrderID"] = schedulerInfo.OrderID;
return Controller.UpdateAppointment(schedulerInfo, appointmentData);
}
#region not used
[WebMethod]
public IEnumerable<
AppointmentData
> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
{
return Controller.InsertAppointment(schedulerInfo, appointmentData);
}
[WebMethod]
public IEnumerable<
AppointmentData
> CreateRecurrenceException(SchedulerInfo schedulerInfo, AppointmentData recurrenceExceptionData)
{
return Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData);
}
[WebMethod]
public IEnumerable<
AppointmentData
> RemoveRecurrenceExceptions(SchedulerInfo schedulerInfo, AppointmentData masterAppointmentData)
{
return Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData);
}
[WebMethod]
public IEnumerable<
AppointmentData
> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries)
{
return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
}
#endregion
[WebMethod(EnableSession = true)]
public IEnumerable<
ResourceData
> GetResources(MySchedulerInfo schedulerInfo)
{
Session["schHubID"] = schedulerInfo.HubID;
return Controller.GetResources(schedulerInfo);
}
}
Within MyDBSchedulerProvider:
public class MyDbSchedulerProvider2 : DbSchedulerProviderBase
{
#region get Vans
private IDictionary<
int
, Resource> _vans;
private IDictionary<
int
, Resource> Vans
{
get
{
bool load = false;
if (_vans == null)
{
load = true;
}
if (!load)
{
//if (_vans.Count == 0)
load = true;
}
if (load)
{
_vans = new Dictionary<
int
, Resource>();
foreach (Resource van in LoadVans()) <---NEED TO PASS PARAM HERE
{
_vans.Add((int)van.Key, van);
}
}
return _vans;
}
}
public override IEnumerable<
ResourceType
> GetResourceTypes(RadScheduler owner)
{
ResourceType[] resourceTypes = new ResourceType[1];
resourceTypes[0] = new ResourceType("Van", false);
return resourceTypes;
}
I'm loading my resources (Vans), but I need to be able to pass a parameter (HubID) from my aspx to allow me to load the right resources.. I've tried doing this via "Session["schHubID"] = schedulerInfo.HubID;"
#region LoadVans
private IEnumerable<
Resource
> LoadVans()
{
List<
Resource
> resources = new List<
Resource
>();
int hubID = (int)HttpContext.Current.Session["schHubID"];
DO the load based on hubID
I'm no having much luck passing the param to the session... any ideas?
using Version 2010.1.309.35
Thanks