protected
void
trcBehaviorData_ItemDataBound(
object
sender, Telerik.Charting.ChartItemDataBoundEventArgs e)
{
RethinkAutismDataContext ctx =
new
RethinkAutismDataContext();
NameValueCollection nvcNotes = (NameValueCollection)Session[
"nvcNotes"
];
int
index = e.SeriesItem.Index;
var key = nvcNotes[(index + 1).ToString()];
var r = ctx.viewBehaviorPlanDataInfos.Where(rr => rr.dataSetId == Convert.ToInt32(key)).FirstOrDefault();
if
(r !=
null
)
{
String bNotes =
""
;
if
(!String.IsNullOrEmpty(r.notes))
bNotes =
":<br /> "
+ r.notes;
e.SeriesItem.ActiveRegion.Tooltip =
"<b>"
+ r.dateCreated.ToString(
"MM/dd/yyyy"
) +
" "
+ r.uName +
"</b>"
+ bNotes;
e.SeriesItem.YValue = (
double
)r.result;
}
}
protected
void
buildChartXAxis()
{
int
idx = 0;
int
planCount = 1;
RethinkAutismDataContext ctx =
new
RethinkAutismDataContext();
var behavior = (from b
in
ctx.BehaviorTrackings
where b.Id == behaviorId
select b).SingleOrDefault();
trackingMethod = behavior.MethodTypeLU.Name;
int
resultCount = 0;
List<dataReportForBehaviorPlanResult> result = ctx.dataReportForBehaviorPlan(ChildProfileId, behaviorId, Plan).ToList();
intervalMinutes = (
int
)behavior.IntervalsofMinutes;
resultCount = result.Count();
if
(resultCount > 0)
{
if
(resultCount < 21)
{
IEnumerator ieResult = result.GetEnumerator();
ieResult.MoveNext();
dataReportForBehaviorPlanResult resultSummary = (dataReportForBehaviorPlanResult)ieResult.Current;
trcBehaviorData.PlotArea.XAxis.AutoScale =
false
;
trcBehaviorData.PlotArea.XAxis.AddRange(1, 21, 1);
for
(
int
i = 0; i < 21; i++)
{
trcBehaviorData.PlotArea.XAxis[i].TextBlock.Text = (i + 1).ToString();
}
}
if
(resultCount > 20)
{
trcBehaviorData.PlotArea.XAxis.AutoScale =
false
;
trcBehaviorData.PlotArea.XAxis.AddRange(1, resultCount + 1, 1);
IEnumerator ieResult = result.GetEnumerator();
while
(ieResult.MoveNext())
{
dataReportForBehaviorPlanResult resultSummary = (dataReportForBehaviorPlanResult)ieResult.Current;
trcBehaviorData.PlotArea.XAxis[idx].TextBlock.Text = planCount.ToString();
idx++;
planCount++;
}
}
}
}
protected
void
buildChartYAxis()
{
RethinkAutismDataContext ctx =
new
RethinkAutismDataContext();
var behavior = (from b
in
ctx.BehaviorTrackings
where b.Id == behaviorId
select b).SingleOrDefault();
trackingMethod = behavior.MethodTypeLU.Name;
double
yAxisLabel = 0;
switch
(trackingMethod)
{
case
"Intervals"
:
trcBehaviorData.PlotArea.YAxis.AutoScale =
false
;
trcBehaviorData.PlotArea.YAxis.AddRange(1, 120, 10);
for
(
int
i = 0; i < 11; i++)
{
trcBehaviorData.PlotArea.YAxis[i].TextBlock.Text = yAxisLabel.ToString() +
"%"
;
yAxisLabel += 10;
}
trcBehaviorData.PlotArea.YAxis[11].TextBlock.Text =
"Intervals"
;
trcBehaviorData.PlotArea.YAxis[12].TextBlock.Text =
"% of"
;
break
;
case
"Frequency"
:
trcBehaviorData.PlotArea.YAxis.AutoScale =
false
;
trcBehaviorData.PlotArea.YAxis.AddRange(1, 23, 1);
for
(
int
i = 0; i < 21; i++)
{
trcBehaviorData.PlotArea.YAxis[i].TextBlock.Text = yAxisLabel.ToString();
yAxisLabel +=1;
// yAxisLabel + Convert.ToDouble(0.5);
}
trcBehaviorData.PlotArea.YAxis[21].TextBlock.Text =
"/ day"
;
trcBehaviorData.PlotArea.YAxis[22].TextBlock.Text =
"times"
;
break
;
//trcBehaviorData.PlotArea.YAxis.AutoScale = false;
//double maxValue = Convert.ToDouble(trcBehaviorData.PlotArea.YAxis.MaxValue);
//trcBehaviorData.PlotArea.YAxis.AddRange(1, maxValue, .1);
//maxValue -= 1;
//for (int i = 0; i < maxValue; i++)
//{
// trcBehaviorData.PlotArea.YAxis[i].TextBlock.Text = yAxisLabel.ToString();
// yAxisLabel = yAxisLabel + Convert.ToDouble(0.1);
//}
////maxValue = Convert.ToInt32(trcBehaviorData.PlotArea.YAxis.MaxValue);
//trcBehaviorData.PlotArea.YAxis[Convert.ToInt32(maxValue)].TextBlock.Text = "/ hour";
//maxValue += Convert.ToDouble(0.5);
//trcBehaviorData.PlotArea.YAxis[Convert.ToInt32(maxValue)].TextBlock.Text = "times";
//break;
case
"Duration"
:
trcBehaviorData.PlotArea.YAxis.AutoScale =
false
;
trcBehaviorData.PlotArea.YAxis.AddRange(1, 60, 5);
for
(
int
i = 0; i < 12; i++)
{
trcBehaviorData.PlotArea.YAxis[i].TextBlock.Text = yAxisLabel.ToString();
yAxisLabel += 5;
}
trcBehaviorData.PlotArea.YAxis[12].TextBlock.Text =
"Min"
;
break
;
}
}
<
telerik:RadChart
ID
=
"trcBehaviorPlanData"
runat
=
"server"
DataSourceID
=
"behaviorPlanSummary"
DefaultType
=
"Line"
Width
=
"810px"
Height
=
"350px"
>
<
Series
>
<
cc1:ChartSeries
Name
=
"dataMeasurement"
DataYColumn
=
"result"
Type
=
"Line"
DataLabelsColumn
=
"date"
>
<
Appearance
ShowLabels
=
"true"
PointDimentions-AutoSize
=
"False"
PointDimentions-Height
=
"10px"
PointDimentions-Width
=
"30px"
>
<%--graph line color--%>
<
FillStyle
FillType
=
"Solid"
MainColor
=
"47, 127, 172"
>
</
FillStyle
>
<
PointMark
Dimensions-AutoSize
=
"False"
Dimensions-Height
=
"8px"
Dimensions-Width
=
"40px"
Visible
=
"True"
>
</
PointMark
>
<
TextAppearance
TextProperties-Color
=
"78, 168, 188"
>
</
TextAppearance
>
<
Border
Color
=
"177, 215, 250"
/>
</
Appearance
>
</
cc1:ChartSeries
>
</
Series
>
<
PlotArea
>
<
XAxis
>
<
Appearance
Color
=
"226, 218, 202"
MajorTick-Color
=
"221, 235, 244"
>
<
MajorGridLines
Color
=
"221, 235, 244"
/>
<
TextAppearance
TextProperties-Color
=
"81, 99, 100"
>
</
TextAppearance
>
</
Appearance
>
<
AxisLabel
>
<
TextBlock
>
<
Appearance
TextProperties-Color
=
"78, 168, 188"
>
</
Appearance
>
</
TextBlock
>
</
AxisLabel
>
</
XAxis
>
<
YAxis
AxisMode
=
"Normal"
Appearance-LabelAppearance-Position-AlignedPosition
=
"Center"
>
<
Appearance
Color
=
"226, 218, 202"
MajorTick-Color
=
"221, 235, 244"
MinorTick-Color
=
"221, 235, 244"
>
<
MajorGridLines
Color
=
"247, 251, 252"
/>
<
MinorGridLines
Color
=
"247, 251, 252"
/>
<
TextAppearance
TextProperties-Color
=
"81, 99, 100"
>
</
TextAppearance
>
</
Appearance
>
<
AxisLabel
>
<
TextBlock
>
<
Appearance
TextProperties-Color
=
"247, 251, 252"
>
</
Appearance
>
</
TextBlock
>
</
AxisLabel
>
</
YAxis
>
<
Appearance
Dimensions-Width
=
"30"
Dimensions-Margins
=
"40px, 30px, 15%, 9%"
>
<%--graph background color--%>
<
FillStyle
MainColor
=
"247, 251, 252"
SecondColor
=
"Transparent"
>
</
FillStyle
>
<
Border
Color
=
"221, 235, 244"
/>
</
Appearance
>
</
PlotArea
>
<
Appearance
BarWidthPercent
=
"20"
Corners
=
"Round, Round, Round, Round, 5"
>
<
FillStyle
MainColor
=
"247, 251, 252"
>
</
FillStyle
>
<
Border
Color
=
"188, 229, 231"
Width
=
"1"
/>
</
Appearance
>
<
ChartTitle
>
<
Appearance
Dimensions-Margins
=
"4%, 10px, 10px, 7%"
>
<
FillStyle
MainColor
=
""
>
</
FillStyle
>
</
Appearance
>
<
TextBlock
Text
=
""
>
<
Appearance
TextProperties-Color
=
"232, 140, 0"
TextProperties-Font
=
"Verdana, 20pt, style=Bold"
>
</
Appearance
>
</
TextBlock
>
</
ChartTitle
>
<
Legend
>
<
Appearance
Visible
=
"false"
Position-AlignedPosition
=
"TopLeft"
>
<
ItemTextAppearance
TextProperties-Color
=
"81, 99, 100"
>
</
ItemTextAppearance
>
<
Border
Color
=
"247, 251, 252"
/>
</
Appearance
>
<
TextBlock
Visible
=
"true"
>
</
TextBlock
>
</
Legend
>
</
telerik:RadChart
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"gridview1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"gridview2"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"gridview3"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
function refreshGrid1(arg) {
if (!arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("gridview1");
}
}
function refreshGrid2N3(arg) {
if (!arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("gridview2n3");
}
}
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
>