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

Edited Appointment Not Saved

3 Answers 72 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Aaron
Top achievements
Rank 1
Aaron asked on 13 Jan 2012, 08:52 PM
Hello,

I have three RadGridViews that list appointments from a RadScheduleView.  From within the RowActivated event handler of the RadGridViews I take the selected appointment (SqlAppointment) and execute the EditAppointment command:

private void rgvAppointments_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
{
    GridViewRowItem row = e.Row
as GridViewRowItem;
    TextBlock sqlAppointmentId = row.Cells[0].Content
as TextBlock;
    
int apptID = Convert.ToInt32(sqlAppointmentId.Text);
    
foreach (SqlAppointment a in this.rgvAppointments.Items)
    {
        
if (a.SqlAppointmentId == apptID)
        {
            RadScheduleViewCommands.EditAppointment.Execute(a,
this.radScheduleView1);
            
return;
        }
    }
}

This works as expected except for two things.

  1. When the edit dialog opens, Resources associated with the appointment don't show up.  It's like the appointment has no resources.
  2. When I click 'Ok' from the edit dialog the RadGridView reflects the changes made, but the RadScheduleView does not.  Also, if I close the application and run it again, the changes are lost.  So anything that is done in the edit dialog is not getting back to the database.

What am I missing?
Thanks

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 19 Jan 2012, 08:33 AM
Hello Aaron,

Could you please open a support ticket and send us a simple project demonstrating these issues there? We need to observe the problems at our side in order to provide a suitable solution. Thanks in advance

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aaron
Top achievements
Rank 1
answered on 20 Jan 2012, 04:58 PM

While putting together a sample project illustrating the problem I was having, I came up with a partial solution.  This code works:

if (this.radScheduleView1.BeginEdit(appointment))

{

RadScheduleViewCommands.EditAppointment.Execute(appointment,

       this.radScheduleView1);

}

Whereas this didn’t:

RadScheduleViewCommands.EditAppointment.Execute(appointment,

this.radScheduleView1);

The only problem now is that when the edit dialog opens, the resources attached to the appointment aren’t being set.  The combo box with all the possible resources is there, but none are set.  I get the appointment via an asynchronous load operation with a domain service.  This is the process:

/// <summary>

/// Occurs when a row in the Appointments RadGridView is double clicked. Initiates a

/// load operation to retrieve the SqlAppointment record that was selected in the

/// RadGridView.

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void rgvAppointments_RowActivated(object sender,

Telerik.Windows.Controls.GridView.RowEventArgs e)

{

SqlAppointment appt = rgvAppointments.CurrentItem as SqlAppointment;

LoadOperation<SqlAppointment> loadAppointment = ScheduleViewRepository.Context

.Load(ScheduleViewRepository.Context.GetSqlAppointmentByIDQuery(

appt.SqlAppointmentId));

loadAppointment.Completed += new EventHandler(loadAppointment_Completed);

}

/// <summary>

/// Begins an edit transaction for the loaded Appointment Class SqlAppointment and

/// executes the EditAppointment RadScheduleViewCommand.

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

void loadAppointment_Completed(object sender, EventArgs e)

{

LoadOperation<SqlAppointment> op = sender as LoadOperation<SqlAppointment>;

SqlAppointment appointment = op.Entities.FirstOrDefault<SqlAppointment>();

if (this.radScheduleView1.BeginEdit(appointment))

{

RadScheduleViewCommands.EditAppointment.Execute(appointment,

       this.radScheduleView1);
}

}

Do the resources need to be loaded and attached to the SqlAppointment somehow?


Thanks,
Aaron

0
Aaron
Top achievements
Rank 1
answered on 20 Jan 2012, 05:45 PM
Scratch that, the resources are showing up correctly.  Problem solved.


Cheers,
Aaron
Tags
ScheduleView
Asked by
Aaron
Top achievements
Rank 1
Answers by
Yana
Telerik team
Aaron
Top achievements
Rank 1
Share this question
or