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(); }
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; } }
/// <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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; } }
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; }
public void MarkOld() { DeletedList.Clear(); foreach (C child in this) { child.MarkOld(); } }
public void MockUpdated() { foreach (var item in this) { item.MockUpdated(); } DeletedList.Clear(); }
/// <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; } }
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(); }
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; } }
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(); } }
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); } }
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(); } }
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); } } } }
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); } } } }
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; } }