public static void DeleteQuery(int id) { QueryEntity query = new QueryEntity(id); foreach (QueryValueEntity cive in query.QueryValue) { cive.Delete(); } query.Delete(); }
public static string TestPolicy(PolicyDocumentEntity policyDoc, QueryEntity cie) { xmlGenerate gen = new xmlGenerate(); string request = gen.generate(cie); string policy = gen.generate(policyDoc); string res = string.Empty; try { #if REMOTE_SERVICE policyService.TestPolicy policyService = new PolicyBuilder.policyService.TestPolicy(); res = policyService.Test(policy, request); #else policyShimLib.TestPolicyClass tpc = new policyShimLib.TestPolicyClass(); res = tpc.Test(policy, request); #endif } catch (Exception ex) { res = "!!service down!! - try refresh " + ex.Message; } return res; }
public ActionResult TestPolicy(testData vData, int id, int queryInstanceId) { vData.PolicyDocument = new PolicyDocumentEntity(id); QueryEntity cie = new QueryEntity(queryInstanceId); string decision = TestPolicy(vData.PolicyDocument, cie); return Json(new { result = decision, cId = cie.Id, docId = id }); }
public ActionResult TestPolicyDoc(testData vData, int id, FormCollection collection) { vData.PolicyDocument = new PolicyDocumentEntity(id); int? queryInstanceId = null; int parse; if (collection["queryInstanceId"] != null && int.TryParse(collection["queryInstanceId"], out parse)) { queryInstanceId = parse; QueryEntity cie = new QueryEntity(queryInstanceId.Value); TempData["decision"] = TestPolicy(vData.PolicyDocument, cie); } return RedirectToAction("Index", new { id = vData.PolicyDocument.Id, queryId = queryInstanceId }); }
/// <summary> Initializes the class members</summary> private void InitClassMembers() { _attribute = null; _attributeReturnsNewIfNotFound = true; _alwaysFetchAttribute = false; _alreadyFetchedAttribute = false; _query = null; _queryReturnsNewIfNotFound = true; _alwaysFetchQuery = false; _alreadyFetchedQuery = false; PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); }
public ActionResult DuplicateQuery(testData vData, int docId, int id) { vData.PolicyDocument = new PolicyDocumentEntity(docId); vData.Query = new QueryEntity(id); QueryEntity newQuery = new QueryEntity(id); duplicator.MarkEntityDirty(newQuery); newQuery.IsNew = true; newQuery.Description += " copy"; newQuery.Save(); foreach (QueryValueEntity qve in vData.Query.QueryValue) { QueryValueEntity qveNew = new QueryValueEntity(qve.Id); duplicator.MarkEntityDirty(qveNew); qveNew.IsNew = true; qveNew.Query = newQuery; qveNew.Save(); } return RedirectToAction("EditQuery", "test", new { docId = docId, id = newQuery.Id }); }
/// <summary> Removes the sync logic for member _query</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncQuery(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity( _query, new PropertyChangedEventHandler( OnQueryPropertyChanged ), "Query", QueryValueEntity.Relations.QueryEntityUsingQueryId, true, signalRelatedEntity, "QueryValue", resetFKFields, new int[] { (int)QueryValueFieldIndex.QueryId } ); _query = null; }
/// <summary> Retrieves the related entity of type 'QueryEntity', using a relation of type 'n:1'</summary> /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param> /// <returns>A fetched entity of type 'QueryEntity' which is related to this entity.</returns> public virtual QueryEntity GetSingleQuery(bool forceFetch) { if( ( !_alreadyFetchedQuery || forceFetch || _alwaysFetchQuery) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode) { bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(QueryValueEntity.Relations.QueryEntityUsingQueryId); QueryEntity newEntity = new QueryEntity(); if(base.ParticipatesInTransaction) { base.Transaction.Add(newEntity); } bool fetchResult = false; if(performLazyLoading) { fetchResult = newEntity.FetchUsingPK(this.QueryId); } if(fetchResult) { if(base.ActiveContext!=null) { newEntity = (QueryEntity)base.ActiveContext.Get(newEntity); } this.Query = newEntity; } else { if(_queryReturnsNewIfNotFound) { if(performLazyLoading || (!performLazyLoading && (_query == null))) { this.Query = newEntity; } } else { this.Query = null; } } _alreadyFetchedQuery = fetchResult; if(base.ParticipatesInTransaction && !fetchResult) { base.Transaction.Remove(newEntity); } } return _query; }
/// <summary> setups the sync logic for member _query</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncQuery(IEntity relatedEntity) { if(_query!=relatedEntity) { DesetupSyncQuery(true, true); _query = (QueryEntity)relatedEntity; base.PerformSetupSyncRelatedEntity( _query, new PropertyChangedEventHandler( OnQueryPropertyChanged ), "Query", QueryValueEntity.Relations.QueryEntityUsingQueryId, true, ref _alreadyFetchedQuery, new string[] { } ); } }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected QueryValueEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _attribute = (AttributeEntity)info.GetValue("_attribute", typeof(AttributeEntity)); if(_attribute!=null) { _attribute.AfterSave+=new EventHandler(OnEntityAfterSave); } _attributeReturnsNewIfNotFound = info.GetBoolean("_attributeReturnsNewIfNotFound"); _alwaysFetchAttribute = info.GetBoolean("_alwaysFetchAttribute"); _alreadyFetchedAttribute = info.GetBoolean("_alreadyFetchedAttribute"); _query = (QueryEntity)info.GetValue("_query", typeof(QueryEntity)); if(_query!=null) { _query.AfterSave+=new EventHandler(OnEntityAfterSave); } _queryReturnsNewIfNotFound = info.GetBoolean("_queryReturnsNewIfNotFound"); _alwaysFetchQuery = info.GetBoolean("_alwaysFetchQuery"); _alreadyFetchedQuery = info.GetBoolean("_alreadyFetchedQuery"); base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary>Creates a new, empty QueryEntity object.</summary> /// <returns>A new, empty QueryEntity object.</returns> public override IEntity Create() { IEntity toReturn = new QueryEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewQuery // __LLBLGENPRO_USER_CODE_REGION_END return toReturn; }