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

[Solved] Edit Appointment Subject on the Button Click

0 Answers 116 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
chaitanya elluri
Top achievements
Rank 1
chaitanya elluri asked on 09 Dec 2009, 10:30 AM
Hi All,

I am implementing the Rad Scheduler Control by creating the Appointments through Drag and Drop feature.I implemented a Advance Edit Form where i took two comboboxes with tasks and the BreakTime...
and on the top of the scheduler i took 3 buttons TaskView,BreakView and Shift(appointment)View.
so when ever i click on the button the subject of the appointement should be updated based on the selected one.(say if i clicked on the task view ,the subject field should contain the tasks assigned for that appointment).I tried it writting the code inside the appointment -created event but i am getting the error as "Collection was modified; enumeration may not execute " I dont know the reason why i am gettiing this..
Here is the code i implemented..

protected

 

void RSchedulerTemplate_OnAppointmentCreated(object sender, AppointmentCreatedEventArgs e)
{  

 

ViewScheduler(

string ViewType);
}
private
void ViewScheduler(string ViewType)
{

 

for (int i = 0; i < DRMSession.DTScheduler.Rows.Count; i++)
{

 

ShiftDetails sDetails = GetShiftData(DRMSession.DTScheduler.Rows[i]["schedulerid"].ToString());  

 

 

 

 

// assign startOffSet hours and minutes 

 

TimeSpan startTime = TimeSpan.FromTicks(sDetails.startOffset);

 

TimeSpan endTime = TimeSpan.FromTicks(sDetails.Duration);

 

TimeSpan startOffSet = new TimeSpan(startTime.Hours, startTime.Minutes, 0);

 

DateTime startOffSetDate = new DateTime(startOffSet.Ticks);

 

// assign duration hours and minutes  

 

 

TimeSpan duration = new TimeSpan(endTime.Hours, endTime.Minutes, 0);

 

DateTime durationDate = new DateTime(duration.Ticks);

 

// startOffSet and duration formatting result

 

string startOffSetResult = startOffSetDate.ToString("hh:mm tt");

 

string durationResult = durationDate.ToString("hh:mm tt");

 

string jobGroupName = string.Empty;

 

foreach (JobGroup jGroup in JobGroups)
{

 

 

if (jGroup.Id == sDetails.jobGroupId) {

jobGroupName = jGroup.Name;

 

break; }

 

}

 

switch (ViewType) {

 

case "Shift":

 

 {

 

DRMSession.DTScheduler.Rows[i]["name"] = jobGroupName + " # " + startOffSetResult + " - " + durationResult;

 

 }

 

break;

 

 

case "Task":

 

 { 

 

if (sDetails.LstTaskIds.Count > 0)  

{

 

string tasksList = string.Empty;

 

 

foreach (Task tsk in Tasks)

 

 {

 

foreach (int taskId in sDetails.LstTaskIds)

 

 {

 

if (tsk.Id == taskId)

 

 {

tasksList +=

Environment.NewLine + tsk.Title;

 

 }

}

}

 

DRMSession.DTScheduler.Rows[i]["name"] = jobGroupName + Environment.NewLine + " # " + startOffSetResult + " - " + durationResult + Environment.NewLine + tasksList;

 

 }

}

 

break;

 

 

case "Break":

 

 {

 

if (sDetails.LstBreakIds.Count > 0)

 

 {

 

string breakTypes = string.Empty;

 

 

foreach (BreakType bType in BreakType)

 

 {

 

for (int Cnt = 0; Cnt < sDetails.LstBreakIds.Count; Cnt++)

 

 {

 

if (sDetails.LstBreakIds[Cnt] == bType.Id)

 

 {

breakTypes +=

Environment.NewLine + bType.Type + "-" + DateTime.Parse(sDetails.LstBreakTime[Cnt].ToString()).TimeOfDay;

 

}

}

}

 

DRMSession.DTScheduler.Rows[i]["name"] = jobGroupName + Environment.NewLine + " # " + startOffSetResult + " - " + durationResult + Environment.NewLine + breakTypes;

 

 }

}

 

break;

 

 }

}

RSchedulerTemplate.DataSource =

DRMSession.DTScheduler;  

 

RSchedulerTemplate.Rebind();

}

 

protected void btnShiftView_Click(object sender, EventArgs e)

 

 {

ViewType =

"Shift";  

 

ViewScheduler(ViewType);

}

 

protected void btnTaskView_Click(object sender, EventArgs e)

 {

ViewType =

"Task";

 

 ViewScheduler(ViewType);

}

 

protected void btnBreakView_Click(object sender, EventArgs e)

 

 {

ViewType =

"Break";

 

 ViewScheduler(ViewType);

}
This is a crucial requirement. Appreciate any help in this regard.

 

 

 

No answers yet. Maybe you can help?

Tags
Scheduler
Asked by
chaitanya elluri
Top achievements
Rank 1
Share this question
or