Пример #1
0
        protected override void DataPortal_Update()
        {
            bool cancel = false;

            OnUpdating(ref cancel);
            if (cancel)
            {
                return;
            }

            RaiseListChangedEvents = false;

            for (int index = 0; index < DeletedList.Count; index++)
            {
                DeletedList[index] = DeletedList[index].Save();
            }

            DeletedList.Clear();

            for (int index = 0; index < Items.Count; index++)
            {
                Items[index] = Items[index].Save();
            }

            RaiseListChangedEvents = true;

            OnUpdated();
        }
Пример #2
0
        protected virtual void Child_Update(params object[] parameters)
        {
            var oldRLCE = this.RaiseListChangedEvents;

            this.RaiseListChangedEvents = false;
            try
            {
                foreach (var child in DeletedList)
                {
                    DataPortal.UpdateChild(child, parameters);
                }
                DeletedList.Clear();

                foreach (var child in this)
                {
                    if (child.IsDirty)
                    {
                        DataPortal.UpdateChild(child, parameters);
                    }
                }
            }
            finally
            {
                this.RaiseListChangedEvents = oldRLCE;
            }
        }
Пример #3
0
        /// <summary>
        /// Realiza el Save de los objetos de la lista. Inserta, Actualiza o Borra en función
        /// de los flags de cada objeto de la lista
        /// </summary>
        /// <param name="parent">BusinessBaseEx padre de la lista</param>
        internal void Update(Expedient parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (LineaFomento obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (LineaFomento obj in this)
            {
                if (!this.Contains(obj))
                {
                    if (obj.IsNew)
                    {
                        SetNextCode(parent, obj);
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }

            this.RaiseListChangedEvents = true;
        }
        internal void Update(PlanEstudios parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (ClasePractica obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // 'now' that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (ClasePractica obj in this)
            {
                if (obj.OidModulo != 0 && obj.OidSubmodulo != 0)
                {
                    if (obj.IsNew)
                    {
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #5
0
 internal void Update(Employee employee)
 {
     this.RaiseListChangedEvents = false;
     try
     {
         // update (thus deleting) any deleted child objects
         foreach (EmployeeOrder obj in DeletedList)
         {
             obj.Delete();                    // TODO: Should this be SQLDelete
         }
         // now that they are deleted, remove them from memory too
         DeletedList.Clear();
         // add/update any current child objects
         foreach (EmployeeOrder obj in this)
         {
             if (obj.IsNew)
             {
                 obj.Insert(employee);
             }
             else
             {
                 obj.Update(employee);
             }
         }
     }
     finally
     {
         this.RaiseListChangedEvents = true;
     }
 }
        internal void Update(Instructor_Promocion parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Submodulo_Instructor_Promocion obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (Submodulo_Instructor_Promocion obj in this)
            {
                if (obj.OidPromocion != 0)
                {
                    if (obj.IsNew)
                    {
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #7
0
        internal void Update(User usuario)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (SchemaUser obj in DeletedList)
            {
                obj.DeleteSelf(usuario);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (SchemaUser obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(usuario);
                }
                else
                {
                    obj.Update(usuario);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #8
0
        protected override void DataPortal_Update()
        {
            RaiseListChangedEvents = false;

            using (var ctx = ConnectionManager <SqlConnection> .GetManager(Helper.DatabaseConnectionString))
            {
                // loop through each deleted child object
                foreach (var deletedChild in DeletedList)
                {
                    deletedChild.DeleteSelf(ctx.Connection);
                }
                DeletedList.Clear();

                // loop through each non-deleted child object
                foreach (var child in this)
                {
                    if (child.IsNew)
                    {
                        child.Insert(ctx.Connection);
                    }
                    else
                    {
                        child.Update(ctx.Connection);
                    }
                }
            } //using SqlConnection

            RaiseListChangedEvents = true;
        }
        internal void Update(Alumno_Examen parent, ISession sesion)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Respuesta_Alumno_Examen obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (Respuesta_Alumno_Examen obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent, sesion);
                }
                else
                {
                    obj.Update(parent, sesion);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #10
0
        internal void Update(InformeAmpliacion parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (NotificacionInterna obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (NotificacionInterna obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #11
0
        protected override void DataPortal_Update()
        {
            this.RaiseListChangedEvents = false;
            using (SqlConnection cn = new SqlConnection(Database.ConnectionString))
            {
                cn.Open();

                foreach (JobType item in DeletedList)
                {
                    item.DeleteSelf(cn);
                }
                DeletedList.Clear();

                foreach (JobType item in this)
                {
                    if (item.IsNew)
                    {
                        item.Insert(cn);
                    }
                    else
                    {
                        item.Update(cn);
                    }
                }
            }
            this.RaiseListChangedEvents = true;
        }
        internal void Update(InputDelivery parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (AlbaranFacturaProveedor obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (AlbaranFacturaProveedor obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #13
0
        public void Update(IAcreedor parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (PayrollBatch obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (PayrollBatch obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #14
0
        internal void Update(Serie parent)
        {
            try
            {
                this.RaiseListChangedEvents = false;

                SessionCode = parent.SessionCode;

                // update (thus deleting) any deleted child objects
                foreach (SerieFamilia obj in DeletedList)
                {
                    obj.DeleteSelf(parent);
                }

                // now that they are deleted, remove them from memory too
                DeletedList.Clear();

                // add/update any current child objects
                foreach (SerieFamilia obj in this)
                {
                    if (obj.IsNew)
                    {
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }
            finally
            {
                this.RaiseListChangedEvents = true;
            }
        }
Пример #15
0
        internal void Update(Company parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (ContactoEmpresa obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (ContactoEmpresa obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
        internal void Update(ParteAsistencia parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Clase_Parte obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (Clase_Parte obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Пример #17
0
 public void MarkOld()
 {
     DeletedList.Clear();
     foreach (C child in this)
     {
         child.MarkOld();
     }
 }
Пример #18
0
 public void MockUpdated()
 {
     foreach (var item in this)
     {
         item.MockUpdated();
     }
     DeletedList.Clear();
 }
Пример #19
0
        /// <summary>
        /// Realiza el Save de los objetos de la lista. Inserta, Actualiza o Borra en función
        /// de los flags de cada objeto de la lista
        /// </summary>
        /// <param name="reader">IDataReader origen</param>
        protected override void DataPortal_Update()
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Pesaje obj in DeletedList)
            {
                obj.DeleteSelf(this);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            try
            {
                // add/update any current child objects
                foreach (Pesaje obj in this)
                {
                    if (!this.Contains(obj))
                    {
                        if (obj.IsNew)
                        {
                            SetNextCode(obj);
                            obj.Insert(this);
                        }
                        else
                        {
                            obj.Update(this);
                        }
                    }
                }

                if (!SaveAsChildList)
                {
                    Transaction().Commit();
                }
            }
            catch (Exception ex)
            {
                if (!SaveAsChildList)
                {
                    if (Transaction() != null)
                    {
                        Transaction().Rollback();
                    }
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                if (!SaveAsChildList)
                {
                    BeginTransaction();
                }
                this.RaiseListChangedEvents = true;
            }
        }
Пример #20
0
        protected override void DataPortal_Update()
        {
            bool success = false;

            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (TipoAnimal obj in DeletedList)
            {
                obj.DeleteSelf(this);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            try
            {
                // add/update any current child objects
                foreach (TipoAnimal obj in this)
                {
                    if (!ExistOtherItem(obj))
                    {
                        if (obj.IsNew)
                        {
                            obj.Insert(this);
                        }
                        else
                        {
                            obj.Update(this);
                        }
                    }
                }

                Transaction().Commit();

                success = true;
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                if (!success)
                {
                    if (Transaction() != null)
                    {
                        Transaction().Rollback();
                    }
                }

                BeginTransaction();
                this.RaiseListChangedEvents = true;
            }
        }
        /// <summary>
        /// Updates the child object.
        /// </summary>
        /// <param name="parameters">The parameters collection may contain more parameters than needed based on the context it was called. We need to filter this list.</param>
        protected override void Child_Update(params object[] parameters)
        {
            bool cancel = false;

            OnUpdating(ref cancel);
            if (cancel)
            {
                return;
            }

            // We require that one of the parameters be a connection so we can do the CRUD operations.
            var connection = parameters.OfType <SqlConnection>().FirstOrDefault();

            if (connection == null)
            {
                throw new ArgumentNullException("parameters", "Must contain a SqlConnection parameter.");
            }

            RaiseListChangedEvents = false;

            foreach (var item in DeletedList)
            {
                DataPortal.UpdateChild(item, connection);
            }

            DeletedList.Clear();

            // Trim down the list to what is actually contained in the child class.
            var list = new System.Collections.Generic.Dictionary <string, object>()
            {
            };

            foreach (object o in parameters)
            {
                if (o == null)
                {
                    continue;
                }

                var key = o.GetType().ToString();
                if (!list.ContainsKey(key))
                {
                    list.Add(key, o);
                }
            }

            foreach (var item in Items)
            {
                DataPortal.UpdateChild(item, list.Values.ToArray());
            }

            RaiseListChangedEvents = true;

            OnUpdated();
        }
Пример #22
0
        internal void Update(Ticket parent)
        {
            try
            {
                this.RaiseListChangedEvents = false;

                SessionCode = parent.SessionCode;

                // update (thus deleting) any deleted child objects
                foreach (AlbaranTicket obj in DeletedList)
                {
                    if (!GetItem(obj.OidTicket, obj.OidAlbaran))
                    {
                        obj.DeleteSelf(parent);
                    }
                }

                // add/update any current child objects
                foreach (AlbaranTicket obj in this)
                {
                    bool existe = false;

                    if (obj.IsNew)
                    {
                        //Si el albarán se ha eliminado y se ha vuelto a insertar no hay que volver a guardarlo
                        foreach (AlbaranTicket albaran in DeletedList)
                        {
                            if (albaran.OidAlbaran == obj.OidAlbaran)
                            {
                                existe = true;
                                break;
                            }
                        }
                        if (existe)
                        {
                            continue;
                        }
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }

                // now that they are deleted, remove them from memory too
                DeletedList.Clear();
            }
            finally
            {
                this.RaiseListChangedEvents = true;
            }
        }
Пример #23
0
 protected override void DataPortal_Update()
 {
     Csla.ApplicationContext.GlobalContext["CustomerUpdate"] = "Updating Customer List";
     foreach (var oneCustomer in DeletedList)
     {
         oneCustomer.DataPortal_DeleteSelf();
     }
     DeletedList.Clear();
     foreach (var oneCustomer in this)
     {
         oneCustomer.DataPortal_Update();
     }
 }
Пример #24
0
        protected override void DataPortal_Update()
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Payment obj in DeletedList)
            {
                obj.DeleteSelf(this);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            try
            {
                // add/update any current child objects
                foreach (Payment obj in this)
                {
                    if (obj.IsNew)
                    {
                        obj.LastBankLineSerial = GetLastBankLineSerial();
                        SetNextCode(obj);
                        obj.Insert(this);
                    }
                    else
                    {
                        obj.Update(this);
                    }
                }

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (!SharedTransaction && Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                BeginTransaction();
                this.RaiseListChangedEvents = true;
            }
        }
        /// <summary>
        /// Saves the current list, using NHibernate.
        /// </summary>
        /// <param name="session">A reference to an object that implements the NHibernate <see cref="ISession"/> interface.</param>
        public virtual void Save(ISession session)
        {
            // Enumerate all items in the deleted list
            foreach (C businessObject in DeletedList)
            {
                businessObject.Delete(session);
            }

            // Clear the deleted list (as any items that where in there have now been deleted)
            DeletedList.Clear();

            // Enumerate all non-deleted items and persist them
            foreach (C businessObject in this)
            {
                businessObject.Save(session);
            }
        }
Пример #26
0
        protected void DataPortal_Update()
        {
            using (var manager = TransactionManager <SqlConnection, SqlTransaction> .GetManager(TestDBConnection, true))
            {
                foreach (var oneItem in DeletedList)
                {
                    Csla.DataPortal.UpdateChild(oneItem, this);
                }

                foreach (var oneItem in this)
                {
                    Csla.DataPortal.UpdateChild(oneItem, this);
                }

                DeletedList.Clear();

                manager.Commit();
            }
        }
Пример #27
0
        protected virtual void Child_Update(params object[] parameters)
        {
            using (LoadListMode)
            {
                foreach (var child in DeletedList)
                {
                    DataPortal.UpdateChild(child, parameters);
                }
                DeletedList.Clear();

                foreach (var child in this)
                {
                    if (child.IsDirty)
                    {
                        DataPortal.UpdateChild(child, parameters);
                    }
                }
            }
        }
Пример #28
0
        protected virtual void Child_Update(params object[] parameters)
        {
            using (LoadListMode)
            {
                var dp = ApplicationContext.CreateInstance <DataPortal <C> >();
                foreach (var child in DeletedList)
                {
                    dp.UpdateChild(child, parameters);
                }
                DeletedList.Clear();

                foreach (var child in this)
                {
                    if (child.IsDirty)
                    {
                        dp.UpdateChild(child, parameters);
                    }
                }
            }
        }
Пример #29
0
        protected override void DataPortal_Update()
        {
            this.RaiseListChangedEvents = false;

            using (SqlConnection cn = new SqlConnection(Database.ConnectionString))
            {
                cn.Open();
                foreach (MemberFellowship item in DeletedList)
                {
                    item.DeleteSelf(cn);
                }
                DeletedList.Clear();

                foreach (MemberFellowship item in this)
                {
                    item.Update(cn);
                }
            }
            this.RaiseListChangedEvents = true;
        }
        internal void Update(OutputDelivery parent)
        {
            try
            {
                this.RaiseListChangedEvents = false;

                SessionCode = parent.SessionCode;

                LoadLibroGanadero();

                // update (thus deleting) any deleted child objects
                foreach (OutputDeliveryLine obj in DeletedList)
                {
                    obj.DeleteSelf(parent);
                }

                // now that they are deleted, remove them from memory too
                DeletedList.Clear();

                // add/update any current child objects
                foreach (OutputDeliveryLine obj in this)
                {
                    if (obj.IsNew)
                    {
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                this.RaiseListChangedEvents = true;
            }
        }