I have to tables: Contract and ContractDetails which are connected with a relationship.
First I query for all Contracts using Restkit. Then a user taps on one Contract and forces a request to get the detail-data (ContractDetails).
the Contract-Details-JSON-response is something like this:
{
"contractID" = "0815",
"otherValues" = "doesn't matter here"
}
how do I setup a relationship between the two tables in my RestKit-configuration? RestKit should look up the Contract-Entry using the contractID and connect the detailsdata with the contractdata.
See the "Relationships" section of https://github.com/RestKit/RestKit/wiki/Object-mapping.
Essentially, you create a mapping for both the Contract and ContractDetails and connect them via:
[detailsMapping mapKeyPath:#"contractID" toRelationship:#"contract" withMapping:contractMapping];
Related
One type of transaction in NetSuite is "Currency Revaluation" and there are examples of such transactions (e.g. see those with InternalIDs 3335, 3346 and 3347 in the NetSuite testdrive sample data, Honeycomb Mfg). I would like to know how to retrieve these transactions using the SuiteTalk web service API. I can get other types of transaction very easily, for example using the following Java code (simplified for clarity):
TransactionSearchBasic srch = new TransactionSearchBasic();
srch.setRecordType(new SearchStringField(RecordType._invoice, SearchStringFieldOperator.is));
SearchResult res = stub.search(srch);
if (res.getStatus().isIsSuccess()) {
for (Record rec : res.getRecordList().getRecord()) {
Invoice inv = (Invoice) rec;
// ... do things with inv ...
}
}
Now the problem is that, while there are many different transaction record types in SuiteTalk, such as the above (RecordType.invoice and class Invoice), there doesn't seem to be a record type for currency revaluations defined in the web service. How do you search for these?
If the transaction you need in this case fxreval is not in the section of schema browser, you can not access it from webservice.
https://system.na1.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_2/schema/record/fairvalueprice.html
I'm trying to use a background task to gather Likes/Comments from the Facebook Graph APi and use that to drive our blog's trending.
Here the trendingModels have already been populated and are being used to fill in the TrendingParts.GraphId and TrendingParts.TrendingValue.
I'm not getting any exceptions and the properties on TrendingPart point to the fields in the TrendingPartRecord.
Yet nothing persists to the database, any ideas why?
_orchardsServices is IOrchardServices
var articleParts = _orchardService.ContentManager.GetMany<TrendingPart>(
trendingModels.Select(r => r.OrchardId).ToList(),
VersionOptions.Published,
QueryHints.Empty);
// Cycle through the records and update them from the matching model
foreach (var articlePart in articleParts)
{
ArticleTrendingModel trendingModel = trendingModels.Where(r => r.OrchardId == articlePart.Id).FirstOrDefault();
if(trendingModel != null)
{
// Not persisting to the database, WHY?
// What's missing?
// If I'm understanding things properly nHibernate should push this to the db autoMagically.
articlePart.GraphId = trendingModel.GraphId;
articlePart.TrendingValue = trendingModel.TrendingValue;
}
}
Edit:
It's probably worth noting that I can update and publish the fields on the TrendingPart in the admin panel but the saved changes don't appear in the MyModule_TrendingPartRecord table.
The solution was to change my Service to a transient dependency using ITransientDependency.
The service was holding a reference to the PartRecords array and because it was treated as a Singleton it never disposed and the push to the database was never made.
Im working on rebuilding a clients software and they want to keep their database as unmodified as possible.
I got a table where they collect users and orders for different companies, no biggie there but the twist is they do it for multiple entities.
for example the table looks like this:
ID
UserID
Index
CompanyID
Type
lets say they got entities like Project and Workflow, then the Type column would be 'P' for projects and 'W' for workflows. So on a ID is the ID of a Project or Workflow Identity. UserID is always a foreign key to a User entity and Index is the order that the user is used when this Project/Workflow is used. And CompanyID is what company owns project or workflow entity.
I have tried to search google for this but i came up with nothing.
What i want is on a Template entity map two collections say StandardProjectUsers and StandardWorkflowUsers and they should collect them from correct entities with a user and index for current company.
Is this at all possible with fluent nhibernate ?
A nice article on how to do it: http://www.philliphaydon.com/2011/08/fluent-nhibernate-table-inheritance-discriminators/
You are looking at a table-per-hierarchy strategy.
In a nutshell you use:
public class BaseClassMap : ClassMap<BaseClass>
{
public BaseClassMap()
{
DiscriminateSubClassesOnColumn("Type");
...
}
}
public class WorkflowMap : SubclassMap<Workflow>
{
public WorkflowMap()
{
DiscriminatorValue("W");
...
}
}
public class ProjectMap : SubclassMap<Project>
{
public ProjectMap()
{
DiscriminatorValue("P");
...
}
}
I need to write a service that connects to CRM, and returns with a list of all of the entity available on the server (custom or otherwise).
How can I do this? To be clear, I am not looking to return all data for all entities. Just a list of every type, regardless of whether any actually exist.
You need to use RetrieveAllEntitiesRequest
RetrieveAllEntitiesRequest request = new RetrieveAllEntitiesRequest()
{
EntityFilters = EntityFilters.Entity,
RetrieveAsIfPublished = true
};
// service is the IOrganizationService
RetrieveAllEntitiesResponse response = (RetrieveAllEntitiesResponse)service.Execute(request);
foreach (EntityMetadata currentEntity in response.EntityMetadata)
{
string logicalName = currentEntity.LogicalName;
// your logic here
}
note that you will get also system or hidden entities, like wizardpage or recordcountsnapshot
You will probably find these sections of the MSDN useful:
Customize Entity Metadata (lookout for the samples linked on that page).
Retrieve and Detect Changes to Metadata.
I'm looking for a way to get all records where deleted is set to true on a particular table. How might I accomplish this?
Note: Using auto-generated class by SubSonic. Not T-SQL.
The auto-generated SubSonic classes don't support querying logical deletes. But you can do this (version 2.1/2.2 syntax):
public partial class TableClassCollection
{
public TableClassCollection LoadAll(bool suppressLogicalDeletes)
{
SubSonic.SqlQuery q = new SubSonic.Select(TableClass.Schema)
.From(TableClass.Schema);
if (suppressLogicalDeletes)
{
q.Where(TableClass.DeletedColumn).IsEqualTo(false);
}
return q.ExecuteAsCollection<TableClassCollection>();
}
}
More examples at subsonicproject.com
I've never heard of SubSonic before, but a quick Google search turned up: Select Queries in SubSonic.
So, using that page as a guide, it sounds like you'd be able to write your query as:
FooCollection deletedFoos = // use the generated collection class
DB.Select().From("FooTable") // table name goes here
.Where("deleted").IsEqualTo(true) // might need 1, depends on database?
.ExecuteAsCollection<FooCollection>(); // should match the type above
not a lot of detail in your question, but assuming there's a column named "deleted," it would look something like this:
select * from tableName where deleted = true