The aspx.cs Code: the code itself is pretty big, and the code here is fictional, but it looks (the important part) like this:
foreach (Transaction trans in vTransactionList)
{
switch (trans)
{
case 201: codehere; break;
case 202: codehere; break;
case 203:
vProcesso.MarcaEnvioServico(
trans.ProcessId,
trans.CodTrans);
break;
}
}
The business class Method:
RENDataContext db = new RENDataContext();
Processo update = tabela.SingleOrDefault(
x => x.CodTrans == pCodTrans);
update.SentDate= DateTime.Now;
update.ProcessId = pProcessId;
update.LogUsuario = pUsuario_Id;
update.LogVersaoRegistro = servico.LogVersaoRegistro + 1;
update.LogDataAlteracao = DateTime.Now;
db.SubmitChanges();
Sometimes (very frequently I get this error (sqlserverexception) when executing this code: "The server failed to resume the transaction." Again, it's just random, sometimes it executes and sometimes it don't. When it fails first it keeps failing for some period of time.
I was using a stored procedure to update the table instead of that LINQ code, and the same problem happened.