Example #1
0
        public static void UpdateActivity(int activityID, ProviderEDSC.ActivityDTRow ActivityDetailDR, ProviderEDSC.ActivityContactDetailDTRow contactDetailsDR, ProviderEDSC.ActivityGroupingDTRow ActGroupingDR, ProviderEDSC.ActivityScheduleDTDataTable ActScheduleDT)
        {
            ProviderDAC dac = new ProviderDAC();

            dac.DeleteActivitySchedules(activityID);
            using (TransactionScope trans = new TransactionScope())
            {
                ActivityDetailDR.ID = contactDetailsDR.ActivityID = ActGroupingDR.ActivityID = activityID;
                //Activity was update, Create other
                dac.UpdateActivities(ActivityDetailDR);


                //CreateContactDetails
                dac.UpdateActivityContactDetail(contactDetailsDR);

                //Delete old Schedule before insert new one

                if (ActScheduleDT != null)
                {
                    //Create Schedule
                    foreach (var ActScheduleDR in ActScheduleDT)
                    {
                        ActScheduleDR.ActivityID = activityID;
                        dac.CreateActivitySchedule(ActScheduleDR);
                    }
                }
                //Create Grouping
                dac.UpdateActivityGrouping(ActGroupingDR);


                trans.Complete();
            }
        }