Ejemplo n.º 1
0
        internal static String Save(DB.CAL_Calendar entry, DataContext dataContext)
        {
            try
            {
                if (dataContext.EntityCalendarContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached)
                {
                    dataContext.EntityCalendarContext.CAL_Calendar.Add(entry);
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                return(dataContext.PackageValidationException());
            }

            return("Success");
        }
Ejemplo n.º 2
0
 private void schedulerStorage1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
 {
     try
     {
         foreach (Appointment apt in e.Objects)
         {
             DB.CAL_Calendar o = apt.GetSourceObject((SchedulerStorage)sender) as DB.CAL_Calendar;
             if (o != null)
             {
                 try
                 {
                     using (TransactionScope transaction = DataContext.GetTransactionScope())
                     {
                         BL.EntityController.SaveCAL_Calendar(o, DataContext);
                         DataContext.SaveChangesEntityCalendarContext();
                         schedulerStorage1.SetAppointmentId(apt, o.Id);
                         RefreshData();
                         DataContext.CompleteTransaction(transaction);
                     }
                     DataContext.EntityCalendarContext.AcceptAllChanges();
                 }
                 catch (Exception ex)
                 {
                     DataContext.EntityCalendarContext.RejectChanges();
                     HasErrors = true;
                     if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                     {
                         throw ex;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }