Beispiel #1
0
        private void SaveDataSet()
        {
            Cursor.Current = Cursors.WaitCursor;

            DateTime date = monthCalendar1.SelectionStart;

            try
            {
                adaScheduleDataSet1.EnforceConstraints = false;

                Activity_ReminderTableAdapter arAdapter = new Activity_ReminderTableAdapter();
                arAdapter.Update(adaScheduleDataSet1.Activity_Reminder.Select("", "", DataViewRowState.Deleted));

                ScheduleTableAdapter scheduleAdapter = new ScheduleTableAdapter();
                scheduleAdapter.Update(adaScheduleDataSet1);

                ActivityTableAdapter activityAdapter = new ActivityTableAdapter();
                activityAdapter.Update(adaScheduleDataSet1);

                ReminderTableAdapter reminderAdapter = new ReminderTableAdapter();
                reminderAdapter.Update(adaScheduleDataSet1);

                arAdapter.Update(adaScheduleDataSet1);

                adaScheduleDataSet1.EnforceConstraints = true;
                adaScheduleDataSet1.AcceptChanges();
            }
            catch (Exception ex)
            {
                ReportError(ex);
            }

            Cursor.Current = Cursors.Default;
        }
Beispiel #2
0
        private void LoadDataSet(ADAScheduleDataSet dataSet, DateTime date, bool loadSymbol)
        {
            try
            {
                dataSet.EnforceConstraints = false;

                UserTableAdapter userAdapter = new UserTableAdapter();
                userAdapter.Fill(dataSet.User);

                ScheduleTableAdapter scheduleAdapter = new ScheduleTableAdapter();
                scheduleAdapter.Fill(dataSet.Schedule, date);

                if (loadSymbol)
                {
                    SymbolTableAdapter symbolAdapter = new SymbolTableAdapter();
                    symbolAdapter.Fill(dataSet.Symbol, date);
                }

                ActivityTableAdapter activityAdapter = new ActivityTableAdapter();
                activityAdapter.Fill(dataSet.Activity, date);

                ReminderTableAdapter reminderAdapter = new ReminderTableAdapter();
                reminderAdapter.Fill(dataSet.Reminder);

                Activity_ReminderTableAdapter arAdapter = new Activity_ReminderTableAdapter();
                arAdapter.Fill(dataSet.Activity_Reminder, date);

                if (loadSymbol)
                {
                    dataSet.EnforceConstraints = true;

                    foreach (ADAScheduleDataSet.ActivityRow activityRow in dataSet.Activity.Rows)
                    {
                        if (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsImageNull())
                        {
                            activityRow.Image = activityRow.SymbolRow.Image;
                        }
                    }
                }

                dataSet.AcceptChanges();
            }
            catch (Exception ex)
            {
                ReportError(ex);
            }
        }