public override void Execute(UpdatePersonOrderContainer container) { Group group = container.Group; int parentOrderNo = group.FindPerson(container.UpdateOrderNoData.BaseItemId.Value).OrderNo.Value; List <Person> persons = group.FindPersons(container.UpdateOrderNoData.PersonIdsToUpdate); persons.ForEach(n => n.UpdateOrderNo(parentOrderNo)); }
private void UpdateOrderNo(UpdatePersonOrderNo data, Group group) { var updateOrderNoService = new UpdatePersonOrderNoService(); var container = new UpdatePersonOrderContainer { UpdateOrderNoData = data, Group = group }; updateOrderNoService.UpdateOrderNo(data.UpdateType, container); }
public override void Execute(UpdatePersonOrderContainer container) { Group group = container.Group; List <int> idsToUpdate = container.UpdateOrderNoData.PersonIdsToUpdate; int?maxOrderNo = group.GetMaxPersonOrderNo(idsToUpdate); List <Person> persons = group.FindPersons(idsToUpdate); persons.ForEach(n => n.UpdateOrderNo(maxOrderNo.HasValue ? maxOrderNo.Value + 1 : 0)); }
public override void Execute(UpdatePersonOrderContainer container) { Group group = container.Group; int orderNoFrom = group.FindPerson(container.UpdateOrderNoData.BaseItemId.Value).OrderNo.Value; // i'm sure that found person hs order no List <int> personIdsToUpdate = container.UpdateOrderNoData.PersonIdsToUpdate; List <Person> persons = group.FindPersonsWithOrderNumberGraterThan(orderNoFrom, personIdsToUpdate); persons.ForEach(n => n.UpdateOrderNo(n.OrderNo.Value + 1)); // all persons placed after the one which was inserted group.FindPersons(personIdsToUpdate).ForEach(n => n.UpdateOrderNo(orderNoFrom)); }
public void UpdateOrderNo(UpdateOrderNoType key, UpdatePersonOrderContainer container) { _updateOrderNoService.Execute(key, container); }
public abstract void Execute(UpdatePersonOrderContainer data);