Walaa wrote:
Please clarify the following:
1- When the user creates a new departement, does he enters the different languages descriptions?
2- What does the trigger do exactl?
3- Please give an example of the INSERT statements you want to execute when a user inserts a new departement.
Hi Walaa,
Thanks for reading and answering my post.
1) When the user creates a new department, he enters the code and the description for his language. (A linked form is available if he would like to provide the other languages as well, but this is not required)
2) When you add a record in the Translation table, the trigger will create X records in the translationValues table. (where X = number of languages defined in the database). When you delete a translation record, the trigger will first delete the linked translationvalue records.
3) INSERT INTO departments (Code, TranslationID) VALUES ('SW', ?)
Where ? stands for the id of the linked translation record which also should been created
INSERT INTO translations (TranslationKey, CreatedBy) VALUES ("DEP_SW", "TomV");
When my grid detects a new line, this what I have types in the eventhandler
DepartmentEntity newDepartment = gvDepartments.GetRow(e.RowHandle) as DepartmentEntity;
if (newDepartment != null)
{
TranslationEntity newTranslation = new TranslationEntity();
newDepartment.Translation = newTranslation;
}
While I'm typing this, indeed, I'm not yet able to fill these translationValues. I will hold these in a collection in memory. First save translations and departments. Let the trigger do his work and create the translationvalues. A refetch will provide me these records. i will loop over my in memory collection and fill the values in to the newly fetched objects. And do a save again. Maybe I try to wrap this everything in a transaction. This involves two save actions, but this kind of behavior is only used when initializing our application...
Hope I answered your questions good.
anyway, thanks in advance!
Kind regards
TomV