Do not load the resource at the appointment

4 posts, 0 answers
  1. Emmanuel
    Emmanuel avatar
    7 posts
    Member since:
    Sep 2018

    Posted 08 Oct 2018 Link to this post

    Hello,

    I did all the steps in the documentation, I do not load the selected resource of the appointment, but if they are saving in the database the 3 tables

    I need help, what am I doing wrong

    I leave the code and attach images

     

            public radForm1()
            {
                InitializeComponent();

                AppointmentsTableAdapter appointmentsTableAdapter = new AppointmentsTableAdapter();
                appointmentsTableAdapter.Fill(testDataSet.Appointments);

                ResourcesTableAdapter resourcesTableAdapter = new ResourcesTableAdapter();
                resourcesTableAdapter.Fill(testDataSet.Resources);

                AppointmentsResourcesTableAdapter appointmentsResourcesTableAdapter = new AppointmentsResourcesTableAdapter();
                appointmentsResourcesTableAdapter.Fill(testDataSet.AppointmentsResources);

            }

      private void radButtonSave_Click(object sender, EventArgs e)
            {
                AppointmentsTableAdapter appointmentsTableAdapter = new AppointmentsTableAdapter();
                AppointmentsResourcesTableAdapter appointmentsResourcesTableAdapter = new AppointmentsResourcesTableAdapter();

                TestDataSet.AppointmentsResourcesDataTable deletedChildRecords =
                    this.testDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted)
                    as TestDataSet.AppointmentsResourcesDataTable;

                TestDataSet.AppointmentsResourcesDataTable newChildRecords =
                  this.testDataSet.AppointmentsResources.GetChanges(DataRowState.Added)
                  as TestDataSet.AppointmentsResourcesDataTable;

                TestDataSet.AppointmentsResourcesDataTable modifiedChildRecords =
                this.testDataSet.AppointmentsResources.GetChanges(DataRowState.Modified)
                as TestDataSet.AppointmentsResourcesDataTable;

                try
                {
                    if (deletedChildRecords != null)
                    {
                        appointmentsResourcesTableAdapter.Update(deletedChildRecords);
                    }
                    appointmentsTableAdapter.Update(this.DataSet.Appointments);

                    if (newChildRecords != null)
                    {
                        appointmentsResourcesTableAdapter.Update(newChildRecords);
                    }

                    if (modifiedChildRecords != null)
                    {
                        appointmentsResourcesTableAdapter.Update(modifiedChildRecords);
                    }

                    this.DataSet.AcceptChanges();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    if (deletedChildRecords != null)
                        deletedChildRecords.Dispose();

                    if (newChildRecords != null)
                        newChildRecords.Dispose();

                    if (modifiedChildRecords != null)
                        modifiedChildRecords.Dispose();

                }
            }

     

  2. Emmanuel
    Emmanuel avatar
    7 posts
    Member since:
    Sep 2018

    Posted 08 Oct 2018 Link to this post

    Only the appointment does not link the correct resource but the list of resources is filled.
  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3323 posts

    Posted 10 Oct 2018 Link to this post

    Hello, Emmanuel, 

    One possible problem for not matching the appointments with the respective resource is if the resource id in the appointment doesn't match the type  of the id for the resource itself. For such cases, RadScheduler offers SchedulerMapping where you can convert the value of the id to an EventId. I have attached a sample project for your reference. There is also a back up file of my sample database included in the zip.

    If you are still experiencing any further difficulties, feel free to submit a support ticket from your account and our support staff will gladly assist you in resolving this case.

    I hope this information helps.

     Regards,
    Dess
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  4. Emmanuel
    Emmanuel avatar
    7 posts
    Member since:
    Sep 2018

    Posted 10 Oct 2018 Link to this post

    Thanks for answering, I have already solved this.

    Con solo colocarle este metodo this.schedulerBindingDataSource1.Rebind();

             public radForm1 ()
             {
                 InitializeComponent ();

                 AppointmentsTableAdapter nightsTableAdapter = new AppointmentsTableAdapter ();
                 lettersTableAdapter.Fill (testDataSet.Appointments);

                 ResourcesTableAdapter resourcesTableAdapter = new ResourcesTableAdapter ();
                 resourcesTableAdapter.Fill (testDataSet.Resources);

                 AppointmentsResourcesTableAdapterpointmentResourcesTableAdapter = new AppointmentsResourcesTableAdapter ();
                 creditsResourcesTableAdapter.Fill (testDataSet.AppointmentsResources);

                 this.schedulerBindingDataSource1.Rebind ();
             }

Back to Top