void updateDetails(mailDetails mail, bool Cancelled, Exception Error) { try { string error = null; var updateData = mail.mail; int int_failed_count = 0; if (updateData.int_failed_count != null) { int_failed_count = updateData.int_failed_count.Value; } int int_satues = 0; if (!Cancelled && Error == null) { updateData.dt_send_date = DateTime.Now; int_satues = 255; } else { int_satues = -1; logHelper.LogException(Error, main_path); if (Error != null) { if (Error.InnerException != null) { error = Error.InnerException.Message; } else { error = Error.Message; } } int_failed_count++; } updateData.str_error = error; updateData.int_status = int_satues; updateData.int_failed_count = int_failed_count; dbHelper helper = new dbHelper(); if (helper.UpdateData(updateData)) { collection.Remove(mail); } } catch (Exception er) { logHelper.LogException(er, main_path); } }