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

Confused With RadScheduler?

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nani
Top achievements
Rank 1
Nani asked on 14 Oct 2011, 06:03 PM

I have two dataobjects from linq queries that i need to bind to radscheduler how it should appear is in the "Pic" i attached can anyone help me out with the issue.

From the first linq query i need to bind "TimeaFrame" i.e AM,PM and MID in the 'Pic' and side by that "capacitytotal"/"ActualTotal" as in the "Pic"

From second query i need to bind "FullName" and "Interval" for which the 'SalesRep.' is available...

"Date" parameter in the methods come from Query String...so i need to bind date for rest of the dates in the week beacuse i am choosing "WeekView" in the RadScheduler....

I hope u understand my requirement...i am attaching code i have and the Requirement "Pic"

I have one more concern "RadScheduler" give the default function i.e. it allows to select particular date and write done something der...but i dont want user to select any date...how to disable that functionality...

Telerik Team PLease do reply i am working on it since one day i am finding hardtime,.,I am totally confuse plz do help me

Thanku

public object GetCapacityTotals(DateTime date)
       {
           using (EnabledDataContext db = new EnabledDataContext())
           {
               var captotals = (from cap in db.Capacities
                                from timeframe in db.TimeFrames
                                where cap.WorkDate.Equals(date) &&
                                      cap.TimeFrame == timeframe.TimeFrame1 &&
                                      cap.StoreID == 535 &&
                                      !timeframe.Deleted
                                select new
                                {
                                    TimeFrame = timeframe.TimeFrame1,
                                    CapacityTotal = cap.CapacityTotal,
                                    ActualTotal = cap.ActualTotal
                                }).ToList();
               if (captotals.Count == 0)
               {
                   captotals.Insert(0,new {TimeFrame = "AM",CapacityTotal = 0, ActualTotal = 0});
                   captotals.Insert(1, new { TimeFrame = "MID", CapacityTotal = 0, ActualTotal = 0 });
                   captotals.Insert(2, new { TimeFrame = "PM", CapacityTotal = 0, ActualTotal = 0 });
               }
               return captotals;
           }
       }
        
       public object GetSalesReps(DateTime date)
       {
           using (EnabledDataContext db = new EnabledDataContext())
           {
               //Left Outer Join
               var salesReps =
                               (from records in
                                    (from userstore in db.UserStores
                                     from users in db.Users
                                     join sr in db.SalesRepSchedules on users.UserID equals sr.UserID into srsch
                                     from srschi in (from s in srsch
                                                     where s.WorkDate == date &&
                                                          !users.Deleted
                                                     select s).DefaultIfEmpty()
                                      
                                     where users.UserID == userstore.UserID &&
                                           userstore.StoreID == 535 &&
                                           db.HasRole(users.UserID, "Sales Rep").Equals(1)
                                     select new
                                     {
                                         UserID = users.UserID,
                                         FirstName = users.FirstName,
                                         LastName = users.LastName,
                                         FullName = String.Concat(users.FirstName," ",users.LastName),
                                         TerritoryID = srschi.TerritoryID == null ? users.TerritoryID : srschi.TerritoryID,
                                         Interval = srschi.Interval == null ? "OFF" : srschi.Interval
                                     })
                                group records by new
                                {
                                    records.UserID,
                                    records.FirstName,
                                    records.LastName,
                                    records.FullName,
                                    records.TerritoryID,
                                    records.Interval
                                } into g
                                select new
                                {
                                    UserID = g.Key.UserID,
                                    FirstName = g.Key.FirstName,
                                    LastName = g.Key.LastName,
                                    FullName = g.Key.FullName,
                                    TerritoryID = g.Key.TerritoryID.GetValueOrDefault(),
                                    Interval = g.Key.Interval
 
                                }).OrderBy(a => a.FirstName).ThenBy(a => a.LastName).ThenBy(a => a.UserID).ToList();
               return salesReps;
           }
       }
<telerik:RadScheduler runat="server" ID="RadScheduler1" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday"
                DataKeyField="TerritoryID" DataSubjectField="FullName" DataStartField="FullName" DataEndField="Interval"
                DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
                SelectedView="WeekView" EnableDatePicker="false" Localization-HeaderDay="" Localization-HeaderMonth=""
                Localization-HeaderWeek="" Localization-HeaderTimeline="" Localization-HeaderToday=""
                Localization-AllDay="" Localization-Show24Hours="" Localization-ShowBusinessHours=""
                RowHeaderWidth="0px" ShowAllDayRow="false" ShowHoursColumn="false" DayView-ReadOnly="true"
                AllowInsert="false" DayView-ShowHiddenAppointmentsIndicator="false" DayView-ShowResourceHeaders="false"
                EnableResourceEditing="false" ShowFooter="false"  >
                <AdvancedForm Modal="true" />
               
            </telerik:RadScheduler>

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 18 Oct 2011, 04:57 PM
Hello Nani,

Here is sample project that shows how one can populate the RadScheduler form different data source than usual.

You can also refer to Binding to List demo where you can see how to handle the Insert /Update /Delete events.

Best wishes,
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
Tags
General Discussions
Asked by
Nani
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or