My code snippet:
public override void OnAfterInsert(object dataObj, object conn)
{
SimpleDataClass dataItem = dataObj as SimpleDataClass;
if (dataItem != null)
{
if (dataItem.ClassName.ToLower() == "cms.document")
{
CMS.SiteProvider.UserInfo ui = CMS.SiteProvider.UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);
int documentId = CMS.GlobalHelper.ValidationHelper.GetInteger((dataObj as SimpleDataClass).GetValue("DocumentID"), 0);
CMS.TreeEngine.TreeNode node = tree.SelectSingleDocument(documentId);
if (node != null)
{
string urlBairro = string.Empty;
if (node.NodeClassName.ToLower() == "custom.bairros")
{
//node = tree.SelectSingleNode(CMSContext.CurrentSite.SiteName, node.NodeAliasPath, TreeProvider.ALL_CULTURES);
string parametrosBusca = node.GetValue("BairrosParametroBusca").ToString();
string cidade_estado = Util.GerarUrlDocumentBairro(parametrosBusca);
if (!string.IsNullOrEmpty(cidade_estado))
{
string newAliasPath = string.Format("/{0}/{1}", cidade_estado, node.NodeAlias.ToLower());
newAliasPath = Util.RemoveAccentsWithRegEx(newAliasPath);
CMS.TreeEngine.DocumentAliasInfo aliasinfo = new CMS.TreeEngine.DocumentAliasInfo();
aliasinfo.AliasURLPath = newAliasPath;
aliasinfo.AliasSiteID = CMS.CMSHelper.CMSContext.CurrentSiteID;
aliasinfo.AliasNodeID = node.NodeID;
aliasinfo.AliasExtensions = ".aspx";
aliasinfo.SetObject();
//Here is the update of node
node.SetValue("UrlBairro", newAliasPath);
node.Update();
}
}
}
}
}
}
The event log is clear, it has only information about the process, withous errors.
I'm not using the hotfix.
Thanks