public bool Contains(Resource resource) { if (UseSchemaFacts && SchemaStore.Contains(resource)) { return(true); } // source items if (resource is Entity) { for (int i = 0; i < Sources.Length; i++) { var descr = Sources[i]; if (IsSourceItemNs(descr, resource.Uri)) { var id = ExtractSourceId(descr, resource.Uri); //TODO: id type, 'virtual' resources? var matchedRecords = Dalc.RecordsCount(descr.SourceName, (QField)descr.IdFieldName == (QConst)id); if (matchedRecords > 0) { return(true); } } } } // should we check for literals?.. return(false); }
private void SaveInternal(IDictionary data, IFileObject fileObject, string tableName, string keyFieldName) { QueryConditionNode conditions = new QueryConditionNode((QField)keyFieldName, Conditions.Equal, (QConst)fileObject.Name); Hashtable recordData = new Hashtable(); int result = Dalc.RecordsCount(new Query(tableName, conditions)); if (result > 0) { if (data.Contains(keyFieldName)) { data.Remove(keyFieldName); // fixed DB bug on update } Dalc.Update(new Query(tableName, conditions), data); } else { Dalc.Insert(tableName, data); } }
public bool Exists(string userName, string roleName) { return(Dalc.RecordsCount(new Query(UserRoleSourceName, (QField)ResolveFieldName("User") == (QConst)userName & (QField)ResolveFieldName("Role") == (QConst)roleName)) > 0); }