I using webservice popolate data on RadSchedule. But when build load Resourece, I want to pass some parameter to load list Resource in MySchedulerProvider. How to call and code example??? When I using using:
private MySchedulerInfo _customParameter = new MySchedulerInfo();
private IDictionary<int, Resource> _subjectId;
private IDictionary<int, Resource> SubjectId
{
get
{
if (_subjectId == null)
{
_subjectId = new Dictionary<int, Resource>();
foreach (Resource subjectId in LoadSubjectId(_customParameter.ClassId))
{
_subjectId.Add((int)subjectId.Key, subjectId);
}
}
return _subjectId;
}
}
public override IEnumerable<Appointment> GetAppointments(ISchedulerInfo shedulerInfo)
{
List<Appointment> appointments = new List<Appointment>();
MySchedulerInfo myInfo = shedulerInfo as MySchedulerInfo;
if(myInfo != null)
{
_customParameter = myInfo;
using (DbConnection conn = OpenConnection())
{
DbCommand cmd = DbFactory.CreateCommand();
if (cmd != null)
{
cmd.Connection = conn;
cmd.CommandText = "SELECT [Id],[Class_Id],[School_Id],[Subject],[Description],[Begin_Date],[End_Date],[Recurrent_Rule],[Recurrence_Parent_Key],[Subject_Id],[Reminder] FROM [Class_Schedule] WHERE [Class_Id]=@ClassId;";
cmd.Parameters.Add(CreateParameter("@ClassId", myInfo.ClassId));
using (DbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Appointment apt = new Appointment();
apt.ID = reader["Id"];
apt.Subject = Convert.ToString(reader["Subject"]);
apt.Start = DateTime.SpecifyKind(Convert.ToDateTime(reader["Begin_Date"]), DateTimeKind.Utc);
apt.End = DateTime.SpecifyKind(Convert.ToDateTime(reader["End_Date"]), DateTimeKind.Utc);
apt.RecurrenceRule = Convert.ToString(reader["Recurrent_Rule"]);
apt.RecurrenceParentID = reader["Recurrence_Parent_Key"] == DBNull.Value ? null : reader["Recurrence_Parent_Key"];
if (reader["Reminder"] != DBNull.Value)
{
IList<Reminder> reminders = Reminder.TryParse(Convert.ToString(reader["Reminder"]));
if (reminders != null)
{
apt.Reminders.AddRange(reminders);
}
}
if (apt.RecurrenceParentID != null)
{
apt.RecurrenceState = RecurrenceState.Exception;
}
else
if (apt.RecurrenceRule != string.Empty)
{
apt.RecurrenceState = RecurrenceState.Master;
}
LoadResources(apt);
appointments.Add(apt);
}
}
cmd.Dispose();
}
}
}
return appointments;
}
But customParameter all way null object data.