Edited Appointment Not Saved

4 posts, 0 answers
  1. Aaron
    Aaron avatar
    29 posts
    Member since:
    May 2011

    Posted 13 Jan 2012 Link to this post

    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
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Aaron
    Aaron avatar
    29 posts
    Member since:
    May 2011

    Posted 20 Jan 2012 Link to this post

    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

  5. Aaron
    Aaron avatar
    29 posts
    Member since:
    May 2011

    Posted 20 Jan 2012 Link to this post

    Scratch that, the resources are showing up correctly.  Problem solved.


    Cheers,
    Aaron
Back to Top