protected override void Execute(NativeActivityContext context) { var manager = GetBaseManager(); var uw = BeginTransactionActivity.GetUnitOfWork(context); if (uw != null) { manager.SetUnitOfWork(uw); } var item = Key.Get(context); if (!IsNotUpdateInnerEntities) { var serializable = item as ICustomXmlSerializable; if (serializable != null) { serializable.OverrideIgnore = false; } } var isNew = item as IIsNew; if (IsNew || isNew != null && isNew.IsNew) { manager.Insert(ref item); context.SetValue(Key, item); } else { manager.Update(Key.Get(context)); } }
protected override void Execute(NativeActivityContext context) { var manager = GetBaseManager(); var uow = BeginTransactionActivity.GetUnitOfWork(context); if (uow != null) { manager.SetUnitOfWork(uow); } manager.Delete(Key.Get(context)); }
protected override void Execute(NativeActivityContext context) { //TODO: сделать возможность часичного получения var manager = GetBaseManager(); var uow = BeginTransactionActivity.GetUnitOfWork(context); if (uow != null) { manager.SetUnitOfWork(uow); } context.SetValue(Result, manager.GetAll(Mode).ToList()); }
protected override void Execute(NativeActivityContext context) { var key = Key.Get(context); if (key == null) { throw new DeveloperException("Не задан обазательный параметр Key"); } var manager = GetBaseManager(); var uow = BeginTransactionActivity.GetUnitOfWork(context); if (uow != null) { manager.SetUnitOfWork(uow); } var result = manager.Get(key, Mode); context.SetValue(Result, result); }
protected override void Execute(NativeActivityContext context) { var itemType = typeof(T); var isHistory = itemType.IsGenericType && typeof(IHistoryItem).IsAssignableFrom(itemType); if (isHistory) { itemType = itemType.GetGenericArguments()[0]; } var mgrInterface = typeof(IBaseManager <>).MakeGenericType(itemType); var mgr = (IBaseManager)IoC.Instance.Resolve(mgrInterface); var uow = BeginTransactionActivity.GetUnitOfWork(context); if (uow != null) { mgr.SetUnitOfWork(uow); } mgr.ClearCache(); var filter = Filter.Get(context); List <object> result; if (isHistory) { var historyMgr = (IHistoryManager)mgr; var res = string.IsNullOrEmpty(AttrEntity) ? historyMgr.GetHistory(filter, Mode).ToList() : historyMgr.GetHistory(filter, AttrEntity).ToList(); result = res; } else { result = string.IsNullOrEmpty(AttrEntity) ? mgr.GetFiltered(filter, Mode).ToList() : mgr.GetFiltered(filter, AttrEntity).ToList(); } context.SetValue(Result, result.Cast <T>().ToList()); }
protected override void Execute(NativeActivityContext context) { var manager = GetBaseManager(); var stateMgr = manager as IStateChange; if (stateMgr == null) { throw new NotImplementedException("IStateChange"); } var uow = BeginTransactionActivity.GetUnitOfWork(context); if (uow != null) { manager.SetUnitOfWork(uow); } var key = Key.Get(context); stateMgr.ChangeStateByKey(key, Operation.Get(context)); context.SetValue(Result, manager.Get(key)); }